00001
00039 #ifndef _PROTOCOLS_H_
00040 #define _PROTOCOLS_H_
00041
00042 #include <netinet/if_ether.h>
00043
00044
00045
00046
00047
00048 #ifndef ETH_P_8021Q
00049 #define ETH_P_8021Q 0x8100
00050 #endif
00051
00052 #define ETH_P_ISMP 0x81FD
00054 #ifndef ETH_P_MPLS_UC
00055 #define ETH_P_MPLS_UC 0x8847
00056 #endif
00057
00058 #ifndef ETH_P_MPLS_MC
00059 #define ETH_P_MPLS_MC 0x8848
00060 #endif
00061
00062 #define ETH_P_LLDP 0x88CC
00064 #define _ETH_P_8021AD 0x88A8
00065 #define _ETH_P_8021QINQ 0x9100
00066 #define _ETH_P_8021QINQ_DOUBLE 0x9200
00067 #define _ETH_P_8021QINQ_TRIPPLE 0x9300
00069
00070
00071
00072 #define LLC_SAP_MASK 0xFE
00073 #define LLC_SAP_BACNET 0x82
00075
00076
00077
00078 #define VLAN_HLEN 4
00079 #define VLAN_ID_MASK 0xFF0F
00081
00082
00083
00084 #define MPLS_HLEN 4
00086 #define MPLS_LABEL_MASK 0xfffff000
00087 #define MPLS_LABEL_SHIFT 12
00088 #define MPLS_EXP_MASK 0x00000e00
00089 #define MPLS_EXP_SHIFT 9
00090 #define MPLS_STACK_MASK 0x00000100
00091 #define MPLS_STACK_SHIFT 8
00092 #define MPLS_TTL_MASK 0x000000ff
00093 #define MPLS_TTL_SHIFT 0
00095
00096
00097
00098 #define UDP_HDR_SIZE 8
00104 struct __attribute__ ((packed)) bacnet_npdu {
00105
00108 uint8_t version;
00112 uint8_t control;
00116 uint8_t data[];
00117 };
00118
00119 #define BACNET_CTRL_MSGTYPE_MASK 0x80
00120 #define BACNET_CTRL_DST_MASK 0x20
00121 #define BACNET_CTRL_SRC_MASK 0x08
00122 #define BACNET_UDP_PORT 0xbac0
00124 #define BACNET_IP_TYPE 0x81
00125 #define BACNET_ETH_TYPE LLC_SAP_BACNET
00127 #endif
00128