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

Header file for various basic CDP (Cisco Discovery Protocol definitions and accessor functions. More...

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

Go to the source code of this file.

Macros

#define CDP_TLV_DEVID   0x0001
 Hostname of the device or hardware serial number in ASCII. More...
 
#define CDP_TLV_ADDRESS   0x0002
 The L3 address of the interface that has sent the update. More...
 
#define CDP_TLV_PORTID   0x0003
 The port from which the CDP update has been sent. More...
 
#define CDP_TLV_CAPS   0x0004
 Bit mask describing the functional capabilities of the device. More...
 
#define CDP_TLV_VERS   0x0005
 A character string containing the software version (same as in show version). More...
 
#define CDP_TLV_PLATFORM   0x0006
 Hardware platform, such as WS-C5000, WS-C6009, or Cisco RSP. More...
 
#define CDP_TLV_IPPREFIX   0x0007
 4 bytes of IPv4 network prefix + 1 byte of CIDR-style netmask More...
 
#define CDP_TLV_HELLO   0x0008
 Protocol-Hello - encapsulates some other protocol. More...
 
#define CDP_TLV_VTPDOMAIN   0x0009
 The VTP Domain, if configured on the device. More...
 
#define CDP_TLV_NATIVEVLAN   0x000A
 In dot1q, this is the untagged VLAN. More...
 
#define CDP_TLV_DUPLEX   0x000B
 This field contains the duplex setting of the sending port. More...
 
#define CDP_TLV_APPLID   0x000E
 Appliance ID - auxiliary vlan ID for a VOIP phone. More...
 
#define CDP_TLV_POWER   0x0010
 Power consumption in milliwatts. More...
 
#define CDP_CAPMASK_ROUTER   0x01
 L3 Router. More...
 
#define CDP_CAPMASK_TBBRIDGE   0x02
 TB Bridge. More...
 
#define CDP_CAPMASK_SPBRIDGE   0x04
 SP Bridge. More...
 
#define CDP_CAPMASK_SWITCH   0x08
 L2 Switch. More...
 
#define CDP_CAPMASK_HOST   0x10
 Host. More...
 
#define CDP_CAPMASK_IGMPFILTER   0x20
 Does not forward IGMP report packets on non-routerports. More...
 
#define CDP_CAPMASK_REPEATER   0x40
 Repeater. More...
 

Functions

WINEXPORT guint8 get_cdp_vers (gconstpointer pktptr, gconstpointer pktend)
 
WINEXPORT guint8 get_cdp_ttl (gconstpointer pktptr, gconstpointer pktend)
 
WINEXPORT guint16 get_cdp_cksum (gconstpointer pktptr, gconstpointer pktend)
 
WINEXPORT guint16 get_cdptlv_type (gconstpointer tlv_vp, gconstpointer pktend)
 
WINEXPORT gsize get_cdptlv_len (gconstpointer tlv_vp, gconstpointer pktend)
 
WINEXPORT gsize get_cdptlv_vlen (gconstpointer tlv_vp, gconstpointer pktend)
 
WINEXPORT gconstpointer get_cdptlv_body (gconstpointer tlv_vp, gconstpointer pktend)
 
WINEXPORT gconstpointer get_cdptlv_first (gconstpointer pkt, gconstpointer pktend)
 
WINEXPORT gconstpointer get_cdptlv_next (gconstpointer tlv_vp, gconstpointer pktend)
 
WINEXPORT gconstpointer get_cdp_chassis_id (gconstpointer packet, gssize *idlength, gconstpointer pktend)
 Get the chassis ID associated with this CDP packet. More...
 
WINEXPORT gconstpointer get_cdp_port_id (gconstpointer packet, gssize *idlength, gconstpointer pktend)
 get the port ID associated with this CDP packet More...
 
WINEXPORT gboolean is_valid_cdp_packet (gconstpointer packet, gconstpointer pktend)
 
WINEXPORT gboolean enable_cdp_packets (gboolean enableme)
 

Detailed Description

Header file for various basic CDP (Cisco Discovery Protocol definitions and accessor functions.

There is a lot that's not documented and not understood about this protocol. But what we understand is somewhat documented here.

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

Function Documentation

WINEXPORT gboolean enable_cdp_packets ( gboolean  enableme)
WINEXPORT gconstpointer get_cdp_chassis_id ( gconstpointer  packet,
gssize *  idlength,
gconstpointer  pktend 
)

Get the chassis ID associated with this CDP packet.

Returns
pointer to chassis ID memory area and also length of the chassis ID
Parameters
[in]packetPointer to a the start of a CDP packet
[out]idlengthlength of chassis id
[in]pktendPointer of first byte past end of CDP packet

Definition at line 261 of file cdp_min.c.

References CDP_TLV_DEVID, get_cdptlv_body(), get_cdptlv_first(), get_cdptlv_next(), get_cdptlv_type(), and get_cdptlv_vlen().

Here is the call graph for this function:

WINEXPORT guint16 get_cdp_cksum ( gconstpointer  pktptr,
gconstpointer  pktend 
)
WINEXPORT gconstpointer get_cdp_port_id ( gconstpointer  packet,
gssize *  idlength,
gconstpointer  pktend 
)

get the port ID associated with this CDP packet

Returns
pointer to port ID memory area and also length of the port ID
Parameters
[in]packetPointer to a the start of a CDP packet
[out]idlengthlength of chassis id
[in]pktendPointer of first byte past end of CDP packet

Definition at line 282 of file cdp_min.c.

References CDP_TLV_PORTID, get_cdptlv_body(), get_cdptlv_first(), get_cdptlv_next(), get_cdptlv_type(), and get_cdptlv_vlen().

Here is the call graph for this function:

WINEXPORT guint8 get_cdp_ttl ( gconstpointer  pktptr,
gconstpointer  pktend 
)
WINEXPORT guint8 get_cdp_vers ( gconstpointer  pktptr,
gconstpointer  pktend 
)
WINEXPORT gconstpointer get_cdptlv_body ( gconstpointer  tlv_vp,
gconstpointer  pktend 
)
WINEXPORT gconstpointer get_cdptlv_first ( gconstpointer  pkt,
gconstpointer  pktend 
)
WINEXPORT gsize get_cdptlv_len ( gconstpointer  tlv_vp,
gconstpointer  pktend 
)
WINEXPORT gconstpointer get_cdptlv_next ( gconstpointer  tlv_vp,
gconstpointer  pktend 
)
WINEXPORT guint16 get_cdptlv_type ( gconstpointer  tlv_vp,
gconstpointer  pktend 
)
WINEXPORT gsize get_cdptlv_vlen ( gconstpointer  tlv_vp,
gconstpointer  pktend 
)
WINEXPORT gboolean is_valid_cdp_packet ( gconstpointer  packet,
gconstpointer  pktend 
)