Uip


Files

file  uip.c
file  uip.h

Modules

 uIP configuration functions
 uIP initialization functions
 uIP device driver functions
 uIP application functions
 uIP conversion functions
 uIP Address Resolution Protocol
 Architecture specific uIP functions

Data Structures

struct  uip_conn
struct  uip_stats
struct  uip_tcpip_hdr
struct  uip_icmpip_hdr
struct  uip_udpip_hdr

Defines

#define TCP_FIN   0x01
#define TCP_SYN   0x02
#define TCP_RST   0x04
#define TCP_PSH   0x08
#define TCP_ACK   0x10
#define TCP_URG   0x20
#define TCP_CTL   0x3f
#define ICMP_ECHO_REPLY   0
#define ICMP_ECHO   8
#define BUF   ((uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define FBUF   ((uip_tcpip_hdr *)&uip_reassbuf[0])
#define ICMPBUF   ((uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define UDPBUF   ((uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define UIP_STAT(s)
#define UIP_LOG(m)
#define UIP_ACKDATA   1
#define UIP_NEWDATA   2
#define UIP_REXMIT   4
#define UIP_POLL   8
#define UIP_CLOSE   16
#define UIP_ABORT   32
#define UIP_CONNECTED   64
#define UIP_TIMEDOUT   128
#define UIP_DATA   1
#define UIP_TIMER   2
#define CLOSED   0
#define SYN_RCVD   1
#define SYN_SENT   2
#define ESTABLISHED   3
#define FIN_WAIT_1   4
#define FIN_WAIT_2   5
#define CLOSING   6
#define TIME_WAIT   7
#define LAST_ACK   8
#define TS_MASK   15
#define UIP_STOPPED   16
#define UIP_TCPIP_HLEN   40
#define UIP_PROTO_ICMP   1
#define UIP_PROTO_TCP   6
#define UIP_PROTO_UDP   17

Functions

void uip_init (void)
void uip_unlisten (u16_t port)
void uip_listen (u16_t port)
static void uip_add_rcv_nxt (u16_t n)
void uip_process (u8_t flag)
u16_t htons (u16_t val)

Variables

u16_t uip_hostaddr [2]
u16_t uip_arp_draddr [2]
u16_t uip_arp_netmask [2]
u8_t uip_buf [UIP_BUFSIZE+2]
volatile u8_tuip_appdata
volatile u8_tuip_sappdata
volatile u16_t uip_len
volatile u16_t uip_slen
volatile u8_t uip_flags
uip_connuip_conn
uip_conn uip_conns [UIP_CONNS]
u16_t uip_listenports [UIP_LISTENPORTS]
static u16_t ipid
static u8_t iss [4]
volatile u8_t uip_acc32 [4]
static u8_t c
static u8_t opt
static u16_t tmp16
volatile u8_tuip_appdata
volatile u8_tuip_sappdata
volatile u16_t uip_len
volatile u16_t uip_slen
uip_connuip_conn
uip_conn uip_conns [UIP_CONNS]
uip_stats uip_stat
volatile u8_t uip_flags
u16_t uip_hostaddr [2]
uip_eth_addr uip_eth_hdr::src
u16_t uip_eth_hdr::type
u16_t uip_arp_draddr [2]
u16_t uip_arp_netmask [2]


Define Documentation

#define BUF   ((uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
 

Definition at line 156 of file uip.c.

#define CLOSED   0
 

Definition at line 963 of file uip.h.

Referenced by uip_init(), and uip_process().

#define CLOSING   6
 

Definition at line 969 of file uip.h.

Referenced by uip_process().

#define ESTABLISHED   3
 

Definition at line 966 of file uip.h.

#define FBUF   ((uip_tcpip_hdr *)&uip_reassbuf[0])
 

Definition at line 157 of file uip.c.

#define FIN_WAIT_1   4
 

Definition at line 967 of file uip.h.

Referenced by uip_process().

#define FIN_WAIT_2   5
 

Definition at line 968 of file uip.h.

Referenced by uip_process().

#define ICMP_ECHO   8
 

Definition at line 153 of file uip.c.

#define ICMP_ECHO_REPLY   0
 

Definition at line 152 of file uip.c.

#define ICMPBUF   ((uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN])
 

Definition at line 158 of file uip.c.

#define LAST_ACK   8
 

Definition at line 971 of file uip.h.

Referenced by uip_process().

#define SYN_RCVD   1
 

Definition at line 964 of file uip.h.

Referenced by uip_process().

#define SYN_SENT   2
 

Definition at line 965 of file uip.h.

Referenced by uip_init(), and uip_process().

#define TCP_ACK   0x10
 

Definition at line 148 of file uip.c.

Referenced by uip_process().

#define TCP_CTL   0x3f
 

Definition at line 150 of file uip.c.

