# uip/uip.c File Reference

## Detailed Description

The uIP TCP/IP stack code.

Author:
  Adam Dunkels <adam@dunkels.com>

Definition in file uip.c.

`#include "uip.h"`
`#include "uipopt.h"`
`#include "uip_arch.h"`
`#include <string.h>`

Go to the source code of this file.

## Defines

#define | DEBUG_PRINTF()
#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 | TCP_OPT_END 0
#define | TCP_OPT_NOOP 1
#define | TCP_OPT_MSS 2
#define | TCP_OPT_MSS_LEN 4
#define | ICMP_ECHO_REPLY 0
#define | ICMP_ECHO 8
#define | ICMP6_ECHO_REPLY 129
#define | ICMP6_ECHO 128
#define | ICMP6_NEIGHBOR_SOLICITATION 135
#define | ICMP6_NEIGHBOR_ADVERTISEMENT 136
#define | ICMP6_FLAG_S (1 << 6)
#define | ICMP6_OPTION_SOURCE_LINK_ADDRESS 1
#define | ICMP6_OPTION_TARGET_LINK_ADDRESS 2
#define | BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define | FBUF ((struct uip_tcpip_hdr *)&uip_reassbuf[0])
#define | ICMPBUF ((struct uip_icmpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define | UDPBUF ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])
#define | UIP_STAT(s)
#define | UIP_LOG(m)

## Functions

void | uip_setipid (u16_t id)
| uIP initialization function.
void | uip_add32 (u8_t *op32, u16_t op16)
| Carry out a 32-bit addition.
u16_t | uip_chksum (u16_t *buf, u16_t len)
| Calculate the Internet checksum over a buffer.
u16_t | uip_ipchksum (void)
| Calculate the IP header checksum of the packet header in uip_buf.
u16_t | uip_tcpchksum (void)
| Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
void | uip_init (void)
| uIP initialization function.
uip_conn * | uip_connect (uip_ipaddr_t *ripaddr, u16_t rport)
| Connect to a remote host using TCP.
uip_udp_conn * | uip_udp_new (uip_ipaddr_t *ripaddr, u16_t rport)
| Set up a new UDP connection.
void | uip_unlisten (u16_t port)
| Stop listening to the specified port.
void | uip_listen (u16_t port)
| Start listening to the specified port.
void | uip_process (u8_t flag)
u16_t | htons (u16_t val)
| Convert 16-bit quantity from host byte order to network byte order.
void | uip_send (const void *data, int len)
| Send data on the current connection.

## Variables

uip_ipaddr_t | uip_hostaddr
uip_ipaddr_t | uip_draddr
uip_ipaddr_t | uip_netmask
uip_eth_addr | uip_ethaddr = {{0,0,0,0,0,0}}
u8_t | uip_buf [UIP_BUFSIZE+2]
| The uIP packet buffer.
void * | uip_appdata
| Pointer to the application data in the packet buffer.
void * | uip_sappdata
u16_t | uip_len
| The length of the packet in the uip_buf buffer.
u16_t | uip_slen
u8_t | uip_flags
uip_conn * | uip_conn
| Pointer to the current TCP connection.
uip_conn | uip_conns [UIP_CONNS]
u16_t | uip_listenports [UIP_LISTENPORTS]
uip_udp_conn * | uip_udp_conn
| The current UDP connection.
uip_udp_conn | uip_udp_conns [UIP_UDP_CONNS]
u8_t | uip_acc32 [4]
| 4-byte array used for the 32-bit sequence number calculations.