Document ethernet level functions

This commit is contained in:
Dirk Ziegelmeier 2016-08-24 08:01:36 +02:00
parent c719c466b3
commit e78bc41116
2 changed files with 45 additions and 17 deletions

View File

@ -102,21 +102,43 @@ PACK_STRUCT_END
#define SIZEOF_VLAN_HDR 4
#define VLAN_ID(vlan_hdr) (htons((vlan_hdr)->prio_vid) & 0xFFF)
/* A list of often ethtypes (although lwIP does not use all of them): */
#define ETHTYPE_IP 0x0800U /* Internet protocol v4 */
#define ETHTYPE_ARP 0x0806U /* Address resolution protocol */
#define ETHTYPE_WOL 0x0842U /* Wake on lan */
#define ETHTYPE_VLAN 0x8100U /* Virtual local area network */
#define ETHTYPE_IPV6 0x86DDU /* Internet protocol v6 */
#define ETHTYPE_PPPOEDISC 0x8863U /* PPP Over Ethernet Discovery Stage */
#define ETHTYPE_PPPOE 0x8864U /* PPP Over Ethernet Session Stage */
#define ETHTYPE_JUMBO 0x8870U /* Jumbo Frames */
#define ETHTYPE_PROFINET 0x8892U /* Process field network */
#define ETHTYPE_ETHERCAT 0x88A4U /* Ethernet for control automation technology */
#define ETHTYPE_LLDP 0x88CCU /* Link layer discovery protocol */
#define ETHTYPE_SERCOS 0x88CDU /* Serial real-time communication system */
#define ETHTYPE_PTP 0x88F7U /* Precision time protocol */
#define ETHTYPE_QINQ 0x9100U /* Q-in-Q, 802.1ad */
/**
* @ingroup ethernet
* A list of often ethtypes (although lwIP does not use all of them): */
enum eth_type {
/** Internet protocol v4 */
ETHTYPE_IP = 0x0800U,
/** Address resolution protocol */
ETHTYPE_ARP = 0x0806U,
/** Wake on lan */
ETHTYPE_WOL = 0x0842U,
/** RARP */
ETHTYPE_RARP = 0x8035U,
/** Virtual local area network */
ETHTYPE_VLAN = 0x8100U,
/** Internet protocol v6 */
ETHTYPE_IPV6 = 0x86DDU,
/** PPP Over Ethernet Discovery Stage */
ETHTYPE_PPPOEDISC = 0x8863U,
/** PPP Over Ethernet Session Stage */
ETHTYPE_PPPOE = 0x8864U,
/** Jumbo Frames */
ETHTYPE_JUMBO = 0x8870U,
/** Process field network */
ETHTYPE_PROFINET = 0x8892U,
/** Ethernet for control automation technology */
ETHTYPE_ETHERCAT = 0x88A4U,
/** Link layer discovery protocol */
ETHTYPE_LLDP = 0x88CCU,
/** Serial real-time communication system */
ETHTYPE_SERCOS = 0x88CDU,
/** Media redundancy protocol */
ETHTYPE_MRP = 0x88E3U,
/** Precision time protocol */
ETHTYPE_PTP = 0x88F7U,
/** Q-in-Q, 802.1ad */
ETHTYPE_QINQ = 0x9100U
};
/** The 24-bit IANA IPv4-multicast OUI is 01-00-5e: */
#define LL_IP4_MULTICAST_ADDR_0 0x01

View File

@ -1,6 +1,9 @@
/**
* @file
* Ethernet common functions
*
* @defgroup ethernet Ethernet
* @ingroup callbackstyle_api
*/
/*
@ -236,14 +239,17 @@ free_and_return:
}
/**
* Send an ethernet packet on the network using netif->linkoutput
* @ingroup ethernet
* Send an ethernet packet on the network using netif->linkoutput().
* The ethernet header is filled in before sending.
*
* @see @ref LWIP_HOOK_UNKNOWN_ETH_PROTOCOL
*
* @param netif the lwIP network interface on which to send the packet
* @param p the packet to send, p->payload pointing to the (uninitialized) ethernet header
* @param src the source MAC address to be copied into the ethernet header
* @param dst the destination MAC address to be copied into the ethernet header
* @param eth_type ethernet type
* @param eth_type ethernet type (@ref eth_type)
* @return ERR_OK if the packet was sent, any other err_t on failure
*/
err_t