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