38 lines
1014 B
C
38 lines
1014 B
C
#ifndef ETHERLIB_ETH_INTERFACE_H
|
|
#define ETHERLIB_ETH_INTERFACE_H
|
|
|
|
#include "packet_sieve.h"
|
|
#include "prefab/packet_parsers/packet_parsers.h"
|
|
|
|
typedef struct {
|
|
int (*llTx)(const RawPckt * rawPckt); ///< Function pointer to low-level transmit function
|
|
int (*llTxDone)(const RawPckt * rawPckt); ///< Transmission done (interrupt) callback
|
|
int (*llLinkChg)(int linkState); ///< Link change interrupt
|
|
int (*llError)(int error); ///< Low-level error interrupt
|
|
} EthIODef;
|
|
|
|
typedef struct {
|
|
PcktSieve sieve; ///< Packet sieve
|
|
EthIODef ioDef; ///< Low-level IO definitions
|
|
EthernetAddress mac; ///< Ethernet address
|
|
} EthInterface;
|
|
|
|
/**
|
|
* Allocate a new Ethernet interface
|
|
* @return new interface instance
|
|
*/
|
|
EthInterface * ethintf_new();
|
|
|
|
/**
|
|
* 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
|