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