udp_server.h File Reference

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

Include dependency graph for udp_server.h:

This graph shows which files directly or indirectly include this file:

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)


Function Documentation

int udp_init ( struct socket_info sock_info  ) 

Initialize a UDP socket, supports multicast, IPv4 and IPv6.

Parameters:
sock_info socket that should be bind
Returns:
zero on success, -1 otherwise

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.

See also:
receive_msg

main_loop

Returns:
-1 for errors

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.

See also:
msg_send
Parameters:
source send socket
buf sent data
len data length in bytes
to destination address
Returns:
-1 on error, the return value from sento on success

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().


Generated on Thu May 24 22:00:45 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6