2
* cdpr - Cisco Discovery Protocol Reporter
3
* Copyright (c) 2002-2006 MonkeyMental.com
5
* This program will show you which Cisco device your machine is
6
* connected to based on CDP packets received.
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License
10
* as published by the Free Software Foundation; either version 2
11
* of the License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
#include <netinet/in.h>
27
/* Define the constants and text values for the 'type' field: */
28
#define TYPE_DEVICE_ID 0x0001
29
#define TYPE_ADDRESS 0x0002
30
#define TYPE_PORT_ID 0x0003
31
#define TYPE_CAPABILITIES 0x0004
32
#define TYPE_IOS_VERSION 0x0005
33
#define TYPE_PLATFORM 0x0006
34
#define TYPE_IP_PREFIX 0x0007
36
#define TYPE_VTP_MGMT_DOMAIN 0x0009
37
#define TYPE_NATIVE_VLAN 0x000a
38
#define TYPE_DUPLEX 0x000b
46
{ TYPE_DEVICE_ID, "Device ID" },
47
{ TYPE_ADDRESS, "Addresses" },
48
{ TYPE_PORT_ID, "Port ID" },
49
{ TYPE_CAPABILITIES, "Capabilities" },
50
{ TYPE_IOS_VERSION, "Software version" },
51
{ TYPE_PLATFORM, "Platform" },
52
{ TYPE_IP_PREFIX, "IP Prefix (used for ODR)" },
53
{ TYPE_VTP_MGMT_DOMAIN, "VTP Management Domain" },
54
{ TYPE_NATIVE_VLAN, "Native VLAN" },
55
{ TYPE_DUPLEX, "Duplex" },
59
typedef struct _cdp_packet_header
61
u_int8_t version; // always one
62
u_int8_t time_to_live; // in seconds
63
u_int16_t checksum; // ip checksum
66
typedef struct _cfp_packet_data
68
u_int16_t type; // see TYPE_ above
69
u_int16_t length; // total length of type/length/value
70
// value; // variable length value