The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nanoprobe/nanoprobe.c File Reference

nanoprobe main program. More...

#include <projectcommon.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <framesettypes.h>
#include <frameset.h>
#include <ctype.h>
#include <netgsource.h>
#include <reliableudp.h>
#include <netaddr.h>
#include <authlistener.h>
#include <signframe.h>
#include <cryptframe.h>
#include <compressframe.h>
#include <intframe.h>
#include <addrframe.h>
#include <cstringframe.h>
#include <frametypes.h>
#include <misc.h>
#include <nanoprobe.h>
Include dependency graph for nanoprobe/nanoprobe.c:

Go to the source code of this file.

Macros

#define SEP   "/"
 
#define HAS_FORK
 

Functions

FSTATIC void catch_a_signal (int signum)
 Signal reception function - signals stop by here... More...
 
FSTATIC gboolean check_for_signals (gpointer ignored)
 Check for signals periodically. More...
 
FSTATIC gboolean gotnetpkt (Listener *l,FrameSet *fs,NetAddr *srcaddr)
 Test routine called when an otherwise-unclaimed NetIO packet is received. More...
 
FSTATIC void usage (const char *cmdname)
 
int main (int argc, char **argv)
 Nanoprobe main program. More...
 

Variables

const char * localaddr = NULL
 
const char * cmaaddr = NULL
 
const char * procname = "nanoprobe"
 process name More...
 
gint64 pktcount = 0
 
NetIOnettransport
 
NetGSourcenetpkt
 
NetAddrdestaddr
 
NetAddrlocalbindaddr
 
int heartbeatcount = 0
 
int pcapcount = 0
 
int wirepktcount = 0
 
gboolean sigint = FALSE
 
gboolean sigterm = FALSE
 
gboolean sighup = FALSE
 
gboolean sigusr1 = FALSE
 
gboolean sigusr2 = FALSE
 

Detailed Description

nanoprobe main program.

Starts up a nanoprobe and does nanoprobie things - deferring most of the work to others.

This file is part of the Assimilation Project.

Author
Copyright © 2011, 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file nanoprobe/nanoprobe.c.

Macro Definition Documentation

#define HAS_FORK

Definition at line 62 of file nanoprobe/nanoprobe.c.

#define SEP   "/"

Definition at line 61 of file nanoprobe/nanoprobe.c.

Referenced by main().

Function Documentation

FSTATIC void catch_a_signal ( int  signum)

Signal reception function - signals stop by here...

Definition at line 125 of file nanoprobe/nanoprobe.c.

References proj_class_decr_debug(), proj_class_incr_debug(), sighup, sigint, sigterm, sigusr1, and sigusr2.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC gboolean check_for_signals ( gpointer  ignored)

Check for signals periodically.

Definition at line 154 of file nanoprobe/nanoprobe.c.

References nano_initiate_shutdown(), procname, sigint, sigterm, sigusr1, and sigusr2.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean gotnetpkt ( Listener l,
FrameSet fs,
NetAddr srcaddr 
)

Test routine called when an otherwise-unclaimed NetIO packet is received.

Parameters
[in,out]lInput GSource
[in,out]fsFrameSets received
[in]srcaddrSource address of this packet

Definition at line 95 of file nanoprobe/nanoprobe.c.

References __FUNCTION__, _NetAddr::baseclass, _FrameSet::baseclass, DEBUGMSG3, DUMP3, FRAMESETTYPE_HBBACKALIVE, FRAMESETTYPE_SENDHB, FRAMESETTYPE_STARTUP, _FrameSet::fstype, UNREF, and wirepktcount.

Referenced by main().

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)

Nanoprobe main program.

It leaves most of the work of starting up the nanoprobe code to nano_start_full()

Todo:
initialize from a setup file - initial IP address:port, debug - anything else?

Shut down object system to make valgrind happy :-D

Definition at line 197 of file nanoprobe/nanoprobe.c.

References _NetGSource::addListener, anyaddr, are_we_already_running(), assimilation_openlog(), _Listener::associate, _NetIOudp::baseclass, _SignFrame::baseclass, _CompressFrame::baseclass, _ReliableUDP::baseclass, _NetGSource::baseclass, _NetAddr::baseclass, _NetIO::bindaddr(), BINDDEBUG, _NetIO::boundaddr, catch_a_signal(), check_for_signals(), cmaaddr, CMAADDR, COMPRESS_ZLIB, compressframe_new(), obsolete_cma::config, configcontext_new(), CONFIGNAME_CMAINIT, CONFIGNAME_COMPRESS, CONFIGNAME_OUTSIG, daemonize_me(), errcount, FRAMETYPE_COMPRESS, g_info, get_default_pid_fileName(), _Listener::got_frameset, gotnetpkt(), _NetAddr::ismcast, kill_pid_service(), listener_new(), localaddr, LONG_LICENSE_STRING, mainloop, nano_packet_decoder(), nano_shutdown(), nano_start_full(), NANOLISTENADDR, netaddr_ipv6_new(), netaddr_string_new(), netgsource_new(), netio_is_dual_ipv4v6_stack(), PID_RUNNING, pidrunningstat_to_status(), _NetAddr::port, procname, proj_class_dump_live_objects(), proj_class_finalize_sys(), proj_class_incr_debug(), proj_class_live_object_count(), reliableudp_new(), remove_pid_file(), SEP, _ConfigContext::setaddr, _ConfigContext::setframe, _NetIO::setmcast_ttl(), signal, signframe_new(), _AssimObj::toString, UNREF, UNREF2, usage(), VERSION_STRING, and wirepktcount.

Here is the call graph for this function:

void usage ( const char *  cmdname)

Definition at line 172 of file nanoprobe/nanoprobe.c.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

const char* cmaaddr = NULL

Definition at line 66 of file nanoprobe/nanoprobe.c.

Referenced by main().

NetAddr* destaddr

Definition at line 72 of file nanoprobe/nanoprobe.c.

Referenced by _fsprotocol_find(), and nanoobey_stopexpecthb().

int heartbeatcount = 0

Definition at line 74 of file nanoprobe/nanoprobe.c.

const char* localaddr = NULL

Definition at line 65 of file nanoprobe/nanoprobe.c.

Referenced by main().

NetAddr* localbindaddr

Definition at line 73 of file nanoprobe/nanoprobe.c.

NetGSource* netpkt

Definition at line 71 of file nanoprobe/nanoprobe.c.

Referenced by main().

NetIO* nettransport

Definition at line 70 of file nanoprobe/nanoprobe.c.

int pcapcount = 0

Definition at line 75 of file nanoprobe/nanoprobe.c.

gint64 pktcount = 0

Definition at line 69 of file nanoprobe/nanoprobe.c.

gboolean sighup = FALSE

Definition at line 82 of file nanoprobe/nanoprobe.c.

Referenced by catch_a_signal().

gboolean sigint = FALSE

Definition at line 80 of file nanoprobe/nanoprobe.c.

Referenced by catch_a_signal(), and check_for_signals().

gboolean sigterm = FALSE

Definition at line 81 of file nanoprobe/nanoprobe.c.

Referenced by catch_a_signal(), and check_for_signals().

gboolean sigusr1 = FALSE

Definition at line 83 of file nanoprobe/nanoprobe.c.

Referenced by catch_a_signal(), and check_for_signals().

gboolean sigusr2 = FALSE

Definition at line 84 of file nanoprobe/nanoprobe.c.

Referenced by catch_a_signal(), and check_for_signals().

int wirepktcount = 0

Definition at line 76 of file nanoprobe/nanoprobe.c.

Referenced by gotnetpkt(), and main().