- 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)
51 lines
1.6 KiB
C
51 lines
1.6 KiB
C
#ifndef ETHERLIB_UDP_CONNBLOCK_H
|
|
#define ETHERLIB_UDP_CONNBLOCK_H
|
|
|
|
#include <stdint.h>
|
|
#include "../../connection_block.h"
|
|
#include "../../eth_interface.h"
|
|
#include "ipv4_connblock.h"
|
|
#include "../../cbd_table.h"
|
|
|
|
#define UDP_PORT_FROM_FILTCOND(fc) ((fc)->uw[0])
|
|
#define UDP_PORT_TO_FILTCOND(fc,port) (((fc)->uw[0]) = (port))
|
|
|
|
/**
|
|
* Create new IPv4 connection block.
|
|
* @param intf interface to the connection block will be associated
|
|
* @param ipAddr address of the connection block
|
|
* @param port port of the connection block
|
|
* @param cbFn callback function fired when connection block receives data or some event occurs
|
|
* @return instance of a new connection block
|
|
*/
|
|
cbd udp_new_connblock(EthInterface * intf, ip4_addr ipAddr, uint16_t port, SieveCallBackFn cbFn);
|
|
|
|
/**
|
|
* UDP transmit function.
|
|
* @param connBlock UDP connection block
|
|
* @param data pointer to data buffer
|
|
* @param size data size
|
|
* @param addr remote address to send datagram to
|
|
* @param addr remote port
|
|
*/
|
|
int udp_sendto(cbd connBlock, const uint8_t * data, uint32_t size, ip4_addr addr, uint16_t port);
|
|
|
|
/**
|
|
* UDP transmit function with additional argument.
|
|
* @param connBlock UDP connection block
|
|
* @param data pointer to data buffer
|
|
* @param size data size
|
|
* @param addr remote address to send datagram to
|
|
* @param addr remote port
|
|
* @param arg user-defined parameter
|
|
*/
|
|
int udp_sendto_arg(cbd connBlock, const uint8_t * data, uint32_t size, ip4_addr addr, uint16_t port, uint32_t arg);
|
|
|
|
/**
|
|
* Print UDP connblock report.
|
|
* @param connBlock UDP connblock
|
|
*/
|
|
void udp_print_report(const ConnBlock* connBlock);
|
|
|
|
#endif //ETHERLIB_UDP_CONNBLOCK_H
|