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

This is our basic NetGSource object. More...

Collaboration diagram for NetGSource class:

Data Structures

struct  _NetGSource
 The NetGSource class objects integrate NetIO class objects into the g_main_loop paradigm. More...
 

Functions

FSTATIC gboolean _netgsource_prepare (GSource *source,gint *timeout)
 GSource prepare routine for NetGSource - always returns TRUE Called before going into the select/poll call - to get things ready for the poll call. More...
 
FSTATIC gboolean _netgsource_check (GSource *gself)
 GSource check routine for NetGSource. More...
 
FSTATIC gboolean _netgsource_dispatch (GSource *gself,GSourceFunc ignore_callback,gpointer ignore_userdata)
 GSource dispatch routine for NetGSource. More...
 
FSTATIC void _netgsource_finalize (GSource *gself)
 Finalize (free) the NetGSource object. More...
 
FSTATIC void _netgsource_addListener (NetGSource *, guint16, Listener *)
 
FSTATIC void _netgsource_del_listener (gpointer)
 
FSTATIC void _netgsource_sendaframeset (NetGSource *self,const NetAddr *addr,FrameSet *fs)
 Send a single frameset to the given address. More...
 
FSTATIC void _netgsource_sendframesets (NetGSource *self,const NetAddr *addr,GSList *fslist)
 Send a (GSList) list of FrameSets to the given address. More...
 
NetGSourcenetgsource_new (NetIO *iosrc, GDestroyNotify notify, gint priority, gboolean can_recurse, GMainContext *context, gsize objsize, gpointer userdata)
 Create a new (abstract) NetGSource object. More...
 

Detailed Description

This is our basic NetGSource object.

It is used for reading from NetIO class objects in the context of the g_main_loop GSource paradigm. It is a class from which we might eventually make subclasses, and is managed by our C-Class Management system.

Function Documentation

FSTATIC void _netgsource_addListener ( NetGSource self,
guint16  fstype,
Listener disp 
)
Parameters
[in,out]selfObject being modified
[in]fstypeFrameSet fstype
[in]dispdispatch function

Definition at line 244 of file netgsource.c.

References REF.

Referenced by netgsource_new().

Here is the caller graph for this function:

FSTATIC gboolean _netgsource_check ( GSource *  gself)

GSource check routine for NetGSource.

Called after the select/poll call completes.

Returns
TRUE if if a packet is present, FALSE otherwise
Parameters
[in]gselfNetGSource object being 'check'ed.

Definition at line 151 of file netgsource.c.

References CASTTOCLASS.

Referenced by _netgsource_prepare().

Here is the caller graph for this function:

FSTATIC void _netgsource_del_listener ( gpointer  lptr)

Definition at line 63 of file netgsource.c.

References CASTTOCLASS, and UNREF.

Referenced by netgsource_new().

Here is the caller graph for this function:

FSTATIC gboolean _netgsource_dispatch ( GSource *  gself,
GSourceFunc  ignore_callback,
gpointer  ignore_userdata 
)

GSource dispatch routine for NetGSource.

Called after our check function returns TRUE. If a bunch of events are fired at once, then this call will be dispatched before the next prepare call, but perhaps not quite right away - depending on what other events (with possibly higher priority) get dispatched ahead of us, and how long they take to complete.

Parameters
[in,out]gselfNetGSource object being dispatched
ignore_callback[ignore] callback not being used
ignore_userdata[ignore] userdata not being used

Definition at line 164 of file netgsource.c.

References __FUNCTION__, CASTTOCLASS, DEBUGMSG, obsolete_cma::disp, _FrameSet::fstype, _Listener::got_frameset, and UNREF.

FSTATIC void _netgsource_finalize ( GSource *  gself)

Finalize (free) the NetGSource object.

If this next call crashes, you should have supplied your own finalize routine (and maybe you should anyway)

Parameters
[in,out]gselfobject being finalized

Definition at line 197 of file netgsource.c.

References __FUNCTION__, CASTTOCLASS, DEBUGMSG, FREECLASSOBJ, and proj_class_dissociate().

Here is the call graph for this function:

FSTATIC gboolean _netgsource_prepare ( GSource *  source,
gint *  timeout 
)

GSource prepare routine for NetGSource - always returns TRUE Called before going into the select/poll call - to get things ready for the poll call.

Parameters
source[unused] - GSource object
timeout[unused] - timeout

Definition at line 140 of file netgsource.c.

References _netgsource_check().

Here is the call graph for this function:

FSTATIC void _netgsource_sendaframeset ( NetGSource self,
const NetAddr addr,
FrameSet fs 
)

Send a single frameset to the given address.

Parameters
selfNetGSource class Object to send via
addrNetAddr class address to send to
fsFrameSet class to send

Definition at line 227 of file netgsource.c.

References _NetIO::sendaframeset().

Referenced by netgsource_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC void _netgsource_sendframesets ( NetGSource self,
const NetAddr addr,
GSList *  fslist 
)

Send a (GSList) list of FrameSets to the given address.

Parameters
selfNetGSource class object to send via
addrNetAddr class address to send to
fslistGSList of FrameSet class objects to send

Definition at line 236 of file netgsource.c.

References _NetIO::sendframesets().

Referenced by netgsource_new().

Here is the call graph for this function:

Here is the caller graph for this function:

NetGSource* netgsource_new ( NetIO iosrc,
GDestroyNotify  notify,
gint  priority,
gboolean  can_recurse,
GMainContext *  context,
gsize  objsize,
gpointer  userdata 
)

Create a new (abstract) NetGSource object.

Parameters
[in,out]iosrcNetwork I/O object
[in]notifyCalled when object destroyed
[in]priorityg_main_loop dispatch priority
[in]can_recurseTRUE if it can recurse
[in]contextGMainContext or NULL
[in]objsizenumber of bytes in NetGSource object - or zero
[in,out]userdataUserdata to pass to dispatch function

Definition at line 74 of file netgsource.c.

References _NetGSource::_dispatchers, _NetGSource::_finalize, _NetGSource::_gfd, _NetGSource::_gsfuncs, _NetGSource::_gsourceid, _netgsource_addListener(), _netgsource_del_listener(), _netgsource_sendaframeset(), _netgsource_sendframesets(), _NetGSource::_netio, _NetGSource::_socket, _NetGSource::_userdata, _NetGSource::addListener, BINDDEBUG, CASTTOCLASS, FREECLASSOBJ, _NetIO::getfd(), MALLOCBASECLASS, proj_class_register_object(), proj_class_register_subclassed(), _NetGSource::sendaframeset, _NetGSource::sendframesets, and _NetIO::setblockio().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function: