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

TLV helper interfaces definitions. More...

#include <projectcommon.h>
#include <glib.h>
Include dependency graph for tlvhelper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

WINEXPORT guint8 tlv_get_guint8 (const void *vitem, const void *bufend)
 Retrieve an unsigned 8 bit integer from the given location with error checking. More...
 
WINEXPORT guint16 tlv_get_guint16 (const void *vitem, const void *bufend)
 Retrieve an unsigned 16 bit integer from the given location with error checking and without caring about byte alignment. More...
 
WINEXPORT guint32 tlv_get_guint24 (const void *vitem, const void *bufend)
 Retrieve an unsigned 24 bit (3-byte) integer from the given location with error checking and without caring about byte alignment. More...
 
WINEXPORT guint32 tlv_get_guint32 (const void *vitem, const void *bufend)
 Retrieve an unsigned 32 bit integer from the given location with error checking and without caring about byte alignment. More...
 
WINEXPORT guint64 tlv_get_guint64 (const void *vitem, const void *bufend)
 Retrieve an unsigned 64 bit integer from the given location with error checking and without caring about byte alignment. More...
 
WINEXPORT void tlv_set_guint8 (void *vitem, guint8 item, const void *bufend)
 Set an unsigned 8 bit integer to the given location with error checking. More...
 
WINEXPORT void tlv_set_guint16 (void *vitem, guint16 item, const void *bufend)
 Set an unsigned 16 bit integer to the given location with error checking and without caring about byte alignment. More...
 
WINEXPORT void tlv_set_guint24 (void *vitem, guint32 item, const void *bufend)
 Set an unsigned 24 bit (3-byte) integer to the given location with error checking and without caring about byte alignment. More...
 
WINEXPORT void tlv_set_guint32 (void *vitem, guint32 item, const void *bufend)
 Set an unsigned 32 bit integer to the given location with error checking and without caring about byte alignment. More...
 
WINEXPORT void tlv_set_guint64 (void *vitem, guint64 item, const void *bufend)
 Set an unsigned 64 bit integer to the given location with error checking and without caring about byte alignment. More...
 

Detailed Description

TLV helper interfaces definitions.

Provides a bunch of generic getters and putters for TLV-style integer information. Used by all our TLV implementations (3 of them at this writing)

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 tlvhelper.h.

Function Documentation

WINEXPORT guint16 tlv_get_guint16 ( const void *  vitem,
const void *  bufend 
)

Retrieve an unsigned 16 bit integer from the given location with error checking and without caring about byte alignment.

Parameters
vitemLocation to get int from
bufendone byte past end of buffer

Definition at line 53 of file tlvhelper.c.

Referenced by _addrframe_default_isvalid(), _arpdiscovery_dispatch(), _decode_packet_get_frameset_data(), _ipportframe_default_isvalid(), addrframe_tlvconstructor(), get_cdp_cksum(), get_cdptlv_len(), get_cdptlv_type(), get_generic_tlv_type(), cma.AssimCclasses.pySwitchDiscovery::getNint(), intframe_tlvconstructor(), ipportframe_tlvconstructor(), seqnoframe_tlvconstructor(), and tlv_get_guint24().

Here is the caller graph for this function:

WINEXPORT guint32 tlv_get_guint24 ( const void *  vitem,
const void *  bufend 
)

Retrieve an unsigned 24 bit (3-byte) integer from the given location with error checking and without caring about byte alignment.

This is used for IEEE OUI values.

Todo:
verify that this 3-byte ordering is correct - it has to match the IEEE OUI layout...
Parameters
vitemLocation to get int from
bufendone byte past end of buffer

Definition at line 131 of file tlvhelper.c.

References tlv_get_guint16().

Referenced by _compressframe_isvalid(), compressframe_tlvconstructor(), get_generic_tlv_len(), cma.AssimCclasses.pySwitchDiscovery::getNint(), and intframe_tlvconstructor().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT guint32 tlv_get_guint32 ( const void *  vitem,
const void *  bufend 
)

Retrieve an unsigned 32 bit integer from the given location with error checking and without caring about byte alignment.

Parameters
vitemLocation to get int from
bufendone byte past end of buffer

Definition at line 81 of file tlvhelper.c.

Referenced by cma.AssimCclasses.pySwitchDiscovery::getNint(), intframe_tlvconstructor(), and seqnoframe_tlvconstructor().

