The Assimilation Project  based on Assimilation version 1.1.7.1474836767
nanomain.c
Go to the documentation of this file.
1 
24 #include <projectcommon.h>
25 #include <stdlib.h>
26 #ifdef HAVE_UNISTD_H
27 # include <unistd.h>
28 #endif
29 #include <string.h>
30 #include <signal.h>
31 #include <errno.h>
32 #include <framesettypes.h>
33 #include <frameset.h>
34 #include <ctype.h>
35 #include <netgsource.h>
36 #include <reliableudp.h>
37 #include <netaddr.h>
38 #include <authlistener.h>
39 #include <signframe.h>
40 #include <cryptframe.h>
41 #include <compressframe.h>
42 #include <intframe.h>
43 #include <addrframe.h>
44 #include <cstringframe.h>
45 #include <frametypes.h>
46 #include <misc.h>
47 #include <nanoprobe.h>
48 
49 #define DEBUGSHUTDOWN 1
50 #undef DEBUGSHUTDOWN
51 
53 
54 #ifdef WIN32
55 #define SEP "\\"
56 # undef HAS_FORK
57 WINIMPORT int errcount;
58 WINIMPORT GMainLoop* mainloop;
59 WINEXPORT void remove_pid_file(const char * pidfile);
60 WINEXPORT void daemonize_me(gboolean stay_in_foreground, const char * dirtorunin, char* pidfile);
61 WINEXPORT PidRunningStat are_we_already_running(const char * pidfile, int* pid);
62 WINEXPORT int kill_pid_service(const char * pidfile, int signal);
63 #else
64 #define SEP "/"
65 # define HAS_FORK
66 #endif
67 
68 const char * localaddr = NULL;
69 const char * cmaaddr = NULL;
70 const char * procname = "nanoprobe";
71 
72 gint64 pktcount = 0;
78 int pcapcount = 0;
79 int wirepktcount = 0;
80 
81 
82 // Signals...
83 gboolean sigint = FALSE;
84 gboolean sigterm = FALSE;
85 gboolean sighup = FALSE;
86 gboolean sigusr1 = FALSE;
87 gboolean sigusr2 = FALSE;
88 
89 
90 FSTATIC void catch_a_signal(int signum);
91 FSTATIC gboolean check_for_signals(gpointer ignored);
92 FSTATIC gboolean gotnetpkt(Listener*, FrameSet* fs, NetAddr* srcaddr);
93 FSTATIC void usage(const char * cmdname);
94 
95 
97 FSTATIC gboolean
99  FrameSet* fs,
100  NetAddr* srcaddr
101  )
102 {
103  char* srcstr = srcaddr->baseclass.toString(&srcaddr->baseclass);
104  (void)l;
105  ++wirepktcount;
106  if (fs->fstype != FRAMESETTYPE_HEARTBEAT) {
107  g_warning("%s.%d: Received a FrameSet of type %d over the 'wire' from %s (OOPS!)."
108  , __FUNCTION__, __LINE__, fs->fstype, srcstr);
109  DUMP3(__FUNCTION__, &fs->baseclass, " Was the frameset received.");
110  }
111  FREE(srcstr);
112  UNREF(fs);
113  return TRUE;
114 }
115 
117 FSTATIC void
118 catch_a_signal(int signum)
119 {
120  switch(signum) {
121  case SIGINT:
122  sigint = TRUE;
123  break;
124  case SIGTERM:
125  sigterm = TRUE;
126  break;
127 #ifndef WIN32
128  case SIGHUP:
129  sighup = TRUE;
130  break;
131  case SIGUSR1:
132  proj_class_incr_debug(NULL);
133  sigusr1 = TRUE;
134  break;
135  case SIGUSR2:
136  proj_class_decr_debug(NULL);
137  sigusr2 = TRUE;
138  break;
139 #endif
140  }
141 }
142 
143 // If our output is all ACKed, then go ahead and shutdown
144 
146 FSTATIC gboolean
147 check_for_signals(gpointer ignored)
148 {
149  (void)ignored;
150  if (sigterm || sigint) {
151  g_message("%s: exiting on %s.", procname, (sigterm ? "SIGTERM" : "SIGINT"));
152 #ifdef DEBUGSHUTDOWN
153  // Crank up protocol debugging
154  proj_class_incr_debug("FsProtocol");
155  proj_class_incr_debug("FsProtocol");
156  proj_class_incr_debug("FsProtocol");
157  proj_class_incr_debug("FsProtocol");
158  proj_class_incr_debug("FsProtocol");
159  // And reliable UDP, etc. debugging too.
160  proj_class_incr_debug("NetIO");
161  proj_class_incr_debug("NetIO");
162  proj_class_incr_debug("NetIO");
163  proj_class_incr_debug("NetIO");
164  proj_class_incr_debug("NetIO");
165  proj_class_incr_debug("FsQueue");
166  proj_class_incr_debug("FsQueue");
167  proj_class_incr_debug("FsQueue");
168  proj_class_incr_debug("FsQueue");
169  proj_class_incr_debug("FsQueue");
170 #endif
171  return nano_initiate_shutdown();
172  return FALSE;
173  }
174  if (sigusr1) {
175  sigusr1 = FALSE;
176  }
177  if (sigusr2) {
178  sigusr2 = FALSE;
179  }
180  return TRUE;
181 }
182 
183 FSTATIC void
184 usage(const char * cmdname)
185 {
186  fprintf(stderr, "usage: %s [arguments...]\n", cmdname);
187  fprintf(stderr, "Legal arguments are:\n");
188  fprintf(stderr, "\t-c --cmaaddr <address:port-of-CMA>\n");
189  fprintf(stderr, "\t-b --bind <address:port-to-listen-on-locally>\n");
190  fprintf(stderr, "\t-t --ttl <multi cast ttl (default == 31)>\n");
191 #ifndef WIN32
192 #ifdef HAS_FORK
193  fprintf(stderr, "\t-f --foreground (stay in foreground.)\n");
194 #endif
195  fprintf(stderr, "\t-k --kill (send SIGTERM to the running service.)\n");
196  fprintf(stderr, "\t-p --pidfile <pid-file-pathname>.\n");
197  fprintf(stderr, "\t-s --status (report nanoprobe status)\n");
198 #endif
199  fprintf(stderr, "\t-d --debug <debug-level (0-5)>\n");
200  fprintf(stderr, "\t-D --dynamic (use ephemeral/dynamic port number)\n");
201 }
202 
208 int
209 main(int argc, char **argv)
210 {
211  static char defaultCMAaddr[] = CMAADDR;
212  static char defaultlocaladdress [] = NANOLISTENADDR;
213  SignFrame* signature = signframe_glib_new(G_CHECKSUM_SHA256, 0);
215  Listener* otherlistener;
217  PacketDecoder* decoder = nano_packet_decoder();
218 #ifdef HAVE_SIGACTION
219  struct sigaction sigact;
220 #endif
221  static char * localaddr = defaultlocaladdress;
222  static char * cmaaddr = defaultCMAaddr;
223  static int debug = 0;
224  gboolean anyportpermitted = TRUE;
225  static int mcast_ttl = 31;
226  static gboolean stay_in_foreground = FALSE;
227  static gboolean dostatusonly = FALSE;
228  static gboolean dokillonly = FALSE;
229  static gboolean dynamicport = FALSE;
230  static char* pidfile = NULL;
231  gboolean bindret = FALSE;
232  PidRunningStat rstat;
233  int ret;
234 
235  GError *error = NULL;
236  static GOptionEntry long_options[] = {
237  {"bind", 'b', 0, G_OPTION_ARG_STRING, &localaddr, "<address:port-to-listen-on-locally>", NULL},
238  {"cmaaddr", 'c', 0, G_OPTION_ARG_STRING, &cmaaddr, "<address:port-of-CMA>", NULL},
239  {"debug", 'd', 0, G_OPTION_ARG_INT, &debug, "set debug level", NULL},
240  {"dynamic", 'D', 0, G_OPTION_ARG_NONE, &dynamicport," force dynamic port", NULL},
241  {"ttl", 't', 0, G_OPTION_ARG_INT, &mcast_ttl, "<multicast-ttl> (default is 31)", NULL},
242  {"kill", 'k', 0, G_OPTION_ARG_NONE, &dokillonly, "send SIGTERM to the running service", NULL},
243  {"pidfile", 'p', 0, G_OPTION_ARG_STRING, &pidfile, "<pid-file-pathname>", NULL},
244  {"status", 's', 0, G_OPTION_ARG_NONE, &dostatusonly, "report nanoprobe status", NULL},
245 #ifdef HAS_FORK
246  {"foreground", 'f', 0, G_OPTION_ARG_NONE, &stay_in_foreground, "stay in foreground", NULL},
247 #endif
248  {NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}
249  };
250 
251  GOptionContext *context = g_option_context_new("- start nanoprobe");
252  g_option_context_add_main_entries(context, long_options, NULL);
254 
255 
256  if(!(g_option_context_parse(context, &argc, &argv, &error))) {
257  g_print("option parsing failed %s\n", error->message);
258  usage(argv[0]);
259  exit(1);
260  }
261 
262  BINDDEBUG(NanoprobeMain);
263 
264  if (debug > 0 && debug <= 5) {
265  DEBUGMSG("DEBUG IS SET TO %d", debug);
266  while(debug > 0) {
267  proj_class_incr_debug(NULL);
268  debug -= 1;
269  }
270  }
271 
272 
273  if (pidfile == NULL) {
275  }
276 
277  if (dostatusonly) {
278  rstat = are_we_already_running(pidfile, NULL);
279  ret = pidrunningstat_to_status(rstat);
280  g_free(pidfile);
281  exit(ret);
282  }
283  if (dokillonly) {
284  int rc = kill_pid_service(pidfile, SIGTERM);
285  if (rc != 0) {
286  fprintf(stderr, "%s: could not stop service [%s]\n", "nanoprobe", g_strerror(errno));
287  g_warning("%s: could not stop service [%s]\n", "nanoprobe", g_strerror(errno));
288  g_free(pidfile);
289  exit(1);
290  }
291  while (are_we_already_running(pidfile, NULL) == PID_RUNNING) {
292  usleep(100000); // 1/10 second
293  }
294  g_free(pidfile);
295  exit(0);
296  }
297  daemonize_me(stay_in_foreground, SEP, pidfile, 0);
298 
299  assimilation_openlog(argv[0]);
300 
302  g_warning("This OS DOES NOT support dual ipv4/v6 sockets - this may not work!!");
303  }
304 #ifndef HAVE_SIGACTION
305  signal(SIGTERM, catch_a_signal);
306  if (stay_in_foreground) {
307  if (signal(SIGINT, catch_a_signal) == SIG_IGN) {
308  signal(SIGINT, SIG_IGN);
309  }
310  }else{
311  signal(SIGINT, SIG_IGN);
312  }
313 #else
314  memset(&sigact, 0, sizeof(sigact));
315  sigact.sa_handler = catch_a_signal;
316  sigaction(SIGTERM, &sigact, NULL);
317  if (stay_in_foreground) {
318  struct sigaction oldact;
319  sigaction(SIGINT, &sigact, &oldact); // Need to check to see if it's already blocked.
320  if (oldact.sa_handler == SIG_IGN) {
321  // OOPS - put it back like it was
322  sigaction(SIGINT, &oldact, NULL);
323  }
324  }else{
325  // Always ignore SIGINT when in the background
326  struct sigaction ignoreme;
327  memset(&ignoreme, 0, sizeof(ignoreme));
328  ignoreme.sa_handler = SIG_IGN;
329  sigaction(SIGINT, &ignoreme, NULL);
330  }
331  sigaction(SIGUSR1, &sigact, NULL);
332  sigaction(SIGUSR2, &sigact, NULL);
333 #endif
334 
335  config->setframe(config, CONFIGNAME_OUTSIG, &signature->baseclass);
336  config->setframe(config, CONFIGNAME_COMPRESS, &compression->baseclass);
337 
338  // Create a network transport object for normal UDP packets
339  nettransport = &(reliableudp_new(0, config, decoder, 0)->baseclass.baseclass);
340  g_return_val_if_fail(NULL != nettransport, 2);
341 
342 
343  // Construct the NetAddr we'll talk to (it defaults to a mcast address nowadays)
344  destaddr = netaddr_string_new(cmaaddr);
345  g_info("CMA address: %s", cmaaddr);
346  if (destaddr->ismcast(destaddr)) {
347  if (!nettransport->setmcast_ttl(nettransport, mcast_ttl)) {
348  g_warning("Unable to set multicast TTL to %d [%s %d]", mcast_ttl
349  , g_strerror(errno), errno);
350  }
351  }
352 
353  g_return_val_if_fail(NULL != destaddr, 3);
354  g_return_val_if_fail(destaddr->port(destaddr) != 0, 4);
355  config->setaddr(config, CONFIGNAME_CMAINIT, destaddr);
356 
357 
358  if (dynamicport) {
359  anyportpermitted = TRUE;
360  }else{
361  // Construct a NetAddr to bind to (listen from) (normally ANY address)
362  localbindaddr = netaddr_string_new(localaddr);
363  g_return_val_if_fail(NULL != localbindaddr, 5);
364 
365  // Bind to the requested address (defaults to ANY as noted above)
366  bindret = nettransport->bindaddr(nettransport, localbindaddr, anyportpermitted);
367  UNREF(localbindaddr);
368  }
369  if (!bindret) {
370  // OOPS! Address:Port already busy...
371  if (anyportpermitted) {
372  guint8 anyaddr[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
373  localbindaddr = netaddr_ipv6_new(anyaddr, 0);
374  g_return_val_if_fail(NULL != localbindaddr, 5);
375  bindret = nettransport->bindaddr(nettransport, localbindaddr, FALSE);
376  UNREF(localbindaddr);
377  localbindaddr = NULL;
378  g_return_val_if_fail(bindret, 6);
379  }else{
380  g_warning("Cannot bind to local address [%s] and cannot use any free port."
381  , localaddr);
382  return(5);
383  }
384  }
385  {
386  NetAddr* boundaddr = nettransport->boundaddr(nettransport);
387  if (boundaddr) {
388  char * boundstr = boundaddr->baseclass.toString(&boundaddr->baseclass);
389  g_info("Local address: %s", boundstr);
390  g_free(boundstr);
391  UNREF(boundaddr);
392  }else{
393  g_warning("Unable to determine local address!");
394  }
395  }
396 
397  // Connect up our network transport into the g_main_loop paradigm
398  // so we get dispatched when packets arrive
399  netpkt = netgsource_new(nettransport, NULL, G_PRIORITY_HIGH, FALSE, NULL, 0, NULL);
400 
401  // Observe all unclaimed packets
402  otherlistener = listener_new(config, 0);
403  otherlistener->got_frameset = gotnetpkt;
404  netpkt->addListener(netpkt, 0, otherlistener);
405  otherlistener->associate(otherlistener,netpkt);
406  g_timeout_add_seconds(1, check_for_signals, NULL);
407 
408  // Unref the "other" listener - netpkt et al holds references to it
409  UNREF(otherlistener);
410 
411  // Free signature frame
412  UNREF2(signature);
413  // Free compression frame
414  UNREF2(compression);
415 
416  // Free misc addresses
417  UNREF(destaddr);
418 
419  nano_start_full("netconfig", 900, netpkt, config, NULL);
420  g_info("Starting version %s: licensed under %s", VERSION_STRING, LONG_LICENSE_STRING);
421 
422  // Free config object
423  UNREF(config);
424 
425  mainloop = g_main_loop_new(g_main_context_default(), TRUE);
426 
427  /********************************************************************
428  * Start up the main loop - run our test program...
429  * (the one pretending to be both the nanoprobe and the CMA)
430  ********************************************************************/
431  g_main_loop_run(mainloop);
432 
433  /********************************************************************
434  * We exited the main loop. Shut things down.
435  ********************************************************************/
436 
437  remove_pid_file(pidfile);
438  g_free(pidfile);
439 
440  nano_shutdown(TRUE); // Tell it to shutdown and print stats
441  g_info("%-35s %8d", "Count of 'other' pkts received:", wirepktcount);
442 
443  UNREF(nettransport);
444 
445  // This two calls need to be last - and in this order...
446  // (I wish the documentation on this stuff was clearer... Sigh...)
447  //g_main_context_unref(g_main_context_default());
448  g_main_loop_unref(mainloop);
449  g_source_unref(&netpkt->baseclass); // Not sure why this is needed...
450  g_source_destroy(&netpkt->baseclass); // Not sure why this is needed...
451  mainloop = NULL; netpkt = NULL;
452 
453 
454  // At this point - nothing should show up - we should have freed everything
455  if (proj_class_live_object_count() > 0) {
457  g_warning("Too many objects (%d) alive at end of test.",
459  ++errcount;
460  }else{
461  g_info("No objects left alive. Awesome!");
462  }
464  return(errcount <= 127 ? errcount : 127);
465 }
guint16(* port)(const NetAddr *self)
Return port from this address.
Definition: netaddr.h:46
GSource baseclass
Parent GSource Object pointer.
Definition: netgsource.h:44
AssimObj baseclass
Definition: frameset.h:47
NetAddr *(* boundaddr)(const NetIO *self)
[in] Object to return bound address/port of
Definition: netio.h:79
FSTATIC void usage(const char *cmdname)
Definition: nanomain.c:184
Defines miscellaneous interfaces.
void(* setaddr)(ConfigContext *, const char *, NetAddr *)
Set NetAddr value.
Definition: configcontext.h:93
NetAddr * destaddr
Definition: nanomain.c:75
PacketDecoder * nano_packet_decoder(void)
Return our nanoprobe packet decoder map.
Definition: nanoprobe.c:1319
gint64 pktcount
Definition: nanomain.c:72
#define FRAMESETTYPE_HEARTBEAT
A heartbeat packet.
Definition: framesettypes.h:32
Describes interfaces to Signature Frame (Signframe) C-Class - providing digital signatures.
Listener * listener_new(ConfigContext *config, gsize objsize)
Construct a new Listener - setting up GSource and timeout data structures for it. ...
Definition: listener.c:82
WINEXPORT SignFrame * signframe_glib_new(GChecksumType sigtype, gsize framesize)
Construct a new SignFrame - allowing for "derived" frame types...
Definition: signframe.c:334
#define DEBUGMSG(...)
Definition: proj_classes.h:87
WINEXPORT GMainLoop * mainloop
Definition: nanoprobe.c:68
gboolean(* got_frameset)(Listener *self, FrameSet *fs, NetAddr *na)
called when a FrameSet arrives
Definition: listener.h:45
Implements minimal client-oriented Frame and Frameset capabilities.
const char * procname
process name
Definition: nanomain.c:70
#define CONFIGNAME_OUTSIG
SignFrame to use to sign/verify packets.
NetGSource * netgsource_new(NetIO *iosrc, GDestroyNotify notify, gint priority, gboolean can_recurse, GMainContext *context, gsize objsize, gpointer userdata)
Create a new (abstract) NetGSource object.
Definition: netgsource.c:74
void proj_class_finalize_sys(void)
Shut down (finalize) our object class system. Only do on shutdown to make valgrind happy :-D...
Definition: proj_classes.c:88
FSTATIC gboolean gotnetpkt(Listener *, FrameSet *fs, NetAddr *srcaddr)
Test routine called when an otherwise-unclaimed NetIO packet is received.
Definition: nanomain.c:98
Describes interfaces to C-String Frame (Cstringframe) C-Class It holds conventional zero-terminated b...
AssimObj baseclass
Definition: netaddr.h:44
#define LONG_LICENSE_STRING
NetAddr * localbindaddr
Definition: nanomain.c:76
gboolean bindaddr(NetIO *self, const NetAddr *, gboolean silent)
<[in] Bind this NetIO to the given address
int wirepktcount
Definition: nanomain.c:79
#define NANOLISTENADDR
The SignFrame class object - implements digital signatures for FrameSets.
Definition: signframe.h:47
NetGSource * netpkt
Definition: nanomain.c:74
#define WINEXPORT
Definition: projectcommon.h:45
#define FSTATIC
Definition: projectcommon.h:31
int signal
Definition: childprocess.c:238
guint16 fstype
Type of frameset.
Definition: frameset.h:52
void proj_class_decr_debug(const char *Cclass)
Decrement debug level for this class and all its subclasses by one.
Definition: proj_classes.c:148
#define BINDDEBUG(Cclass)
BINDDEBUG is for telling the class system where the debug variable for this class is - put it in the ...
Definition: proj_classes.h:82
void(* setframe)(ConfigContext *, const char *, Frame *)
Set Frame value.
Definition: configcontext.h:91
Implements the IntFrame class - integers in a frame.
int pcapcount
Definition: nanomain.c:78
#define __FUNCTION__
CompressFrame * compressframe_new(guint16 frame_type, guint16 compression_method)
void(* addListener)(NetGSource *, guint16, Listener *)
Register a new listener.
Definition: netgsource.h:55
This is our CompressFrame class object - used for representing a compression method.
Definition: compressframe.h:41
Describes interfaces to CryptFrame (encryption) C-Class It represents the abstract base class for Fra...
Implements the Reliable UDP network I/O transport (ReliableUDP) class.
#define DUMP3(prefix, obj, suffix)
Definition: proj_classes.h:97
void assimilation_openlog(const char *logname)
Open logs in our style (syslog)
Definition: misc.c:225
const char * cmaaddr
Definition: nanomain.c:69
WINEXPORT int errcount
error count
Definition: nanoprobe.c:67
#define VERSION_STRING
Header file defining all known FrameSet types THIS FILE MECHANICALLY GENERATED by "/home/alanr/assim/...
#define COMPRESS_ZLIB
Compression using &#39;zlib&#39;.
Definition: compressframe.h:38
gboolean netio_is_dual_ipv4v6_stack(void)
Definition: netio.c:954
Describes interfaces to C-String Frame (Compressframe) C-Class It holds conventional zero-terminated ...
NetAddr * netaddr_ipv6_new(gconstpointer ipbuf, guint16 port)
Create new NetAddr from a IPv6 address.
Definition: netaddr.c:1092
#define FREE(m)
Our interface to free.
Definition: projectcommon.h:29
const char * localaddr
Definition: nanomain.c:68
NetIO * nettransport
Definition: nanomain.c:73
include file defining functions to be called by a main to instantiate a nanoprobe.
gchar *(* toString)(gconstpointer)
Produce malloc-ed string representation.
Definition: assimobj.h:58
guint32 proj_class_live_object_count(void)
Return the count of live C class objects.
Definition: proj_classes.c:406
Project common header file.
int kill_pid_service(const char *pidfile, int signal)
kill the service that goes with our current pid file - return negative iff pidfile pid is running and...
Definition: misc.c:503
Header file defining the data layouts for our Frames.
NetAddr * anyaddr
Definition: pcap+mainloop.c:86
gboolean(* ismcast)(const NetAddr *self)
Return TRUE if this address is a multicast address.
Definition: netaddr.h:48
WINEXPORT gboolean nano_initiate_shutdown(void)
Initiate shutdown - return TRUE if we have shut down immediately...
Definition: nanoprobe.c:1435
void(* associate)(Listener *self, NetGSource *source)
NetGSource class to associate with
Definition: listener.h:49
PidRunningStat
Status of pid file and/or running processes referred to by it - analogous to "service status"...
Definition: misc.h:37
gboolean sigusr1
Definition: nanomain.c:86
#define CONFIGNAME_COMPRESS
Frame to use for compressing/decompressing.
guint pidrunningstat_to_status(PidRunningStat stat)
Convert PidRunningStat to an exit code for status.
Definition: misc.c:553
ReliableUDP * reliableudp_new(gsize objsize, ConfigContext *config, PacketDecoder *decoder, guint rexmit_timer_uS)
Construct new UDP NetIO object (and its socket, etc)
Definition: reliableudp.c:69
gboolean sigterm
Definition: nanomain.c:84
void daemonize_me(gboolean stay_in_foreground, const char *dirtorunin, char *origpidfile, int minclosefd)
Function to get system name (uname -n in UNIX terms) - and return in lower case
Definition: misc.c:106
void proj_class_incr_debug(const char *Cclass)
Increment debug level for this class and all its subclasses by one.
Definition: proj_classes.c:140
void remove_pid_file(const char *pidfile)
Remove the pid file that goes with this service iff we created one during this invocation.
Definition: misc.c:494
gboolean sigusr2
Definition: nanomain.c:87
The NetAddr class class represents a general network address - whether IP, MAC, or any other type of ...
Definition: netaddr.h:43
Describes interfaces to Address Frame (AddrFrame) C-Class.
FSTATIC gboolean check_for_signals(gpointer ignored)
Check for signals periodically.
Definition: nanomain.c:147
Defines interfaces for the NetAddr (network address) object.
int main(int argc, char **argv)
Nanoprobe main program.
Definition: nanomain.c:209
#define g_info(...)
Definition: projectcommon.h:66
NetIO baseclass
Base class (NetIO) object.
Definition: netioudp.h:41
FrameSet class - used for collecting Frames when not on the wire, and for marshalling/demarshalling t...
Definition: frameset.h:46
#define CMAADDR
char * get_default_pid_fileName(const char *procname)
get default pid file name
Definition: misc.c:481
WINEXPORT void nano_shutdown(gboolean report)
Shut down the things started up by nano_start_full() - mainly free storage to make valgrind happy...
Definition: nanoprobe.c:1392
int heartbeatcount
Definition: nanomain.c:77
WINEXPORT void nano_start_full(const char *initdiscoverpath, guint discover_interval, NetGSource *io, ConfigContext *config, gboolean(*authfunc)(const FrameSet *, NetAddr *))
Here is how the startup process works:
Definition: nanoprobe.c:1355
PidRunningStat are_we_already_running(const char *pidfile, int *pidarg)
See if the pid file suggests we are already running or not.
Definition: misc.c:331
Implements NetIO GSource object.
#define DEBUGDECLARATIONS
Definition: proj_classes.h:79
#define SEP
Definition: nanomain.c:64
#define CONFIGNAME_CMAINIT
Initial startup contact address for the CMA.
gboolean sighup
Definition: nanomain.c:85
void proj_class_dump_live_objects(void)
Dump all live C class objects (address and Class)
Definition: proj_classes.c:356
Defines Listener interfaces for packets coming from the Collective Authority.
ConfigContext * configcontext_new(gsize objsize)
Construct a new ConfigContext object - with no values defaulted.
Frame baseclass
Base Frame class object.
Definition: signframe.h:48
NetIOudp baseclass
Base class (NetIO) object.
Definition: reliableudp.h:44
NetAddr * netaddr_string_new(const char *addrstr)
Create a NetAddr from an ipv4, ipv6 or MAC address string.
Definition: netaddr.c:976
#define UNREF2(obj)
Definition: assimobj.h:36
#define FRAMETYPE_COMPRESS
FRAMETYPE_COMPRESS Frame (frametype 3) Frame subclass - CompressFrame class.
Definition: frametypes.h:122
#define UNREF(obj)
Definition: assimobj.h:35
This is a basic NetIO class abstract class for doing network I/O.
Definition: netio.h:58
gboolean sigint
Definition: nanomain.c:83
The NetGSource class objects integrate NetIO class objects into the g_main_loop paradigm.
Definition: netgsource.h:43
gboolean setmcast_ttl(NetIO *self, guint8 ttl)
< Set ipv4 multicast TTL
This is the Listener class. object - which generically listens for packets.
Definition: listener.h:41
FSTATIC void catch_a_signal(int signum)
Signal reception function - signals stop by here...
Definition: nanomain.c:118