Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Examples

tcpip.h File Reference


Detailed Description

Header for the Contiki/uIP interface.

Author:
Adam Dunkels <adam@sics.se>

Definition in file tcpip.h.

#include "contiki.h"
#include "net/uip.h"

Go to the source code of this file.

Data Structures

struct  tcpip_uipstate

TCP functions

#define tcp_markconn(conn, appstate)   tcp_attach(conn, appstate)
void tcp_attach (struct uip_conn *conn, void *appstate)
 Attach a TCP connection to the current process.
void tcp_listen (u16_t port)
 Open a TCP port.
void tcp_unlisten (u16_t port)
 Close a listening TCP port.
uip_conntcp_connect (u16_t *ripaddr, u16_t port, void *appstate)
 Open a TCP connection to the specified IP address and port.
void tcpip_poll_tcp (struct uip_conn *conn)
 Cause a specified TCP connection to be polled.

UDP functions

#define udp_markconn(conn, appstate)   udp_attach(conn, appstate)
#define udp_bind(conn, port)   uip_udp_bind(conn, port)
 Bind a UDP connection to a local port.
void udp_attach (struct uip_udp_conn *conn, void *appstate)
 Attach the current process to a UDP connection.
uip_udp_connudp_new (u16_t *ripaddr, u16_t port, void *appstate)
 Create a new UDP connection.
uip_udp_connudp_broadcast_new (u16_t port, void *appstate)
 Create a new UDP broadcast connection.
void tcpip_poll_udp (struct uip_udp_conn *conn)
 Cause a specified UDP connection to be polled.

TCP/IP packet processing

void tcpip_input (void)
 Deliver an incoming packet to the TCP/IP stack.
void tcpip_output (void)
void tcpip_set_forwarding (unsigned char f)

Defines

#define UIP_APPCALL   tcpip_uipcall
 The name of the application function that uIP should call in response to TCP/IP events.
#define UIP_UDP_APPCALL   tcpip_uipcall

Typedefs

typedef tcpip_uipstate uip_udp_appstate_t
 The type of the application state that is to be stored in the uip_conn structure.
typedef tcpip_uipstate uip_tcp_appstate_t
 The type of the application state that is to be stored in the uip_conn structure.

Functions

void tcpip_uipcall (void)

Variables

process_event_t tcpip_event
 The uIP event.


Define Documentation

#define udp_bind conn,
port   )     uip_udp_bind(conn, port)
 

Bind a UDP connection to a local port.

This function binds a UDP conncetion to a specified local port.

When a connction is created with udp_new(), it gets a local port number assigned automatically. If the application needs to bind the connection to a specified local port, this function should be used.

Note:
The port number must be provided in network byte order so a conversion with HTONS() usually is necessary.
Parameters:
conn A pointer to the UDP connection that is to be bound.
port The port number in network byte order to which to bind the connection.

Definition at line 259 of file tcpip.h.

Referenced by udp_broadcast_new().


Function Documentation

void tcpip_input void   ) 
 

Deliver an incoming packet to the TCP/IP stack.

This function is called by network device drivers to deliver an incoming packet to the TCP/IP stack. The incoming packet must be present in the uip_buf buffer, and the length of the packet must be in the global uip_len variable.

Examples:
example-packet-service.c.

Definition at line 333 of file tcpip.c.

References NULL, process_post_synch(), tcpip_input(), and uip_len.

Referenced by tcpip_input().

void tcpip_poll_udp struct uip_udp_conn conn  ) 
 

Cause a specified UDP connection to be polled.

This function causes uIP to poll the specified UDP connection. The function is used when the application has data that is to be sent immediately and do not wish to wait for the periodic uIP polling mechanism.

Parameters:
conn A pointer to the UDP connection that should be polled.
Examples:
example-program.c.

Definition at line 340 of file tcpip.c.

References process_post(), and tcpip_poll_udp().

Referenced by resolv_query(), and tcpip_poll_udp().

void udp_attach struct uip_udp_conn conn,
void *  appstate
 

Attach the current process to a UDP connection.

This function attaches the current process to a UDP connection. Each UDP connection must have a process attached to it in order for the process to be able to receive and send data over the connection. Additionally, this function can add a pointer with connection state to the connection.

Parameters:
conn A pointer to the UDP connection.
appstate An opaque pointer that will be passed to the process whenever an event occurs on the connection.

Definition at line 180 of file tcpip.c.

References uip_udp_conn::appstate, tcpip_uipstate::p, PROCESS_CURRENT, tcpip_uipstate::state, and udp_attach().

Referenced by udp_attach().

struct uip_udp_conn* udp_broadcast_new u16_t  port,
void *  appstate
 

Create a new UDP broadcast connection.

This function creates a new (link-local) broadcast UDP connection to a specified port.

Parameters:
port Port number in network byte order.
appstate Pointer to application defined data.
Returns:
A pointer to the newly created connection, or NULL if memory could not be allocated for the connection.
Examples:
example-program.c.

Definition at line 209 of file tcpip.c.

References NULL, udp_bind, udp_broadcast_new(), udp_new(), and uip_ipaddr.

Referenced by udp_broadcast_new().

struct uip_udp_conn* udp_new u16_t *  ripaddr,
u16_t  port,
void *  appstate
 

Create a new UDP connection.

This function creates a new UDP connection with the specified remote endpoint.

Note:
The port number must be provided in network byte order so a conversion with HTONS() usually is necessary.
See also:
udp_bind()
Parameters:
ripaddr Pointer to the IP address of the remote host.
port Port number in network byte order.
appstate Pointer to application defined data.
Returns:
A pointer to the newly created connection, or NULL if memory could not be allocated for the connection.

Definition at line 191 of file tcpip.c.

References uip_udp_conn::appstate, NULL, tcpip_uipstate::p, PROCESS_CURRENT, tcpip_uipstate::state, udp_new(), and uip_udp_new().

Referenced by PROCESS_THREAD(), udp_broadcast_new(), and udp_new().


Variable Documentation

process_event_t tcpip_event
 

The uIP event.

This event is posted to a process whenever a uIP event has occured.

Examples:
example-program.c, and example-psock-server.c.

Definition at line 44 of file tcpip.c.

Referenced by PROCESS_THREAD(), and tcpip_uipcall().


Generated on Thu Jun 22 17:45:43 2006 for Contiki 2.x by  doxygen 1.4.4