// // Created by xajhuang on 2023/3/17. // #ifndef VCPE_VXLAN_H #define VCPE_VXLAN_H #ifdef __cplusplus extern "C" { #endif #include #include #include #include "common.h" #pragma pack(push) #pragma pack(1) typedef struct vxlan_hdr { U8 flags; U8 res1; U8 res2; U8 res3; U32 vni; } VXLAN_HDR, *PVXLAN_HDR; typedef struct qinq_hdr { #if __BYTE_ORDER == __LITTLE_ENDIAN U32 priority : 3; U32 dei : 1; U32 id : 12; #elif __BYTE_ORDER == __BIG_ENDIAN U32 id : 12; U32 dei : 1; U32 priority : 3; #else #error "Please fix " #endif } QINQ_HDR, *PQINQ_HDR; typedef struct { struct ethhdr eth; struct iphdr ip; struct udphdr udp; struct vxlan_hdr vxlan; struct ethhdr eth_in; struct qinq_hdr qinq; } VXLAN_PKG_HDR, *PVXLAN_PKG_HDR; #pragma pack(pop) #ifdef __cplusplus } #endif #endif //VCPE_VXLAN_H