Here is the caller graph for this function:

WINEXPORT guint64 tlv_get_guint64 ( const void *  vitem,
const void *  bufend 
)

Retrieve an unsigned 64 bit integer from the given location with error checking and without caring about byte alignment.

Parameters
vitemLocation to get int from
bufendone byte past end of buffer

Definition at line 107 of file tlvhelper.c.

Referenced by cma.AssimCclasses.pySwitchDiscovery::getNint(), intframe_tlvconstructor(), and seqnoframe_tlvconstructor().

Here is the caller graph for this function:

WINEXPORT guint8 tlv_get_guint8 ( const void *  vitem,
const void *  bufend 
)

Retrieve an unsigned 8 bit integer from the given location with error checking.

Parameters
vitemLocation to get int from
bufendone byte past end of buffer

Definition at line 30 of file tlvhelper.c.

Referenced by _arpdiscovery_dispatch(), _compressframe_isvalid(), _cryptcurve25519_default_isvalid(), _signframe_isvalid(), _signframe_isvalid_glib(), compressframe_tlvconstructor(), cryptcurve25519_tlvconstructor(), get_cdp_ttl(), get_cdp_vers(), get_lldptlv_len(), get_lldptlv_type(), cma.AssimCclasses.pySwitchDiscovery::getNint(), intframe_tlvconstructor(), and signframe_tlvconstructor().

Here is the caller graph for this function:

WINEXPORT void tlv_set_guint16 ( void *  vitem,
guint16  item,
const void *  bufend 
)

Set an unsigned 16 bit integer to the given location with error checking and without caring about byte alignment.

Parameters
vitemLocation to stuff the int into
itemValue to stuff into 'vitem'
bufendone byte past the end of this buffer

Definition at line 68 of file tlvhelper.c.

Referenced by _addrframe_setaddr(), _intframe_updatedata(), _ipportframe_setaddr(), _seqnoframe_updatedata(), cast_frameset_tests(), frame_append_to_frameset_packet(), frameset_construct_packet(), set_generic_tlv_type(), and tlv_set_guint24().

Here is the caller graph for this function:

WINEXPORT void tlv_set_guint24 ( void *  vitem,
guint32  item,
const void *  bufend 
)

Set an unsigned 24 bit (3-byte) integer to the given location with error checking and without caring about byte alignment.

This is used for IEEE OUI values.

Todo:
verify that this 3-byte ordering is correct - it has to match the IEEE OUI layout...
Parameters
vitemLocation to stuff the int into
itemValue to stuff into 'vitem'
bufendone byte past the end of this buffer

Definition at line 146 of file tlvhelper.c.

References tlv_set_guint16().

Referenced by _compressframe_updatedata(), _intframe_updatedata(), frame_append_to_frameset_packet(), and set_generic_tlv_len().

Here is the call graph for this function:

Here is the caller graph for this function:

WINEXPORT void tlv_set_guint32 ( void *  vitem,
guint32  item,
const void *  bufend 
)

Set an unsigned 32 bit integer to the given location with error checking and without caring about byte alignment.

Parameters
vitemLocation to stuff the int into
itemValue to stuff into 'vitem'
bufendone byte past the end of this buffer

Definition at line 93 of file tlvhelper.c.

Referenced by _intframe_updatedata(), and _seqnoframe_updatedata().

Here is the caller graph for this function:

WINEXPORT void tlv_set_guint64 ( void *  vitem,
guint64  item,
const void *  bufend 
)

Set an unsigned 64 bit integer to the given location with error checking and without caring about byte alignment.

Parameters
vitemLocation to stuff the int into
itemValue to stuff into 'vitem'
bufendone byte past the end of this buffer

Definition at line 119 of file tlvhelper.c.

Referenced by _intframe_updatedata(), and _seqnoframe_updatedata().

Here is the caller graph for this function:

WINEXPORT void tlv_set_guint8 ( void *  vitem,
guint8  item,
const void *  bufend 
)

Set an unsigned 8 bit integer to the given location with error checking.

Parameters
vitemLocation to stuff the int into
itemValue to stuff into 'vitem'
bufendone byte past the end of this buffer

Definition at line 41 of file tlvhelper.c.

Referenced by _compressframe_updatedata(), _cryptcurve25519_updatedata(), _intframe_updatedata(), and _signframe_updatedata().

Here is the caller graph for this function: