~ubuntu-branches/ubuntu/oneiric/cdpr/oneiric

« back to all changes in this revision

Viewing changes to cdp.h

  • Committer: Bazaar Package Importer
  • Author(s): Lukas Fittl
  • Date: 2006-09-28 12:59:22 UTC
  • Revision ID: james.westby@ubuntu.com-20060928125922-ifqnugsv5unc4iiz
Tags: upstream-2.2.1
ImportĀ upstreamĀ versionĀ 2.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* cdpr - Cisco Discovery Protocol Reporter
 
3
* Copyright (c) 2002-2006 MonkeyMental.com
 
4
*
 
5
* This program will show you which Cisco device your machine is
 
6
* connected to based on CDP packets received.
 
7
*
 
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.
 
12
*
 
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.
 
17
*
 
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.
 
21
*/
 
22
 
 
23
#ifndef WIN32
 
24
#include <netinet/in.h>
 
25
#endif
 
26
 
 
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
 
35
 
 
36
#define TYPE_VTP_MGMT_DOMAIN            0x0009
 
37
#define TYPE_NATIVE_VLAN                0x000a
 
38
#define TYPE_DUPLEX                     0x000b
 
39
 
 
40
struct
 
41
{
 
42
    int type;
 
43
    char *val;
 
44
}
 
45
type_vals[] = {
 
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" },
 
56
        { 0,                    NULL },
 
57
};
 
58
 
 
59
typedef struct _cdp_packet_header
 
60
{
 
61
        u_int8_t  version;              // always one
 
62
        u_int8_t  time_to_live; // in seconds
 
63
        u_int16_t checksum;             // ip checksum
 
64
} CDP_HDR;
 
65
 
 
66
typedef struct _cfp_packet_data
 
67
{
 
68
        u_int16_t type;                 // see TYPE_ above
 
69
        u_int16_t length;               // total length of type/length/value
 
70
        //        value;                // variable length value
 
71
} CDP_DATA;
 
72