source: trunk/python2/regfi/pyregfi.h @ 200

Last change on this file since 200 was 200, checked in by tim, 14 years ago

redesigned python key iterator and test script
updated documentation

File size: 3.7 KB
Line 
1/*
2** regfi.h
3**
4** Made by mic
5** Login   <mic@laptop>
6**
7** Started on  Fri Apr 30 02:06:43 2010 mic
8** Last update Fri Apr 30 02:06:43 2010 mic
9*/
10
11#ifndef         PYREGFI_H_
12# define        PYREGFI_H_
13#include "class.h"
14#include "aff4_errors.h"
15#include "regfi.h"
16
17/** Forward declerations */
18struct RegistryFile_t;
19struct ValueIterator_t;
20
21BIND_STRUCT(REGFI_NK_REC)
22BIND_STRUCT(REGFI_VK_REC)
23BIND_STRUCT(REGFI_DATA)
24
25/** This is the base class for data objects */
26CLASS(RawData, Object)
27    const REGFI_DATA *data;
28    const REGFI_VK_REC *rec;
29
30    RawData METHOD(RawData, Con, REGFI_DATA *data, REGFI_VK_REC *record);
31
32    /** Return the raw buffer as a string. By default we only return
33        this much data - specify a required length to return more.
34
35        DEFAULT(len) = 4096;
36    */
37    int METHOD(RawData, get_value, OUT char *buffer, int len);
38END_CLASS
39
40CLASS(DataString, RawData)
41     BORROWED char *METHOD(DataString, get_value);
42END_CLASS
43
44CLASS(DWORDData, RawData)
45     uint64_t METHOD(DWORDData, get_value);
46END_CLASS
47
48/** This is an iterator for reading keys from the registry */
49CLASS(KeyIterator, Object)
50     PRIVATE REGFI_ITERATOR *iter;
51     PRIVATE bool root_traversed;
52
53     KeyIterator METHOD(KeyIterator, Con, struct RegistryFile_t *file, char **path,
54                        REGFI_ENCODING encoding);
55
56     struct ValueIterator_t *METHOD(KeyIterator, list_values);
57
58     void METHOD(KeyIterator, __iter__);
59     BORROWED REGFI_NK_REC *METHOD(KeyIterator, iternext);
60
61     int METHOD(KeyIterator, down);
62     int METHOD(KeyIterator, up);
63END_CLASS
64
65/** This is an iterator for reading values from the registry */
66CLASS(ValueIterator, Object)
67     PRIVATE REGFI_ITERATOR *iter;
68     PRIVATE bool first_called;
69     
70     ValueIterator METHOD(ValueIterator, Con, KeyIterator key);
71
72     void METHOD(ValueIterator, __iter__);
73     REGFI_VK_REC *METHOD(ValueIterator, iternext);
74END_CLASS
75
76CLASS(RegistryFile, Object)
77  REGFI_FILE *reg;
78  int fd;
79
80  RegistryFile METHOD(RegistryFile, Con, char *filename);
81
82  /* Get an iterator for a specific path in the register if path is
83     specified.
84
85     DEFAULT(path) == NULL;
86     DEFAULT(encoding) = REGFI_ENCODING_ASCII;
87  */
88  KeyIterator METHOD(RegistryFile, get_key, char **path, REGFI_ENCODING encoding);
89
90  /** Set the verbosity level of messages generated by the library for the
91 *  current thread.
92 *
93 * @param mask   An integer representing the types of messages desired.
94 *               Acceptable values are created through bitwise ORs of
95 *               REGFI_LOG_* values.  For instance, if only errors and
96 *               informational messages were desired (but not warnings),
97 *               then one would specify: REGFI_LOG_ERROR|REGFI_LOG_INFO
98 *               By default the message mask is: REGFI_LOG_ERROR|REGFI_LOG_WARN.
99 *
100 * @return       true on success and false on failure.  Failure occurs if
101 *               underlying pthread functions fail.  errno is set in this case.
102 *
103 * Message masks are set in a thread-specific way.  If one were to set a message
104 * mask in one thread and then spawn a new thread, then the new thread will have
105 * it's message mask reset to the default.  This function may be called at any
106 * time and will take effect immediately for the current thread.
107 *
108 * @note When a non-zero message mask is set, messages will
109 *       accumulate in memory without limit if they are not fetched using
110 *       @ref regfi_get_log_str and subsequently freed by the caller.  It is
111 *       recommended that messsages be fetched after each regfi API call in
112 *       order to provide the most context.
113 *
114 * @ingroup regfiBase
115 */
116  int METHOD(RegistryFile, set_log_mask, uint16_t mask);
117
118 
119END_CLASS
120
121
122void pyregfi_init();
123
124#endif      /* !PYREGFI_H_ */
Note: See TracBrowser for help on using the repository browser.