For examples how to use UDP and write applications that communicate using UDP see inet/demo/main_demo.c and inet/demo/udp_demo.c.
Definition in file udp.c.
Go to the source code of this file.
Functions | |
INT8 | udp_init (void) |
Initialize UDP socket pool. | |
INT8 | udp_getsocket (UINT8 tos, INT32(*listener)(INT8, UINT8, UINT32, UINT16, UINT16, UINT16), UINT8 opts) |
Allocate a free socket in UDP socket pool. | |
INT8 | udp_releasesocket (INT8 sochandle) |
Release a given socket. | |
INT8 | udp_open (INT8 sochandle, UINT16 locport) |
Open a given UDP socket for communication. | |
INT8 | udp_close (INT8 sochandle) |
Close given socket for communication. | |
INT16 | udp_send (INT8 sochandle, UINT32 remip, UINT16 remport, UINT8 *buf, UINT16 blen, UINT16 dlen) |
Send data to remote host using given UDP socket. | |
INT16 | process_udp_in (struct ip_frame *frame, UINT16 len) |
Process received UDP frame. | |
UINT16 | udp_getfreeport (void) |
Returns next free (not used) local port number. | |
Variables | |
ucb | udp_socket [NO_OF_UDPSOCKETS] |
UDP table holding socket parameters for every UDP socket. | |
udp_frame | received_udp_packet |
Used for storing field information about the received UDP packet. |
|
Definition at line 118 of file udp.c. References ucb::locport, ucb::opts, ucb::state, ucb::tos, UDP_OPT_CHECK_CS, UDP_OPT_SEND_CS, and UDP_STATE_FREE. |
|
Definition at line 175 of file udp.c. References ucb::locport, ucb::opts, ucb::state, ucb::tos, UDP_OPT_CHECK_CS, UDP_OPT_SEND_CS, UDP_STATE_CLOSED, and UDP_STATE_FREE. Referenced by bootpc_init(), dhcpc_init(), dns_init(), and tftps_init(). |
|
Definition at line 244 of file udp.c. References ucb::locport, ucb::opts, ucb::state, ucb::tos, UDP_OPT_CHECK_CS, UDP_OPT_SEND_CS, and UDP_STATE_FREE. |
|
Definition at line 291 of file udp.c. References ucb::locport, ucb::state, udp_getfreeport(), and UDP_STATE_OPENED. Referenced by bootpc_init(), dhcpc_init(), dns_init(), and tftps_init(). |
|
Definition at line 340 of file udp.c. References ucb::state, and UDP_STATE_CLOSED. |
|
Definition at line 395 of file udp.c. References ip_checksum(), ip_checksum_buf(), IP_UDP, ucb::locport, ucb::opts, process_ip_out(), ucb::state, ucb::tos, UDP_HLEN, UDP_OPT_SEND_CS, and UDP_STATE_OPENED. Referenced by bootpc_run(), dhcpc_send_message(), and get_host_by_name(). |
|
Definition at line 550 of file udp.c. References udp_frame::buf_index, ip_frame::buf_index, udp_frame::checksum, ip_frame::dip, udp_frame::dport, ip_checksum(), IP_UDP, ucb::locport, NETWORK_RECEIVE_INITIALIZE, ucb::opts, ip_frame::protocol, RECEIVE_NETWORK_B, ip_frame::sip, udp_frame::sport, ucb::state, udp_frame::tlen, UDP_EVENT_DATA, UDP_HLEN, UDP_OPT_CHECK_CS, and UDP_STATE_OPENED. |
|
Definition at line 684 of file udp.c. References ucb::locport, ucb::state, UDP_PORTS_END, and UDP_STATE_CLOSED. Referenced by udp_open(). |
|
UDP table is an array of ucb structures holding all of the necessary information about the state, listener, port numbers and other info about the UDP sockets opened. Number of UDP sockets that can be opened at any given time is defined by the NO_OF_UDPSOCKETS and may be changed in order to change the amount of used RAM memory. See ucb definition for more information about the structure itself. |
|
Various fields from the received UDP packet are stored in this variable. See udp_frame definition for struct information. |