EtherLib/prefab/conn_blocks/ipv4_connblock.h
Wiesner András ab8d45932f Timestamping and bunch of bugfix and optimization
- 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)
2023-04-27 09:38:26 +02:00

45 lines
1.4 KiB
C

#ifndef ETHERLIB_IPV4_CONNBLOCK_H
#define ETHERLIB_IPV4_CONNBLOCK_H
#include <stdint.h>
#include "../../connection_block.h"
#include "../../eth_interface.h"
#include "../packet_parsers/ipv4_types.h"
#define IP_ADDR_FROM_FILTCOND(fc) ((fc)->u[0])
#define IP_ADDR_TO_FILTCOND(fc,addr) (((fc)->u[0]) = (addr))
/**
* Create new IPv4 connection block.
* @param intf interface to the connection block will be associated
* @param ipAddr address of the connection block
* @param cbFn callback function fired when connection block receives data
* @return instance of a new connection block
*/
ConnBlock ipv4_new_connblock(EthInterface * intf, ip4_addr ipAddr, SieveCallBackFn cbFn);
/**
* Send IPv4 packet to specified IPv4 address.
* @param intf interface we will use
* @param addr address to send to
* @param data data to be transmitted
* @param size data size
* @param headers linked list of headers, always list top contains relevant info
*/
void ipv4_send(EthInterface * intf, ip4_addr addr, const uint8_t * data, uint32_t size, const PcktHeaderElement * headers);
/**
* Print IPv4 connblock report.
* @param connBlock IPv4 connblock
*/
void ipv4_print_report(const ConnBlock* connBlock);
/**
* Is the given address a multicast one?
* @param addr IP address to check
* @return ...
*/
bool ipv4_is_multicast_address(ip4_addr addr);
#endif //ETHERLIB_IPV4_CONNBLOCK_H