Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

ip_addr.h File Reference

#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include "str.h"
#include "compiler_opt.h"
#include "ut.h"
#include "dprint.h"

Go to the source code of this file.

Data Structures

struct  ip_addr
struct  net
union  sockaddr_union
struct  addr_info
struct  socket_info
struct  receive_info
struct  dest_info
struct  name_lst
struct  socket_id

Defines

#define PROTO_LAST   PROTO_SCTP
#define sockaddru_len(su)   sizeof(struct sockaddr_in)
#define hostent2ip_addr(ip, he, addr_no)
#define AF2PF(af)   (((af)==AF_INET)?PF_INET:(af))
#define ip_addr_cmp(ip1, ip2)
#define ip_addr2su   init_su
#define IP6_MAX_STR_SIZE   39
#define IP4_MAX_STR_SIZE   15
#define IP_ADDR_MAX_STR_SIZE   (IP6_MAX_STR_SIZE+1)
#define SU2A_MAX_STR_SIZE
#define init_dest_info(dst)

Enumerations

enum  sip_protos {
  PROTO_NONE, PROTO_UDP, PROTO_TCP, PROTO_TLS,
  PROTO_SCTP
}
enum  si_flags {
  SI_NONE = 0, SI_IS_IP = 1, SI_IS_LO = 2, SI_IS_MCAST = 4,
  SI_IS_ANY = 8, SI_IS_MHOMED = 16
}

Functions

netmk_net (struct ip_addr *ip, struct ip_addr *mask)
netmk_net_bitlen (struct ip_addr *ip, unsigned int bitlen)
void print_ip (char *prefix, struct ip_addr *ip, char *suffix)
void stdout_print_ip (struct ip_addr *ip)
void print_net (struct net *net)
int ip_addr_any (struct ip_addr *ip)
int ip_addr_loopback (struct ip_addr *ip)
void ip_addr_mk_any (int af, struct ip_addr *ip)
int matchnet (struct ip_addr *ip, struct net *net)
void sockaddr2ip_addr (struct ip_addr *ip, struct sockaddr *sa)
int su_cmp (union sockaddr_union *s1, union sockaddr_union *s2)
unsigned short su_getport (union sockaddr_union *su)
void su_setport (union sockaddr_union *su, unsigned short port)
void su2ip_addr (struct ip_addr *ip, union sockaddr_union *su)
int init_su (union sockaddr_union *su, struct ip_addr *ip, unsigned short port)
int hostent2su (union sockaddr_union *su, struct hostent *he, unsigned int idx, unsigned short port)
int ip4tosbuf (unsigned char *ip4, char *buff, int len)
int ip_addr2sbuf (struct ip_addr *ip, char *buff, int len)
char * ip_addr2a (struct ip_addr *ip)
char * su2a (union sockaddr_union *su, int su_len)
hostent * ip_addr2he (str *name, struct ip_addr *ip)
void init_dst_from_rcv (struct dest_info *dst, struct receive_info *rcv)


Define Documentation

#define AF2PF af   )     (((af)==AF_INET)?PF_INET:(af))
 

Definition at line 203 of file ip_addr.h.

Referenced by init_tcpudp_sock().

#define hostent2ip_addr ip,
he,
addr_no   ) 
 

Value:

do{ \
                (ip)->af=(he)->h_addrtype; \
                (ip)->len=(he)->h_length;  \
                memcpy((ip)->u.addr, (he)->h_addr_list[(addr_no)], (ip)->len); \
        }while(0)

Definition at line 187 of file ip_addr.h.

Referenced by find_socket(), fix_actions(), and fix_hostname().

#define init_dest_info dst   ) 
 

Value:

do{ \
                memset((dst), 0, sizeof(struct dest_info)); \
        } while(0)

Definition at line 735 of file ip_addr.h.

Referenced by add_uac(), do_action(), forward_reply(), natping(), ping_contact_f(), pingClients(), sl_send_reply(), t_forward_cancel(), t_relay_to(), and uri2dst().

#define IP4_MAX_STR_SIZE   15
 

Definition at line 492 of file ip_addr.h.

Referenced by ip4tosbuf().

#define IP6_MAX_STR_SIZE   39
 

Definition at line 491 of file ip_addr.h.

#define ip_addr2su   init_su
 

Definition at line 415 of file ip_addr.h.

#define ip_addr_cmp ip1,
ip2   ) 
 

Value:

(((ip1)->af==(ip2)->af)&& \
                (memcmp((ip1)->u.addr, (ip2)->u.addr, (ip1)->len)==0))

Definition at line 324 of file ip_addr.h.

