The Assimilation Project  based on Assimilation version
netio.c File Reference

Implements network I/O class (NetIO class) More...

#include <projectcommon.h>
#include <errno.h>
#include <memory.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <glib.h>
#include <packetdecoder.h>
#include <address_family_numbers.h>
#include <proj_classes.h>
#include <netio.h>
#include <frameset.h>
#include <frametypes.h>
#include <misc.h>
Include dependency graph for netio.c:

Go to the source code of this file.


#define __FUNCTION__   "_netio_recvapacket"


FSTATIC gint _netio_getfd (const NetIO *self)
 Member function to return the file descriptor underlying this NetIO object. More...
FSTATIC int _netio_getsockbufsize (const NetIO *self, gboolean forinput)
 Return the kernel's idea of what our input or output socket buffer size is. More...
FSTATIC int _netio_setsockbufsize (const NetIO *self, gboolean forinput, gsize bufsize)
 Set the kernel's idea of what our input or output socket buffer size as close as we can We'll even do a binary search to maximize the value if we can't get what we want. More...
FSTATIC void _netio_maximize_sockbufsize (const NetIO *self, gboolean forinput, int desiredsize)
 Maximize the socket buffer size as requested - as best we can... More...
FSTATIC void _netio_setblockio (const NetIO *self, gboolean blocking)
 Member function to set blocking/non-blocking mode on our sockets. More...
FSTATIC gboolean _netio_bindaddr (NetIO *self,const NetAddr *src,gboolean silent)
 Member function to bind this NewIO object to a NetAddr address. More...
FSTATIC gboolean _netio_input_queued (const NetIO *self)
 Member function that returns TRUE if input is ready to be read. More...
FSTATIC NetAddr_netio_boundaddr (const NetIO *self)
 Member function to return the bound NetAddr (with port) of this NetIO object. More...
FSTATIC void _netio_sendframesets (NetIO *self,const NetAddr *destaddr,GSList *framesets)
 NetIO member function to send a GSList of FrameSets. More...
FSTATIC void _netio_sendaframeset (NetIO *self, const NetAddr *destaddr, FrameSet *frameset)
FSTATIC void _netio_finalize (AssimObj *aself)
 Member function to free this NetIO object. More...
FSTATIC void _netio_sendapacket (NetIO *self,gconstpointer packet,gconstpointer pktend,const NetAddr *destaddr)
 NetIO internal function to send a packet (datagram) More...
FSTATIC gpointer _netio_recvapacket (NetIO *self,gpointer *pktend,struct sockaddr_in6 *srcaddr, socklen_t *addrlen)
 Internal function to receive a packet from our NetIO object General method: More...
FSTATIC gsize _netio_getmaxpktsize (const NetIO *self)
 Get the max packet size for this NetIO transport. More...
FSTATIC gsize _netio_setmaxpktsize (NetIO *self,gsize maxpktsize)
 Set the max packet size for this NetIO transport. More...
FSTATIC GSList * _netio_recvframesets (NetIO *self,NetAddr **src)
 Member function to receive a collection of FrameSets (GSList*) out of our NetIO object. More...
FSTATIC SignFrame_netio_signframe (NetIO *self)
FSTATIC CompressFrame_netio_compressframe (NetIO *self)
FSTATIC gboolean _netio_mcastjoin (NetIO *self, const NetAddr *src, const NetAddr *localaddr)
 Set up a NetIO object to listen to (join) a particular multicast group. More...
FSTATIC gboolean _netio_setmcast_ttl (NetIO *self,guint8 ttlin)
 Set up the multicast TTL for this NetIO object. More...
FSTATIC void _netio_enablepktloss (NetIO *self, gboolean enable)
 Enable (or disable) packet loss as requested. More...
FSTATIC void _netio_setpktloss (NetIO *self, double rcvloss, double xmitloss)
 Set the desired level of packet loss - doesn't take effect from this call alone. More...
FSTATIC gboolean _netio_sendareliablefs (NetIO *self, NetAddr *dest, guint16 queueid, FrameSet *frameset)
FSTATIC gboolean _netio_sendreliablefs (NetIO *self, NetAddr *dest, guint16 queueid, GSList *fslist)
FSTATIC gboolean _netio_ackmessage (NetIO *self, NetAddr *dest, FrameSet *frameset)
FSTATIC gboolean _netio_supportsreliable (NetIO *self)
FSTATIC void _netio_closeconn (NetIO *self, guint16 qid, const NetAddr *destaddr)
FSTATIC void _netio_netaddr_destroy (gpointer addrptr)
 g_hash_table destructor for a NetAddr More...
FSTATIC void _netio_addalias (NetIO *self, NetAddr *fromaddr, NetAddr *toaddr)
 Add an alias to our alias table. More...
NetIOnetio_new (gsize objsize, ConfigContext *config, PacketDecoder *decoder)
 NetIO constructor. More...
gboolean netio_is_dual_ipv4v6_stack (void)

Detailed Description

Implements network I/O class (NetIO class)

This file contains the code to support the NetIO class objects for doing network I/O.

This file is part of the Assimilation Project.

Copyright © 2011, 2012 - Alan Robertson
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see

Definition in file netio.c.

Macro Definition Documentation