Asterisk - The Open Source Telephony Project GIT-master-0bf3178
|
Distributed Universal Number Discovery (DUNDi) More...
#include "asterisk.h"
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "asterisk/frame.h"
#include "asterisk/utils.h"
#include "asterisk/dundi.h"
#include "dundi-parser.h"
Go to the source code of this file.
Data Structures | |
struct | dundi_ie |
Functions | |
static void | dump_answer (char *output, int maxlen, void *value, int len) |
static void | dump_byte (char *output, int maxlen, void *value, int len) |
static void | dump_cause (char *output, int maxlen, void *value, int len) |
static void | dump_cbypass (char *output, int maxlen, void *value, int len) |
static void | dump_eid (char *output, int maxlen, void *value, int len) |
static void | dump_encrypted (char *output, int maxlen, void *value, int len) |
static void | dump_hint (char *output, int maxlen, void *value, int len) |
static void | dump_ies (unsigned char *iedata, int spaces, int len) |
static void | dump_int (char *output, int maxlen, void *value, int len) |
static void | dump_raw (char *output, int maxlen, void *value, int len) |
static void | dump_short (char *output, int maxlen, void *value, int len) |
static void | dump_string (char *output, int maxlen, void *value, int len) |
char * | dundi_eid_to_str_short (char *s, int maxlen, dundi_eid *eid) |
int | dundi_eid_zero (dundi_eid *eid) |
char * | dundi_flags2str (char *buf, int bufsiz, int flags) |
char * | dundi_hint2str (char *buf, int bufsiz, int flags) |
const char * | dundi_ie2str (int ie) |
int | dundi_ie_append (struct dundi_ie_data *ied, unsigned char ie) |
int | dundi_ie_append_addr (struct dundi_ie_data *ied, unsigned char ie, struct sockaddr_in *sin) |
int | dundi_ie_append_answer (struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid, unsigned char protocol, unsigned short flags, unsigned short weight, char *data) |
int | dundi_ie_append_byte (struct dundi_ie_data *ied, unsigned char ie, unsigned char dat) |
int | dundi_ie_append_cause (struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *data) |
int | dundi_ie_append_eid (struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid) |
int | dundi_ie_append_encdata (struct dundi_ie_data *ied, unsigned char ie, unsigned char *iv, void *data, int datalen) |
int | dundi_ie_append_hint (struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data) |
int | dundi_ie_append_int (struct dundi_ie_data *ied, unsigned char ie, unsigned int value) |
int | dundi_ie_append_raw (struct dundi_ie_data *ied, unsigned char ie, void *data, int datalen) |
int | dundi_ie_append_short (struct dundi_ie_data *ied, unsigned char ie, unsigned short value) |
int | dundi_ie_append_str (struct dundi_ie_data *ied, unsigned char ie, char *str) |
int | dundi_parse_ies (struct dundi_ies *ies, unsigned char *data, int datalen) |
void | dundi_set_error (void(*func)(const char *)) |
void | dundi_set_output (void(*func)(const char *)) |
void | dundi_showframe (struct dundi_hdr *fhi, int rx, struct ast_sockaddr *sin, int datalen) |
int | dundi_str_short_to_eid (dundi_eid *eid, const char *s) |
static void | internalerror (const char *str) |
static void | internaloutput (const char *str) |
static char * | proto2str (int proto, char *buf, int bufsiz) |
Variables | |
static void(* | errorf )(const char *str) = internalerror |
static struct dundi_ie | infoelts [] |
static void(* | outputf )(const char *str) = internaloutput |
Distributed Universal Number Discovery (DUNDi)
Definition in file dundi-parser.c.
|
static |
Definition at line 286 of file dundi-parser.c.
References answer(), ast_eid_to_str(), dundi_answer::data, dundi_flags2str(), dundi_answer::flags, len(), proto2str(), tmp(), and value.
|
static |
Definition at line 216 of file dundi-parser.c.
References ast_copy_string(), len(), and value.
|
static |
Definition at line 159 of file dundi-parser.c.
References ARRAY_LEN, ast_strlen_zero(), dundi_cause::causecode, causes, dundi_cause::desc, desc, len(), and value.
|
static |
Definition at line 98 of file dundi-parser.c.
|
static |
Definition at line 103 of file dundi-parser.c.
References ast_eid_to_str(), len(), and value.
|
static |
Definition at line 317 of file dundi-parser.c.
|
static |
Definition at line 131 of file dundi-parser.c.
References ast_strlen_zero(), dundi_hint::data, dundi_hint2str(), dundi_hint::flags, len(), and value.
|
static |
Definition at line 385 of file dundi-parser.c.
References ARRAY_LEN, dundi_ie::dump, DUNDI_IE_ENCDATA, infoelts, len(), name, outputf, and tmp().
Referenced by dundi_showframe().
|
static |
Definition at line 200 of file dundi-parser.c.
References ast_copy_string(), len(), and value.
|
static |
Definition at line 331 of file dundi-parser.c.
|
static |
Definition at line 208 of file dundi-parser.c.
References ast_copy_string(), len(), and value.
|
static |
char * dundi_eid_to_str_short | ( | char * | s, |
int | maxlen, | ||
dundi_eid * | eid | ||
) |
Definition at line 54 of file dundi-parser.c.
References ast_eid::eid.
Referenced by cache_lookup(), cache_save(), cache_save_hint(), do_register_expire(), and handle_command_response().
int dundi_eid_zero | ( | dundi_eid * | eid | ) |
Definition at line 82 of file dundi-parser.c.
References ARRAY_LEN, and ast_eid::eid.
Referenced by build_transactions(), dundi_discover(), dundi_query(), dundi_show_cache(), dundi_show_requests(), and precache_trans().
char * dundi_flags2str | ( | char * | buf, |
int | bufsiz, | ||
int | flags | ||
) |
Definition at line 248 of file dundi-parser.c.
References ast_strlen_zero(), buf, DUNDI_FLAG_CANMATCH, DUNDI_FLAG_COMMERCIAL, DUNDI_FLAG_EXISTS, DUNDI_FLAG_IGNOREPAT, DUNDI_FLAG_MATCHMORE, DUNDI_FLAG_MOBILE, DUNDI_FLAG_NOCOMUNSOLICIT, DUNDI_FLAG_NOUNSOLICITED, and DUNDI_FLAG_RESIDENTIAL.
Referenced by cache_lookup_internal(), dump_answer(), dundi_do_lookup(), dundi_show_cache(), and dundi_show_mappings().
char * dundi_hint2str | ( | char * | buf, |
int | bufsiz, | ||
int | flags | ||
) |
Definition at line 111 of file dundi-parser.c.
References ast_strlen_zero(), buf, DUNDI_HINT_DONT_ASK, DUNDI_HINT_TTL_EXPIRED, and DUNDI_HINT_UNAFFECTED.
Referenced by dump_hint().
const char * dundi_ie2str | ( | int | ie | ) |
Definition at line 375 of file dundi-parser.c.
References ARRAY_LEN, infoelts, and dundi_ie::name.
Referenced by dundi_ie_append_answer(), dundi_ie_append_cause(), dundi_ie_append_encdata(), dundi_ie_append_hint(), dundi_ie_append_raw(), and dundi_parse_ies().
int dundi_ie_append | ( | struct dundi_ie_data * | ied, |
unsigned char | ie | ||
) |
Definition at line 622 of file dundi-parser.c.
References dundi_ie_append_raw(), and NULL.
Referenced by dundi_discover().
int dundi_ie_append_addr | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
struct sockaddr_in * | sin | ||
) |
Definition at line 588 of file dundi-parser.c.
References dundi_ie_append_raw().
int dundi_ie_append_answer | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
dundi_eid * | eid, | ||
unsigned char | protocol, | ||
unsigned short | flags, | ||
unsigned short | weight, | ||
char * | data | ||
) |
Definition at line 561 of file dundi-parser.c.
References dundi_ie_data::buf, dundi_ie2str(), ast_eid::eid, errorf, dundi_ie_data::pos, tmp(), and weight.
Referenced by dundi_lookup_thread(), and precache_trans().
int dundi_ie_append_byte | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
unsigned char | dat | ||
) |
Definition at line 617 of file dundi-parser.c.
References dundi_ie_append_raw().
Referenced by handle_command_response().
int dundi_ie_append_cause | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
unsigned char | cause, | ||
char * | data | ||
) |
Definition at line 501 of file dundi-parser.c.
References dundi_ie_data::buf, dundi_ie2str(), errorf, dundi_ie_data::pos, and tmp().
Referenced by dundi_answer_entity(), dundi_answer_query(), dundi_lookup_thread(), dundi_prop_precache(), and handle_command_response().
int dundi_ie_append_eid | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
dundi_eid * | eid | ||
) |
Definition at line 612 of file dundi-parser.c.
References dundi_ie_append_raw().
Referenced by do_register(), dundi_discover(), dundi_encrypt(), dundi_ie_append_eid_appropriately(), dundi_query(), handle_command_response(), and precache_trans().
int dundi_ie_append_encdata | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
unsigned char * | iv, | ||
void * | data, | ||
int | datalen | ||
) |
Definition at line 541 of file dundi-parser.c.
References dundi_ie_data::buf, dundi_ie2str(), errorf, dundi_ie_data::pos, and tmp().
Referenced by dundi_encrypt(), and handle_command_response().
int dundi_ie_append_hint | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
unsigned short | flags, | ||
char * | data | ||
) |
Definition at line 520 of file dundi-parser.c.
References dundi_ie_data::buf, dundi_ie2str(), errorf, dundi_ie_data::pos, and tmp().
Referenced by dundi_lookup_thread(), dundi_query_thread(), and precache_trans().
int dundi_ie_append_int | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
unsigned int | value | ||
) |
Definition at line 593 of file dundi-parser.c.
References dundi_ie_append_raw(), and value.
Referenced by dundi_encrypt().
int dundi_ie_append_raw | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
void * | data, | ||
int | datalen | ||
) |
Definition at line 486 of file dundi-parser.c.
References dundi_ie_data::buf, dundi_ie2str(), errorf, dundi_ie_data::pos, and tmp().
Referenced by dundi_encrypt(), dundi_ie_append(), dundi_ie_append_addr(), dundi_ie_append_byte(), dundi_ie_append_eid(), dundi_ie_append_int(), dundi_ie_append_short(), dundi_ie_append_str(), and handle_command_response().
int dundi_ie_append_short | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
unsigned short | value | ||
) |
Definition at line 600 of file dundi-parser.c.
References dundi_ie_append_raw(), and value.
Referenced by do_register(), dundi_discover(), dundi_lookup_thread(), dundi_query(), handle_command_response(), and precache_trans().
int dundi_ie_append_str | ( | struct dundi_ie_data * | ied, |
unsigned char | ie, | ||
char * | str | ||
) |
Definition at line 607 of file dundi-parser.c.
References dundi_ie_append_raw(), and str.
Referenced by dundi_discover(), dundi_query(), dundi_query_thread(), and precache_trans().
int dundi_parse_ies | ( | struct dundi_ies * | ies, |
unsigned char * | data, | ||
int | datalen | ||
) |
Definition at line 637 of file dundi-parser.c.
References dundi_ies::anscount, dundi_ies::answers, dundi_ies::called_context, dundi_ies::called_number, dundi_ies::cause, dundi_ies::causestr, dundi_ies::cbypass, dundi_answer::data, dundi_hint::data, dundi_ie2str(), DUNDI_IE_ANSWER, DUNDI_IE_CACHEBYPASS, DUNDI_IE_CALLED_CONTEXT, DUNDI_IE_CALLED_NUMBER, DUNDI_IE_CAUSE, DUNDI_IE_COUNTRY, DUNDI_IE_DEPARTMENT, DUNDI_IE_EID, DUNDI_IE_EID_DIRECT, DUNDI_IE_EMAIL, DUNDI_IE_ENCDATA, DUNDI_IE_EXPIRATION, DUNDI_IE_HINT, DUNDI_IE_IPADDR, DUNDI_IE_KEYCRC32, DUNDI_IE_LOCALITY, DUNDI_IE_ORGANIZATION, DUNDI_IE_PHONE, DUNDI_IE_REQEID, DUNDI_IE_SHAREDKEY, DUNDI_IE_SIGNATURE, DUNDI_IE_STATE_PROV, DUNDI_IE_TTL, DUNDI_IE_UNKNOWN, DUNDI_IE_VERSION, DUNDI_MAX_ANSWERS, DUNDI_MAX_STACK, dundi_ies::eid_direct, dundi_ies::eidcount, dundi_ies::eids, dundi_ies::encblock, dundi_ies::enclen, dundi_ies::encsharedkey, dundi_ies::encsig, errorf, dundi_ies::expiration, dundi_ies::hint, dundi_ies::keycrc32, len(), outputf, dundi_ies::q_country, dundi_ies::q_dept, dundi_ies::q_email, dundi_ies::q_ipaddr, dundi_ies::q_locality, dundi_ies::q_org, dundi_ies::q_phone, dundi_ies::q_stateprov, dundi_ies::reqeid, tmp(), dundi_ies::ttl, dundi_ies::unknowncmd, and dundi_ies::version.
Referenced by handle_command_response().
void dundi_set_error | ( | void(*)(const char *) | func | ) |
void dundi_set_output | ( | void(*)(const char *) | func | ) |
void dundi_showframe | ( | struct dundi_hdr * | fhi, |
int | rx, | ||
struct ast_sockaddr * | sin, | ||
int | datalen | ||
) |
Definition at line 434 of file dundi-parser.c.
References ARRAY_LEN, ast_sockaddr_stringify(), dundi_hdr::cmdflags, dundi_hdr::cmdresp, commands, dundi_hdr::dtrans, dump_ies(), DUNDI_FLAG_RESERVED, DUNDI_FLAG_RETRANS, dundi_hdr::ies, dundi_hdr::iseqno, dundi_hdr::oseqno, outputf, dundi_hdr::strans, and tmp().
Referenced by dundi_send(), dundi_xmit(), handle_command_response(), and socket_read().
int dundi_str_short_to_eid | ( | dundi_eid * | eid, |
const char * | s | ||
) |
Definition at line 70 of file dundi-parser.c.
References ast_eid::eid.
Referenced by cache_lookup_internal(), dundi_show_cache(), and dundi_show_hints().
|
static |
Definition at line 46 of file dundi-parser.c.
References str.
|
static |
|
static |
Definition at line 224 of file dundi-parser.c.
References buf, DUNDI_PROTO_H323, DUNDI_PROTO_IAX, DUNDI_PROTO_NONE, DUNDI_PROTO_PJSIP, and DUNDI_PROTO_SIP.
Referenced by dump_answer().
|
static |
Definition at line 52 of file dundi-parser.c.
Referenced by dundi_ie_append_answer(), dundi_ie_append_cause(), dundi_ie_append_encdata(), dundi_ie_append_hint(), dundi_ie_append_raw(), dundi_parse_ies(), and dundi_set_error().
|
static |
Referenced by dump_ies(), and dundi_ie2str().
|
static |
Definition at line 51 of file dundi-parser.c.
Referenced by dump_ies(), dundi_parse_ies(), dundi_set_output(), and dundi_showframe().