#include <yaf/autoinc.h>
Go to the source code of this file.
Typedefs | |
| typedef void(* | YAFragFunc )(uint8_t *vctx, const struct pcap_pkthdr *hdr, const uint8_t *pkt) |
| Packet handler function type. | |
Functions | |
| void | yaf_defrag_init (int32_t init_datalink, uint32_t init_timeout, uint32_t init_maxcount, YAFragFunc init_ipfn, YAFragFunc init_nonipfn) |
| Initialize the fragment reassembler. | |
| void | yaf_defrag (uint8_t *vctx, const struct pcap_pkthdr *hdr, const uint8_t *pkt) |
| Handle a packet. | |
| void | yaf_defrag_reset () |
| Reset the fragment reassembler. | |
This file defines the interface to a drop-in IP fragment reassembler for pcap-based network inspection tools. The interface consists of three functions; yaf_defrag_init() initializes the fragment reassembler's internal data structures, yaf_defrag() handles packets from pcap_dispatch() and reassembles fragments, and yaf_defrag_reset() flushes outstanding fragmented packets and cleans up internal storage.
The "drop-in" nature of this module comes from the fact that when a packet is found not to be an IP packet, not to be a fragment, or is reassembled from fragments, it is passed as a full packet including datalink headers to a caller-supplied pcap handler function.
|
|
Packet handler function type. Parallels pcap_dispatch handler; passed as ipfn and nonipfn to yaf_defrag_init as functions to pass complete IP datagrams and non-IP packets to on calls to yaf_defrag(). |
|
||||||||||||||||
|
Handle a packet. Pass this function to pcap_dispatch() to use the reassembler. Will cause ipfn or nonipfn to be called when the packet is reassembled or if it is not fragmented. This function can handle trace files with capture length less than the MTU of the underlying link-layer; missing bytes in this case will replaced with zeroes in the defragmented packet.
|
|
||||||||||||||||||||||||
|
Initialize the fragment reassembler. Allocates internal data structures for use by yaf_defrag(). Must be called before the first call to yaf_defrag().
|
|
|
Reset the fragment reassembler. Cleans up internal data structures. After reset, yaf_defrag_init() must be called before handling any more packets. |