The Assimilation Monitoring 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 
29 #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 
79 #ifdef CTYPESGEN
80 # undef g_slist_next
81 # define g_slist_next(slist) (slist->next)
82  extern void g_slist_free(GSList *list);
83  extern void g_free(gpointer);
84 #endif
85 
86 
87 #define DISCOVERY_DIR "/usr/share/assimilation/discovery_agents"
88 #define CMAADDR "224.0.2.5:1984"
89 #define NANOLISTENADDR "0.0.0.0:1984"
90 #define VERSION_STRING "0.1.0"
91 #define SHORT_LICENSE_STRING "GPLv3"
92 #define LONG_LICENSE_STRING "The GNU General Public License Version 3"
93 #define HAVE_UNISTD_H
94 #define HAVE_SYS_UTSNAME_H
95 #define HAVE_FCNTL_H
96 #define HAVE_MCHECK_H
97 
98 /* #undef HAVE_CLOCK_GETTIME */
99 #define HAVE_ENDPROTOENT
100 /* #undef HAVE_GETCOMPUTERNAME */
101 #define HAVE_KILL
102 #define HAVE_SETPGID
103 #define HAVE_SIGACTION
104 #define HAVE_UNAME
105 #define HAVE_G_GET_REAL_TIME
106 #define HAVE_G_GET_MONOTONIC_TIME
107 #define HAVE_G_GET_ENVIRON
108 #define HAVE_FCNTL
109 #define HAVE_MCHECK
110 #define HAVE_MCHECK_PEDANTIC
111 #define HAVE_GETEUID
112 
113 #ifndef HAVE_G_GET_REAL_TIME
114 WINEXPORT gint64 g_get_real_time(void);
115 #endif
116 #ifndef HAVE_G_GET_MONOTONIC_TIME
117 WINEXPORT gint64 g_get_monotonic_time(void);
118 #endif
119 #ifndef HAVE_G_GET_ENVIRON
120 WINEXPORT gchar** g_get_environ(void);
121 #endif
122 
123 
124 #include <proj_classes.h>
125 
126 #endif /* _PROJECTCOMMON_H */