The Assimilation Project  based on Assimilation version 0.5.1441048221
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
projectcommon.h
Go to the documentation of this file.
1 
22 #ifndef _PROJECTCOMMON_H
23 #define _PROJECTCOMMON_H
24 #define DIMOF(a) (sizeof(a)/sizeof(a[0]))
25 #define MALLOC0(nbytes) g_try_malloc0(nbytes)
26 #define MALLOC(nbytes) g_try_malloc(nbytes)
27 #define MALLOCTYPE(t) (g_try_new0(t, 1))
28 #define FREE(m) g_free(m)
30 
31 #define FSTATIC /* Static function */
32 #define FMT_64BIT "%"G_GINT64_MODIFIER
33 
34 #ifdef _MSC_VER
35 # ifndef _W64
36 # define _W64
37 # endif
38 # define WINEXPORT __declspec( dllexport )
39 # define WINIMPORT __declspec( dllimport )
40 # define MSG_DONTWAIT 0 // This could be trouble!!
41 # if _MSC_VER < 1300
42 # define MSG_TRUNC 0
43 # endif
44 #else
45 # define WINEXPORT /* Nothing */
46 # define HAVE_PCAP_SET_RFMON 1 // We should test for this...
47 #endif
48 
49 #ifdef WIN32
50 # undef HAS_FORK
51 #else
52 # define HAS_FORK
53 #endif
54 
55 #include <glib.h>
56 #if !HAVE_G_UNLINK
57  /* #if (GLIB_MINOR_VERSION < 6) - but this doesn't work as I expected */
58 #ifdef WIN32
59 #define g_unlink(arg) _unlink(arg)
60 #else
61 # define g_unlink(arg) unlink(arg)
62 #endif
63 #endif
64 
65 #ifndef g_info
66 # define g_info(...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__)
67 #endif
68 
69 // This is a totally broken way to do this - but it seems to work at the moment...
70 
71 #if GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 28
72  void assim_slist_free_full(GSList *list, GDestroyNotify free_func);
73 # define g_slist_free_full assim_slist_free_full
74 #else
75 # define HAVE_G_SLIST_FREE_FULL
76 #endif
77 
78 #if GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 30
79  gboolean g_queue_remove_boolean(GQueue* queue, gconstpointer element);
80 #else
81 # define g_queue_remove_boolean g_queue_remove
82 #endif
83 
84 
85 
86 #ifdef CTYPESGEN
87 # undef g_slist_next
88 # define g_slist_next(slist) (slist->next)
89  extern void g_slist_free(GSList *list);
90  extern void g_free(gpointer);
91  extern guint g_slist_length(GSList* list);
92 #endif
93 
94 
95 #define DIRDELIM "/"
96 #define DISCOVERY_DIR "/usr/share/assimilation/discovery_agents"
97 #define BPINSTALL_DIR "/usr/share/assimilation/best_practices"
98 #define QUERYINSTALL_DIR "/usr/share/assimilation/queries"
99 #define MONRULEINSTALL_DIR "/usr/share/assimilation/monrules"
100 #define NOTIFICATION_SCRIPT_DIR "/usr/share/assimilation/notification.d"
101 #define CRYPTKEYDIR "/usr/share/assimilation/crypto.d"
102 #define PUBKEYSUFFIX ".pub"
103 #define PRIVATEKEYSUFFIX ".secret"
104 #define CMAADDR "224.0.2.5:1984"
105 #define NANOLISTENADDR "0.0.0.0:1984"
106 #define VERSION_STRING "0.5.1441048221"
107 #define SHORT_LICENSE_STRING "GPLv3"
108 #define LONG_LICENSE_STRING "The GNU General Public License Version 3"
109 #define CMAINITFILE "/etc/cma.conf"
110 #define CMAUSERID "assimilation"
111 
112 /* These #defines are here to make ctypesgen define them for python */
113 #define GLIB_IO_IN G_IO_IN
114 #define GLIB_IO_PRI G_IO_PRI
115 #define GLIB_IO_OUT G_IO_OUT
116 #define GLIB_IO_HUP G_IO_HUP
117 #define GLIB_IO_ERR G_IO_ERR
118 #define GLIB_io_channel_unix_new g_io_channel_unix_new
119 #define GLIB_io_add_watch g_io_add_watch
120 #define GLIB_timeout_add g_timeout_add
121 #define GLIB_timeout_add_seconds g_timeout_add_seconds
122 #define GLIB_g_main_loop_new g_main_loop_new
123 #define GLIB_g_main_run g_main_run
124 #define GLIB_g_main_quit g_main_quit
125 #define GLIB_source_remove g_source_remove
126 #define GLIB_main_context_default g_main_context_default
127 #define GLIB_g_main_loop_unref g_main_loop_unref
128 
129 #define HAVE_UNISTD_H
130 #define HAVE_SYS_UTSNAME_H
131 #define HAVE_FCNTL_H
132 #define HAVE_MCHECK_H
133 #define HAVE_SYS_TYPES_H
134 #define HAVE_SYS_SOCKET_H
135 #define HAVE_NETDB_H
136 #define HAVE_ZLIB_H
137 #define HAVE_SODIUM_H
138 
139 #define HAVE_CLOCK_GETTIME
140 #define HAVE_ENDPROTOENT
141 #define HAVE_FCNTL
142 #define HAVE_G_GET_REAL_TIME
143 #define HAVE_G_GET_MONOTONIC_TIME
144 #define HAVE_G_GET_ENVIRON
145 #define HAVE_GETADDRINFO
146 /* #undef HAVE_GETCOMPUTERNAME */
147 #define HAVE_GETEUID
148 #define HAVE_KILL
149 #define HAVE_MCHECK
150 #define HAVE_MCHECK_PEDANTIC
151 #define HAVE_SETPGID
152 #define HAVE_SIGACTION
153 #define HAVE_UNAME
154 
155 #ifndef HAVE_G_GET_REAL_TIME
156 WINEXPORT gint64 g_get_real_time(void);
157 #endif
158 #ifndef HAVE_G_GET_MONOTONIC_TIME
159 WINEXPORT gint64 g_get_monotonic_time(void);
160 #endif
161 #ifndef HAVE_G_GET_ENVIRON
162 WINEXPORT gchar** g_get_environ(void);
163 #endif
164 
165 
166 #include <proj_classes.h>
167 
168 #endif /* _PROJECTCOMMON_H */
void assim_slist_free_full(GSList *list, GDestroyNotify free_func)
WINEXPORT gint64 g_get_real_time(void)
HAVE_G_GET_MONOTONIC_TIME.
#define WINEXPORT
Definition: projectcommon.h:45
WINEXPORT gint64 g_get_monotonic_time(void)
Local replacement for g_get_monotonic_time() - for old releases of glib.
gchar ** g_get_environ(void)
Defines interfaces a project Class system for class hierarchies in 'C'.
gboolean g_queue_remove_boolean(GQueue *queue, gconstpointer element)
HAVE_G_GET_ENVIRON.