The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pcap+mainloop.c
Go to the documentation of this file.
1 
37 #include <projectcommon.h>
38 #include <stdlib.h>
39 #include <stdio.h>
40 #include <string.h>
41 #ifdef HAVE_MCHECK_H
42 # include <mcheck.h>
43 #endif
44 #include <framesettypes.h>
45 #include <frameset.h>
46 #include <ctype.h>
47 #include <netgsource.h>
48 #include <reliableudp.h>
49 #include <netaddr.h>
50 #include <authlistener.h>
51 #include <signframe.h>
52 #include <cryptframe.h>
53 #include <compressframe.h>
54 #include <intframe.h>
55 #include <addrframe.h>
56 #include <cstringframe.h>
57 #include <frametypes.h>
58 #include <nanoprobe.h>
59 #include <resourcecmd.h>
60 #include <cmalib.h>
61 
62 
63 #define TESTPORT 1984
64 
65 #ifdef WIN32
66 WINIMPORT int errcount;
67 WINIMPORT NanoHbStats nano_hbstats;
68 WINIMPORT GMainLoop* mainloop;
69 #else
70 extern int errcount;
72 GMainLoop* mainloop;
73 #endif
74 
76 gint64 maxpkts = G_MAXINT64;
77 gint64 pktcount = 0;
78 GMainLoop* mainloop;
85 int wirepktcount = 0;
86 
87 gboolean gotnetpkt(Listener*, FrameSet* fs, NetAddr* srcaddr);
88 void got_heartbeat(HbListener* who);
89 void got_heartbeat2(HbListener* who);
90 void check_JSON(FrameSet* fs);
91 
93 gboolean timeout_agent(gpointer ignored);
94 
97  {0, NULL},
98 };
99 
100 
102 
103 void
105 {
106  GSList* fptr;
107  int jsoncount = 0;
108  int errcount = 0;
109 
110  g_debug("Frameset type is: %d", fs->fstype);
111  for (fptr=fs->framelist; fptr; fptr=fptr->next) {
112  Frame* frame = CASTTOCLASS(Frame, fptr->data);
113  CstringFrame* csf;
115  g_debug("Frame type is: %d", frame->type);
116  if (frame->type != FRAMETYPE_JSDISCOVER) {
117  continue;
118  }
119  ++jsoncount;
120  // Ahh! JSON data. Let's parse it!
121  csf = CASTTOCLASS(CstringFrame, frame);
123  if (config == NULL) {
124  g_warning("JSON text did not parse correctly [%s]"
125  , (char*)csf->baseclass.value);
126  ++errcount;
127  }else{
128  char * tostr = config->baseclass.toString(config);
129  g_message("PARSED JSON: %s", tostr);
130  g_free(tostr); tostr = NULL;
131  UNREF(config);
132  }
133  }
134  g_message("%d JSON strings parsed. %d errors.", jsoncount, errcount);
135 }
136 
138 gboolean
140  FrameSet* fs,
141  NetAddr* srcaddr
142  )
143 {
144  (void)l; (void)srcaddr;
145  ++wirepktcount;
146  switch(fs->fstype) {
147  case FRAMESETTYPE_HBDEAD:
148  g_message("CMA Received dead host notification (type %d) over the 'wire'."
149  , fs->fstype);
150  break;
152  g_message("CMA Received switch discovery data (type %d) over the 'wire'."
153  , fs->fstype);
154  break;
156  g_message("CMA Received JSON discovery data (type %d) over the 'wire'."
157  , fs->fstype);
158  check_JSON(fs);
159  break;
160  default:{
161  char * fsstr = fs->baseclass.toString(&fs->baseclass);
162  g_message("CMA Received a FrameSet of type %d [%s] over the 'wire'."
163  , fs->fstype, fsstr);
164  FREE(fsstr); fsstr = NULL;
165  }
166  }
167 
168  l->transport->_netio->ackmessage(l->transport->_netio, srcaddr, fs);
169  UNREF(fs);
170  if (wirepktcount >= maxpkts) {
171  g_message("QUITTING NOW - wirepktcount!");
173  return FALSE;
174  }
175  return TRUE;
176 }
177 
179 gboolean
180 timeout_agent(gpointer ignored)
181 {
182  ReliableUDP* io = CASTTOCLASS(ReliableUDP, nettransport);
183 
184  (void)ignored;
185  if (nano_hbstats.heartbeat_count > (unsigned)maxpkts) {
186  g_message("QUITTING NOW! (heartbeat count)");
187  io->_protocol->closeall(io->_protocol);
189  return FALSE;
190  }
191  return TRUE;
192 }
193 
194 #define OCFCLASS "\"" REQCLASSNAMEFIELD "\": \"ocf\""
195 #define HBPROVIDER "\"" REQPROVIDERNAMEFIELD "\": \"heartbeat\""
196 #define DUMMYTYPE "\"" CONFIGNAME_TYPE "\": \"Dummy\""
197 #define STARTOP "\"" REQOPERATIONNAMEFIELD "\": \"start\""
198 #define STOPOP "\"" REQOPERATIONNAMEFIELD "\": \"stop\""
199 #define MONITOROP "\"" REQOPERATIONNAMEFIELD "\": \"monitor\""
200 #define METADATAOP "\"" REQOPERATIONNAMEFIELD "\": \"meta-data\""
201 #define RESOURCENAME "\"" CONFIGNAME_INSTANCE "\": \"DummyTestGTest01\""
202 #define NULLPARAMS "\"" REQENVIRONNAMEFIELD "\": {}"
203 #define C ","
204 #define REQID(id) "\"" REQIDENTIFIERNAMEFIELD "\": " #id
205 #define REPEAT(repeat) "\"" REQREPEATNAMEFIELD "\": " #repeat
206 #define INITDELAY(delay) "\"" CONFIGNAME_INITDELAY "\": " #delay
207 #define COMMREQUEST OCFCLASS C HBPROVIDER C DUMMYTYPE C RESOURCENAME C NULLPARAMS
208 #define REQUEST(type,id, repeat,delay) \
209  "{" COMMREQUEST C type C REQID(id) C REPEAT(repeat) C INITDELAY(delay)"}"
210 #define START REQUEST(STARTOP, 1, 0, 0) // One shot - no delay
211 #define MONITOR REQUEST(MONITOROP, 2, 0, 0) // Repeat every second - no delay
212 #define STOP REQUEST(STOPOP, 3, 0, 5) // No repeat - 5 second delay
213 
215 void
217 {
218  FrameSet* pkt;
219  NetGSource* netpkt = auth->baseclass.transport;
220  char * nanostr = nanoaddr->baseclass.toString(nanoaddr);
221 
222  (void)ifs;
223  g_message("CMA received startup message from nanoprobe at address %s/%d."
224  , nanostr, nanoaddr->port(nanoaddr));
225  g_free(nanostr); nanostr = NULL;
226  check_JSON(ifs);
227 
228  // Send the configuration data to our new "client"
229  pkt = create_setconfig(nanoconfig);
230  netpkt->_netio->sendareliablefs(netpkt->_netio, nanoaddr, DEFAULT_FSP_QID, pkt);
231  UNREF(pkt);
232 
233  // Now tell them to send/expect heartbeats to various places
235  netpkt->_netio->sendareliablefs(netpkt->_netio, nanoaddr, DEFAULT_FSP_QID, pkt);
236  UNREF(pkt);
237 
239  netpkt->_netio->sendareliablefs(netpkt->_netio, nanoaddr, DEFAULT_FSP_QID, pkt);
240  UNREF(pkt);
241 
243  netpkt->_netio->sendareliablefs(netpkt->_netio, nanoaddr, DEFAULT_FSP_QID, pkt);
244  UNREF(pkt);
245 
246  {
247  const char * json[] = { START, MONITOR, STOP};
248  unsigned j;
249  // Create a frameset for a few resource operations
251  for (j=0; j < DIMOF(json); j++) {
253  csf->baseclass.setvalue(&csf->baseclass, g_strdup(json[j])
254  , strlen(json[j])+1, g_free);
255  frameset_append_frame(pkt, &csf->baseclass);
256  UNREF2(csf);
257  }
258  netpkt->_netio->sendareliablefs(netpkt->_netio, nanoaddr, DEFAULT_FSP_QID, pkt);
259  UNREF(pkt);
260  }
261 }
262 
271 int
272 main(int argc, char **argv)
273 {
274  const guint8 loopback[] = CONST_IPV6_LOOPBACK;
275  const guint8 mcastaddrstring[] = CONST_ASSIM_DEFAULT_V4_MCAST;
276  NetAddr* mcastaddr;
277  const guint8 otheradstring[] = {127,0,0,1};
278  const guint8 otheradstring2[] = {10,10,10,4};
279  const guint8 anyadstring[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
280  guint16 testport = TESTPORT;
281  SignFrame* signature = signframe_new(G_CHECKSUM_SHA256, 0);
282  Listener* otherlistener;
284  PacketDecoder* decoder = nano_packet_decoder();
285  AuthListener* listentonanoprobes;
286 
287 #if 0
288 # ifdef HAVE_MCHECK_PEDANTIC
289  g_assert(mcheck_pedantic(NULL) == 0);
290 # else
291 # ifdef HAVE_MCHECK
292  g_assert(mcheck(NULL) == 0);
293 # endif
294 # endif
295 #endif
296  g_setenv("G_MESSAGES_DEBUG", "all", TRUE);
297 #if 0
298  proj_class_incr_debug(NULL);
299  proj_class_incr_debug(NULL);
300  proj_class_incr_debug(NULL);
301  proj_class_incr_debug(NULL);
302  proj_class_incr_debug(NULL);
303 #endif
304  g_log_set_fatal_mask(NULL, G_LOG_LEVEL_ERROR);
305 
306  if (argc > 1) {
307  maxpkts = atol(argv[1]);
308  g_debug("Max packet count is "FMT_64BIT"d", maxpkts);
309  }
310 
312  g_message("Our OS supports dual ipv4/v6 sockets. Hurray!");
313  }else{
314  g_warning("Our OS DOES NOT support dual ipv4/v6 sockets - this may not work!!");
315  }
316 
317 
318  config->setframe(config, CONFIGNAME_OUTSIG, &signature->baseclass);
319 
320  // Create a network transport object for normal UDP packets
321  nettransport = &(reliableudp_new(0, config, decoder, 0)->baseclass.baseclass);
322  g_return_val_if_fail(NULL != nettransport, 2);
323 
324  // Set up the parameters the 'CMA' is going to send to our 'nanoprobe'
325  // in response to their request for configuration data.
326  nanoconfig = configcontext_new(0);
327  nanoconfig->setint(nanoconfig, CONFIGNAME_INTERVAL, 1);
328  nanoconfig->setint(nanoconfig, CONFIGNAME_TIMEOUT, 3);
329  nanoconfig->setint(nanoconfig, CONFIGNAME_CMAPORT, testport);
330 
331 
332  // Construct the NetAddr we'll talk to (i.e., ourselves) and listen from
333  destaddr = netaddr_ipv6_new(loopback, testport);
334  g_return_val_if_fail(NULL != destaddr, 3);
335  config->setaddr(config, CONFIGNAME_CMAINIT, destaddr);
336  nanoconfig->setaddr(nanoconfig, CONFIGNAME_CMAADDR, destaddr);
337  nanoconfig->setaddr(nanoconfig, CONFIGNAME_CMAFAIL, destaddr);
338  nanoconfig->setaddr(nanoconfig, CONFIGNAME_CMADISCOVER, destaddr);
339 
340 
341  // Construct another couple of NetAddrs to talk to and listen from
342  // for good measure...
343  otheraddr = netaddr_ipv4_new(otheradstring, testport);
344  g_return_val_if_fail(NULL != otheraddr, 4);
345  otheraddr2 = netaddr_ipv4_new(otheradstring2, testport);
346  g_return_val_if_fail(NULL != otheraddr2, 4);
347 
348  // Construct another NetAddr to bind to (anything)
349  anyaddr = netaddr_ipv6_new(anyadstring, testport);
350  g_return_val_if_fail(NULL != destaddr, 5);
351 
352  // Bind to ANY address (as noted above)
353  g_return_val_if_fail(nettransport->bindaddr(nettransport, anyaddr, FALSE),16);
354  //g_return_val_if_fail(nettransport->bindaddr(nettransport, destaddr),16);
355 
356  g_message("Joining multicast address.");
357  mcastaddr = netaddr_ipv4_new(mcastaddrstring, testport);
358  g_return_val_if_fail(nettransport->mcastjoin(nettransport, mcastaddr, NULL), 17);
359  UNREF(mcastaddr);
360  g_message("multicast join succeeded.");
361 
362  // Connect up our network transport into the g_main_loop paradigm
363  // so we get dispatched when packets arrive
364  netpkt = netgsource_new(nettransport, NULL, G_PRIORITY_HIGH, FALSE, NULL, 0, NULL);
365 
366  // Set up so that we can observe all unclaimed packets
367  otherlistener = listener_new(config, 0);
368  otherlistener->got_frameset = gotnetpkt;
369  netpkt->addListener(netpkt, 0, otherlistener);
370  otherlistener->associate(otherlistener,netpkt);
371 
372  // Unref the "other" listener - we hold other references to it
373  UNREF(otherlistener);
374 
375  // Pretend to be the CMA...
376  // Listen for packets from our nanoprobes - scattered throughout space...
377  listentonanoprobes = authlistener_new(0, cmalist, config, TRUE);
378  listentonanoprobes->baseclass.associate(&listentonanoprobes->baseclass, netpkt);
379 
380  nano_start_full("netconfig", 900, netpkt, config);
381 
382  g_timeout_add_seconds(1, timeout_agent, NULL);
383  mainloop = g_main_loop_new(g_main_context_default(), TRUE);
384 
385  /********************************************************************
386  * Start up the main loop - run our test program...
387  * (the one pretending to be both the nanoprobe and the CMA)
388  ********************************************************************/
389  g_main_loop_run(mainloop);
390 
391  /********************************************************************
392  * We exited the main loop. Shut things down.
393  ********************************************************************/
394 
395  nano_shutdown(TRUE); // Tell it to shutdown and print stats
396  g_message("Count of 'other' pkts received:\t%d", wirepktcount);
397 
398  UNREF(nettransport);
399 
400  // Main loop is over - shut everything down, free everything...
401  g_main_loop_unref(mainloop); mainloop=NULL;
402 
403 
404  // Unlink misc dispatcher - this should NOT be necessary...
405  netpkt->addListener(netpkt, 0, NULL);
406 
407  // Dissociate packet actions from the packet source.
408  listentonanoprobes->baseclass.dissociate(&listentonanoprobes->baseclass);
409 
410  // Unref the AuthListener object
411  UNREF2(listentonanoprobes);
412 
413  g_source_destroy(&netpkt->baseclass);
414  g_source_unref(&netpkt->baseclass);
415  //g_main_context_unref(g_main_context_default());
416 
417  // Free signature frame
418  UNREF2(signature);
419 
420  // Free misc addresses
421  UNREF(destaddr);
422  UNREF(otheraddr);
423  UNREF(otheraddr2);
424  UNREF(anyaddr);
425 
426  // Free config object
427  UNREF(config);
428  UNREF(nanoconfig);
429 
430  // At this point - nothing should show up - we should have freed everything
431  if (proj_class_live_object_count() > 0) {
432  g_warning("Too many objects (%d) alive at end of test.",
435  ++errcount;
436  }else{
437  g_message("No objects left alive. Awesome!");
438  }
439  proj_class_finalize_sys(); // Shut down object system to make valgrind happy :-D
440  return(errcount <= 127 ? errcount : 127);
441 }
ConfigContext * configcontext_new_JSON_string(const char *jsontext)
Construct a ConfigContext object from the given JSON string.
Listener baseclass
Definition: authlistener.h:42
#define FRAMESETTYPE_HBDEAD
System named in packet appears to be dead.
Definition: framesettypes.h:39
#define CONFIGNAME_CMADISCOVER
Address of where to send discovery reports.
#define CONFIGNAME_INTERVAL
How long to wait between events.
void check_JSON(FrameSet *fs)
GSource baseclass
Parent GSource Object pointer.
Definition: netgsource.h:44
AssimObj baseclass
Definition: frameset.h:46
#define FRAMESETTYPE_JSDISCOVERY
Packet contains JSON-formatted discovery data.
Definition: framesettypes.h:45
guint16(* port)(const NetAddr *self)
Return port from this address.
Definition: netaddr.h:46
Structure associating FrameSet class types with actions to perform when they're received.
Definition: authlistener.h:50
NetIO * _netio
netio this object is based on
Definition: netgsource.h:50
PacketDecoder * nano_packet_decoder(void)
Return our nanoprobe packet decoder map.
Definition: nanoprobe.c:1180
gint64 pktcount
Definition: pcap+mainloop.c:77
#define CONFIGNAME_CMAPORT
Default Port for contacting the CMA.
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
NetIOudp is a NetIOudp class subclass specialized to provide reliable UDP connections.
Definition: reliableudp.h:43
GMainLoop * mainloop
gtest01.c - miscellaneous glib mainloop-based tests.
Definition: pcap+mainloop.c:72
#define FRAMETYPE_JSDISCOVER
FRAMETYPE_JSDISCOVER Frame (frametype 19) Frame subclass - CstringFrame class.
Definition: frametypes.h:302
Implements minimal client-oriented Frame and Frameset capabilities.
ObeyFrameSetTypeMap cmalist[]
Definition: pcap+mainloop.c:95
This is the base Frame class object (in-memory TLV (type, length, value)) for every general component...
Definition: frame.h:43
#define CONFIGNAME_OUTSIG
SignFrame to use to sign/verify packets.
gboolean ackmessage(NetIO *self, NetAddr *dest, FrameSet *frameset)
< User-level ACK of a message sent reliably
gboolean gotnetpkt(Listener *, FrameSet *fs, NetAddr *srcaddr)
Test routine called when an otherwise-unclaimed NetIO packet is received.
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
Describes interfaces to C-String Frame (Cstringframe) C-Class It holds conventional zero-terminated b...
AssimObj baseclass
Definition: netaddr.h:44
WINEXPORT void nano_start_full(const char *initdiscoverpath, guint discover_interval, NetGSource *io, ConfigContext *config)
Here is how the startup process works:
Definition: nanoprobe.c:1216
FrameSet * frameset_new(guint16 frameset_type)
Construct a new frameset of the given type.
Definition: frameset.c:110
gboolean bindaddr(NetIO *self, const NetAddr *, gboolean silent)
<[in] Bind this NetIO to the given address
NetAddr * netaddr_ipv4_new(gconstpointer ipbuf, guint16 port)
Create new NetAddr from a IPv4 address.
Definition: netaddr.c:1024
The SignFrame class object - implements digital signatures for FrameSets.
Definition: signframe.h:40
gpointer value
Frame Value (pointer)
Definition: frame.h:47
int expected_dead_count
Definition: pcap+mainloop.c:75
NetAddr * otheraddr
Definition: pcap+mainloop.c:82
NetIO * nettransport
Definition: pcap+mainloop.c:79
guint64 heartbeat_count
Definition: nanoprobe.h:33
guint16 fstype
Type of frameset.
Definition: frameset.h:51
int wirepktcount
Definition: pcap+mainloop.c:85
void(* setaddr)(ConfigContext *, const char *, NetAddr *)
Set NetAddr value.
Definition: configcontext.h:93
void(* setframe)(ConfigContext *, const char *, Frame *)
Set Frame value.
Definition: configcontext.h:91
Implements the IntFrame class - integers in a frame.
AssimObj baseclass
Definition: configcontext.h:72
void frameset_append_frame(FrameSet *fs, Frame *f)
Append frame to the front of the end of the frame list.
Definition: frameset.c:143
Describes interfaces to C-String Frame (Cstringframe) C-Class It holds conventional zero-terminated b...
#define CONFIGNAME_TIMEOUT
How before declaring a serious problem...
Implements the Reliable UDP network I/O transport (ReliableUDP) class.
int main(int argc, char **argv)
Test program looping and reading LLDP/CDP packets and exercising most of the packet send/receive mech...
int errcount
error count
Definition: nanoprobe.c:65
Header file defining all known FrameSet types THIS FILE MECHANICALLY GENERATED by "/home/alanr/assim/...
ConfigContext * nanoconfig
This is the AuthListener class. object - which (authorizes and) obeys packets from the Authority...
Definition: authlistener.h:41
#define CONST_IPV6_LOOPBACK
Definition: netaddr.h:76
FrameSet * create_sendexpecthb(ConfigContext *config, guint16 msgtype, NetAddr *addrs, int addrcount)
Create a FrameSet class to send and expect heartbeats from the same sets of addresses.
Definition: cmalib.c:42
gboolean netio_is_dual_ipv4v6_stack(void)
Definition: netio.c:751
#define FRAMETYPE_RSCJSON
FRAMETYPE_RSCJSON Frame (frametype 27) Frame subclass - CstringFrame class.
Definition: frametypes.h:400
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:1032
#define FMT_64BIT
Format designator for a 64 bit integer.
Definition: projectcommon.h:32
#define FREE(m)
Our interface to free.
Definition: projectcommon.h:29
FsProtocol * _protocol
Queuing, ordering, retransmission and ACKing discipline.
Definition: reliableudp.h:45
include file defining functions to be called by a main to instantiate a nanoprobe.
This is the base HbListener class. object - which listens for heartbeats from a particular sender...
Definition: hblistener.h:44
void got_heartbeat(HbListener *who)
This is our CstringFrame class object - used for holding C-style NULL terminated strings.
Definition: cstringframe.h:36
guint32 proj_class_live_object_count(void)
Return the count of live C class objects.
Definition: proj_classes.c:406
Project common header file.
#define DIMOF(a)
Definition: lldp_min.c:30
gint64 maxpkts
Definition: pcap+mainloop.c:76
Header file defining the data layouts for our Frames.
NetAddr * anyaddr
Definition: pcap+mainloop.c:84
NetGSource * transport
Definition: listener.h:44
NetAddr * destaddr
Definition: pcap+mainloop.c:81
SignFrame * signframe_new(GChecksumType sigtype, gsize framesize)
Construct a new SignFrame - allowing for "derived" frame types...
Definition: signframe.c:208
#define CONST_ASSIM_DEFAULT_V4_MCAST
This is our reserved multicast address.
Definition: netaddr.h:84
WINEXPORT gboolean nano_initiate_shutdown(void)
Initiate shutdown - return TRUE if we have shut down immediately...
Definition: nanoprobe.c:1288
#define STOP
NanoHbStats nano_hbstats
Definition: nanoprobe.c:63
void(* setint)(ConfigContext *, const char *name, gint value)
Set integer value.
Definition: configcontext.h:75
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
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
ConfigContext * config
Definition: listener.h:43
gboolean sendareliablefs(NetIO *self, NetAddr *dest, guint16 queueid, FrameSet *frameset)
[out] source address of return result
void(* addListener)(NetGSource *, guint16, Listener *)
Register a new listener.
Definition: netgsource.h:55
#define MONITOR
#define FRAMESETTYPE_SWDISCOVER
Packet encapsulates switch discovery packet.
Definition: framesettypes.h:44
#define TESTPORT
Definition: pcap+mainloop.c:63
guint16 type
Frame Type (see Individual TLV 'Frame' data types and layouts (by TLV type) - frameformats.h )
Definition: frame.h:45
GSList * framelist
List of frames in this FrameSet.
Definition: frameset.h:47
The NetAddr class class represents a general network address - whether IP, MAC, or any other type of ...
Definition: netaddr.h:43
#define CONFIGNAME_CMAADDR
Address of the Collective Management authority.
AuthListener * authlistener_new(gsize objsize, ObeyFrameSetTypeMap *map, ConfigContext *config, gboolean autoack)
Construct a new Listener - setting up GSource and timeout data structures for it. ...
Definition: authlistener.c:123
Describes interfaces to Address Frame (AddrFrame) C-Class.
FrameSet * create_setconfig(ConfigContext *cfg)
Create a FRAMESETTYPE_SETCONFIG FrameSet class.
Definition: cmalib.c:111
gboolean(* got_frameset)(Listener *self, FrameSet *fs, NetAddr *na)
called when a FrameSet arrives
Definition: listener.h:45
Defines interfaces for the NetAddr (network address) object.
NetIO baseclass
Base class (NetIO) object.
Definition: netioudp.h:40
#define DEFAULT_FSP_QID
Default Queue ID.
Definition: fsprotocol.h:127
FrameSet class - used for collecting Frames when not on the wire, and for marshalling/demarshalling t...
Definition: frameset.h:45
gchar *(* toString)(gconstpointer)
Produce malloc-ed string representation.
Definition: assimobj.h:58
void(* closeall)(FsProtocol *)
Close all our connections.
Definition: fsprotocol.h:122
#define FRAMESETTYPE_SENDEXPECTHB
Send Heartbeats to these addresses, and expect them as well.
Definition: framesettypes.h:49
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:1246
Implements NetIO GSource object.
#define FRAMESETTYPE_STARTUP
System originating packet looking for heartbeat configuration.
Definition: framesettypes.h:38
void(* dissociate)(Listener *self)
Dissociate us from our source.
Definition: listener.h:51
#define CONFIGNAME_CMAFAIL
Address of where to send failure reports.
#define CONFIGNAME_CMAINIT
Initial startup contact address for the CMA.
Implements the resource command abstract class.
void proj_class_dump_live_objects(void)
Dump all live C class objects (address and Class)
Definition: proj_classes.c:356
void(* associate)(Listener *self, NetGSource *source)
NetGSource class to associate with
Definition: listener.h:49
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:41
NetAddr * otheraddr2
Definition: pcap+mainloop.c:83
NetIOudp baseclass
Base class (NetIO) object.
Definition: reliableudp.h:44
void(* setvalue)(Frame *self, gpointer value, guint32 length, GDestroyNotify valfinal)
member function for setting value
Definition: frame.h:52
gboolean mcastjoin(NetIO *self, const NetAddr *, const NetAddr *)
<Join multicast group
#define START
#define UNREF2(obj)
Definition: assimobj.h:36
void fakecma_startup(AuthListener *, FrameSet *fs, NetAddr *)
Routine to pretend to be the initial CMA.
#define CASTTOCLASS(Cclass, obj)
Safely cast 'obj' to C-class 'class' - verifying that it was registerd as being of type class ...
Definition: proj_classes.h:66
#define UNREF(obj)
Definition: assimobj.h:35
This is a basic NetIO class abstract class for doing network I/O.
Definition: netio.h:58
Basic utility functions for the CMA.
gboolean timeout_agent(gpointer ignored)
Called every second during tests.
#define FRAMESETTYPE_DORSCOP
Do a (possibly-repeating) JSON resource action.
Definition: framesettypes.h:58
The NetGSource class objects integrate NetIO class objects into the g_main_loop paradigm.
Definition: netgsource.h:43
This is the Listener class. object - which generically listens for packets.
Definition: listener.h:41
NetGSource * netpkt
Definition: pcap+mainloop.c:80
void got_heartbeat2(HbListener *who)
WINEXPORT CstringFrame * cstringframe_new(guint16 frame_type, gsize framesize)
Construct a new CstringFrame - allowing for "derived" frame types...
Definition: cstringframe.c:101