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

Class for holding/storing various kinds of NetAddr class network addresses. More...

Collaboration diagram for AddrFrame class:

Data Structures

struct  _AddrFrame
 This is our AddrFrame class object - used for holding NetAddr class network addresses. More...
 

Functions

FSTATIC gboolean _addrframe_default_isvalid (const Frame *self,gconstpointer tlvptr,gconstpointer pktend)
 AddrFrame class 'isvalid' member function - checks address type and length. More...
 
FSTATIC void _addrframe_setaddr (AddrFrame *f,guint16 addrtype,gconstpointer addr,gsize addrlen)
 Assign an address to this AddrFrame class object. More...
 
FSTATIC void _addrframe_setport (AddrFrame *, guint16 port)
 
FSTATIC NetAddr_addrframe_getnetaddr (AddrFrame *self)
 
FSTATIC void _addrframe_setnetaddr (AddrFrame *self,NetAddr *naddr)
 Assign a NetAddr to this AddrFrame class object. More...
 
FSTATIC void _addrframe_finalize (AssimObj *)
 
WINEXPORT AddrFrameaddrframe_new (guint16 frame_type, gsize framesize)
 Construct a new AddrFrame class - allowing for "derived" frame types... More...
 
WINEXPORT AddrFrameaddrframe_ipv4_new (guint16 frame_type, gconstpointer addr)
 Construct and initialize an IPv4 AddrFrame class. More...
 
WINEXPORT AddrFrameaddrframe_ipv6_new (guint16 frame_type, gconstpointer addr)
 Construct and initialize an IPv6 AddrFrame class. More...
 
WINEXPORT AddrFrameaddrframe_mac48_new (guint16 frame_type, gconstpointer addr)
 Construct and initialize a 48-bit MAC address AddrFrame class. More...
 
WINEXPORT AddrFrameaddrframe_mac64_new (guint16 frame_type, gconstpointer addr)
 Construct and initialize a 64-bit MAC address AddrFrame class. More...
 
WINEXPORT Frameaddrframe_tlvconstructor (gpointer tlvstart, gconstpointer pktend, gpointer *ignorednewpkt, gpointer *ignoredpktend)
 Given marshalled packet data corresponding to an AddrFrame (address), return the corresponding Frame class In other words, un-marshall the data... More...
 
FSTATIC char * _addrframe_toString (gconstpointer aself)
 Convert AddrFrame object into a printable string. More...
 

Detailed Description

Class for holding/storing various kinds of NetAddr class network addresses.

We're a subclass of Frame class.

Function Documentation

FSTATIC gboolean _addrframe_default_isvalid ( const Frame self,
gconstpointer  tlvptr,
gconstpointer  pktend 
)

AddrFrame class 'isvalid' member function - checks address type and length.

Note that this checking is more thorough for IPV4, IPV5 and MAC addresses than for any other types. Right now it does allow other address types, but perhaps they should be disallowed? Each of the classes that use this class should make sure that the address held in an AddrFrame class is suitable to the purpose at hand. We need to support MAC addresses, but they can't be used in a context that requires some kind of IP address. So, caveat emptor has to be the rule of the day anyway.

Parameters
[in,out]selfAddrFrame object ('this')
[in]tlvptrPointer to the TLV for this AddrFrame
[in]pktendPointer to one byte past the end of the packet

Definition at line 75 of file addrframe.c.

References ADDR_FAMILY_802, ADDR_FAMILY_IPV4, ADDR_FAMILY_IPV6, get_generic_tlv_len(), get_generic_tlv_value(), and tlv_get_guint16().

Referenced by _addrframe_setnetaddr(), addrframe_new(), and addrframe_tlvconstructor().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC void _addrframe_finalize ( AssimObj obj)

Definition at line 185 of file addrframe.c.

References CASTTOCLASS, FREE, and UNREF.

Referenced by addrframe_new().

Here is the caller graph for this function:

FSTATIC NetAddr * _addrframe_getnetaddr ( AddrFrame self)

Definition at line 162 of file addrframe.c.

Referenced by addrframe_new().

Here is the caller graph for this function:

FSTATIC void _addrframe_setaddr ( AddrFrame self,
guint16  frametype,
gconstpointer  addr,
gsize  addrlen 
)

Assign an address to this AddrFrame class object.

Definition at line 129 of file addrframe.c.

References _AddrFrame::_addr, _AddrFrame::baseclass, FREE, _Frame::length, MALLOC, netaddr_new(), tlv_set_guint16(), and _Frame::value.

Referenced by addrframe_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC void _addrframe_setnetaddr ( AddrFrame self,
NetAddr naddr 
)

Assign a NetAddr to this AddrFrame class object.

Parameters
[in,out]selfAddrFrame whose address we're setting...
[in]naddrNetAddr value to set it to. We hold a reference to it.

Definition at line 169 of file addrframe.c.

