Network socket handling. More...
#include "asterisk.h"
#include <ifaddrs.h>
#include "asterisk/netsock.h"
#include "asterisk/utils.h"
#include "asterisk/astobj.h"
Go to the source code of this file.
Data Structures | |
struct | ast_netsock |
struct | ast_netsock_list |
Functions | |
int | ast_eid_cmp (const struct ast_eid *eid1, const struct ast_eid *eid2) |
Compare two EIDs. More... | |
char * | ast_eid_to_str (char *s, int maxlen, struct ast_eid *eid) |
struct ast_netsock * | ast_netsock_bind (struct ast_netsock_list *list, struct io_context *ioc, const char *bindinfo, int defaultport, int tos, int cos, ast_io_cb callback, void *data) |
struct ast_netsock * | ast_netsock_bindaddr (struct ast_netsock_list *list, struct io_context *ioc, struct sockaddr_in *bindaddr, int tos, int cos, ast_io_cb callback, void *data) |
struct sockaddr_in * | ast_netsock_boundaddr (const struct ast_netsock *ns) |
void * | ast_netsock_data (const struct ast_netsock *ns) |
static void | ast_netsock_destroy (struct ast_netsock *netsock) |
struct ast_netsock * | ast_netsock_find (struct ast_netsock_list *list, struct sockaddr_in *sa) |
int | ast_netsock_init (struct ast_netsock_list *list) |
struct ast_netsock_list * | ast_netsock_list_alloc (void) |
int | ast_netsock_release (struct ast_netsock_list *list) |
int | ast_netsock_set_qos (int netsocket, int tos, int cos, const char *desc) |
int | ast_netsock_sockfd (const struct ast_netsock *ns) |
void | ast_netsock_unref (struct ast_netsock *ns) |
void | ast_set_default_eid (struct ast_eid *eid) |
Fill in an ast_eid with the default eid of this machine. More... | |
int | ast_str_to_eid (struct ast_eid *eid, const char *s) |
Convert a string into an EID. More... | |
Network socket handling.
Definition in file netsock.c.
Compare two EIDs.
Definition at line 320 of file netsock.c.
Referenced by aji_devstate_cb(), aji_handle_pubsub_event(), aji_mwi_cb(), ast_event_cb(), build_peer(), build_transactions(), destroy_trans(), dundi_answer_entity(), dundi_answer_query(), dundi_ie_append_eid_appropriately(), dundi_lookup_internal(), dundi_prop_precache(), dundi_query_thread(), evt_event_deliver_cb(), find_peer(), handle_command_response(), optimize_transactions(), and register_request().
char* ast_eid_to_str | ( | char * | s, |
int | maxlen, | ||
struct ast_eid * | eid | ||
) |
/brief Convert an EID to a string
Definition at line 222 of file netsock.c.
References ast_eid::eid.
Referenced by aji_publish_device_state(), aji_publish_mwi(), append_transaction(), ast_set_default_eid(), ast_str_retrieve_variable(), build_peer(), build_transactions(), cache_lookup(), cache_lookup_internal(), check_key(), complete_peer_helper(), destroy_trans(), do_autokill(), do_register(), do_register_expire(), dump_answer(), dump_eid(), dump_raw_ie(), dundi_answer_entity(), dundi_lookup_internal(), dundi_lookup_local(), dundi_lookup_thread(), dundi_precache_thread(), dundi_prop_precache(), dundi_query_thread(), dundi_send(), dundi_show_entityid(), dundi_show_peer(), dundi_show_peers(), dundi_show_requests(), handle_command_response(), handle_show_settings(), populate_addr(), register_request(), and update_key().
struct ast_netsock* ast_netsock_bind | ( | struct ast_netsock_list * | list, |
struct io_context * | ioc, | ||
const char * | bindinfo, | ||
int | defaultport, | ||
int | tos, | ||
int | cos, | ||
ast_io_cb | callback, | ||
void * | data | ||
) |
Definition at line 178 of file netsock.c.
References ast_netsock_bindaddr(), ast_strdupa, inet_aton(), and strsep().
Referenced by peer_set_srcaddr(), and set_config().
struct ast_netsock* ast_netsock_bindaddr | ( | struct ast_netsock_list * | list, |
struct io_context * | ioc, | ||
struct sockaddr_in * | bindaddr, | ||
int | tos, | ||
int | cos, | ||
ast_io_cb | callback, | ||
void * | data | ||
) |
Definition at line 108 of file netsock.c.
References ast_calloc, ast_enable_packet_fragmentation(), ast_free, ast_inet_ntoa(), ast_io_add(), AST_IO_IN, ast_log(), ast_netsock_set_qos(), ASTOBJ_CONTAINER_LINK, ASTOBJ_INIT, ast_netsock::bindaddr, ast_netsock::data, errno, ast_netsock::ioc, ast_netsock::ioref, LOG_ERROR, LOG_WARNING, netsocket, and ast_netsock::sockfd.
Referenced by ast_netsock_bind().
struct sockaddr_in* ast_netsock_boundaddr | ( | const struct ast_netsock * | ns | ) |
void* ast_netsock_data | ( | const struct ast_netsock * | ns | ) |
Definition at line 212 of file netsock.c.
References ast_netsock::data.
|
static |
Definition at line 64 of file netsock.c.
References ast_free, ast_io_remove(), ast_netsock::ioc, ast_netsock::ioref, and ast_netsock::sockfd.
Referenced by ast_netsock_release(), and ast_netsock_unref().
struct ast_netsock* ast_netsock_find | ( | struct ast_netsock_list * | list, |
struct sockaddr_in * | sa | ||
) |
Definition at line 93 of file netsock.c.
References ASTOBJ_CONTAINER_TRAVERSE, ASTOBJ_RDLOCK, ASTOBJ_UNLOCK, and inaddrcmp().
Referenced by peer_set_srcaddr().
int ast_netsock_init | ( | struct ast_netsock_list * | list | ) |
Definition at line 76 of file netsock.c.
References ASTOBJ_CONTAINER_INIT.
Referenced by load_module(), and set_config().
struct ast_netsock_list* ast_netsock_list_alloc | ( | void | ) |
Definition at line 71 of file netsock.c.
References ast_calloc.
Referenced by load_module(), and set_config().
int ast_netsock_release | ( | struct ast_netsock_list * | list | ) |
Definition at line 84 of file netsock.c.
References ast_free, ast_netsock_destroy(), ASTOBJ_CONTAINER_DESTROY, and ASTOBJ_CONTAINER_DESTROYALL.
Referenced by __unload_module(), and set_config().
int ast_netsock_set_qos | ( | int | netsocket, |
int | tos, | ||
int | cos, | ||
const char * | desc | ||
) |
Definition at line 158 of file netsock.c.
References ast_log(), ast_verb, and LOG_WARNING.
Referenced by ast_netsock_bindaddr(), ast_udptl_setqos(), config_load(), load_module(), and reload_config().
int ast_netsock_sockfd | ( | const struct ast_netsock * | ns | ) |
Definition at line 202 of file netsock.c.
Referenced by peer_set_srcaddr(), and set_config().
void ast_netsock_unref | ( | struct ast_netsock * | ns | ) |
Definition at line 217 of file netsock.c.
References ast_netsock_destroy(), and ASTOBJ_UNREF.
Referenced by peer_set_srcaddr(), and set_config().
void ast_set_default_eid | ( | struct ast_eid * | eid | ) |
Fill in an ast_eid with the default eid of this machine.
Definition at line 239 of file netsock.c.
References ARRAY_LEN, ast_debug, ast_eid_to_str(), and ast_eid::eid.
Referenced by ast_readconfig().
int ast_str_to_eid | ( | struct ast_eid * | eid, |
const char * | s | ||
) |
Convert a string into an EID.
This function expects an EID in the format: 00:11:22:33:44:55
Definition at line 305 of file netsock.c.
References ast_eid::eid.
Referenced by aji_handle_pubsub_event(), ast_readconfig(), build_peer(), dundi_do_query(), and set_config().