iPXE
stp.h
Go to the documentation of this file.
00001 #ifndef _IPXE_STP_H
00002 #define _IPXE_STP_H
00003 
00004 /** @file
00005  *
00006  * Spanning Tree Protocol (STP)
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <ipxe/if_ether.h>
00014 
00015 /** "Protocol" value for STP
00016  *
00017  * This is the concatenated {DSAP,SSAP} value used internally by iPXE
00018  * as the network-layer protocol for LLC frames.
00019  */
00020 #define ETH_P_STP 0x4242
00021 
00022 /** A switch identifier */
00023 struct stp_switch {
00024         /** Priotity */
00025         uint16_t priority;
00026         /** MAC address */
00027         uint8_t mac[ETH_ALEN];
00028 } __attribute__ (( packed ));
00029 
00030 /** A Spanning Tree bridge protocol data unit */
00031 struct stp_bpdu {
00032         /** LLC DSAP */
00033         uint8_t dsap;
00034         /** LLC SSAP */
00035         uint8_t ssap;
00036         /** LLC control field */
00037         uint8_t control;
00038         /** Protocol ID */
00039         uint16_t protocol;
00040         /** Protocol version */
00041         uint8_t version;
00042         /** Message type */
00043         uint8_t type;
00044         /** Flags */
00045         uint8_t flags;
00046         /** Root switch */
00047         struct stp_switch root;
00048         /** Root path cost */
00049         uint32_t cost;
00050         /** Sender switch */
00051         struct stp_switch sender;
00052         /** Port */
00053         uint16_t port;
00054         /** Message age */
00055         uint16_t age;
00056         /** Maximum age */
00057         uint16_t max;
00058         /** Hello time */
00059         uint16_t hello;
00060         /** Forward delay */
00061         uint16_t delay;
00062 } __attribute__ (( packed ));
00063 
00064 /** Spanning Tree protocol ID */
00065 #define STP_PROTOCOL 0x0000
00066 
00067 /** Rapid Spanning Tree protocol version */
00068 #define STP_VERSION_RSTP 0x02
00069 
00070 /** Rapid Spanning Tree bridge PDU type */
00071 #define STP_TYPE_RSTP 0x02
00072 
00073 /** Port is forwarding */
00074 #define STP_FL_FORWARDING 0x20
00075 
00076 #endif /* _IPXE_STP_H */