|
The Assimilation Monitoring Project
|
Class representing a pcap GSource object - for capturing packets in the g_main_loop paradigm. More...
|
Functions | |
| FSTATIC gboolean | g_source_pcap_prepare (GSource *source,gint *timeout) |
| The GMainLoop prepare function for libpcap packet capturing. More... | |
| FSTATIC gboolean | g_source_pcap_check (GSource *src) |
| The GMainLoop check function for libpcap packet capturing. More... | |
| FSTATIC gboolean | g_source_pcap_dispatch (GSource *src,GSourceFunc callback,gpointer user_data) |
| The GMainLoop dispatch function for libpcap packet capturing. More... | |
| FSTATIC void | g_source_pcap_finalize (GSource *src) |
| The GMainLoop finalize function for libpcap packet capturing Called when this object is 'finalized' (destroyed) More... | |
| FSTATIC guint64 | proj_timeval_to_g_real_time (const struct timeval *tv) |
| Convert struct timeval to g_get_real_time() style value. More... | |
| GSource * | g_source_pcap_new (const char *dev, unsigned listenmask, gboolean(*dispatch)(GSource_pcap_t *gsource, pcap_t *capstruct, gconstpointer pkt, gconstpointer pend, const struct pcap_pkthdr *pkthdr, const char *capturedev, gpointer userdata), GDestroyNotify notify, gint priority, gboolean can_recurse, GMainContext *context, gsize objectsize, gpointer userdata) |
| Construct new GSource from a newly constructed pcap capture object. More... | |
| FrameSet * | construct_pcap_frameset (guint16 framesettype, gconstpointer pkt, gconstpointer pktend, const struct pcap_pkthdr *pkthdr, const char *interfacep) |
| Construct a PCAP capture FrameSet from a PCAP packet. More... | |
Class representing a pcap GSource object - for capturing packets in the g_main_loop paradigm.
This is technically a subclass of GSource (which isn't part of this project).
| FrameSet* construct_pcap_frameset | ( | guint16 | framesettype, |
| gconstpointer | pkt, | ||
| gconstpointer | pktend, | ||
| const struct pcap_pkthdr * | pkthdr, | ||
| const char * | interfacep | ||
| ) |
Construct a PCAP capture FrameSet from a PCAP packet.
| [in] | framesettype | type to create FrameSet with |
| [in] | pkt | captured packet |
| [in] | pktend | one byte past end of pkt |
| [in] | pkthdr | libpcap packet header |
| [in] | interfacep | interface it was captured on |
Definition at line 237 of file pcap_GSource.c.
References _CstringFrame::baseclass, _IntFrame::baseclass, cstringframe_new(), frame_new(), frameset_append_frame(), frameset_new(), FRAMETYPE_HOSTNAME, FRAMETYPE_INTERFACE, FRAMETYPE_PKTDATA, FRAMETYPE_WALLCLOCK, intframe_new(), MALLOC0, proj_get_sysname(), proj_timeval_to_g_real_time(), _IntFrame::setint, _Frame::setvalue, UNREF, and UNREF2.
Referenced by _switchdiscovery_dispatch().


| gboolean g_source_pcap_check | ( | GSource * | src | ) |
The GMainLoop check function for libpcap packet capturing.
| [in] | src | source being checked |
Definition at line 170 of file pcap_GSource.c.
References CASTTOCLASS, and _GSource_pcap::gfd.
| gboolean g_source_pcap_dispatch | ( | GSource * | src, |
| GSourceFunc | callback, | ||
| gpointer | user_data | ||
| ) |
The GMainLoop dispatch function for libpcap packet capturing.
| [in] | src | source being dispatched |
| [in] | callback | dispatch function (ignored) |
| [in] | user_data | user data (ignored) |
Definition at line 180 of file pcap_GSource.c.
References _GSource_pcap::capture, _GSource_pcap::capturedev, CASTTOCLASS, _GSource_pcap::dispatch, _GSource_pcap::gfd, cma.cma::rc, and _GSource_pcap::userdata.
| void g_source_pcap_finalize | ( | GSource * | source | ) |
The GMainLoop finalize function for libpcap packet capturing Called when this object is 'finalized' (destroyed)
Definition at line 209 of file pcap_GSource.c.
References _GSource_pcap::capture, _GSource_pcap::capturedev, CASTTOCLASS, close_pcap_listener(), _GSource_pcap::destroynote, _GSource_pcap::listenmask, _GSource_pcap::pcprog, and proj_class_dissociate().

| GSource* g_source_pcap_new | ( | const char * | dev, |
| unsigned | listenmask, | ||
| gboolean(*)(GSource_pcap_t *gsource, pcap_t *capstruct, gconstpointer pkt, gconstpointer pend, const struct pcap_pkthdr *pkthdr, const char *capturedev, gpointer userdata) | dispatch, | ||
| GDestroyNotify | notify, | ||
| gint | priority, | ||
| gboolean | can_recurse, | ||
| GMainContext * | context, | ||
| gsize | objectsize, | ||
| gpointer | userdata | ||
| ) |
Construct new GSource from a newly constructed pcap capture object.
We use create_pcap_listener() to construct the pcap capture object. This code is based on the the Glib main event loop (g_main_loop) event scheduler/dispatcher concept.
| [in] | dev | Capture device name |
| [in] | listenmask | bit mask of supported protocols [in] called when new pcap data has arrived |
| [in,out] | dispatch | user-object |
| [in] | notify | Called when this object is being destroyed - can be NULL. |
| [in] | priority | g_main_loop dispatch priority |
| [in] | can_recurse | TRUE if dispatch recursion is allowed |
| [in] | context | GMainContext or NULL |
| [in] | objectsize | size of pcap_g_source object to create (or zero) |
| [in,out] | userdata | pointer to user object for dispatch function |
Definition at line 86 of file pcap_GSource.c.
References _GSource_pcap::capture, _GSource_pcap::capturedev, _GSource_pcap::capturefd, CASTTOCLASS, create_pcap_listener(), _GSource_pcap::destroynote, _GSource_pcap::dispatch, _GSource_pcap::gfd, _GSource_pcap::gsourceid, _GSource_pcap::listenmask, _GSource_pcap::pcprog, proj_class_register_object(), proj_class_register_subclassed(), and _GSource_pcap::userdata.
Referenced by switchdiscovery_new().


| gboolean g_source_pcap_prepare | ( | GSource * | source, |
| gint * | timeout | ||
| ) |
The GMainLoop prepare function for libpcap packet capturing.
| [in] | source | Gsource being prepared for |
| [in,out] | timeout | timeout - neither referenced nor set |
Definition at line 160 of file pcap_GSource.c.
| FSTATIC guint64 proj_timeval_to_g_real_time | ( | const struct timeval * | tv | ) |
Convert struct timeval to g_get_real_time() style value.
Definition at line 227 of file pcap_GSource.c.
Referenced by construct_pcap_frameset().
