40 lines
734 B
C
40 lines
734 B
C
#ifndef _DECODE_UDP_H
|
|
#define _DECODE_UDP_H
|
|
|
|
#ifdef __cpluscplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#include "public.h"
|
|
|
|
#define UDP_HEADER_LEN 8
|
|
|
|
typedef struct udp_header_s
|
|
{
|
|
uint16_t udp_src_port;
|
|
uint16_t udp_dst_port;
|
|
uint16_t udp_len;
|
|
uint16_t udp_sum;
|
|
} __attribute__((__packed__)) udp_header_t;
|
|
|
|
typedef struct udp_info_s
|
|
{
|
|
uint16_t src_port;
|
|
uint16_t dst_port;
|
|
|
|
udp_header_t *hdr;
|
|
uint8_t *payload;
|
|
|
|
uint32_t hdr_len;
|
|
uint32_t payload_len;
|
|
} udp_info_t;
|
|
|
|
int decode_udp(udp_info_t *packet, const uint8_t *data, uint32_t len);
|
|
int dump_udp_info(udp_info_t *packet, char *buff, size_t size);
|
|
|
|
#ifdef __cpluscplus
|
|
}
|
|
#endif
|
|
|
|
#endif |