The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ipportframe.c File Reference

Implements the IpPortFrame class class - A frame for generic network addresses. More...

#include <string.h>
#include <projectcommon.h>
#include <frameset.h>
#include <ipportframe.h>
#include <frametypes.h>
#include <generic_tlv_min.h>
#include <tlvhelper.h>
#include <address_family_numbers.h>
Include dependency graph for ipportframe.c:

Go to the source code of this file.

Macros

#define TLVOVERHEAD   (sizeof(guint16)+sizeof(guint16))
 
#define TLVIPV4SIZE   (TLVOVERHEAD+4)
 IPv4 addresses are 4 bytes. More...
 
#define TLVIPV6SIZE   (TLVOVERHEAD+16)
 IPv4 addresses are 16 bytes. More...
 

Functions

FSTATIC gboolean _ipportframe_default_isvalid (const Frame *self, gconstpointer tlvptr,gconstpointer pktend)
 IpPortFrame class 'isvalid' member function - checks address type and length. More...
 
FSTATIC void _ipportframe_setaddr (IpPortFrame *self, guint16 frametype, guint16 port, gconstpointer addr, gsize addrlen)
 
FSTATIC NetAddr_ipportframe_getnetaddr (IpPortFrame *self)
 
FSTATIC void _ipportframe_setnetaddr (IpPortFrame *self, NetAddr *netaddr)
 
FSTATIC void _ipportframe_finalize (AssimObj *obj)
 Finalize an IpPortFrame. More...
 
FSTATIC IpPortFrameipportframe_new (guint16 frame_type,gsize framesize)
 Construct a new IpPortFrame class - allowing for "derived" frame types... More...
 
FSTATIC gchar * _ipportframe_toString (gconstpointer aself)
 Convert IPaddrPortFrame object into a printable string. More...
 
WINEXPORT IpPortFrameipportframe_ipv4_new (guint16 frame_type, guint16 port, gconstpointer addr)
 Construct and initialize an IPv4 IpPortFrame class. More...
 
WINEXPORT IpPortFrameipportframe_ipv6_new (guint16 frame_type, guint16 port, gconstpointer addr)
 Construct and initialize an IPv6 IpPortFrame class. More...
 
WINEXPORT IpPortFrameipportframe_netaddr_new (guint16 frame_type, NetAddr *addr)
 Construct and initialize an IpPortFrame class from a IP NetAddr class. More...
 
WINEXPORT Frameipportframe_tlvconstructor (gconstpointer tlvstart, gconstpointer pktend)
 Given marshalled packet data corresponding to an IpPortFrame (address), return the corresponding Frame class In other words, un-marshall the data... More...
 

Detailed Description

Implements the IpPortFrame class class - A frame for generic network addresses.

IpPortFrames consist of a 2-byte port number followed by a 2-byte IANA address family number plus the address. These fields are stored in network byte order. We only support IPv4 and IPv6 addresses - as the port is mandatory for this object.

See Also
Frame, FrameSet, Generic TLV capabilities, AddrFrame
http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml

This file is part of the Assimilation Project.

Author
Copyright © 2011, 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
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 http://www.gnu.org/licenses/

Definition in file ipportframe.c.

Macro Definition Documentation

#define TLVIPV4SIZE   (TLVOVERHEAD+4)

IPv4 addresses are 4 bytes.

Definition at line 64 of file ipportframe.c.

Referenced by _ipportframe_default_isvalid(), and ipportframe_tlvconstructor().

#define TLVIPV6SIZE   (TLVOVERHEAD+16)

IPv4 addresses are 16 bytes.

Definition at line 65 of file ipportframe.c.

Referenced by _ipportframe_default_isvalid(), and ipportframe_tlvconstructor().

#define TLVOVERHEAD   (sizeof(guint16)+sizeof(guint16))

Two bytes for port number, and two for the address type

Definition at line 63 of file ipportframe.c.

Referenced by ipportframe_tlvconstructor().

Function Documentation

FSTATIC void _ipportframe_setnetaddr ( IpPortFrame self,
NetAddr netaddr 
)