if_ether.h File Reference


Detailed Description

Ethernet interface definitions.

A more elaborated file description.

Definition in file if_ether.h.

Go to the source code of this file.

Data Structures

struct  ether_header
 Ethernet protocol header. More...
struct  ether_arp
 Ethernet ARP protocol structure. More...

Defines

#define ETHERTYPE_IP   0x0800
 IP protocol.
#define ETHERTYPE_ARP   0x0806
 Address resolution protocol.
#define ETHERMTU   1500
 Ethernet maximum transfer unit.
#define ETHERMIN   (60-14)
 Ethernet minimum transfer unit.
#define ETHER_IS_ZERO(ea)   (((ea)[0] | (ea)[1] | (ea)[2] | (ea)[3] | (ea)[4] | (ea)[5]) == 0)
 Determine if a given Ethernet address is zero.
#define ETHER_IS_BROADCAST(ea)   (((ea)[0] & (ea)[1] & (ea)[2] & (ea)[3] & (ea)[4] & (ea)[5]) == 0xFF)
 Determine if a given Ethernet address is a broadcast address.
#define ETHER_IS_MULTICAST(ea)   ((ea)[0] & 1)
 Determine if a given Ethernet address is a multicast address.
#define ETHER_IS_UNICAST(ea)   (!ETHER_IS_ZERO(ea) && !ETHER_IS_MULTICAST(ea))
 Determine if a given Ethernet address is a unicast address.

Typedefs

typedef struct ether_header ETHERHDR
 Ethernet protocol header type.
typedef struct ether_arp ETHERARP
 Ethernet ARP protocol type.

Functions

u_charether_aton (CONST char *str)
 Convert an ASCII string to a binary Ethernet address.
char * ether_ntoa (CONST u_char *mac)
 Convert a binary Ethernet address to an ASCII string.
void NutArpInput (NUTDEVICE *dev, NETBUF *nb)
 Handle incoming ARP packets.
NETBUFNutArpAllocNetBuf (u_short type, u_long ip, u_char *mac)
 Allocate an ARP network buffer structure.
int NutArpOutput (NUTDEVICE *dev, NETBUF *nb)
 Send an ARP packet.
void NutArpCacheUpdate (NUTDEVICE *dev, u_long ip, u_char *ha)
 Update an ARP entry.
int NutArpCacheQuery (NUTDEVICE *dev, u_long ip, u_char *mac)


Define Documentation

#define ETHERTYPE_IP   0x0800

IP protocol.

Definition at line 134 of file if_ether.h.

Referenced by NutArpAllocNetBuf(), NutArpInput(), NutEtherInput(), and NutIpOutput().

#define ETHERTYPE_ARP   0x0806

Address resolution protocol.

Definition at line 135 of file if_ether.h.

Referenced by NutArpOutput(), and NutEtherInput().

#define ETHERMTU   1500

Ethernet maximum transfer unit.

Definition at line 137 of file if_ether.h.

#define ETHERMIN   (60-14)

Ethernet minimum transfer unit.

Definition at line 139 of file if_ether.h.

#define ETHER_IS_ZERO ( ea   )     (((ea)[0] | (ea)[1] | (ea)[2] | (ea)[3] | (ea)[4] | (ea)[5]) == 0)

Determine if a given Ethernet address is zero.

Parameters:
ea Pointer to a character array containing the address.
Return 1 if the address is zero. Otherwise 0 is returned.

Definition at line 148 of file if_ether.h.

#define ETHER_IS_BROADCAST ( ea   )     (((ea)[0] & (ea)[1] & (ea)[2] & (ea)[3] & (ea)[4] & (ea)[5]) == 0xFF)

Determine if a given Ethernet address is a broadcast address.

Parameters:
ea Pointer to a character array containing the address.
Return 1 if the address is a broadcast address. Otherwise 0 is returned.

Definition at line 157 of file if_ether.h.

#define ETHER_IS_MULTICAST ( ea   )     ((ea)[0] & 1)

Determine if a given Ethernet address is a multicast address.

The broadcast address is defined as a special multicast address.

Parameters:
ea Pointer to a character array containing the address.
Return 1 if the address is a multicast address. Otherwise 0 is returned.

Definition at line 168 of file if_ether.h.

#define ETHER_IS_UNICAST ( ea   )     (!ETHER_IS_ZERO(ea) && !ETHER_IS_MULTICAST(ea))

Determine if a given Ethernet address is a unicast address.

By definition, an address with all zeros is not a valid unicast address.

Parameters:
ea Pointer to a character array containing the address.
Return 1 if the address is a unicast address. Otherwise 0 is returned.

Definition at line 179 of file if_ether.h.

Referenced by NutNetIfSetup().


Typedef Documentation

Ethernet protocol header type.

Ethernet ARP protocol type.


Function Documentation

u_char* ether_aton ( CONST char *  str  ) 

Convert an ASCII string to a binary Ethernet address.

Note:
This function returns a pointer to internal static storage space that will be overwritten by subsequent calls.
Parameters:
str String to convert.
Returns:
Pointer to a static string that contains the converted binary address.

Definition at line 60 of file ether_addr.c.

References CONST, and memset().

char* ether_ntoa ( CONST u_char mac  ) 

Convert a binary Ethernet address to an ASCII string.

Note:
This function returns a pointer to internal static storage space that will be overwritten by subsequent calls.
Parameters:
mac Address to convert.
Returns:
Pointer to a static string that contains the converted ASCII string.

Definition at line 99 of file ether_addr.c.

int NutArpCacheQuery ( NUTDEVICE dev,
u_long  ip,
u_char mac 
)

Referenced by NutIpOutput().


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/