The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Discovery class

Discovery abstract base class - supporting the discovery of various local things by our subclasses. More...

Collaboration diagram for Discovery class:

Modules

 JSON discovery class.
 JSONDiscovery class - supporting the discovery of various things through scripts that produce JSON output to stdout.
 
 SwitchDiscovery class
 Class providing a switch discovery class for discovering network switch properties - subclass of Discovery class.
 

Functions

FSTATIC char * _discovery_instancename (const Discovery *self)
 internal function return the type of Discovery object More...
 
FSTATIC void _discovery_flushcache (Discovery *self)
 default (do-nothing) 'flush cache' function More...
 
FSTATIC guint _discovery_discoverintervalsecs (const Discovery *self)
 default function - return zero for discovery interval More...
 
FSTATIC gboolean _discovery_rediscover (gpointer vself)
 GSourceFunc function to invoke discover member function at the timed interval. More...
 
FSTATIC void _discovery_ghash_destructor (gpointer gdiscovery)
 Discovery Destructor function for the GHashTable. More...
 
FSTATIC void _discovery_finalize (AssimObj *gself)
 Finalizing function for Discovery objects. More...
 
Discoverydiscovery_new (const char *instname, NetGSource *iosource, ConfigContext *context, gsize objsize)
 Discovery constructor. More...
 
void discovery_register (Discovery *self)
 Function for registering a discovery object with the discovery infrastructure. More...
 
FSTATIC void discovery_unregister (const char *instance)
 
void discovery_unregister_all (void)
 Unregister all discovery methods in preparation for shutting down - to make valgrind happy :-D. More...
 
typedef struct _Discovery Discovery
 
typedef struct _JsonDiscovery JsonDiscovery
 
WINEXPORT JsonDiscoveryjsondiscovery_new (const char *discoverytype, const char *instancename, int intervalsecs, ConfigContext *jsonparams, NetGSource *, ConfigContext *, gsize)
 
#define JSONAGENTROOT   DISCOVERY_DIR
 

Detailed Description

Discovery abstract base class - supporting the discovery of various local things by our subclasses.

Macro Definition Documentation

#define JSONAGENTROOT   DISCOVERY_DIR

Definition at line 33 of file jsondiscovery.h.

Referenced by jsondiscovery_new().

Typedef Documentation

typedef struct _Discovery Discovery

Definition at line 45 of file discovery.h.

typedef struct _JsonDiscovery JsonDiscovery

Definition at line 35 of file jsondiscovery.h.

Function Documentation

FSTATIC guint _discovery_discoverintervalsecs ( const Discovery self)

default function - return zero for discovery interval

Parameters
[in]selfObject whose interval to return

Definition at line 57 of file discovery.c.

Referenced by discovery_new().

Here is the caller graph for this function:

FSTATIC void _discovery_finalize ( AssimObj gself)

Finalizing function for Discovery objects.

Parameters
[in,out]gselfObject to finalize (free)

Definition at line 66 of file discovery.c.

References CASTTOCLASS, FREECLASSOBJ, and UNREF.

Referenced by _jsondiscovery_finalize(), and discovery_new().

Here is the caller graph for this function:

FSTATIC void _discovery_flushcache ( Discovery self)

default (do-nothing) 'flush cache' function

Parameters
selfobject whose cache we're suppossed to flush...

Definition at line 50 of file discovery.c.

FSTATIC void _discovery_ghash_destructor ( gpointer  gdiscovery)

Discovery Destructor function for the GHashTable.

This function gets called every time a Discovery gets deleted from our _discovery_timers hash table. It has the potential for infinite mutual recursion with discovery_finalize() - which we prevent.

Definition at line 95 of file discovery.c.

References CASTTOCLASS, and UNREF.

Referenced by discovery_register().

Here is the caller graph for this function:

DEBUGDECLARATIONS FSTATIC char * _discovery_instancename ( const Discovery self)

internal function return the type of Discovery object

Parameters
[in]selfobject whose instance name to return

Definition at line 43 of file discovery.c.

Referenced by discovery_new().

Here is the caller graph for this function:

FSTATIC gboolean _discovery_rediscover ( gpointer  vself)

GSourceFunc function to invoke discover member function at the timed interval.

This function is called by the g_main_loop mechanism when the rediscover timeout elapses.

Parameters
[in,out]vselfObject to perform discovery on

Definition at line 105 of file discovery.c.

References CASTTOCLASS.

Referenced by discovery_register().

Here is the caller graph for this function:

Discovery* discovery_new ( const char *  instname,
NetGSource iosource,
ConfigContext context,
gsize  objsize 
)

Discovery constructor.

Note that derived classes must set the discover member function - or things might crash. That is certainly what will happen if you try and construct one of these objects directly and then use it.

Parameters
[in]instnameinstance name
[in,out]iosourceI/O object
[in,out]contextconfiguration context
[in]objsizenumber of bytes to malloc for the object (or zero)

Definition at line 117 of file discovery.c.

References _Discovery::_config, _discovery_discoverintervalsecs(), _discovery_finalize(), _discovery_instancename(), _AssimObj::_finalize, _Discovery::_instancename, _Discovery::_iosource, _Discovery::_timerid, assimobj_new(), _Discovery::baseclass, BINDDEBUG, _Discovery::discover, _Discovery::discoverintervalsecs, _Discovery::instancename, NEWSUBCLASS, and REF.

Referenced by jsondiscovery_new(), and switchdiscovery_new().

Here is the call graph for this function:

Here is the caller graph for this function:

void discovery_register ( Discovery self)

Function for registering a discovery object with the discovery infrastructure.

It runs the discover function, then schedules it for repeated discovery - if appropriate. It "knows" how often to rediscover things by calling the discoverintervalsecs() member function. If that function returns a value greater than zero, then this discovery object will be "re-discovered" according to the number of seconds returned.

Parameters
[in,out]selfDiscovery object to register

Definition at line 146 of file discovery.c.

References _discovery_ghash_destructor(), _discovery_rediscover(), and REF.

Referenced by jsondiscovery_new(), and switchdiscovery_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC void discovery_unregister ( const char *  instance)

Definition at line 163 of file discovery.c.

Referenced by nanoobey_stopdiscover().

Here is the caller graph for this function:

void discovery_unregister_all ( void  )

Unregister all discovery methods in preparation for shutting down - to make valgrind happy :-D.

Definition at line 172 of file discovery.c.

References DEBUGMSG1.

Referenced by nano_initiate_shutdown().

Here is the caller graph for this function:

WINEXPORT JsonDiscovery* jsondiscovery_new ( const char *  discoverytype,
const char *  instancename,
int  intervalsecs,
ConfigContext jsonparams,
NetGSource ,
ConfigContext ,
gsize   
)