Mon Jun 27 16:51:16 2011

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 __sip_subscribe_mwi_do(), ast_find_ourip(), ast_readconfig(), build_peer(), cli_prompt(), create_addr(), find_user_realtime(), get_realm(), 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 436 of file utils.c.

References ast_threadstorage_get(), and inet_ntoa_buf.

Referenced by __attempt_transmit(), __find_callno(), __iax2_show_peers(), _skinny_show_device(), _skinny_show_devices(), acf_channel_read(), action_login(), add_ipv4_ie(), add_sdp(), ast_apply_ha(), ast_netsock_bindaddr(), ast_parse_arg(), authenticate(), calltoken_required(), check_access(), config_load(), create_client(), data_get_xml_add_child(), data_result_manager_output(), data_result_print_cli_node(), do_message(), 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(), gtalk_update_externip(), gtalk_update_stun(), handle_call_token(), handle_cli_iax2_set_debug(), handle_cli_iax2_show_callno_limits(), handle_cli_iax2_show_channels(), handle_cli_iax2_show_peer(), handle_cli_iax2_show_registry(), handle_command_response(), handle_error(), handle_mgcp_show_endpoints(), handle_open_receive_channel_ack_message(), handle_request(), handle_show_http(), handle_showmanconn(), handle_skinny_show_settings(), iax2_ack_registry(), iax2_prov_app(), iax2_trunk_queue(), iax_server(), iax_showframe(), jingle_create_candidates(), load_module(), manager_iax2_show_peer_list(), manager_iax2_show_registry(), mgcpsock_read(), oh323_addrcmp_str(), oh323_call(), oh323_set_rtp_peer(), parsing(), peercnt_add(), peercnt_modify(), peercnt_remove(), peers_data_provider_get(), phoneprov_callback(), process_request(), process_sdp(), purge_sessions(), raw_hangup(), realtime_peer(), realtime_user(), register_verify(), registry_rerequest(), resend_response(), rpt_exec(), sched_delay_remove(), score_address(), send_packet(), send_raw_client(), send_request(), send_response(), send_trunk(), session_do(), set_config(), set_peercnt_limit(), setup_incoming_call(), show_main_page(), skinny_session(), skinny_set_rtp_peer(), socket_process(), socket_process_meta(), start_rtp(), stun_monitor_request(), timing_read(), unistim_info(), unistimsock_read(), and update_registry().

00437 {
00438    char *buf;
00439 
00440    if (!(buf = ast_threadstorage_get(&inet_ntoa_buf, INET_ADDRSTRLEN)))
00441       return "";
00442 
00443    return inet_ntop(AF_INET, &ia, buf, INET_ADDRSTRLEN);
00444 }

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(), find_tpeer(), find_transaction(), handle_command_response(), iax2_ack_registry(), oh323_addrcmp(), registry_rerequest(), socket_process(), and socket_read().

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 ast_netsock_bind(), build_peer(), data_search_cmp_ipaddr(), jingle_create_candidates(), populate_addr(), and try_transfer().


Generated on Mon Jun 27 16:51:16 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7