#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/utsname.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include "globals.h"
#include "socket_info.h"
#include "dprint.h"
#include "mem/mem.h"
#include "ut.h"
#include "resolve.h"
#include "name_alias.h"

Go to the source code of this file.
Defines | |
| #define | sock_listadd(head, el) |
| #define | sock_listins(el, after) |
| #define | sock_listrm(head, el) |
Functions | |
| int | add_interfaces (char *if_name, int family, unsigned short port, unsigned short proto, struct socket_info **list) |
| 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 int | fix_socket_list (struct socket_info **list) |
| static void | free_sock_info (struct socket_info *si) |
| static char * | get_proto_name (unsigned short proto) |
| struct socket_info * | grep_sock_info (str *host, unsigned short port, unsigned short proto) |
| int | new_sock2list (char *name, unsigned short port, unsigned short proto, enum si_flags flags, struct socket_info **list) |
| static struct socket_info * | new_sock_info (char *name, unsigned short port, unsigned short proto, enum si_flags flags) |
| void | print_aliases (void) |
| void | print_all_socket_lists (void) |
Definition in file socket_info.c.
| #define sock_listadd | ( | head, | |||
| el | ) |
| #define sock_listins | ( | el, | |||
| after | ) |
Definition at line 80 of file socket_info.c.
| #define sock_listrm | ( | head, | |||
| el | ) |
Value:
do {\ if (*(head)==(el)) *(head)=(el)->next; \ if ((el)->next) (el)->next->prev=(el)->prev; \ if ((el)->prev) (el)->prev->next=(el)->next; \ }while(0)
Definition at line 94 of file socket_info.c.
Referenced by fix_socket_list().
| int add_interfaces | ( | char * | if_name, | |
| int | family, | |||
| unsigned short | port, | |||
| unsigned short | proto, | |||
| struct socket_info ** | list | |||
| ) |
Definition at line 372 of file socket_info.c.
References ip_addr2a(), LM_ERR, MAX, new_sock2list(), pkg_free, pkg_malloc, s, SI_IS_LO, SI_NONE, and sockaddr2ip_addr().
Referenced by fix_all_socket_lists(), and fix_socket_list().
| 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 int fix_socket_list | ( | struct socket_info ** | list | ) | [static] |
Definition at line 491 of file socket_info.c.
References add_alias(), add_interfaces(), ip_addr::addr, socket_info::address, socket_info::address_str, ip_addr::af, auto_aliases, socket_info::flags, free_sock_info(), get_proto_name(), hostent2ip_addr, int2str(), ip_addr2a(), ip_addr::len, _str::len, len, LM_DBG, LM_ERR, LM_WARN, MAX_PORT_LEN, socket_info::name, socket_info::next, pkg_free, pkg_malloc, port_no, socket_info::port_no, socket_info::port_no_str, socket_info::proto, PROTO_SCTP, PROTO_TCP, PROTO_TLS, resolvehost(), rev_resolvehost, _str::s, SI_IS_IP, SI_IS_MCAST, sock_listrm, socket_info::sock_str, socket2str(), and ip_addr::u.
Referenced by fix_all_socket_lists().
| static void free_sock_info | ( | struct socket_info * | si | ) | [static] |
Definition at line 132 of file socket_info.c.
References socket_info::address_str, socket_info::name, pkg_free, socket_info::port_no_str, and _str::s.
Referenced by fix_socket_list().
| static char* get_proto_name | ( | unsigned short | proto | ) | [static] |
Definition at line 143 of file socket_info.c.
References PROTO_NONE, PROTO_SCTP, PROTO_TCP, PROTO_TLS, and PROTO_UDP.
Referenced by fix_socket_list(), print_aliases(), 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().
| int new_sock2list | ( | char * | name, | |
| unsigned short | port, | |||
| unsigned short | proto, | |||
| enum si_flags | flags, | |||
| struct socket_info ** | list | |||
| ) |
Definition at line 309 of file socket_info.c.
References LM_ERR, new_sock_info(), and sock_listadd.
Referenced by add_interfaces(), and add_listen_iface().
| static struct socket_info* new_sock_info | ( | char * | name, | |
| unsigned short | port, | |||
| unsigned short | proto, | |||
| enum si_flags | flags | |||
| ) | [static, read] |
Definition at line 104 of file socket_info.c.
References socket_info::flags, _str::len, LM_ERR, socket_info::name, pkg_free, pkg_malloc, socket_info::port_no, socket_info::proto, _str::s, and socket_info::socket.
Referenced by new_sock2list().
| 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().
1.5.6