- Timestamping management added - Errors due to reading uninitialized data in ARP fixed - EthInterface reworked, incoming packet notification and payload readout separated (through which fixing concurrent access problems) - RX and TX offloads added - Capability to add a packet sieve layer without prior registration of specific packet class added (this makes it possible to register arbitrary EtherType connection blocks, for example)
43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
#ifndef ETHERLIB_UDP_PACKET_H
|
|
#define ETHERLIB_UDP_PACKET_H
|
|
|
|
#include <stdint.h>
|
|
#include "../../packet_registry.h"
|
|
#include "../../packet_sieve.h"
|
|
|
|
#define ETH_UDP_PACKET_CLASS (17)
|
|
#define ETH_UDP_HEADER_SIZE (8)
|
|
|
|
/**
|
|
* @struct UdpProps
|
|
* UDP packet properties.
|
|
*/
|
|
typedef struct {
|
|
PcktPropsHeader
|
|
|
|
uint16_t SourcePort; ///> source port
|
|
uint16_t DestinationPort; ///> destination port
|
|
uint16_t Length; ///> packet size
|
|
uint16_t Checksum; ///> UDP checksum
|
|
} UdpProps;
|
|
|
|
struct EthInterface_;
|
|
|
|
/**
|
|
* Parse raw UDP packets.
|
|
* @param hdr pointer to the UDP packet header
|
|
* @param size total packet size
|
|
* @param pcktHdrLe pointer to property storage
|
|
* @return 0 on success or -1 on failure
|
|
*/
|
|
int parse_udp(const uint8_t *hdr, uint32_t size, PcktHeaderElement *pcktHdrLe, struct EthInterface_ *intf, PcktProcFnPassbackData *pb);
|
|
|
|
/**
|
|
* Insert UDP header.
|
|
* @param hdr space where the header is to be inserted
|
|
* @param headers linked list of header, top is always relevant
|
|
*/
|
|
void insert_udp_header(uint8_t *hdr, const PcktHeaderElement *headers, struct EthInterface_ *intf);
|
|
|
|
#endif //ETHERLIB_UDP_PACKET_H
|