#define TCP_FIN   0x01
 

Definition at line 144 of file uip.c.

#define TCP_PSH   0x08
 

Definition at line 147 of file uip.c.

#define TCP_RST   0x04
 

Definition at line 146 of file uip.c.

Referenced by uip_process().

#define TCP_SYN   0x02
 

Definition at line 145 of file uip.c.

#define TCP_URG   0x20
 

Definition at line 149 of file uip.c.

#define TIME_WAIT   7
 

Definition at line 970 of file uip.h.

Referenced by uip_init(), and uip_process().

#define TS_MASK   15
 

Definition at line 972 of file uip.h.

Referenced by uip_process().

#define UDPBUF   ((uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
 

Definition at line 159 of file uip.c.

#define UIP_ABORT   32
 

Definition at line 926 of file uip.h.

#define UIP_ACKDATA   1
 

Definition at line 910 of file uip.h.

#define UIP_CLOSE   16
 

Definition at line 921 of file uip.h.

#define UIP_CONNECTED   64
 

Definition at line 931 of file uip.h.

#define UIP_DATA   1
 

Definition at line 952 of file uip.h.

#define UIP_LOG  ) 
 

Definition at line 173 of file uip.c.

#define UIP_NEWDATA   2
 

Definition at line 914 of file uip.h.

#define UIP_POLL   8
 

Definition at line 918 of file uip.h.

#define UIP_PROTO_ICMP   1
 

Definition at line 1046 of file uip.h.

#define UIP_PROTO_TCP   6
 

Definition at line 1047 of file uip.h.

#define UIP_PROTO_UDP   17
 

Definition at line 1048 of file uip.h.

#define UIP_REXMIT   4
 

Definition at line 916 of file uip.h.

Referenced by uip_process().

#define UIP_STAT  ) 
 

Definition at line 165 of file uip.c.

Referenced by uip_process().

#define UIP_STOPPED   16
 

Definition at line 974 of file uip.h.

#define UIP_TCPIP_HLEN   40
 

Definition at line 976 of file uip.h.

#define UIP_TIMEDOUT   128
 

Definition at line 936 of file uip.h.

Referenced by uip_process().

#define UIP_TIMER   2
 

Definition at line 956 of file uip.h.

Referenced by uip_process().


Function Documentation

u16_t htons u16_t  val  ) 
 

Convert 16-bit quantity from host byte order to network byte order.

This function is primarily used for converting variables from host byte order to network byte order. For converting constants to network byte order, use the HTONS() macro instead.

Definition at line 1576 of file uip.c.

Referenced by main(), uip_init(), and uip_tcpchksum().

static void uip_add_rcv_nxt u16_t  n  )  [static]
 

Definition at line 470 of file uip.c.

References uip_conn::rcv_nxt, and uip_add32().

void uip_init void   ) 
 

uIP initialization function.

This function should be called at boot up to initilize the uIP TCP/IP stack.

Definition at line 178 of file uip.c.

References CLOSED, htons(), HTONS, uip_conn::initialmss, uip_conn::len, uip_conn::lport, uip_conn::mss, uip_conn::nrtx, uip_conn::ripaddr, uip_conn::rport, uip_conn::rto, uip_conn::sa, uip_conn::snd_nxt, uip_conn::sv, SYN_SENT, uip_conn::tcpstateflags, TIME_WAIT, uip_conn::timer, UIP_ACTIVE_OPEN, uip_connect(), UIP_FIXEDADDR, UIP_LISTENPORTS, UIP_RTO, UIP_TCP_MSS, and uip_udp_new().

Referenced by main().

void uip_listen u16_t  port  ) 
 

Start listening to the specified port.

Note:
Since this function expects the port number in network byte order, a conversion using HTONS() or htons() is necessary.

Parameters:
port A 16-bit port number in network byte order.

Definition at line 326 of file uip.c.

Referenced by example5_init().

void uip_process u8_t  flag  ) 
 

Definition at line 480 of file uip.c.

References BUF, CLOSED, CLOSING, FIN_WAIT_1, FIN_WAIT_2, LAST_ACK, SYN_RCVD, SYN_SENT, uip_stats::tcp, TCP_ACK, TCP_RST, uip_conn::tcpstateflags, TIME_WAIT, uip_conn::timer, TS_MASK, UIP_ACTIVE_OPEN, UIP_APPCALL, UIP_LLH_LEN, UIP_MAXRTX, UIP_MAXSYNRTX, uip_outstanding, UIP_REASSEMBLY, UIP_REXMIT, UIP_RTO, UIP_STAT, UIP_TIME_WAIT_TIMEOUT, UIP_TIMEDOUT, and UIP_TIMER.

void uip_unlisten u16_t  port  ) 
 

Stop listening to the specified port.

