Fri Jun 19 12:10:42 2009

Asterisk developer's documentation


network.h File Reference

Wrapper for network related headers, masking differences between various operating systems. On passing, we also provide here trivial functions or other simple wrappers to network-related functions. More...

#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <sys/socket.h>
#include <net/if.h>
#include <sys/ioctl.h>

Go to the source code of this file.

Defines

#define IFNAMSIZ   16
#define inet_ntoa   __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
#define MAXHOSTNAMELEN   256

Functions

const char * ast_inet_ntoa (struct in_addr ia)
 thread-safe replacement for inet_ntoa().
static force_inline int inaddrcmp (const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
 Compares the source address and port of two sockaddr_in.
int inet_aton (const char *cp, struct in_addr *pin)


Detailed Description

Wrapper for network related headers, masking differences between various operating systems. On passing, we also provide here trivial functions or other simple wrappers to network-related functions.

Definition in file network.h.


Define Documentation

#define IFNAMSIZ   16

Definition at line 65 of file network.h.

#define inet_ntoa   __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__

Definition at line 87 of file network.h.

#define MAXHOSTNAMELEN   256

Definition at line 69 of file network.h.

Referenced by ast_find_ourip(), ast_readconfig(), build_peer(), cli_prompt(), create_addr(), find_user_realtime(), main(), make_email_file(), netconsole(), sendmail(), sendpage(), set_config(), and transmit_register().


Function Documentation

const char* ast_inet_ntoa ( struct in_addr  ia  ) 

thread-safe replacement for inet_ntoa().

Note:
It is very important to note that even though this is a thread-safe replacement for inet_ntoa(), it is *not* reentrant. In a single thread, the result from a previous call to this function is no longer valid once it is called again. If the result from multiple calls to this function need to be kept or used at once, then the result must be copied to a local buffer before calling this function again.

Definition at line 431 of file utils.c.

References ast_threadstorage_get(), and inet_ntoa_buf.

Referenced by __attempt_transmit(), __find_callno(), __iax2_show_peers(), __sip_xmit(), _sip_show_peer(), _sip_show_peers(), acf_channel_read(), action_login(), add_sdp(), ast_append_ha(), ast_apply_ha(), ast_netsock_bindaddr(), ast_parse_arg(), ast_rtcp_read(), ast_rtcp_write_rr(), ast_rtcp_write_sr(), ast_rtp_raw_write(), ast_rtp_read(), ast_rtp_sendcng(), ast_rtp_senddigit_begin(), ast_rtp_senddigit_continuation(), ast_rtp_senddigit_end(), ast_sip_ouraddrfor(), ast_tcptls_client_start(), ast_tcptls_server_start(), ast_udptl_bridge(), ast_udptl_read(), ast_udptl_write(), authenticate(), bridge_native_loop(), bridge_p2p_rtp_write(), build_callid_pvt(), build_callid_registry(), build_contact(), build_peer(), build_reply_digest(), build_rpid(), build_via(), check_access(), check_peer_ok(), check_via(), copy_via_headers(), create_addr_from_peer(), create_client(), dnsmgr_refresh(), dump_addr(), dump_ipaddr(), dundi_rexmit(), dundi_show_peer(), dundi_show_peers(), dundi_show_trans(), dundi_showframe(), dundi_xmit(), external_rtp_create(), find_command(), find_peer(), find_subchannel_and_lock(), find_tpeer(), function_iaxpeer(), function_sipchaninfo_read(), function_sippeer(), get_input(), gtalk_create_candidates(), gtalk_update_stun(), handle_cli_iax2_set_debug(), handle_cli_iax2_show_channels(), handle_cli_iax2_show_peer(), handle_cli_iax2_show_registry(), handle_cli_udptl_debug_deprecated(), handle_cli_udptl_set_debug(), handle_command_response(), handle_error(), handle_incoming(), handle_mgcp_show_endpoints(), handle_open_receive_channel_ack_message(), handle_request(), handle_request_bye(), handle_request_do(), handle_request_register(), handle_request_subscribe(), handle_response(), handle_response_notify(), handle_response_refer(), handle_show_http(), handle_showmanconn(), handle_skinny_show_device(), handle_skinny_show_devices(), handle_skinny_show_settings(), httpstatus_callback(), iax2_ack_registry(), iax2_prov_app(), iax2_trunk_queue(), iax_server(), iax_showframe(), initreqprep(), jingle_create_candidates(), load_module(), manager_iax2_show_peer_list(), mgcpsock_read(), oh323_addrcmp_str(), oh323_call(), oh323_set_rtp_peer(), parse_register_contact(), parsing(), phoneprov_callback(), process_request(), process_rfc3389(), process_sdp(), purge_sessions(), raw_hangup(), realtime_peer(), realtime_update_peer(), realtime_user(), reg_source_db(), register_verify(), registry_rerequest(), reload_config(), resend_response(), retrans_pkt(), rpt_exec(), rtcp_do_debug_ip(), rtp_do_debug_ip(), score_address(), send_dtmf(), send_packet(), send_raw_client(), send_request(), send_response(), send_trunk(), session_do(), set_config(), set_destination(), setup_incoming_call(), show_channels_cb(), show_chanstats_cb(), show_main_page(), sip_do_debug_ip(), sip_do_debug_peer(), sip_poke_peer(), sip_set_rtp_peer(), sip_set_udptl_peer(), sip_show_channel(), sip_show_settings(), sip_show_tcp(), skinny_session(), skinny_set_rtp_peer(), socket_process(), socket_process_meta(), start_rtp(), timing_read(), transmit_notify_with_mwi(), unistim_info(), unistimsock_read(), and update_registry().

00432 {
00433    char *buf;
00434 
00435    if (!(buf = ast_threadstorage_get(&inet_ntoa_buf, INET_ADDRSTRLEN)))
00436       return "";
00437 
00438    return inet_ntop(AF_INET, &ia, buf, INET_ADDRSTRLEN);
00439 }

static force_inline int inaddrcmp ( const struct sockaddr_in *  sin1,
const struct sockaddr_in *  sin2 
) [static]

Compares the source address and port of two sockaddr_in.

Definition at line 90 of file network.h.

Referenced by ast_netsock_find(), ast_udptl_bridge(), bridge_native_loop(), dnsmgr_refresh(), find_tpeer(), find_transaction(), handle_command_response(), iax2_ack_registry(), oh323_addrcmp(), parse_register_contact(), registry_rerequest(), socket_process(), socket_read(), and update_registry().

00091 {
00092         return ((sin1->sin_addr.s_addr != sin2->sin_addr.s_addr)
00093                 || (sin1->sin_port != sin2->sin_port));
00094 }

int inet_aton ( const char *  cp,
struct in_addr *  pin 
)

Referenced by __init_manager(), ast_append_ha(), ast_dnsmgr_lookup(), ast_find_ourip(), ast_netsock_bind(), build_peer(), jingle_create_candidates(), osp_convert_address(), populate_addr(), proxy_update(), reg_source_db(), and try_transfer().


Generated on Fri Jun 19 12:10:42 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7