Referenced by domain_exists(), find_si(), ipmatch(), lump_check_opt(), si_hname_cmp(), and tls_lookup_cfg().

#define IP_ADDR_MAX_STR_SIZE   (IP6_MAX_STR_SIZE+1)
 

Definition at line 655 of file ip_addr.h.

Referenced by parse_ipv6().

#define PROTO_LAST   PROTO_SCTP
 

Definition at line 55 of file ip_addr.h.

#define sockaddru_len su   )     sizeof(struct sockaddr_in)
 

Definition at line 179 of file ip_addr.h.

Referenced by get_out_socket(), handle_ctrl_dgram(), handle_new_connect(), init_tcpudp_sock(), udp_rcv_loop(), and udp_send().

#define SU2A_MAX_STR_SIZE
 

Value:

(IP6_MAX_STR_SIZE + 2 /* [] */+\
                                                                1 /* : */ + USHORT2SBUF_MAX_LEN + 1 /* \0 */)

Definition at line 674 of file ip_addr.h.


Enumeration Type Documentation

enum si_flags
 

Enumeration values:
SI_NONE 
SI_IS_IP 
SI_IS_LO 
SI_IS_MCAST 
SI_IS_ANY 
SI_IS_MHOMED 

Definition at line 91 of file ip_addr.h.

Referenced by add_interfaces().

enum sip_protos
 

Enumeration values:
PROTO_NONE 
PROTO_UDP 
PROTO_TCP 
PROTO_TLS 
PROTO_SCTP 

Definition at line 54 of file ip_addr.h.

Referenced by get_proto(), get_uri_send_info(), uri2dst(), and uri2proxy().


Function Documentation

int hostent2su union sockaddr_union su,
struct hostent *  he,
unsigned int  idx,
unsigned short  port
[inline, static]
 

Definition at line 456 of file ip_addr.h.

References idx, L_CRIT, LOG, sockaddr_union::s, and sockaddr_union::sin.

Referenced by init_tcpudp_sock(), natping_contact(), pingClients(), proxy2su(), sip_hostport2su(), and update_sock_struct_from_via().

void init_dst_from_rcv struct dest_info dst,
struct receive_info rcv
[inline, static]
 

Definition at line 743 of file ip_addr.h.

References receive_info::bind_address, dest_info::id, receive_info::proto, dest_info::proto, receive_info::proto_reserved1, dest_info::send_sock, receive_info::src_su, and dest_info::to.

Referenced by create_via(), and http_xmlrpc2sip().

int init_su union sockaddr_union su,
struct ip_addr ip,
unsigned short  port
[inline, static]
 

Definition at line 420 of file ip_addr.h.

References ip_addr::addr, ip_addr::af, L_CRIT, ip_addr::len, LOG, sockaddr_union::s, sockaddr_union::sin, and ip_addr::u.

Referenced by dns_sip_resolve2su(), and nhop_type().

int ip4tosbuf unsigned char *  ip4,
char *  buff,
int  len
[inline, static]
 

Definition at line 572 of file ip_addr.h.

References IP4_MAX_STR_SIZE, len, and unlikely.

Referenced by ip_addr2sbuf(), and su2a().

char* ip_addr2a struct ip_addr ip  )  [inline, static]
 

Definition at line 659 of file ip_addr.h.

References ip_addr2sbuf(), and len.

Referenced by add_interfaces(), allow_trusted(), append_fixed_vars(), check_via_address(), comp_ip(), create_rcv_uri(), create_via(), encode2format(), fix_actions(), fix_hostname(), fix_nated_contact_f(), fix_nated_sdp_f(), FixContact(), fmt2strar(), force_rtp_proxy(), force_rtp_proxy1_f(), forward_request(), http_xmlrpc2sip(), io_listen_who_rpc(), ipmatch(), load_gws(), match_hash_table(), nhop_type(), ops_check_avp(), ops_write_avp(), pike_check_req(), received_builder(), rtpproxy_answer1_f(), rtpproxy_offer1_f(), sel_alt(), sel_rewrite_contact(), select_ip_port(), t_send_branch(), tls_accept(), tls_connect(), tls_domain_str(), udp_rcv_loop(), udp_send(), UseMediaProxy(), xl_get_srcip(), and yyparse().

struct hostent* ip_addr2he str name,
struct ip_addr ip
[inline, static]
 

Definition at line 709 of file ip_addr.h.

References ip_addr::addr, ip_addr::af, ip_addr::len, _str::len, _str::s, str, and ip_addr::u.

Referenced by _resolvehost(), and srv_sip_resolvehost().

int ip_addr2sbuf struct ip_addr ip,
char *  buff,
int  len
[inline, static]
 

Definition at line 633 of file ip_addr.h.

