Functions used by an application running of top of uIP.
Macros | |
#define | uip_abort() |
Abort the current connection. More... | |
#define | uip_aborted() |
Has the connection been aborted by the other end? More... | |
#define | uip_acked() |
Has previously sent data been acknowledged? More... | |
#define | uip_close() |
Close the current connection. More... | |
#define | uip_closed() |
Has the connection been closed by the other end? More... | |
#define | uip_connected() |
Has the connection just been connected? More... | |
#define | uip_datalen() |
The length of any incoming data that is currently available (if available) in the uip_appdata buffer. More... | |
#define | uip_initialmss() |
Get the initial maximum segment size (MSS) of the current connection. More... | |
#define | uip_mss() |
Get the current maximum segment size that can be sent on the current connection. More... | |
#define | uip_newdata() |
Is new incoming data available? More... | |
#define | uip_outstanding(conn) |
#define | uip_poll() |
Is the connection being polled by uIP? More... | |
#define | uip_restart() |
Restart the current connection, if is has previously been stopped with uip_stop(). More... | |
#define | uip_rexmit() |
Do we need to retransmit previously data? More... | |
#define | uip_stop() |
Tell the sending host to stop sending data. More... | |
#define | uip_stopped(conn) |
Find out if the current connection has been previously stopped with uip_stop(). More... | |
#define | uip_timedout() |
Has the connection timed out? More... | |
#define | uip_udp_bind(conn, port) |
Bind a UDP connection to a local port. More... | |
#define | uip_udp_remove(conn) |
Remove a UDP connection. More... | |
#define | uip_udp_send(len) |
Send a UDP datagram of length len on the current connection. More... | |
#define | uip_udpconnection() |
Is the current connection a UDP connection? More... | |
#define | uip_urgdatalen() |
The length of any out-of-band data (urgent data) that has arrived on the connection. More... | |
Functions | |
struct uip_conn * | uip_connect (uip_ipaddr_t *ripaddr, uint16_t port) |
Connect to a remote host using TCP. More... | |
void | uip_listen (uint16_t port) |
Start listening to the specified port. More... | |
CCIF void | uip_send (const void *data, int len) |
Send data on the current connection. More... | |
struct uip_udp_conn * | uip_udp_new (const uip_ipaddr_t *ripaddr, uint16_t rport) |
Set up a new UDP connection. More... | |
void | uip_unlisten (uint16_t port) |
Stop listening to the specified port. More... | |
#define uip_abort | ( | ) |
Abort the current connection.
This function will abort (reset) the current connection, and is usually used when an error has occurred that prevents using the uip_close() function.
Referenced by appcall(), httpd_appcall(), parse_statusline(), and websocket_http_client_appcall().
#define uip_aborted | ( | ) |
Has the connection been aborted by the other end?
Non-zero if the current connection has been aborted (reset) by the remote host.
Referenced by appcall(), httpd_appcall(), and websocket_http_client_appcall().
#define uip_acked | ( | ) |
Has previously sent data been acknowledged?
Will reduce to non-zero if the previously sent data has been acknowledged by the remote host. This means that the application can send new data.
Referenced by appcall(), data_is_sent_and_acked(), PT_THREAD(), and websocket_http_client_appcall().
#define uip_close | ( | ) |
Close the current connection.
This function will close the current connection in a nice way.
Referenced by appcall().
#define uip_closed | ( | ) |
Has the connection been closed by the other end?
Is non-zero if the connection has been closed by the remote host. The application may then do the necessary clean-ups.
Referenced by appcall(), httpd_appcall(), and websocket_http_client_appcall().
#define uip_connected | ( | ) |
Has the connection just been connected?
Reduces to non-zero if the current connection has been connected to a remote host. This will happen both if the connection has been actively opened (with uip_connect()) or passively opened (with uip_listen()).
Referenced by appcall(), httpd_appcall(), tcpip_uipcall(), and websocket_http_client_appcall().
#define uip_datalen | ( | ) |
The length of any incoming data that is currently available (if available) in the uip_appdata buffer.
The test function uip_data() must first be used to check if there is any data available at all.
Referenced by msg_for_me(), newdata(), parse_msg(), and PROCESS_THREAD().
#define uip_initialmss | ( | ) |
Get the initial maximum segment size (MSS) of the current connection.
#define uip_mss | ( | ) |
Get the current maximum segment size that can be sent on the current connection.
The current maximum segment size that can be sent on the connection is computed from the receiver's window and the MSS of the connection (which also is available by calling uip_initialmss()).
Referenced by acked(), data_is_sent_and_acked(), generate(), generate_file_stats(), make_addresses(), make_addrmap(), make_led_toggle(), make_neighbor(), make_neighbor_roomfor(), make_processes(), make_route(), make_routes_roomfor(), make_tcp_stats(), PT_THREAD(), senddata(), while(), and write_mss_error().
#define uip_newdata | ( | ) |
Is new incoming data available?
Will reduce to non-zero if there is new data for the application present at the uip_appdata pointer. The size of the data is available through the uip_len variable.
Referenced by appcall(), PROCESS_THREAD(), psock_newdata(), websocket_http_client_appcall(), and while().
#define uip_outstanding | ( | conn | ) |
Check if a connection has outstanding (i.e., unacknowledged) data.
conn | A pointer to the uip_conn structure for the connection. |
Referenced by make_tcp_stats(), and uip_process().
#define uip_poll | ( | ) |
Is the connection being polled by uIP?
Is non-zero if the reason the application is invoked is that the current connection has been idle for a while and should be polled.
The polling event can be used for sending data without having to wait for the remote host to send data.
Referenced by appcall(), httpd_appcall(), PROCESS_THREAD(), and websocket_http_client_appcall().
#define uip_restart | ( | ) |
Restart the current connection, if is has previously been stopped with uip_stop().
This function will open the receiver's window again so that we start receiving data for the current connection.
#define uip_rexmit | ( | ) |
Do we need to retransmit previously data?
Reduces to non-zero if the previously sent data has been lost in the network, and the application should retransmit it. The application should send the exact same data as it did the last time, using the uip_send() function.
Referenced by appcall(), data_is_sent_and_acked(), PT_THREAD(), and websocket_http_client_appcall().
#define uip_stop | ( | ) |
Tell the sending host to stop sending data.
This function will close our receiver's window so that we stop receiving data for the current connection.
#define uip_stopped | ( | conn | ) |
Find out if the current connection has been previously stopped with uip_stop().
Referenced by make_tcp_stats().
#define uip_timedout | ( | ) |
Has the connection timed out?
Non-zero if the current connection has been aborted due to too many retransmissions.
Referenced by appcall(), httpd_appcall(), and websocket_http_client_appcall().
Bind a UDP connection to a local port.
conn | A pointer to the uip_udp_conn structure for the connection. |
port | The local port number, in network byte order. |
#define uip_udp_remove | ( | conn | ) |
Remove a UDP connection.
conn | A pointer to the uip_udp_conn structure for the connection. |
Referenced by PROCESS_THREAD(), and udp_socket_close().
#define uip_udp_send | ( | len | ) |
Send a UDP datagram of length len on the current connection.
This function can only be called in response to a UDP event (poll or newdata). The data must be present in the uip_buf buffer, at the place pointed to by the uip_appdata pointer.
len | The length of the data in the uip_buf buffer. |
#define uip_udpconnection | ( | ) |
Is the current connection a UDP connection?
This function checks whether the current connection is a UDP connection.
#define uip_urgdatalen | ( | ) |
The length of any out-of-band data (urgent data) that has arrived on the connection.
struct uip_conn* uip_connect | ( | uip_ipaddr_t * | ripaddr, |
uint16_t | port | ||
) |
Connect to a remote host using TCP.
This function is used to start a new connection to the specified port on the specified host. It allocates a new connection identifier, sets the connection to the SYN_SENT state and sets the retransmission timer to 0. This will cause a TCP SYN segment to be sent out the next time this connection is periodically processed, which usually is done within 0.5 seconds after the call to uip_connect().
ripaddr | The IP address of the remote host. |
port | A 16-bit port number in network byte order. |
void uip_listen | ( | uint16_t | port | ) |
Start listening to the specified port.
port | A 16-bit port number in network byte order. |
CCIF void uip_send | ( | const void * | data, |
int | len | ||
) |
Send data on the current connection.
This function is used to send out a single segment of TCP data. Only applications that have been invoked by uIP for event processing can send data.
The amount of data that actually is sent out after a call to this function is determined by the maximum amount of data TCP allows. uIP will automatically crop the data so that only the appropriate amount of data is sent. The function uip_mss() can be used to query uIP for the amount of data that actually will be sent.
data | A pointer to the data which is to be sent. |
len | The maximum amount of data bytes to be sent. |
References MIN, NULL, uip_buf, UIP_BUFSIZE, UIP_LLH_LEN, uip_sappdata, uip_slen, and UIP_TCPIP_HLEN.
Referenced by data_is_sent_and_acked(), PT_THREAD(), send_discover(), send_request(), and senddata().
struct uip_udp_conn* uip_udp_new | ( | const uip_ipaddr_t * | ripaddr, |
uint16_t | rport | ||
) |
Set up a new UDP connection.
This function sets up a new UDP connection. The function will automatically allocate an unused local port for the new connection. However, another port can be chosen by using the uip_udp_bind() call, after the uip_udp_new() function has been called.
Example:
ripaddr | The IP address of the remote host. |
rport | The remote port number in network byte order. |
void uip_unlisten | ( | uint16_t | port | ) |
Stop listening to the specified port.
port | A 16-bit port number in network byte order. |
Referenced by eventhandler().