// // Created by xajhuang on 2023/3/18. // #ifndef VCPE_VLAN_H #define VCPE_VLAN_H #ifdef __cplusplus extern "C" { #endif #include #include #include #include "common.h" #define VLAN_SUPPORT (1) #pragma pack(push) #pragma pack(1) #define VXLAN_VIN_ID_PACK(x) ((ntohs(x)) & 0xFFF) typedef enum { VLAN_NONE, VLAN_LEVEL1, VLAN_LEVEL2 } VLAN_TYPE; typedef struct vlan_hdr { #if VLAN_SUPPORT U16 id; U16 type; #endif } VLAN_HDR, *PVLAN_HDR; typedef struct vlan_hdr2 { #if VLAN_SUPPORT U16 id1; U16 h_type; U16 id2; U16 type; #endif } VLAN_HDR2, *PVLAN_HDR2; typedef struct { struct ethhdr eth; struct iphdr ip; struct udphdr udp; } VLAN_PKG_HDR, *PVLAN_PKG_HDR; typedef struct { struct ethhdr eth; #if VLAN_SUPPORT struct vlan_hdr vlan; #endif struct iphdr ip; struct udphdr udp; } VLAN_PKG_HDR1, *PVLAN_PKG_HDR1; typedef struct { struct ethhdr eth; #if VLAN_SUPPORT struct vlan_hdr2 vlan; #endif struct iphdr ip; struct udphdr udp; } VLAN_PKG_HDR2, *PVLAN_PKG_HDR2; #pragma pack(pop) #ifdef __cplusplus } #endif #endif //VCPE_VLAN_H