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.1"
102 #define SHORT_LICENSE_STRING "GPLv3"
103 #define LONG_LICENSE_STRING "The GNU General Public License Version 3"
104 #define HAVE_UNISTD_H
105 #define HAVE_SYS_UTSNAME_H
106 #define HAVE_FCNTL_H
107 #define HAVE_MCHECK_H
108 #define HAVE_SYS_TYPES_H
109 #define HAVE_SYS_SOCKET_H
110 #define HAVE_NETDB_H
111 
112 #define HAVE_CLOCK_GETTIME
113 #define HAVE_ENDPROTOENT
114 #define HAVE_FCNTL
115 #define HAVE_G_GET_REAL_TIME
116 #define HAVE_G_GET_MONOTONIC_TIME
117 #define HAVE_G_GET_ENVIRON
118 #define HAVE_GETADDRINFO
119 /* #undef HAVE_GETCOMPUTERNAME */
120 #define HAVE_GETEUID
121 #define HAVE_KILL
122 #define HAVE_MCHECK
123 #define HAVE_MCHECK_PEDANTIC
124 #define HAVE_SETPGID
125 #define HAVE_SIGACTION
126 #define HAVE_UNAME
127 
128 #ifndef HAVE_G_GET_REAL_TIME
129 WINEXPORT gint64 g_get_real_time(void);
130 #endif
131 #ifndef HAVE_G_GET_MONOTONIC_TIME
132 WINEXPORT gint64 g_get_monotonic_time(void);
133 #endif
134 #ifndef HAVE_G_GET_ENVIRON
135 WINEXPORT gchar** g_get_environ(void);
136 #endif
137 
138 
139 #include <proj_classes.h>
140 
141 #endif /* _PROJECTCOMMON_H */