friendev EtherDune TCP/IP library
Classes | Macros | Variables
/home/jander/temp/etherdune/inet.h File Reference

Base data structures for Internet communication. More...

#include <ACross.h>
#include "config.h"

Go to the source code of this file.

Classes

union  nint16_t
 Represents a network byte order 16 bit integer. More...
 
union  nint32_t
 Represents a network byte order 32 bit integer. More...
 
struct  IPAddress_P_
 helper struct to store an IP address in PROGMEM More...
 
union  IPAddress
 represents an IP address in memory More...
 
struct  MACAddress_P_
 helper struct to store a MAC address in PROGMEM More...
 
struct  MACAddress
 Stores a MAC address in memory. More...
 
union  ARPPacket
 ARP packet layout. More...
 
union  IPHeader
 IP header. More...
 
union  TCPFlags
 TCP flags data structure. More...
 
struct  TCPHeader
 TCP Header data structure. More...
 
struct  TCPOptions
 Structure to encode one 2-byte long TCP option. More...
 
struct  UDPHeader
 Structure to represent an UDP header. More...
 
struct  DNSHeader
 Structure used to encode part of a DNS query. More...
 
struct  ICMPHeader
 ICMP Header and Echo request/reply. More...
 
struct  EthernetHeader
 Represents the header of an Ethernet frame. More...
 
struct  DHCPHeader
 Holds a DHCP header. More...
 
struct  DHCPOptions
 struct to represent the remaining space for DHCP options More...
 
union  EthBuffer
 Union of all the different protocol headers and layers to help EtherDune interpret or build packet. More...
 
struct  ARPEntry
 Entry in the ARP table. More...
 

Macros

#define IPAddress_P   PROGMEM IPAddress_P_
 helper macro to store an IP address in PROGMEM More...
 
#define IPADDR_P(b0, b1, b2, b3)   {{ (b0),(b1),(b2),(b3) }}
 defines an IP address as stored in PROGMEM More...
 
#define MACAddress_P   PROGMEM MACAddress_P_
 
#define MACADDR_P(b0, b1, b2, b3, b4, b5)   {{ (b0),(b1),(b2),(b3),(b4),(b5) }}
 stores a MAC address in PROGMEM More...
 

Variables

static const uint8_t SCK_STATE_CLOSED = 0
 (both server and client) represents no connection state at all. More...
 
static const uint8_t SCK_STATE_LISTEN = 1
 (server) represents waiting for a connection request from any remote TCP and port. More...
 
static const uint8_t SCK_STATE_SYN_SENT = 2
 (client) represents waiting for a matching connection request after having sent a connection request. More...
 
static const uint8_t SCK_STATE_SYN_RECEIVED = 3
 (server) represents waiting for a confirming connection request acknowledgment after having both received and sent a connection request. More...
 
static const uint8_t SCK_STATE_ESTABLISHED = 4
 (both server and client) represents an open connection, data received can be delivered to the user. More...
 
static const uint8_t SCK_STATE_FIN_WAIT_1 = 5
 (both server and client) represents waiting for a connection termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent. More...
 
static const uint8_t SCK_STATE_FIN_WAIT_2 = 6
 (both server and client) represents waiting for a connection termination request from the remote TCP. More...
 
static const uint8_t SCK_STATE_CLOSE_WAIT = 7
 (both server and client) represents waiting for a connection termination request from the local user. More...
 
static const uint8_t SCK_STATE_CLOSING = 8
 (both server and client) represents waiting for a connection termination request acknowledgment from the remote TCP. More...
 
static const uint8_t SCK_STATE_LAST_ACK = 9
 (both server and client) represents waiting for an acknowledgment of the connection termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request). More...
 
static const uint8_t SCK_STATE_TIME_WAIT = 10
 (either server or client) represents waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request. More...
 
static const uint8_t SCK_STATE_RESOLVING = 11
 IP Address is being resolved. More...
 
static const uint8_t DHCP_STATE_INIT = 0
 This is the initialization state, where a client begins the process of acquiring a lease. More...
 
static const uint8_t DHCP_STATE_SELECTING = 1
 The client is waiting to receive DHCPOFFER messages from one or more DHCP servers, so it can choose one. More...
 
static const uint8_t DHCP_STATE_REQUESTING = 2
 The client is waiting to hear back from the server to which it sent its request. More...
 
static const uint8_t DHCP_STATE_BOUND = 3
 Client has a valid lease and is in its normal operating state. More...
 
static const uint8_t DHCP_STATE_RENEWING = 4
 Client is trying to renew its lease. More...
 
static const uint8_t DHCP_STATE_REBINDING = 5
 The client has failed to renew its lease with the server that originally granted it, and now seeks a lease extension with any server that can hear it. More...
 
static const uint8_t IP_PROTO_ICMP = 1
 IP header protocol type for ICMP. More...
 
static const uint8_t IP_PROTO_TCP = 6
 IP header protocol type for TCP. More...
 
static const uint8_t IP_PROTO_UDP = 17
 IP header protocol type for UDP. More...
 
static const uint8_t ICMP_TYPE_ECHOREPLY = 0
 ICMP echo reply operation type. More...
 
static const uint8_t ICMP_TYPE_ECHOREQUEST = 8
 ICMP echo request operation type. More...
 
static const uint16_t ETHTYPE_ARP = 0x0806
 Ethernet header protocol type for ARP. More...
 
static const uint16_t ETHTYPE_IP = 0x0800
 Ethernet header protocol type for IP. More...
 
static const uint8_t ARP_OPCODE_REPLY_L = 0x02
 ARP Opcode for reply. More...
 
static const uint8_t ARP_OPCODE_REQ_L = 0x01
 ARP Opcode for request. More...
 

