EtherLib/prefab/conn_blocks/tcp_connblock.h
Wiesner András ac5fc9c529 -IP reassembler added
-PcktSieve special return functionality added
-ARP multicast learning bug fixed
-include guards have been refactored
-Doxygen style tweaked
2023-02-04 11:04:26 +01:00

58 lines
1.6 KiB
C

#ifndef ETHERLIB_TCP_CONNBLOCK_H
#define ETHERLIB_TCP_CONNBLOCK_H
#define TCP_PORT_FROM_FILTCOND(fc) ((fc)->uw[7])
#define TCP_PORT_TO_FILTCOND(fc,port) (((fc)->uw[7]) = (port))
#include <stdint.h>
#include "../packet_parsers/ipv4_types.h"
#include "../../connection_block.h"
#include "../packet_parsers/tcp_segment.h"
#include "../../cbd_table.h"
struct EthInterface_;
/**
* Create new TCP connection block
* @param intf associated Ethernet interface
* @param ipAddr local IP-address
* @param port local port
* @param cbFn receive callback function
* @return TCP connection block
*/
cbd tcp_new_connblock(struct EthInterface_ *intf, ip4_addr ipAddr, uint16_t port, SieveCallBackFn cbFn);
/**
* Bind TCP connection to remote socket.
* @param d pointer to TCP connection block
* @param remoteAddr remote socket address
* @param remotePort remote socket port
*/
void tcp_bind(cbd d, ip4_addr remoteAddr, uint16_t remotePort);
/**
* Send data over an existing TCP connection.
* @param d pointer to existing connblock
* @param data pointer to data to send
* @param size data size in bytes
* @return number of bytes sent
*/
uint32_t tcp_send(unsigned char d, const uint8_t * data, uint32_t size);
/**
* Turn TCP debugging ON/OFF
* @param d
* @param debug
*/
void tcp_debug(cbd d, bool debug);
/**
* Print TCP connblock report.
* @param connBlock TCP connblock
*/
void tcp_print_report(const ConnBlock* connBlock);
//int tcp_send_segment(const struct ConnBlock_ *connBlock, TcpFlag flags, TcpOption * opts, const uint8_t *data, uint32_t size);
#endif //ETHERLIB_TCP_CONNBLOCK_H