- get_interface_by_address() added - HTTP server initials added - code added to strip away padding on processing the IP layer by shrinking overall packet size - load of TCP fixes and improvements - TCP stream interface added - TCP window destroy() added and some bugs fixed
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
#ifndef ETHERLIB_GLOBAL_STATE_H
|
|
#define ETHERLIB_GLOBAL_STATE_H
|
|
|
|
#include "memory_pool.h"
|
|
#include "packet_registry.h"
|
|
#include "packet_sieve.h"
|
|
#include "eth_interface.h"
|
|
#include "timer.h"
|
|
#include "cbd_table.h"
|
|
|
|
/**
|
|
* Global EtherLib state.
|
|
*/
|
|
typedef struct {
|
|
MP * mp; ///< Memory pool for dynamic allocations
|
|
Timer * tmr; ///< Timer for internal schedule.
|
|
PcktRegistry * pcktReg; ///< Packet registry
|
|
EthInterface * ethIntf; ///< Array of Ethernet interfaces
|
|
CbdTable * cbdt; ///< Connection block descriptor table
|
|
} EthState;
|
|
|
|
extern EthState gEthState;
|
|
#define E (gEthState)
|
|
|
|
/**
|
|
* Initialize EthLib.
|
|
*/
|
|
void ethlib_init();
|
|
|
|
void process_raw_packet(const uint8_t * data, uint32_t size);
|
|
|
|
/**
|
|
* Close an existing connection (UDP, TCP etc.)
|
|
* @param d connection block descriptor
|
|
*/
|
|
void close_connection(cbd d);
|
|
|
|
/**
|
|
* Get default Ethernet interface
|
|
* @return pointer to default Ethernet interface
|
|
*/
|
|
EthInterface * get_default_interface();
|
|
|
|
/**
|
|
* Get interface by address.
|
|
* @param addr IP address of a specific interface
|
|
* @return pointer to interface OR NULL if not found
|
|
*/
|
|
EthInterface * get_interface_by_address(ip4_addr addr);
|
|
|
|
#endif //ETHERLIB_GLOBAL_STATE_H
|