Wed Oct 28 11:46:14 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...

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

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 63 of file network.h.

#define inet_ntoa   __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__

Definition at line 85 of file network.h.

#define MAXHOSTNAMELEN   256


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 428 of file utils.c.

References ast_threadstorage_get(), buf, 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(), calltoken_required(), 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(), generic_http_callback(), get_input(), gtalk_create_candidates(), gtalk_update_stun(), handle_call_token(), handle_cli_iax2_show_callno_limits(), 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_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(), peercnt_add(), peercnt_modify(), peercnt_remove(), 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(), sched_delay_remove(), send_dtmf(), send_packet(), send_raw_client(), send_request(), send_response(), send_trunk(), session_do(), set_config(), set_destination(), set_peercnt_limit(), setup_incoming_call(), show_channels_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().

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

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 88 of file network.h.

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

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

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


Generated on Wed Oct 28 11:46:14 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6