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

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

experimental python bindings generator as provided by Michael Cohen

File size: 3.6 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    REGFI_DATA *data;
28    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 const REGFI_NK_REC *next_item;
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     REGFI_NK_REC *METHOD(KeyIterator, iternext);
60END_CLASS
61
62/** This is an iterator for reading values from the registry */
63CLASS(ValueIterator, Object)
64    PRIVATE REGFI_ITERATOR *iter;
65    PRIVATE const REGFI_VK_REC *next_item;
66
67    ValueIterator METHOD(ValueIterator, Con, KeyIterator key);
68
69    void METHOD(ValueIterator, __iter__);
70    RawData METHOD(ValueIterator, iternext);
71END_CLASS
72
73CLASS(RegistryFile, Object)
74  REGFI_FILE *reg;
75  int fd;
76
77  RegistryFile METHOD(RegistryFile, Con, char *filename);
78
79  /* Get an iterator for a specific path in the register if path is
80     specified.
81
82     DEFAULT(path) == NULL;
83     DEFAULT(encoding) = REGFI_ENCODING_ASCII;
84  */
85  KeyIterator METHOD(RegistryFile, get_key, char **path, REGFI_ENCODING encoding);
86
87  /** Set the verbosity level of messages generated by the library for the
88 *  current thread.
89 *
90 * @param mask   An integer representing the types of messages desired.
91 *               Acceptable values are created through bitwise ORs of
92 *               REGFI_LOG_* values.  For instance, if only errors and
93 *               informational messages were desired (but not warnings),
94 *               then one would specify: REGFI_LOG_ERROR|REGFI_LOG_INFO
95 *               By default the message mask is: REGFI_LOG_ERROR|REGFI_LOG_WARN.
96 *
97 * @return       true on success and false on failure.  Failure occurs if
98 *               underlying pthread functions fail.  errno is set in this case.
99 *
100 * Message masks are set in a thread-specific way.  If one were to set a message
101 * mask in one thread and then spawn a new thread, then the new thread will have
102 * it's message mask reset to the default.  This function may be called at any
103 * time and will take effect immediately for the current thread.
104 *
105 * @note When a non-zero message mask is set, messages will
106 *       accumulate in memory without limit if they are not fetched using
107 *       @ref regfi_get_log_str and subsequently freed by the caller.  It is
108 *       recommended that messsages be fetched after each regfi API call in
109 *       order to provide the most context.
110 *
111 * @ingroup regfiBase
112 */
113  int METHOD(RegistryFile, set_log_mask, uint16_t mask);
114
115 
116END_CLASS
117
118
119void pyregfi_init();
120
121#endif      /* !PYREGFI_H_ */
Note: See TracBrowser for help on using the repository browser.