-PcktSieve special return functionality added -ARP multicast learning bug fixed -include guards have been refactored -Doxygen style tweaked
61 lines
1.9 KiB
C
61 lines
1.9 KiB
C
#ifndef ETHERLIB_ETH_INTERFACE_H
|
|
#define ETHERLIB_ETH_INTERFACE_H
|
|
|
|
#include "packet_sieve.h"
|
|
#include "prefab/packet_parsers/packet_parsers.h"
|
|
#include "prefab/packet_parsers/ipv4_types.h"
|
|
#include "arp_cache.h"
|
|
#include "connection_block.h"
|
|
#include "msg_queue.h"
|
|
#include "prefab/conn_blocks/ipv4/ip_assembler.h"
|
|
|
|
/**
|
|
* Ethernet interface low level definition.
|
|
*/
|
|
typedef struct EthIODef_ {
|
|
int (*llTxTrigger)(struct EthIODef_ * io, MsgQueue * mq); ///< Function pointer to low-level transmit function trigger
|
|
int (*llTxDone)(struct EthIODef_ * io, const RawPckt * rawPckt); ///< Transmission done (interrupt) callback
|
|
int (*llLinkChg)(struct EthIODef_ * io, int linkState); ///< Link change interrupt
|
|
int (*llRxDone)(struct EthIODef_ * io, const RawPckt * rawPckt); ///< Receive done callback
|
|
int (*llError)(struct EthIODef_ * io, int error); ///< Low-level error interrupt
|
|
void * tag; ///< Some arbitrary tagging
|
|
|
|
} EthIODef;
|
|
|
|
/**
|
|
* Ethernet interface representation.
|
|
*/
|
|
typedef struct EthInterface_ {
|
|
PcktSieve sieve; ///< Packet sieve
|
|
EthIODef * ioDef; ///< Low-level IO definitions
|
|
EthernetAddress mac; ///< Ethernet address
|
|
ip4_addr ip; ///< IP address
|
|
ip4_addr router; ///< Router IP address
|
|
ip4_addr netmask; ///< Subnet mask
|
|
ip4_addr dns; ///< Domain Name Server
|
|
ArpCache * arpc; ///< ARP cache
|
|
ConnBlock arpCb; ///< ARP connection block
|
|
MsgQueue * txQ; ///< Transmit queue
|
|
IPv4Assembler * ipra; ///< IPv4 reassembler
|
|
} EthInterface;
|
|
|
|
/**
|
|
* Allocate a new Ethernet interface
|
|
* @param io Low-level IO definitions
|
|
* @return new interface instance
|
|
*/
|
|
EthInterface *ethintf_new(EthIODef * io);
|
|
|
|
/**
|
|
* Receive uncooked packet.
|
|
* @param rawPckt
|
|
*/
|
|
void ethinf_receive(EthInterface *intf, const RawPckt *rawPckt);
|
|
|
|
/**
|
|
* Transmit packet.
|
|
*/
|
|
void ethinf_transmit(EthInterface *intf, const RawPckt *rawPckt);
|
|
|
|
#endif //ETHERLIB_ETH_INTERFACE_H
|