EtherLib/prefab/conn_blocks/ipv4_connblock.h

32 lines
1.1 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);
#endif //ETHERLIB_IPV4_CONNBLOCK_H