References _NetAddr::_addrbody, _addrframe_default_isvalid(), _NetAddr::_addrlen, _NetAddr::addrtype, and UNREF.

Referenced by addrframe_new().

Here is the call graph for this function:

Here is the caller graph for this function:

FSTATIC void _addrframe_setport ( AddrFrame self,
guint16  port 
)

Definition at line 152 of file addrframe.c.

Referenced by addrframe_new().

Here is the caller graph for this function:

FSTATIC gchar * _addrframe_toString ( gconstpointer  aself)

Convert AddrFrame object into a printable string.

Definition at line 307 of file addrframe.c.

References CASTTOCONSTCLASS.

Referenced by addrframe_new().

Here is the caller graph for this function:

WINEXPORT AddrFrame* addrframe_ipv4_new ( guint16  frame_type,
gconstpointer  addr 
)

Construct and initialize an IPv4 AddrFrame class.

Parameters
[in]frame_typeTLV type of the AddrFrame class (not address type) frame
[in]addrpointer to the (binary) IPv4 address data

Definition at line 229 of file addrframe.c.

References ADDR_FAMILY_IPV4, addrframe_new(), and _AddrFrame::setaddr.

Referenced by address_tests().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT AddrFrame* addrframe_ipv6_new ( guint16  frame_type,
gconstpointer  addr 
)

Construct and initialize an IPv6 AddrFrame class.

Parameters
[in]frame_typeTLV type of the AddrFrame class (not address type) frame
[in]addrpointer to the (binary) IPv6 address data

Definition at line 241 of file addrframe.c.

References ADDR_FAMILY_IPV6, addrframe_new(), and _AddrFrame::setaddr.

Referenced by address_tests().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT AddrFrame* addrframe_mac48_new ( guint16  frame_type,
gconstpointer  addr 
)

Construct and initialize a 48-bit MAC address AddrFrame class.

Parameters
[in]frame_typeTLV type of the AddrFrame class (not address type) frame
[in]addrpointer to the (binary) MAC address data

Definition at line 253 of file addrframe.c.

References ADDR_FAMILY_802, addrframe_new(), and _AddrFrame::setaddr.

Referenced by address_tests().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT AddrFrame* addrframe_mac64_new ( guint16  frame_type,
gconstpointer  addr 
)

Construct and initialize a 64-bit MAC address AddrFrame class.

Parameters
[in]frame_typeTLV type of the AddrFrame class (not address type) frame
[in]addrpointer to the (binary) MAC address data

Definition at line 264 of file addrframe.c.

References ADDR_FAMILY_802, addrframe_new(), and _AddrFrame::setaddr.

Referenced by address_tests().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT AddrFrame* addrframe_new ( guint16  frame_type,
gsize  framesize 
)

Construct a new AddrFrame class - allowing for "derived" frame types...

This can be used directly for creating AddrFrame class frames, or by derived classes.

Parameters
[in]frame_typeTLV type of the AddrFrame class (not address type) frame
[in]framesizesize of frame structure (or zero for sizeof(AddrFrame))

Definition at line 201 of file addrframe.c.

References _AddrFrame::_addr, _addrframe_default_isvalid(), _addrframe_finalize(), _addrframe_getnetaddr(), _addrframe_setaddr(), _addrframe_setnetaddr(), _addrframe_setport(), _addrframe_toString(), _AddrFrame::_basefinal, _AssimObj::_finalize, _Frame::baseclass, CASTTOCLASS, frame_new(), _AddrFrame::getnetaddr, _Frame::isvalid, proj_class_register_subclassed(), _AddrFrame::setaddr, _AddrFrame::setnetaddr, _AddrFrame::setport, and _AssimObj::toString.

Referenced by cma.AssimCclasses.pyAddrFrame::__init__(), address_tests(), addrframe_ipv4_new(), addrframe_ipv6_new(), addrframe_mac48_new(), addrframe_mac64_new(), addrframe_tlvconstructor(), and cast_frameset_tests().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT Frame* addrframe_tlvconstructor ( gpointer  tlvstart,
gconstpointer  pktend,
gpointer *  ignorednewpkt,
gpointer *  ignoredpktend 
)

Given marshalled packet data corresponding to an AddrFrame (address), return the corresponding Frame class In other words, un-marshall the data...

Note that this always returns an AddrFrame class (a subclass of Frame class)

Parameters
[in]tlvstartpointer to start of where to find our TLV
[in]pktendpointer to the first invalid address past tlvstart
ignorednewpkt[ignored] replacement packet
ignoredpktend[ignored] end of replacement packet

Definition at line 278 of file addrframe.c.

References _addrframe_default_isvalid(), addrframe_new(), _AddrFrame::baseclass, get_generic_tlv_len(), get_generic_tlv_type(), get_generic_tlv_value(), _Frame::length, _AddrFrame::setaddr, tlv_get_guint16(), and UNREF2.

Here is the call graph for this function: