The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups 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 QUERYINSTALL_DIR "/usr/share/assimilation/queries"
98 #define MONRULEINSTALL_DIR "/usr/share/assimilation/monrules"
99 #define NOTIFICATION_SCRIPT_DIR "/usr/share/assimilation/notification.d"
100 #define CRYPTKEYDIR "/usr/share/assimilation/crypto.d"
101 #define PUBKEYSUFFIX ".pub"
102 #define PRIVATEKEYSUFFIX ".secret"
103 #define CMAADDR "224.0.2.5:1984"
104 #define NANOLISTENADDR "0.0.0.0:1984"
105 #define VERSION_STRING "0.1.5.1418938626"
106 #define SHORT_LICENSE_STRING "GPLv3"
107 #define LONG_LICENSE_STRING "The GNU General Public License Version 3"
108 #define CMAINITFILE "/etc/cma.conf"
109 #define CMAUSERID "assimilation"
110 
111 /* These #defines are here to make ctypesgen define them for python */
112 #define GLIB_IO_IN G_IO_IN
113 #define GLIB_IO_PRI G_IO_PRI
114 #define GLIB_IO_OUT G_IO_OUT
115 #define GLIB_IO_HUP G_IO_HUP
116 #define GLIB_IO_ERR G_IO_ERR
117 #define GLIB_io_channel_unix_new g_io_channel_unix_new
118 #define GLIB_io_add_watch g_io_add_watch
119 #define GLIB_timeout_add g_timeout_add
120 #define GLIB_timeout_add_seconds g_timeout_add_seconds
121 #define GLIB_g_main_loop_new g_main_loop_new
122 #define GLIB_g_main_run g_main_run
123 #define GLIB_g_main_quit g_main_quit
124 #define GLIB_source_remove g_source_remove
125 #define GLIB_main_context_default g_main_context_default
126 
127 #define HAVE_UNISTD_H
128 #define HAVE_SYS_UTSNAME_H
129 #define HAVE_FCNTL_H
130 #define HAVE_MCHECK_H
131 #define HAVE_SYS_TYPES_H
132 #define HAVE_SYS_SOCKET_H
133 #define HAVE_NETDB_H
134 #define HAVE_ZLIB_H
135 #define HAVE_SODIUM_H
136 
137 #define HAVE_CLOCK_GETTIME
138 #define HAVE_ENDPROTOENT
139 #define HAVE_FCNTL
140 #define HAVE_G_GET_REAL_TIME
141 #define HAVE_G_GET_MONOTONIC_TIME
142 #define HAVE_G_GET_ENVIRON
143 #define HAVE_GETADDRINFO
144 /* #undef HAVE_GETCOMPUTERNAME */
145 #define HAVE_GETEUID
146 #define HAVE_KILL
147 #define HAVE_MCHECK
148 #define HAVE_MCHECK_PEDANTIC
149 #define HAVE_SETPGID
150 #define HAVE_SIGACTION
151 #define HAVE_UNAME
152 
153 #ifndef HAVE_G_GET_REAL_TIME
154 WINEXPORT gint64 g_get_real_time(void);
155 #endif
156 #ifndef HAVE_G_GET_MONOTONIC_TIME
157 WINEXPORT gint64 g_get_monotonic_time(void);
158 #endif
159 #ifndef HAVE_G_GET_ENVIRON
160 WINEXPORT gchar** g_get_environ(void);
161 #endif
162 
163 
164 #include <proj_classes.h>
165 
166 #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.