#include <stdlib.h>
#include "ip_addr.h"
#include "dprint.h"
#include "globals.h"
#include "ut.h"


Go to the source code of this file.
Defines | |
| #define | MAX_SOCKET_STR ( 4 + 1 + IP_ADDR_MAX_STR_SIZE+1+INT2STR_MAX_LEN+1) |
| #define | PROTO2UINT(a, b, c) |
| #define | sock_str_len(_sock) |
Functions | |
| int | add_listen_iface (char *name, unsigned short port, unsigned short proto, enum si_flags flags) |
| struct socket_info * | find_si (struct ip_addr *ip, unsigned short port, unsigned short proto) |
| int | fix_all_socket_lists (void) |
| static struct socket_info * | get_first_socket (void) |
| gets first non-null socket_info structure (useful if for. e.g we are not listening on any udp sockets ) | |
| static struct socket_info ** | get_sock_info_list (unsigned short proto) |
| struct socket_info * | grep_sock_info (str *host, unsigned short port, unsigned short proto) |
| static int | next_proto (unsigned short proto) |
| helper function: | |
| static int | parse_phostport (char *s, int slen, char **host, int *hlen, int *port, int *proto) |
| parses [proto:]host[:port] where proto= udp|tcp|tls | |
| static int | parse_proto (unsigned char *s, long len, int *proto) |
| Sets protocol. | |
| void | print_aliases (void) |
| void | print_all_socket_lists (void) |
| static char * | socket2str (struct socket_info *sock, char *s, int *len) |
Variables | |
| struct socket_info * | udp_listen |
Definition in file socket_info.h.
| #define MAX_SOCKET_STR ( 4 + 1 + IP_ADDR_MAX_STR_SIZE+1+INT2STR_MAX_LEN+1) |
| #define PROTO2UINT | ( | a, | |||
| b, | |||||
| c | ) |
Value:
(( (((unsigned int)(a))<<16)+ \ (((unsigned int)(b))<<8)+ \ ((unsigned int)(c)) ) | 0x20202020)
Referenced by parse_proto().
| #define sock_str_len | ( | _sock | ) |
Value:
( 3 + 1*((_sock)->proto==PROTO_SCTP) + 1 + \ (_sock)->address_str.len + 1 + (_sock)->port_no_str.len)
Definition at line 314 of file socket_info.h.
Referenced by socket2str().
| int add_listen_iface | ( | char * | name, | |
| unsigned short | port, | |||
| unsigned short | proto, | |||
| enum si_flags | flags | |||
| ) |
Definition at line 329 of file socket_info.c.
References get_sock_info_list(), LM_ERR, new_sock2list(), next_proto(), port_no, PROTO_TLS, and PROTO_UDP.
Referenced by fix_all_socket_lists(), and main().
| struct socket_info* find_si | ( | struct ip_addr * | ip, | |
| unsigned short | port, | |||
| unsigned short | proto | |||
| ) | [read] |
Definition at line 270 of file socket_info.c.
References socket_info::address, get_sock_info_list(), ip_addr_cmp, LM_WARN, socket_info::next, next_proto(), socket_info::port_no, PROTO_NONE, PROTO_UDP, and udp_listen.
Referenced by fix_actions(), get_out_socket(), and get_send_socket().
| int fix_all_socket_lists | ( | void | ) |
Definition at line 706 of file socket_info.c.
References add_interfaces(), add_listen_iface(), fix_socket_list(), LM_ERR, PROTO_SCTP, PROTO_TCP, PROTO_TLS, PROTO_UDP, and udp_listen.
Referenced by main().
| static struct socket_info* get_first_socket | ( | void | ) | [static, read] |
gets first non-null socket_info structure (useful if for. e.g we are not listening on any udp sockets )
Definition at line 160 of file socket_info.h.
Referenced by child_init_callid(), global_init(), init_tags(), seas_exit(), seas_init(), and uac_init().
| static struct socket_info** get_sock_info_list | ( | unsigned short | proto | ) | [static, read] |
Definition at line 66 of file socket_info.h.
References LM_CRIT, PROTO_SCTP, PROTO_TCP, PROTO_TLS, and PROTO_UDP.
Referenced by add_listen_iface(), find_si(), grep_sock_info(), and print_all_socket_lists().
| struct socket_info* grep_sock_info | ( | str * | host, | |
| unsigned short | port, | |||
| unsigned short | proto | |||
| ) | [read] |
Definition at line 176 of file socket_info.c.
References socket_info::address, socket_info::address_str, socket_info::flags, get_sock_info_list(), ip_addr_cmp, _str::len, LM_DBG, LM_WARN, socket_info::name, socket_info::next, next_proto(), socket_info::port_no, PROTO_NONE, PROTO_UDP, _str::s, SI_IS_IP, str2ip6(), and udp_listen.
Referenced by ac_sl_msg(), after_loose(), after_strict(), build_dlg_t(), check_self(), create_socket_info(), dbrow2info(), decode_branch_info(), dp_apply_policy(), get_all_db_ucontacts(), get_sock_hdr(), mi_tm_uac_dlg(), mod_init(), and rls_notify_dlg().
| static int next_proto | ( | unsigned short | proto | ) | [inline, static] |
helper function:
Definition at line 98 of file socket_info.h.
References LM_ERR, PROTO_NONE, PROTO_SCTP, PROTO_TCP, PROTO_TLS, and PROTO_UDP.
Referenced by add_listen_iface(), find_si(), grep_sock_info(), and print_all_socket_lists().
| static int parse_phostport | ( | char * | s, | |
| int | slen, | |||
| char ** | host, | |||
| int * | hlen, | |||
| int * | port, | |||
| int * | proto | |||
| ) | [inline, static] |
parses [proto:]host[:port] where proto= udp|tcp|tls
Definition at line 226 of file socket_info.h.
References _str::len, LM_ERR, parse_proto(), _str::s, second, and str2int().
Referenced by build_dlg_t(), create_socket_info(), dbrow2info(), decode_branch_info(), dp_apply_policy(), fix_actions(), fixup_phostport2proxy(), get_all_db_ucontacts(), get_natping_socket(), get_sock_hdr(), main(), mi_tm_uac_dlg(), and rls_notify_dlg().
| static int parse_proto | ( | unsigned char * | s, | |
| long | len, | |||
| int * | proto | |||
| ) | [inline, static] |
Sets protocol.
Definition at line 179 of file socket_info.h.
References PROTO2UINT, PROTO_NONE, PROTO_SCTP, PROTO_TCP, PROTO_TLS, and PROTO_UDP.
Referenced by parse_phostport().
| void print_aliases | ( | void | ) |
Definition at line 819 of file socket_info.c.
References host_alias::alias, aliases, get_proto_name(), _str::len, host_alias::next, host_alias::port, host_alias::proto, and _str::s.
Referenced by main().
| void print_all_socket_lists | ( | void | ) |
Definition at line 800 of file socket_info.c.
References socket_info::address_str, socket_info::flags, get_proto_name(), get_sock_info_list(), socket_info::name, socket_info::next, next_proto(), socket_info::port_no_str, socket_info::proto, PROTO_UDP, _str::s, and SI_IS_MCAST.
Referenced by main().
| static char* socket2str | ( | struct socket_info * | sock, | |
| char * | s, | |||
| int * | len | |||
| ) | [inline, static] |
Definition at line 317 of file socket_info.h.
References socket_info::address_str, buf, _str::len, LM_CRIT, LM_DBG, LM_ERR, MAX_SOCKET_STR, socket_info::port_no_str, socket_info::proto, PROTO_SCTP, PROTO_TCP, PROTO_TLS, PROTO_UDP, _str::s, and sock_str_len.
Referenced by encode_branch_info(), and fix_socket_list().
| struct socket_info* udp_listen |
Definition at line 257 of file main.c.
Referenced by find_si(), fix_all_socket_lists(), grep_sock_info(), init_multi_proc_support(), process_bind_action(), and send_sockinfo().
1.5.6