2023-03-17 07:42:15 +00:00
|
|
|
//
|
|
|
|
// Created by xajhuang on 2023/3/17.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef VCPE_VXLAN_H
|
|
|
|
#define VCPE_VXLAN_H
|
2023-03-20 02:47:22 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2023-03-17 07:42:15 +00:00
|
|
|
|
2023-03-20 02:47:22 +00:00
|
|
|
#include <netinet/ip.h>
|
|
|
|
#include <netinet/udp.h>
|
|
|
|
#include <linux/if_ether.h>
|
|
|
|
#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 <bits/endian.h>"
|
|
|
|
#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
|
2023-03-17 07:42:15 +00:00
|
|
|
#endif //VCPE_VXLAN_H
|