TSG-7784 PacketAdapter支持CI自动构建RPM; 修改代码结构
This commit is contained in:
55
common/include/decode_ipv4.h
Normal file
55
common/include/decode_ipv4.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#ifndef _DECODE_IPV4_H
|
||||
#define _DECODE_IPV4_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "public.h"
|
||||
|
||||
#define IPV4_HEADER_LEN 20
|
||||
|
||||
typedef struct ipv4_header_s
|
||||
{
|
||||
uint8_t ip_verhl; // version & header length
|
||||
uint8_t ip_tos;
|
||||
uint16_t ip_len;
|
||||
uint16_t ip_id;
|
||||
uint16_t ip_off;
|
||||
uint8_t ip_ttl;
|
||||
uint8_t ip_proto;
|
||||
uint16_t ip_csum;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
struct in_addr ip_src;
|
||||
struct in_addr ip_dst;
|
||||
} ip4_un1;
|
||||
uint16_t ip_addrs[4];
|
||||
} ip4_hdrun1;
|
||||
} __attribute__((__packed__)) ipv4_header_t;
|
||||
|
||||
typedef struct ipv4_info_s
|
||||
{
|
||||
char src_addr[INET_ADDRSTRLEN];
|
||||
char dst_addr[INET_ADDRSTRLEN];
|
||||
|
||||
ipv4_header_t *hdr;
|
||||
uint8_t *payload;
|
||||
uint8_t next_protocol;
|
||||
|
||||
uint32_t hdr_len;
|
||||
uint32_t opts_len;
|
||||
uint32_t payload_len;
|
||||
} ipv4_info_t;
|
||||
|
||||
int decode_ipv4(ipv4_info_t *packet, const uint8_t *data, uint32_t len);
|
||||
void dump_ipv4_info(uint32_t pkt_id, ipv4_info_t *packet);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user