References ip_addr::addr, ip_addr::af, ip4tosbuf(), L_CRIT, len, LOG, and ip_addr::u.

Referenced by ip_addr2a().

int ip_addr_any struct ip_addr ip  )  [inline, static]
 

Definition at line 223 of file ip_addr.h.

References ip_addr::addr32, ip_addr::len, and ip_addr::u.

Referenced by fix_hostname().

int ip_addr_loopback struct ip_addr ip  )  [inline, static]
 

Definition at line 239 of file ip_addr.h.

References ip_addr::addr32, ip_addr::af, and ip_addr::u.

Referenced by fix_hostname().

void ip_addr_mk_any int  af,
struct ip_addr ip
[inline, static]
 

Definition at line 253 of file ip_addr.h.

References ip_addr::addr32, ip_addr::addrl, ip_addr::af, ip_addr::len, likely, and ip_addr::u.

int matchnet struct ip_addr ip,
struct net net
[inline, static]
 

Definition at line 279 of file ip_addr.h.

References ip_addr::addr32, ip_addr::af, net::ip, ip_addr::len, net::mask, and ip_addr::u.

Referenced by comp_ip().

struct net* mk_net struct ip_addr ip,
struct ip_addr mask
 

Definition at line 46 of file ip_addr.c.

References ip_addr::addr32, ip_addr::af, net::ip, L_CRIT, L_WARN, ip_addr::len, LOG, net::mask, mask, pkg_malloc, print_ip(), and ip_addr::u.

Referenced by mk_net_bitlen(), and yyparse().

struct net* mk_net_bitlen struct ip_addr ip,
unsigned int  bitlen
 

Definition at line 84 of file ip_addr.c.

References ip_addr::addr, ip_addr::af, L_CRIT, ip_addr::len, LOG, mask, mk_net(), and ip_addr::u.

Referenced by yyparse().

void print_ip char *  prefix,
struct ip_addr ip,
char *  suffix
 

Definition at line 106 of file ip_addr.c.

References ip_addr::addr, ip_addr::addr16, ip_addr::af, DBG, s, and ip_addr::u.

Referenced by mk_net(), print_action(), print_expr(), and print_net().

void print_net struct net net  ) 
 

Definition at line 169 of file ip_addr.c.

References net::ip, L_WARN, LOG, net::mask, and print_ip().

Referenced by print_expr().

void sockaddr2ip_addr struct ip_addr ip,
struct sockaddr *  sa
[inline, static]
 

Definition at line 300 of file ip_addr.h.

References ip_addr::addr, ip_addr::af, L_CRIT, ip_addr::len, LOG, and ip_addr::u.

Referenced by add_interfaces().

void stdout_print_ip struct ip_addr ip  ) 
 

Definition at line 140 of file ip_addr.c.

References ip_addr::addr, ip_addr::addr16, ip_addr::af, DBG, and ip_addr::u.

char* su2a union sockaddr_union su,
int  su_len
[inline, static]
 

Definition at line 679 of file ip_addr.h.

References buf, ip4tosbuf(), sockaddr_union::s, sockaddr_union::sin, su_getport(), unlikely, and ushort2sbuf().

void su2ip_addr struct ip_addr ip,
union sockaddr_union su
[inline, static]
 

Definition at line 392 of file ip_addr.h.

References ip_addr::addr, ip_addr::af, L_CRIT, ip_addr::len, LOG, sockaddr_union::s, sockaddr_union::sin, and ip_addr::u.

Referenced by eval_elem(), forward_request(), get_out_socket(), io_listen_who_rpc(), ipmatch_onsend(), nhop_type(), t_send_branch(), udp_rcv_loop(), and udp_send().

int su_cmp union sockaddr_union s1,
union sockaddr_union s2
[inline, static]
 

Definition at line 331 of file ip_addr.h.

References L_CRIT, LOG, sockaddr_union::s, and sockaddr_union::sin.

Referenced by nhop_type().

unsigned short su_getport union sockaddr_union su  )  [inline, static]
 

Definition at line 353 of file ip_addr.h.

References L_CRIT, LOG, sockaddr_union::s, and sockaddr_union::sin.

Referenced by forward_request(), io_listen_who_rpc(), ipmatch_onsend(), nhop_type(), su2a(), t_send_branch(), udp_rcv_loop(), and udp_send().

void su_setport union sockaddr_union su,
unsigned short  port
[inline, static]
 

Definition at line 372 of file ip_addr.h.

References L_CRIT, LOG, sockaddr_union::s, and sockaddr_union::sin.


Generated on Thu Jul 29 04:15:54 2010 for SIPExpressRouter by  doxygen 1.3.9.1