![]() |
These routines link the IP layer to the Ethernet driver. Applications do not directly use this.
Functions | |
void | NutEtherInput (NUTDEVICE *dev, NETBUF *nb) |
Handle incoming Ethernet frames. | |
int | NutEtherOutput (NUTDEVICE *dev, u_short type, u_char *ha, NETBUF *nb) |
Send Ethernet frame. |
Handle incoming Ethernet frames.
Splits the Ethernet frame into the data link and the network part. Then the frame is routed to the proper handler, based on the type field in the Ethernet header.
If the frame neither contains an IP nor an ARP type telegram, then it is silently discarded.
dev | Identifies the device that received the frame. | |
nb | Pointer to a network buffer structure containing the ethernet frame. |
Definition at line 141 of file ethin.c.
References ether_header::ether_type, ETHERTYPE_ARP, ETHERTYPE_IP, _NETBUF::nb_dl, _NETBUF::nb_nw, ntohs, NutArpInput(), NutIpInput(), NutNetBufFree(), _NBDATA::sz, and _NBDATA::vp.
Send Ethernet frame.
Send an Ethernet frame of a given type using the specified device.
dev | Identifies the device to use. | |
type | Type of this frame, either ETHERTYPE_IP or ETHERTYPE_ARP. | |
ha | MAC address of the destination, set null for broadcasts. | |
nb | Network buffer structure containing the packet to be sent. The structure must have been allocated by a previous call NutNetBufAlloc() and will be freed if this function returns with an error. |
Definition at line 141 of file ethout.c.
References _NUTDEVICE::dev_icb, ether_header::ether_dhost, ether_header::ether_shost, ether_header::ether_type, htons, ifnet::if_mac, ifnet::if_send, memcpy(), memset(), _NETBUF::nb_dl, NBAF_DATALINK, NutNetBufAlloc(), NutNetBufFree(), and _NBDATA::vp.