socket_info.h File Reference

Find & manage listen addresses. Contains code that initializes and handles server listen addresses lists (struct socket_info). It is used mainly on startup. More...

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

Include dependency graph for socket_info.h:

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

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_infofind_si (struct ip_addr *ip, unsigned short port, unsigned short proto)
int fix_all_socket_lists (void)
static struct socket_infoget_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_infogrep_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_infoudp_listen


Detailed Description

Find & manage listen addresses. Contains code that initializes and handles server listen addresses lists (struct socket_info). It is used mainly on startup.

Definition in file socket_info.h.


Define Documentation

#define MAX_SOCKET_STR   ( 4 + 1 + IP_ADDR_MAX_STR_SIZE+1+INT2STR_MAX_LEN+1)

Definition at line 313 of file socket_info.h.

Referenced by encode_branch_info(), and socket2str().

#define PROTO2UINT ( a,
b,
 ) 

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


Function Documentation

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]

int fix_all_socket_lists ( void   ) 

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]

struct socket_info* grep_sock_info ( str host,
unsigned short  port,
unsigned short  proto 
) [read]

static int next_proto ( unsigned short  proto  )  [inline, static]

helper function:

Returns:
next protocol, if the last one is reached return 0
Note:
useful for cycling on the supported protocols

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

Returns:
0 on success and -1 on failure

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.

Returns:
-1 on error, 0 on success

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   ) 

void print_all_socket_lists ( void   ) 

static char* socket2str ( struct socket_info sock,
char *  s,
int *  len 
) [inline, static]


Variable Documentation


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