69 lines
2.8 KiB
C
69 lines
2.8 KiB
C
|
|
#ifndef _PACKET_HELPERS_H
|
||
|
|
#define _PACKET_HELPERS_H
|
||
|
|
|
||
|
|
#ifdef __cpluscplus
|
||
|
|
extern "C"
|
||
|
|
{
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#include "packet.h"
|
||
|
|
|
||
|
|
// packet
|
||
|
|
uint64_t packet_get_zone_id(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_raw_len(const struct packet *pkt);
|
||
|
|
const char *packet_get0_raw_data(const struct packet *pkt);
|
||
|
|
|
||
|
|
bool paket_is_fragment(const struct packet *pkt);
|
||
|
|
bool packet_has_tcp(const struct packet *pkt);
|
||
|
|
bool packet_has_udp(const struct packet *pkt);
|
||
|
|
|
||
|
|
// foreach layer
|
||
|
|
uint8_t packet_get_layer_count(const struct packet *pkt);
|
||
|
|
enum layer_type packet_get_layer_type(const struct packet *pkt, uint8_t index);
|
||
|
|
const char *packet_get_layer_hdr_ptr(const struct packet *pkt, uint8_t index);
|
||
|
|
const char *packet_get_layer_pld_ptr(const struct packet *pkt, uint8_t index);
|
||
|
|
uint16_t packet_get_layer_hdr_len(const struct packet *pkt, uint8_t index);
|
||
|
|
uint16_t packet_get_layer_pld_len(const struct packet *pkt, uint8_t index);
|
||
|
|
|
||
|
|
// get tcp layer
|
||
|
|
const struct layer_record *packet_get0_tcp_layer(const struct packet *pkt);
|
||
|
|
const char *packet_get_tcp_hdr_ptr(const struct packet *pkt);
|
||
|
|
const char *packet_get_tcp_pld_ptr(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_tcp_hdr_len(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_tcp_pld_len(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_tcp_sport(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_tcp_dport(const struct packet *pkt);
|
||
|
|
uint32_t packet_get_tcp_seq(const struct packet *pkt);
|
||
|
|
uint32_t packet_get_tcp_ack(const struct packet *pkt);
|
||
|
|
uint8_t packet_get_tcp_flags(const struct packet *pkt);
|
||
|
|
bool packet_has_tcp_flag_urg(const struct packet *pkt);
|
||
|
|
bool packet_has_tcp_flag_ack(const struct packet *pkt);
|
||
|
|
bool packet_has_tcp_flag_psh(const struct packet *pkt);
|
||
|
|
bool packet_has_tcp_flag_rst(const struct packet *pkt);
|
||
|
|
bool packet_has_tcp_flag_syn(const struct packet *pkt);
|
||
|
|
bool packet_has_tcp_flag_fin(const struct packet *pkt);
|
||
|
|
|
||
|
|
// get inner udp layer
|
||
|
|
const struct layer_record *packet_get0_inner_udp_layer(const struct packet *pkt);
|
||
|
|
const char *packet_get_inner_udp_hdr_ptr(const struct packet *pkt);
|
||
|
|
const char *packet_get_inner_udp_pld_ptr(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_inner_udp_hdr_len(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_inner_udp_pld_len(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_inner_udp_sport(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_inner_udp_dport(const struct packet *pkt);
|
||
|
|
|
||
|
|
// get outer udp layer
|
||
|
|
const struct layer_record *packet_get0_outer_udp_layer(const struct packet *pkt);
|
||
|
|
const char *packet_get_outer_udp_hdr_ptr(const struct packet *pkt);
|
||
|
|
const char *packet_get_outer_udp_pld_ptr(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_outer_udp_hdr_len(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_outer_udp_pld_len(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_outer_udp_sport(const struct packet *pkt);
|
||
|
|
uint16_t packet_get_outer_udp_dport(const struct packet *pkt);
|
||
|
|
|
||
|
|
#ifdef __cpluscplus
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|