#include <sys/types.h>#include <sys/socket.h>#include "ip_addr.h"


Go to the source code of this file.
Functions | |
| int | udp_init (struct socket_info *si) |
| int | udp_rcv_loop (void) |
| int | udp_send (struct socket_info *source, char *buf, unsigned len, union sockaddr_union *to) |
| int udp_init | ( | struct socket_info * | sock_info | ) |
Initialize a UDP socket, supports multicast, IPv4 and IPv6.
| sock_info | socket that should be bind |
Definition at line 257 of file udp_server.c.
References socket_info::address, socket_info::address_str, AF2PF, socket_info::flags, init_su(), LM_ERR, LM_WARN, socket_info::port_no, probe_max_receive_buffer(), socket_info::proto, PROTO_UDP, _str::s, sockaddr_union::s, SI_IS_MCAST, sockaddru_len, socket_info::socket, socket_info::su, and tos.
Referenced by main_loop().
| int udp_rcv_loop | ( | void | ) |
Main UDP receiver loop, processes data from the network, does some error checking and save it in an allocated buffer. This data is then forwarded to the receive_msg function. If an dynamic buffer is used, the buffer must be freed in later steps.
Definition at line 375 of file udp_server.c.
References socket_info::address, bind_address, receive_info::bind_address, BUF_SIZE, receive_info::dst_ip, receive_info::dst_port, ip_addr2a(), LM_DBG, LM_ERR, LM_INFO, LM_WARN, MIN_UDP_PACKET, pkg_free, pkg_malloc, socket_info::port_no, receive_info::proto, receive_info::proto_reserved1, receive_info::proto_reserved2, PROTO_UDP, receive_msg(), sockaddru_len, socket_info::socket, receive_info::src_ip, receive_info::src_port, receive_info::src_su, socket_info::su, su2ip_addr(), and su_getport().
Referenced by main_loop().
| int udp_send | ( | struct socket_info * | source, | |
| char * | buf, | |||
| unsigned | len, | |||
| union sockaddr_union * | to | |||
| ) |
Main UDP send function, called from msg_send.
| source | send socket | |
| buf | sent data | |
| len | data length in bytes | |
| to | destination address |
Definition at line 469 of file udp_server.c.
References LM_CRIT, LM_ERR, LM_INFO, sockaddr_union::s, sockaddru_len, and socket_info::socket.
Referenced by msg_send(), and nh_timer().
1.5.6