免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 773 | 回复: 0
打印 上一主题 下一主题

lcdp 之 cdp.h [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-06-12 17:04 |只看该作者 |倒序浏览

               

        文件:af_cdp.c.gz大小:6KB下载:
下载
                                cdp.h
/********************************************************************
        Based on documentation from Cisco, detailing the CDP packet format,
        which is available from:
        http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm#xtocid842812
        Portions Copyright (c) 2001 Chris Crowther and tom burkart
        The authors admit no liability nor provide any warranty for this
        software.  This material is provided "AS-IS" and at no charge.
        This software is released under the the GNU Public Licence (GPL).
*******************************************************************/
#ifndef _NET_CDP_H
#define _NET_CDP_H
/* timer values */
#define CDP_POLL                HZ*5    /* poll the neighbor list every 5
                                         * seconds for expired entires */
/* the packet types */
#define CDP_TYPE_DEVICEID       0x0001
#define CDP_TYPE_ADDRESS        0x0002
#define CDP_TYPE_PORTID         0x0003
#define CDP_TYPE_CAPABILITIES   0x0004
#define CDP_TYPE_VERSION        0x0005
#define CDP_TYPE_PLATFORM       0x0006
#define CDP_TYPE_IPPREFIX       0x0007
/* the capability masks */
#define CDP_CAPABILITY_L3R      0x01    /* a layer 3 router */
#define CDP_CAPABILITY_L2TB     0x02    /* a layer 2 transparent bridge */
#define CDP_CAPABILITY_L2SRB    0x04    /* a layer 2 source-route bridge */
#define CDP_CAPABILITY_L2SW     0x08    /* a layer 2 switch (non-spanning tree) */
#define CDP_CAPABILITY_L3TXRX   0x10    /* a layer 3 (non routing) host */
#define CDP_CAPABILITY_IGRP     0x20    /* does not forward IGMP Packets to non-routers */
#define CDP_CAPABILITY_L1       0x40    /* a layer 1 repeater */
static DEFINE_SPINLOCK(cdp_lock);
/* the actual neighbor entry */
struct s_cdp_neighbor {
        unsigned char *remote_ethernet; /* Remote MAC */
        char *local_iface;              /* Device we saw the packet on*/
        struct timeval timestamp;       /* Time packet arrived */
        unsigned char cdp_proto_ver;    /* Version of CDP */
        unsigned char cdp_ttl;          /* Holdtime */
        unsigned short cdp_checksum;    /* Standard IP packet checksum */
        unsigned char *cdp_version;     /* Software version on neighbor */
        unsigned char *cdp_deviceID;    /* Remote device identification */
        unsigned char *cdp_address;     /* copy of the address info from the
                                         * packet */
        unsigned long cdp_capabilities; /* Capabilities */
        unsigned char *cdp_platform;    /* Model name */
        unsigned char *cdp_portID;      /* Remote device port */
        unsigned char *cdp_prefix;      /* IP address prefix */
        struct s_cdp_neighbor *next;
        struct s_cdp_neighbor *prev;
};
/* head struct */
struct s_cdp_neighbors {
        struct s_cdp_neighbor *head;
        struct s_cdp_neighbor *foot;
};
#endif
               
               
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/2837/showart_320029.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP