Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Network support library (net.c)
[Network Library]


Detailed Description

 #include "net/net.h" 
Description
This is a general network support library including a multitude of structure definitions for various types of network packets, functions and macros for switching byte order, and an RFC-compliant function for calculating checksums.


Data Structures

struct  netEthAddr
struct  netEthHeader
struct  netArpHeader
struct  netIpHeader
struct  netIcmpHeader
struct  netUdpHeader
struct  netTcpHeader
struct  netEthArpHeader
struct  netEthIpHeader
struct  tcpip_hdr
struct  icmpip_hdr
struct  udpip_hdr

Defines

#define ETH_HEADER_LEN   14
#define ETHTYPE_ARP   0x0806
#define ETHTYPE_IP   0x0800
#define ETHTYPE_IP6   0x86dd
#define ARP_OPCODE_REQUEST   1
#define ARP_OPCODE_REPLY   2
#define ARP_HWTYPE_ETH   1
#define IP_HEADER_LEN   20
#define IP_PROTO_ICMP   1
#define IP_PROTO_TCP   6
#define IP_PROTO_UDP   17
#define ICMP_HEADER_LEN   8
#define ICMP_TYPE_ECHOREPLY   0
#define ICMP_TYPE_ECHOREQUEST   8
#define UDP_HEADER_LEN   8
#define TCP_HEADER_LEN   20
#define TCP_FLAGS_FIN   0x01
#define TCP_FLAGS_SYN   0x02
#define TCP_FLAGS_RST   0x04
#define TCP_FLAGS_PSH   0x08
#define TCP_FLAGS_ACK   0x10
#define TCP_FLAGS_URG   0x20
#define IPDOT(a, b, c, d)   ((a<<24)|(b<<16)|(c<<8)|(d))
#define HTONS(s)   ((s<<8) | (s>>8))
 Host-to-Network SHORT (16-bit) byte-order swap (macro).
#define HTONL(l)   ((l<<24) | ((l&0x00FF0000l)>>8) | ((l&0x0000FF00l)<<8) | (l>>24))
 Host-to-Network LONG (32-bit) byte-order swap (macro).

Typedefs

typedef netIpHeader ip_hdr

Functions

uint16_t htons (uint16_t val)
 Host-to-Network SHORT (16-bit) byte-order swap (function).
uint32_t htonl (uint32_t val)
 Host-to-Network LONG (32-bit) byte-order swap (function).
uint16_t netChecksum (void *data, uint16_t len)
 Calculate IP-style checksum from data.
void netPrintEthAddr (struct netEthAddr *ethaddr)
 Print Ethernet address in XX:XX:XX:XX:XX:XX format.
void netPrintIPAddr (uint32_t ipaddr)
 Print IP address in dot notation.
void netPrintEthHeader (struct netEthHeader *eth_hdr)
 Print Ethernet header information.
void netPrintIpHeader (struct netIpHeader *ipheader)
 Print IP header information.
void netPrintTcpHeader (struct netTcpHeader *tcpheader)
 Print TCP header information.

Variables

netEthAddr GNUC_PACKED


Define Documentation

#define IPDOT a,
b,
c,
 )     ((a<<24)|(b<<16)|(c<<8)|(d))
 

Convert dot-notation IP address into 32-bit word. Example: IPDOT(192l,168l,1l,1l)

Definition at line 178 of file net.h.


Generated on Sun Oct 29 03:41:10 2006 for Procyon AVRlib by  doxygen 1.4.2