⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spantree.h

📁 基于vxworks操作系统,Tornado2.0平台,生成树STP源码.直接在其对应的设备中添加即可.
💻 H
📖 第 1 页 / 共 2 页
字号:
/* spantree.h - Header file to Spanning Tree code. *//* Copyright 2001 Wind River Systems, Inc. *//* Copyright 1998-2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history----------------------------------------00f,03may01,kw   Add the PTI changes and Fast unlink support.00e,18apr01,kc   Replaced "extern" with "IMPORT".00d,18apr01,kc   Added the count_topology_change, count_forward_transitions prototypes.00c,22feb01,kw   Fixed the stpInit prototype.00b,23sep00,kw   Fixed little endian problems, converted to WRS file hdrs.00a,17Jun99,reb  Written.*//*DESCRIPTIONThe header file for stp-8021d-d17.cINCLUDE FILES: N/A*//*************************************************************************  *                                                                          *             Copyright (c) 1995-1998 XACT Inc. *                                                                          * PROPRIETARY RIGHTS of XACT Incorporated are involved in the subject      * matter of this material.  All manufacturing, reproduction, use, and      * sales rights pertaining to this subject matter are governed by the       * license agreement.  The recipient of this software implicitly accepts    * the terms of the license.                                                * *************************************************************************//* * SPAN, XACT Inc. Copyright 1996 * Spanning Tree Algorithm and Protocol (802.1D) * Pulled from ANSI/IEEE Std 802.1D, 1993 Edition * * spantree.h */#ifndef __INCspantreeh#define __INCspantreeh#ifdef __cplusplusextern "C" {#endif /* __cplusplus *//* * Psuedo-Implementation Constants */#define DEFAULT_PATH_COST       10              /* arbitrary                */#define MESSAGE_AGE_INCREMENT   1               /* minimum possible....     */  #define NO_PORT                 0               /* reserved value...        */#define FIXED_HOLD_TIME         1               /* Hold Time is fixed to 1  */#define DEFAULT_HELLO_TIME      2#define DEFAULT_FORWARD_DELAY   15#define DEFAULT_MAX_AGE         20/* * Spanning Tree Packet Queues */#define XSPAN_MAXPKTQS          8#define SPAN_DISABLE    0#define SPAN_ENABLE     1/****************************************************************************  DEFINED CONSTANTS**************************************************************************/#define Zero        0#define One         1#ifndef __INCtmsTypesh#define False       0#define True        1#endif/***** trap defines *******/typedef enum { newRootTrap =1,  topologyChange=2 }trapType_t;typedef enum { dot1dBridgeEnterpiseNum = 17 } bridgeEnterpiseNum_t;typedef enum { ForwardDelayAging =1,FilterDbaseTime=2 }agingValue_t;enum { INIT_BITMAP = 1, TEST_BITMAP, ADD_PORT, REMOVE_PORT, FREE_BITMAP };/** port states. **/#define Disabled                0          /* (8.4.5)        */#define Listening               1          /* (8.4.2)        */#define Learning                2          /* (8.4.3)        */#define Forwarding              3          /* (8.4.4)        */#define Blocking                4          /* (8.4.1)        *//** BPDU type constants **/ #define Config_bpdu_type     0#define Tcn_bpdu_type      128/** pseudo-implementation constants. **/#define Default_path_cost 10        /* arbitrary */#define Message_age_increment 1        /* minimum increment possible to avoid underestimating age, allows           for BPDU transmission time */#define No_port 0        /* reserved value for Bridge's root port parameter indicating no           root port, used when Bridge is the root *//****************************************************************************  TYPEDEFS, STRUCTURES, AND UNION DECLARATIONS**************************************************************************//** basic types. **/typedef int Int;        /* to align with case stropping convention used                           here. Types and defined constants have their                           initial letters capitalised. */typedef Int State_t;    /* : (Disabled, Listening, Learning,                              Forwarding, Blocking) *//** BPDU encoding types defined in Clause 9, "Encoding of Bridge ProtocolData Units" are:Protocol_version     (9.2.2)Bpdu_type            (9.2.3)Flag                 (9.2.4)Identifier           (9.2.5)Cost                 (9.2.6)Port_id              (9.2.7)Time                 (9.2.8)**/typedef uchar_t Protocol_version;               /* (9.2.2)        */typedef uchar_t Bpdu_type;                      /* (9.2.3)        */typedef uchar_t Flag;                           /* (9.2.4)        */#ifdef __GNUC__#ifndef IDENT_TYPE#define IDENT_TYPEtypedef struct {    ushort_t    priority;    uchar_t     mac[6];} Identifier;                                   /* (9.2.5)        */#endif#else#error "GNU 'C' Not used."  /*lint !e309 */#endiftypedef int Cost_t;                            /* (9.2.6)        */typedef ushort_t    Port_id;                   /* (9.2.7)        */typedef ushort_t    Time_t;                    /* (9.2.8)        */#if 1#define id_equate( x, y )   \            memcpy( (char *)&(x), (char *)&(y), sizeof(Identifier) )#define id_eq( x, y )   \            ((memcmp( (char *)&(x), (char *)&(y), sizeof(Identifier) ) == 0)? True : False)#define id_neq( x, y )  \            ((memcmp( (char *)&(x), (char *)&(y), sizeof(Identifier) ) != 0)? True : False)#define id_lte( x, y )      \            ((memcmp( (char *)&(x), (char *)&(y), sizeof(Identifier) ) <= 0 )? True : False)#define id_lt( x, y )       \            ((memcmp( (char *)&(x), (char *)&(y), sizeof(Identifier) ) < 0 )? True : False)#else#ifdef INCLUDE_ID_ROUTINES#define id_equate( x, y )   _id_equate( (uchar_t *)&(x), (uchar_t *)&(y) )#define id_eq( x, y )       _id_eq( (uchar_t *)&(x), (uchar_t *)&(y) )#define id_neq( x, y )      _id_neq( (uchar_t *)&(x), (uchar_t *)&(y) )#define id_lt( x, y )       _id_lt( (uchar_t *)&(x), (uchar_t *)&(y) )LOCAL __inline__ void _id_equate( uchar_t * to, uchar_t * from ){    int     i;    for( i = 0; i < sizeof(Identifier); i++ )        *to++ = *from++;}LOCAL __inline__ Boolean _id_eq( uchar_t * id1, uchar_t * id2 ){    int     i;    for( i = 0; i < sizeof(Identifier); i++, id1++, id2++ )    {        if ( *id1 == *id2 )            continue;        return False;    }    return True;}LOCAL __inline__ Boolean _id_neq( uchar_t * id1, uchar_t * id2 ){    int     i;    for( i = 0; i < sizeof(Identifier); i++, id1++, id2++ )    {        if ( *id1 == *id2 )            continue;        return True;    }    return False;}LOCAL __inline__ Boolean _id_lt( uchar_t * id1, uchar_t * id2 ){    int     i;    for( i = 0; i < sizeof(Identifier); i++, id1++, id2++ )    {        if ( *id1 <= *id2 )            continue;        return False;    }    return True;}#endif /* INCLUDE_ID_ROUTINES */#endif/** Configuration BPDU Parameters (8.5.1) **/typedef struct{   Bpdu_type  type;   Identifier root_id;                                     /* (8.5.1.1)      */   Cost_t     root_path_cost;                              /* (8.5.1.2)      */   Identifier bridge_id;                                   /* (8.5.1.3)      */   Port_id    port_id;                                     /* (8.5.1.4)      */   Time_t     message_age;                                 /* (8.5.1.5)      */   Time_t     max_age;                                     /* (8.5.1.6)      */   Time_t     hello_time;                                  /* (8.5.1.7)      */   Time_t     forward_delay;                               /* (8.5.1.8)      */   Flag       topology_change_acknowledgment;              /* (8.5.1.9)      */   Flag       topology_change;                             /* (8.5.1.10)     */              } Config_bpdu;/** Topology Change Notification BPDU Parameters (8.5.2) **/typedef struct{   Bpdu_type  type;} Tcn_bpdu;/** Bridge Parameters (8.5.3) **/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -