]> sourceware.org Git - systemtap.git/blob - hash.h
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
[systemtap.git] / hash.h
1 #include <string>
2 #include <vector>
3
4 extern "C" {
5 #include <string.h>
6 #include <mdfour.h>
7 }
8
9 // Grabbed from linux/module.h kernel include.
10 #define MODULE_NAME_LEN (64 - sizeof(unsigned long))
11
12 class hash
13 {
14 private:
15 struct mdfour md4;
16
17 public:
18 hash() { start(); }
19
20 void start();
21
22 void add(const unsigned char *buffer, size_t size);
23 void add(const int x) { add((const unsigned char *)&x, sizeof(x)); }
24 void add(const long x) { add((const unsigned char *)&x, sizeof(x)); }
25 void add(const long long x) { add((const unsigned char *)&x, sizeof(x)); }
26 void add(const unsigned int x) { add((const unsigned char *)&x, sizeof(x)); }
27 void add(const unsigned long x) { add((const unsigned char *)&x,
28 sizeof(x)); }
29 void add(const unsigned long long x) { add((const unsigned char *)&x,
30 sizeof(x)); }
31 void add(const char *s) { add((const unsigned char *)s, strlen(s)); }
32 void add(const std::string& s) { add((const unsigned char *)s.c_str(),
33 s.length()); }
34 void add_file(const std::string& filename);
35
36 void result(std::string& r);
37 };
38
39 void find_hash (systemtap_session& s, const std::string& script);
40 std::string find_tracequery_hash (systemtap_session& s,
41 const std::vector<std::string>& headers);
42 std::string find_typequery_hash (systemtap_session& s, const std::string& name);
43
44 /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */
This page took 0.036188 seconds and 5 git commands to generate.