Detailed Description

Base data structures for Internet communication.

This header file contains all the data structures to interpret data coming in the wire

Definition in file inet.h.

Macro Definition Documentation

#define IPADDR_P (   b0,
  b1,
  b2,
  b3 
)    {{ (b0),(b1),(b2),(b3) }}

defines an IP address as stored in PROGMEM

Definition at line 177 of file inet.h.

#define IPAddress_P   PROGMEM IPAddress_P_

helper macro to store an IP address in PROGMEM

Definition at line 170 of file inet.h.

#define MACADDR_P (   b0,
  b1,
  b2,
  b3,
  b4,
  b5 
)    {{ (b0),(b1),(b2),(b3),(b4),(b5) }}

stores a MAC address in PROGMEM

Definition at line 248 of file inet.h.

#define MACAddress_P   PROGMEM MACAddress_P_

Definition at line 242 of file inet.h.

Variable Documentation

const uint8_t ARP_OPCODE_REPLY_L = 0x02
static

ARP Opcode for reply.

Definition at line 580 of file inet.h.

const uint8_t ARP_OPCODE_REQ_L = 0x01
static

ARP Opcode for request.

Definition at line 581 of file inet.h.

const uint8_t DHCP_STATE_BOUND = 3
static

Client has a valid lease and is in its normal operating state.

Definition at line 566 of file inet.h.

const uint8_t DHCP_STATE_INIT = 0
static

This is the initialization state, where a client begins the process of acquiring a lease.

It also returns here when a lease ends, or when a lease negotiation fails.

Definition at line 563 of file inet.h.

const uint8_t DHCP_STATE_REBINDING = 5
static

The client has failed to renew its lease with the server that originally granted it, and now seeks a lease extension with any server that can hear it.

It periodically sends DHCPREQUEST messages with no server specified until it gets a reply or the lease ends.

Definition at line 568 of file inet.h.

const uint8_t DHCP_STATE_RENEWING = 4
static

Client is trying to renew its lease.

It regularly sends DHCPREQUEST messages with the server that gave it its current lease specified, and waits for a reply.

Definition at line 567 of file inet.h.

const uint8_t DHCP_STATE_REQUESTING = 2
static

The client is waiting to hear back from the server to which it sent its request.

Definition at line 565 of file inet.h.

const uint8_t DHCP_STATE_SELECTING = 1
static

The client is waiting to receive DHCPOFFER messages from one or more DHCP servers, so it can choose one.

Definition at line 564 of file inet.h.

const uint16_t ETHTYPE_ARP = 0x0806
static

Ethernet header protocol type for ARP.

Definition at line 577 of file inet.h.

const uint16_t ETHTYPE_IP = 0x0800
static

Ethernet header protocol type for IP.

Definition at line 578 of file inet.h.

const uint8_t ICMP_TYPE_ECHOREPLY = 0
static

ICMP echo reply operation type.

Definition at line 574 of file inet.h.

const uint8_t ICMP_TYPE_ECHOREQUEST = 8
static

ICMP echo request operation type.

Definition at line 575 of file inet.h.

const uint8_t IP_PROTO_ICMP = 1
static

IP header protocol type for ICMP.

Definition at line 570 of file inet.h.

const uint8_t IP_PROTO_TCP = 6
static

IP header protocol type for TCP.

Definition at line 571 of file inet.h.

const uint8_t IP_PROTO_UDP = 17
static

IP header protocol type for UDP.

Definition at line 572 of file inet.h.

const uint8_t SCK_STATE_CLOSE_WAIT = 7
static

(both server and client) represents waiting for a connection termination request from the local user.

Definition at line 557 of file inet.h.

const uint8_t SCK_STATE_CLOSED = 0
static

(both server and client) represents no connection state at all.

Definition at line 550 of file inet.h.

const uint8_t SCK_STATE_CLOSING = 8
static

(both server and client) represents waiting for a connection termination request acknowledgment from the remote TCP.

Definition at line 558 of file inet.h.

const uint8_t SCK_STATE_ESTABLISHED = 4
static

(both server and client) represents an open connection, data received can be delivered to the user.

The normal state for the data transfer phase of the connection.

Definition at line 554 of file inet.h.

const uint8_t SCK_STATE_FIN_WAIT_1 = 5
static

(both server and client) represents waiting for a connection termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent.

Definition at line 555 of file inet.h.

const uint8_t SCK_STATE_FIN_WAIT_2 = 6
static

(both server and client) represents waiting for a connection termination request from the remote TCP.

Definition at line 556 of file inet.h.

const uint8_t SCK_STATE_LAST_ACK = 9
static

(both server and client) represents waiting for an acknowledgment of the connection termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request).

Definition at line 559 of file inet.h.

const uint8_t SCK_STATE_LISTEN = 1
static

(server) represents waiting for a connection request from any remote TCP and port.

Definition at line 551 of file inet.h.

const uint8_t SCK_STATE_RESOLVING = 11
static

IP Address is being resolved.

Definition at line 561 of file inet.h.

const uint8_t SCK_STATE_SYN_RECEIVED = 3
static

(server) represents waiting for a confirming connection request acknowledgment after having both received and sent a connection request.

Definition at line 553 of file inet.h.

const uint8_t SCK_STATE_SYN_SENT = 2
static

(client) represents waiting for a matching connection request after having sent a connection request.

Definition at line 552 of file inet.h.

const uint8_t SCK_STATE_TIME_WAIT = 10
static

(either server or client) represents waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request.

[According to RFC 793 a connection can stay in TIME-WAIT for a maximum of four minutes known as a MSL (maximum segment lifetime).]

Definition at line 560 of file inet.h.