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

# net.h File Reference

## Detailed Description

Definition in file net.h.

`#include <stdint.h>`
`#include "global.h"`

Go to the source code of this file.

## 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)) & 0x0000FFFF)
| 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