|
The Assimilation Monitoring Project
|
Class providing a switch discovery class for discovering network switch properties - subclass of Discovery class. More...
|
Data Structures | |
| struct | _SwitchDiscoveryType |
Typedefs | |
| typedef struct _SwitchDiscoveryType | SwitchDiscoveryType |
Functions | |
| FSTATIC void | _switchdiscovery_finalize (AssimObj *dself) |
| finalize a SwitchDiscovery object More... | |
| FSTATIC gboolean | _switchdiscovery_discover (Discovery *self) |
| Discover member function for timed discovery – not applicable – return FALSE. More... | |
| FSTATIC gboolean | _switchdiscovery_dispatch (GSource_pcap_t *gsource,pcap_t *capstruct,gconstpointer pkt,gconstpointer pend,const struct pcap_pkthdr *pkthdr,const char *capturedev,gpointer selfptr) |
| Internal pcap gsource dispatch routine - called when we get a packet. More... | |
| SwitchDiscovery * | switchdiscovery_new (const char *instance, const char *dev, guint listenmask, gint priority, GMainContext *mcontext, NetGSource *iosrc, ConfigContext *config, gsize objsize) |
| SwitchDiscovery constructor. More... | |
| FSTATIC gboolean | _switchdiscovery_cache_info (SwitchDiscovery *self,gconstpointer pkt,gconstpointer pktend) |
Class providing a switch discovery class for discovering network switch properties - subclass of Discovery class.
We deal with things like CDP, LDP and so on in order to "hear" our switch/port configuration.
| typedef struct _SwitchDiscoveryType SwitchDiscoveryType |
Definition at line 145 of file switchdiscovery.c.
| FSTATIC gboolean _switchdiscovery_cache_info | ( | SwitchDiscovery * | self, |
| gconstpointer | pkt, | ||
| gconstpointer | pktend | ||
| ) |
| [in,out] | self | Our SwitchDiscovery object |
| [in] | pkt | Pointer to the packet just read in |
| [in] | pktend | Pointer to first byte past 'pkt' |
Definition at line 159 of file switchdiscovery.c.
Referenced by _switchdiscovery_dispatch().

Discover member function for timed discovery – not applicable – return FALSE.
| [in,out] | self |
Definition at line 66 of file switchdiscovery.c.
Referenced by switchdiscovery_new().

| FSTATIC gboolean _switchdiscovery_dispatch | ( | GSource_pcap_t * | gsource, |
| pcap_t * | capstruct, | ||
| gconstpointer | pkt, | ||
| gconstpointer | pend, | ||
| const struct pcap_pkthdr * | pkthdr, | ||
| const char * | capturedev, | ||
| gpointer | selfptr | ||
| ) |
Internal pcap gsource dispatch routine - called when we get a packet.
It examines the packet and sees if it is the same switch id and port ID as previously. If there is no previous packet, or something has changed, it constructs a packet encapsulating the captured packet, then sends this encapsulated packet "upstream" to the CMA. All we care about about are those two fields - the rest we leave to the CMA.
Don't cache if we can't send - and don't send if we have sent this info previously.
| [in] | gsource | Gsource object causing dispatch |
| [in] | capstruct | Pointer to structure capturing for us |
| [in] | pkt | Pointer to the packet just read in |
| [in] | pend | Pointer to first byte past 'pkt' |
| [in] | pkthdr | libpcap packet header |
| [in] | capturedev | Device being captured |
| [in,out] | selfptr | pointer to our Discover object |
Definition at line 80 of file switchdiscovery.c.
References _Discovery::_config, _Discovery::_iosource, _NetGSource::_netio, _switchdiscovery_cache_info(), CASTTOCLASS, CONFIGNAME_CMADISCOVER, construct_pcap_frameset(), DEFAULT_FSP_QID, FRAMESETTYPE_SWDISCOVER, _ConfigContext::getaddr, _NetIO::sendareliablefs(), transport, and UNREF.
Referenced by switchdiscovery_new().


finalize a SwitchDiscovery object
Definition at line 43 of file switchdiscovery.c.
References CASTTOCLASS.
Referenced by switchdiscovery_new().

| SwitchDiscovery* switchdiscovery_new | ( | const char * | instance, |
| const char * | dev, | ||
| guint | listenmask, | ||
| gint | priority, | ||
| GMainContext * | mcontext, | ||
| NetGSource * | iosrc, | ||
| ConfigContext * | config, | ||
| gsize | objsize | ||
| ) |
SwitchDiscovery constructor.
Good for discovering switch information via pcap-enabled discovery protocols (like LLDP and CDP)
| [in] | instance | instance name |
| [in] | dev | device to listen on |
| [in] | listenmask | what protocols to listen to |
| [in] | priority | source priority |
| [in,out] | mcontext | mainloop context |
| [in,out] | iosrc | I/O object |
| [in,out] | config | configuration context |
| [in] | objsize | object size |
Definition at line 113 of file switchdiscovery.c.
References _AssimObj::_finalize, _switchdiscovery_discover(), _switchdiscovery_dispatch(), _switchdiscovery_finalize(), _Discovery::baseclass, CASTTOCLASS, _Discovery::discover, discovery_new(), discovery_register(), _SwitchDiscovery::finalize, g_source_pcap_new(), _SwitchDiscovery::portid, _SwitchDiscovery::portidlen, proj_class_register_subclassed(), _SwitchDiscovery::source, _SwitchDiscovery::switchid, and _SwitchDiscovery::switchidlen.
Referenced by nano_start_full().