Note:
Since this function expects the port number in network byte order, a conversion using HTONS() or htons() is necessary.

Parameters:
port A 16-bit port number in network byte order.

Definition at line 315 of file uip.c.


Variable Documentation

u8_t c [static]
 

Definition at line 140 of file uip.c.

Referenced by _TxStr_P().

u16_t ipid [static]
 

Definition at line 126 of file uip.c.

u8_t iss[4] [static]
 

Definition at line 130 of file uip.c.

u8_t opt [static]
 

Definition at line 140 of file uip.c.

struct uip_eth_addr uip_eth_hdr::src [inherited]
 

Definition at line 72 of file uip_arp.h.

u16_t tmp16 [static]
 

Definition at line 141 of file uip.c.

u16_t uip_eth_hdr::type [inherited]
 

Definition at line 73 of file uip_arp.h.

volatile u8_t uip_acc32[4]
 

4-byte array used for the 32-bit sequence number calculations.

Definition at line 139 of file uip.c.

Referenced by uip_add32().

volatile u8_t* uip_appdata
 

Pointer to the application data in the packet buffer.

This pointer points to the application data when the application is called. If the application wishes to send data, the application may use this space to write the data into before calling uip_send().

Definition at line 92 of file uip.c.

Referenced by uip_tcpchksum().

volatile u8_t* uip_appdata
 

Pointer to the application data in the packet buffer.

This pointer points to the application data when the application is called. If the application wishes to send data, the application may use this space to write the data into before calling uip_send().

Definition at line 92 of file uip.c.

Referenced by uip_tcpchksum().

u16_t uip_arp_draddr[2]
 

Definition at line 87 of file uip.c.

Referenced by uip_arp_out().

u16_t uip_arp_draddr[2]
 

Definition at line 87 of file uip.c.

Referenced by uip_arp_out().

u16_t uip_arp_netmask[2]
 

Definition at line 87 of file uip.c.

Referenced by uip_arp_ipin(), and uip_arp_out().

u16_t uip_arp_netmask[2]
 

Definition at line 87 of file uip.c.

Referenced by uip_arp_ipin(), and uip_arp_out().

u8_t uip_buf[UIP_BUFSIZE+2]
 

The uIP packet buffer.

The uip_buf array is used to hold incoming and outgoing packets. The device driver should place incoming data into this buffer. When sending data, the device driver should read the link level headers and the TCP/IP headers from this buffer. The size of the link level headers is configured by the UIP_LLH_LEN define.

Note:
The application data need not be placed in this buffer, so the device driver must read it from the place pointed to by the uip_appdata pointer as illustrated by the following example:
 void
 devicedriver_send(void)
 {
    hwsend(&uip_buf[0], UIP_LLH_LEN);
    hwsend(&uip_buf[UIP_LLH_LEN], 40);
    hwsend(uip_appdata, uip_len - 40 - UIP_LLH_LEN);
 }

Definition at line 90 of file uip.c.

struct uip_conn* uip_conn
 

Definition at line 111 of file uip.c.

struct uip_conn* uip_conn
 

Definition at line 111 of file uip.c.

struct uip_conn uip_conns[UIP_CONNS]
 

Definition at line 114 of file uip.c.

struct uip_conn uip_conns[UIP_CONNS]
 

Definition at line 114 of file uip.c.

volatile u8_t uip_flags
 

Definition at line 108 of file uip.c.

volatile u8_t uip_flags
 

Definition at line 108 of file uip.c.

u16_t uip_hostaddr[2]
 

Definition at line 86 of file uip.c.

Referenced by uip_arp_arpin(), uip_arp_ipin(), and uip_arp_out().

u16_t uip_hostaddr[2]
 

Definition at line 86 of file uip.c.

Referenced by uip_arp_arpin(), uip_arp_ipin(), and uip_arp_out().

volatile u16_t uip_len
 

Definition at line 103 of file uip.c.

Referenced by main(), udp_app(), uip_arp_arpin(), and uip_arp_ipin().

volatile u16_t uip_len
 

Definition at line 103 of file uip.c.

Referenced by main(), udp_app(), uip_arp_arpin(), and uip_arp_ipin().

u16_t uip_listenports[UIP_LISTENPORTS]
 

Definition at line 117 of file uip.c.

volatile u8_t* uip_sappdata
 

Definition at line 94 of file uip.c.

volatile u8_t* uip_sappdata
 

Definition at line 94 of file uip.c.

volatile u16_t uip_slen
 

Definition at line 103 of file uip.c.

volatile u16_t uip_slen
 

Definition at line 103 of file uip.c.

struct uip_stats uip_stat
 

The uIP TCP/IP statistics.

This is the variable in which the uIP TCP/IP statistics are gathered.


Generated on Fri Jan 6 22:23:19 2006 for EtherProgs by  doxygen 1.4.5