49#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__Darwin__) 
  162#define MAX_RESULTS 64 
  164#define MAX_PACKET_SIZE 8192 
  166#define MAX_WEIGHT 59999 
  168#define DUNDI_MODEL_INBOUND     (1 << 0) 
  169#define DUNDI_MODEL_OUTBOUND    (1 << 1) 
  170#define DUNDI_MODEL_SYMMETRIC   (DUNDI_MODEL_INBOUND | DUNDI_MODEL_OUTBOUND) 
  173#define DUNDI_TIMING_HISTORY    10 
  185#define DUNDI_FLAG_INTERNAL_NOPARTIAL (1 << 17) 
  188#define DUNDI_SECRET_TIME 15     
  190#define DUNDI_SECRET_TIME DUNDI_DEFAULT_CACHE_TIME 
  200static unsigned int tos = 0;
 
  384        if (!strcasecmp(perm->
name, 
"all") || !strcasecmp(perm->
name, cont))
 
 
  411    if (!strcasecmp(
str, 
"IAX") || !strcasecmp(
str, 
"IAX2"))
 
  413    else if (!strcasecmp(
str, 
"SIP"))
 
  415    else if (!strcasecmp(
str, 
"H323"))
 
  417    else if (!strcasecmp(
str, 
"PJSIP"))
 
 
  423static int dundi_lookup_internal(
struct dundi_result *
result, 
int maxret, 
struct ast_channel *chan, 
const char *dcontext, 
const char *
number, 
int ttl, 
int blockempty, 
struct dundi_hint_metadata *md, 
int *expiration, 
int cybpass, 
int modeselect, 
dundi_eid *skip, 
dundi_eid *avoid[], 
int direct[]);
 
  481    memset(&trans, 0, 
sizeof(trans));
 
  488    tmp.hdr.cmdflags = 0;
 
  490    tmp.pack.datalen = 
sizeof(
struct dundi_hdr);
 
  491    tmp.pack.parent = &trans;
 
 
  508        tid = (tid % 32766) + 1;
 
  509    } 
while (tid != 
stid);
 
 
  551    unsigned int *fluffy;
 
  553    fluffy = (
unsigned int *)(iv);
 
 
  579    if (
map->weightstr) {
 
 
  620            dr[anscnt].techint = map->
tech;
 
  623            dr[anscnt].eid = *us_eid;
 
  644                dr[anscnt].dest[0] = 
'\0';
 
  652            for (x = 0; x < (
sizeof(tmp) - 1); x++) {
 
  653                tmp[x] = called_number[x];
 
  659                    if (strlen(tmp) > strlen(hmd->
exten)) {
 
 
  686    memset(&ied, 0, 
sizeof(ied));
 
  687    memset(&
dr, 0, 
sizeof(
dr));
 
  688    memset(&hmd, 0, 
sizeof(hmd));
 
  695    for (x=0;x<ouranswers;x++) {
 
  702        res = 
dundi_lookup_internal(
dr + ouranswers, 
MAX_RESULTS - ouranswers, 
NULL, st->
called_context, st->
called_number, st->
ttl, 1, &hmd, &expiration, st->
nocache, 0, 
NULL, st->
eids, st->
directs);
 
  707            if ((res < -1) && (!ouranswers))
 
  716        ast_debug(1, 
"Our transaction went away!\n");
 
  720        for (x=0;x<ouranswers;x++) {
 
  722            if (
dr[x].expiration && (expiration > 
dr[x].expiration))
 
  723                expiration = 
dr[x].expiration;
 
 
  745    memset(&ied, 0, 
sizeof(ied));
 
  755        ast_debug(1, 
"Our transaction went away!\n");
 
 
  780    memset(&ied, 0, 
sizeof(ied));
 
  781    memset(&dei, 0, 
sizeof(dei));
 
  782    memset(&hmd, 0, 
sizeof(hmd));
 
  785        ast_debug(1, 
"Neat, someone look for us!\n");
 
  800        ast_debug(1, 
"Our transaction went away!\n");
 
 
  832    pthread_t lookupthread;
 
  853        for (x=skipfirst;ies->
eids[x];x++) {
 
  855            *st->
eids[x-skipfirst] = *ies->
eids[x];
 
 
  884    char eidpeer_str[20];
 
  885    char eidroot_str[20];
 
  900    snprintf(key1, 
sizeof(key1), 
"hint/%s/%s/%s/e%08x", eidpeer_str, hint->
data, req->
dcontext, unaffected ? 0 : req->
crc32);
 
  901    snprintf(key2, 
sizeof(key2), 
"hint/%s/%s/%s/r%s", eidpeer_str, hint->
data, req->
dcontext, eidroot_str);
 
  904    timeout += expiration;
 
  905    snprintf(data, 
sizeof(data), 
"%ld|", (
long)(timeout));
 
  908    ast_debug(1, 
"Caching hint at '%s'\n", key1);
 
  910    ast_debug(1, 
"Caching hint at '%s'\n", key2);
 
 
  920    char eidpeer_str[20];
 
  921    char eidroot_str[20];
 
  936    snprintf(key1, 
sizeof(key1), 
"%s/%s/%s/e%08x", eidpeer_str, req->
number, req->
dcontext, unaffected ? 0 : req->
crc32);
 
  937    snprintf(key2, 
sizeof(key2), 
"%s/%s/%s/r%s", eidpeer_str, req->
number, req->
dcontext, eidroot_str);
 
  940    timeout += expiration;
 
  941    snprintf(data, 
sizeof(data), 
"%ld|", (
long)(timeout));
 
  944        if (strchr(req->
dr[x].
dest, 
'|'))
 
  946        snprintf(data + strlen(data), 
sizeof(data) - strlen(data), 
"%u/%d/%d/%s/%s|",
 
 
  970    pthread_t lookupthread;
 
  972    memset(&dr2, 0, 
sizeof(dr2));
 
  973    memset(&
dr, 0, 
sizeof(
dr));
 
  974    memset(&hmd, 0, 
sizeof(hmd));
 
  982    dr.pfds[0] = 
dr.pfds[1] = -1;
 
 1032        if (!strcasecmp(cur->
dcontext, ccontext))
 
 1062        for (x=skipfirst;ies->
eids[x];x++) {
 
 1064            *st->
eids[x-skipfirst] = *ies->
eids[x];
 
 1072            if (!strcasecmp(cur->
dcontext, ccontext)) {
 
 1087            memset(&ied, 0, 
sizeof(ied));
 
 1094        memset(&ied, 0, 
sizeof(ied));
 
 
 1113    pthread_t lookupthread;
 
 1117        if (!strcasecmp(cur->
dcontext, ccontext))
 
 1145        for (x=skipfirst;ies->
eids[x];x++) {
 
 1147            *st->
eids[x-skipfirst] = *ies->
eids[x];
 
 1155            if (!strcasecmp(cur->
dcontext, ccontext)) {
 
 1170            memset(&ied, 0, 
sizeof(ied));
 
 1177        memset(&ied, 0, 
sizeof(ied));
 
 
 1188    char *ptr, *term, *src;
 
 1197    if (!
ast_db_get(
"dundi/cache", key, data, 
sizeof(data))) {
 
 1201            int expiration = timeout - now;
 
 1202            if (expiration > 0) {
 
 1203                ast_debug(1, 
"Found cache expiring in %d seconds!\n", expiration);
 
 1205                while((sscanf(ptr, 
"%30d/%30d/%30d/%n", (
int *)&(
flags.flags), &
weight, &tech, &length) == 3)) {
 
 1207                    term = strchr(ptr, 
'|');
 
 1210                        src = strrchr(ptr, 
'/');
 
 1216                        ast_debug(1, 
"Found cached answer '%s/%s' originally from '%s' with flags '%s' on behalf of '%s'\n",
 
 1221                                !strcmp(req->
dr[z].
dest, ptr))
 
 1245                if (expiration < *lowexpiration)
 
 1246                    *lowexpiration = expiration;
 
 
 1260    char eidroot_str[20];
 
 1264    char eid_str_full[20];
 
 1267    char key[
sizeof(eid_str) + 
sizeof(tmp) + 
sizeof(req->
dcontext) + 
sizeof(eidroot_str) + 
sizeof(
"hint////r")];
 
 1274    snprintf(key, 
sizeof(key), 
"%s/%s/%s/e%08x", eid_str, req->
number, req->
dcontext, crc);
 
 1276    snprintf(key, 
sizeof(key), 
"%s/%s/%s/e%08x", eid_str, req->
number, req->
dcontext, (
unsigned)0);
 
 1278    snprintf(key, 
sizeof(key), 
"%s/%s/%s/r%s", eid_str, req->
number, req->
dcontext, eidroot_str);
 
 1285            if (!(tmp[x] = req->
number[x]))
 
 1289            snprintf(key, 
sizeof(key), 
"hint/%s/%s/%s/e%08x", eid_str, tmp, req->
dcontext, crc);
 
 1291            snprintf(key, 
sizeof(key), 
"hint/%s/%s/%s/e%08x", eid_str, tmp, req->
dcontext, (
unsigned)0);
 
 1293            snprintf(key, 
sizeof(key), 
"hint/%s/%s/%s/r%s", eid_str, tmp, req->
dcontext, eidroot_str);
 
 1296                if (strlen(tmp) > strlen(req->
hmd->
exten)) {
 
 
 1351    unsigned char key[16];
 
 1361            ast_log(
LOG_NOTICE, 
"No such key '%s' for creating RSA encrypted shared key for '%s'!\n",
 
 1367            ast_log(
LOG_NOTICE, 
"No such key '%s' for signing RSA encrypted shared key for '%s'!\n",
 
 
 1390    unsigned char curblock[16];
 
 1392    memcpy(curblock, iv, 
sizeof(curblock));
 
 1395            curblock[x] ^= src[x];
 
 1397        memcpy(curblock, dst, 
sizeof(curblock));
 
 
 1406    unsigned char lastblock[16];
 
 1408    memcpy(lastblock, iv, 
sizeof(lastblock));
 
 1412            dst[x] ^= lastblock[x];
 
 1413        memcpy(lastblock, src, 
sizeof(lastblock));
 
 
 1423    int space = *dstlen;
 
 1424    unsigned long bytes;
 
 1426    unsigned char *decrypt_space;
 
 1433    if (uncompress(dst + 6, &bytes, decrypt_space, srclen) != Z_OK) {
 
 1434        ast_debug(1, 
"Ouch, uncompress failed :(\n");
 
 1438    *dstlen = bytes + 6;
 
 
 1445    unsigned char *compress_space;
 
 1448    unsigned long bytes;
 
 1451    unsigned char iv[16];
 
 1454    memset(compress_space, 0, 
len);
 
 1457    res = compress(compress_space, &bytes, pack->
data + 6, pack->
datalen - 6);
 
 1459        ast_debug(1, 
"Ouch, compression failed!\n");
 
 1462    memset(&ied, 0, 
sizeof(ied));
 
 1492    if ((ied.
pos + bytes) >= 
sizeof(ied.
buf)) {
 
 1497    ied.
pos += ((bytes + 15) / 16) * 16;
 
 
 1509    unsigned char dst[128];
 
 1517    } 
else if (!newkey || !newsig)
 
 1519    if (!memcmp(peer->
rxenckey, newkey, 128) &&
 
 1520        !memcmp(peer->
rxenckey + 128, newsig, 128)) {
 
 1551    ast_debug(1, 
"Wow, new key combo passed signature and decrypt!\n");
 
 1552    memcpy(peer->
rxenckey, newkey, 128);
 
 1553    memcpy(peer->
rxenckey + 128, newsig, 128);
 
 
 1564    *peer_dst = *peer_src;
 
 1577    memset(&peer_dst->
permit, 0, 
sizeof(peer_dst->
permit));
 
 1581        if (!(perm = 
ast_calloc(1, 
sizeof(*perm) + strlen(cur->
name) + 1)))
 
 1591        if (!(perm = 
ast_calloc(1, 
sizeof(*perm) + strlen(cur->
name) + 1)))
 
 
 1604    int final = hdr->
cmdresp & 0x80;
 
 1605    int cmd = hdr->
cmdresp & 0x7f;
 
 1610    unsigned char *bufcpy;
 
 1634        memcpy(bufcpy, hdr->
ies, datalen);
 
 1635        ast_debug(1, 
"Got canonical message %d (%d), %d bytes data%s\n", cmd, hdr->
oseqno, datalen, 
final ? 
" (Final)" : 
"");
 
 1638            goto return_cleanup;
 
 1659            if (strlen(peer->
inkey)) {
 
 1660                hasauth = encrypted;
 
 1725        if (!peer || !peer->
dynamic) {
 
 1732                hasauth = encrypted;
 
 1744                    ast_verb(3, 
"Registered DUNDi peer '%s' at '%s'\n",
 
 1760        if (ies.
cause < 1) {
 
 1764                authpass = encrypted;
 
 1844        if (ies.
cause < 1) {
 
 1846            ast_debug(1, 
"Looks like success of some sort (%d)\n", ies.
cause);
 
 1848                authpass = encrypted;
 
 1897        if (ies.
cause < 1) {
 
 1901                hasauth = encrypted;
 
 1949                    memset(&ies, 0, 
sizeof(ies));
 
 1952                    memset(ied, 0, 
sizeof(*ied));
 
 1985                ddatalen = 
sizeof(decoded);
 
 1996                    ast_debug(1, 
"Ouch, decrypt failed :(\n");
 
 
 2042        if ((pack->
h->
oseqno + 1) % 255 == iseqno) {
 
 
 2093        ast_debug(1, 
"Dropping packet out of window!\n");
 
 
 2107        if (
errno != ECONNREFUSED)
 
 
 2127    unsigned char tmp[16];
 
 2133    while((s = strchr(secret, 
';'))) *s = 
'+';
 
 2134    while((s = strchr(secret, 
'/'))) *s = 
'+';
 
 2135    while((s = strchr(secret, 
':'))) *s = 
'+';
 
 2136    while((s = strchr(secret, 
'@'))) *s = 
'+';
 
 
 2144        snprintf(tmp, 
sizeof(tmp), 
"%s;%s", oldkey, newkey);
 
 2146        snprintf(tmp, 
sizeof(tmp), 
"%s", newkey);
 
 2149    snprintf(tmp, 
sizeof(tmp), 
"%d", (
int)
rotatetime);
 
 
 2170        if ((time(
NULL) - expired) < 0) {
 
 
 2216    int *socket_read_id2 = 
NULL;
 
 2223        if ((res > 1000) || (res < 0))
 
 2236    if (socket_read_id2) {
 
 
 2246    int striplen = 
sizeof(
"/dundi/cache");
 
 2250        pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 
NULL);
 
 2255        for (; db_entry; db_entry = db_entry->
next) {
 
 2260                    ast_debug(1, 
"clearing expired DUNDI cache entry: %s\n", db_entry->
key);
 
 2267        pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 
NULL);
 
 2268        pthread_testcancel();
 
 2270        pthread_testcancel();
 
 
 2323        e->
command = 
"dundi set debug {on|off}";
 
 2325            "Usage: dundi set debug {on|off}\n" 
 2326            "       Enables/Disables dumping of DUNDi packets for debugging purposes\n";
 
 2332    if (
a->argc != e->
args) {
 
 2335    if (!strncasecmp(
a->argv[e->
args -1], 
"on", 2)) {
 
 2337        ast_cli(
a->fd, 
"DUNDi Debugging Enabled\n");
 
 2340        ast_cli(
a->fd, 
"DUNDi Debugging Disabled\n");
 
 
 2349        e->
command = 
"dundi store history {on|off}";
 
 2351            "Usage: dundi store history {on|off}\n" 
 2352            "       Enables/Disables storing of DUNDi requests and times for debugging\n" 
 2359    if (
a->argc != e->
args) {
 
 2362    if (!strncasecmp(
a->argv[e->
args -1], 
"on", 2)) {
 
 2364        ast_cli(
a->fd, 
"DUNDi History Storage Enabled\n");
 
 2367        ast_cli(
a->fd, 
"DUNDi History Storage Disabled\n");
 
 
 2377        e->
command = 
"dundi flush [stats]";
 
 2379            "Usage: dundi flush [stats]\n" 
 2380            "       Flushes DUNDi answer cache, used primarily for debug.  If\n" 
 2381            "'stats' is present, clears timer statistics instead of normal\n" 
 2387    if ((
a->argc < 2) || (
a->argc > 3)) {
 
 2391        if (!strcasecmp(
a->argv[2], 
"stats")) {
 
 2413        ast_cli(
a->fd, 
"DUNDi Cache Flushed\n");
 
 
 2468    qsort(results, count, 
sizeof(results[0]), 
rescomp);
 
 
 2480    struct timeval start;
 
 2485            "Usage: dundi lookup <number>[@context] [bypass]\n" 
 2486            "       Lookup the given number within the given DUNDi context\n" 
 2487            "(or e164 if none is specified).  Bypasses cache if 'bypass'\n" 
 2488            "keyword is specified.\n";
 
 2494    if ((
a->argc < 3) || (
a->argc > 4)) {
 
 2498        if (!strcasecmp(
a->argv[3], 
"bypass")) {
 
 2505    context = strchr(tmp, 
'@');
 
 2514        ast_cli(
a->fd, 
"DUNDi lookup returned error.\n");
 
 2516        ast_cli(
a->fd, 
"DUNDi lookup returned no results.\n");
 
 2519    for (x=0;x<res;x++) {
 
 2521        ast_cli(
a->fd, 
"     from %s, expires in %d s\n", 
dr[x].eid_str, 
dr[x].expiration);
 
 
 2532    struct timeval start;
 
 2535        e->
command = 
"dundi precache";
 
 2537            "Usage: dundi precache <number>[@context]\n" 
 2538            "       Lookup the given number within the given DUNDi context\n" 
 2539            "(or e164 if none is specified) and precaches the results to any\n" 
 2540            "upstream DUNDi push servers.\n";
 
 2545    if ((
a->argc < 3) || (
a->argc > 3)) {
 
 2549    context = strchr(tmp, 
'@');
 
 2558        ast_cli(
a->fd, 
"DUNDi precache returned error.\n");
 
 2560        ast_cli(
a->fd, 
"DUNDi precache returned no error.\n");
 
 
 2576            "Usage: dundi query <entity>[@context]\n" 
 2577            "       Attempts to retrieve contact information for a specific\n" 
 2578            "DUNDi entity identifier (EID) within a given DUNDi context (or\n" 
 2579            "e164 if none is specified).\n";
 
 2584    if ((
a->argc < 3) || (
a->argc > 3)) {
 
 2588        ast_cli(
a->fd, 
"'%s' is not a valid EID!\n", 
a->argv[2]);
 
 2592    context = strchr(tmp, 
'@');
 
 2599        ast_cli(
a->fd, 
"DUNDi Query EID returned error.\n");
 
 2601        ast_cli(
a->fd, 
"DUNDi Query EID returned no results.\n");
 
 2603        ast_cli(
a->fd, 
"DUNDi Query EID succeeded:\n");
 
 
 2619        return "(Unspecified)";
 
 
 2645        e->
command = 
"dundi show peer";
 
 2647            "Usage: dundi show peer [peer]\n" 
 2648            "       Provide a detailed description of a specifid DUNDi peer.\n";
 
 2662        switch(peer->
order) {
 
 2667            order = 
"Secondary";
 
 2673            order = 
"Quartiary";
 
 2699                    ast_cli(
a->fd, 
"Last few query times:\n");
 
 2707        ast_cli(
a->fd, 
"No such peer '%s'\n", 
a->argv[3]);
 
 
 2714#define FORMAT2 "%-20.20s %-41s     %-6.6s %-10.10s %-8.8s %-15.15s\n" 
 2715#define FORMAT "%-20.20s %-41s %s %-6d %-10.10s %-8.8s %-15.15s\n" 
 2717    int registeredonly=0;
 
 2720    int online_peers = 0;
 
 2721    int offline_peers = 0;
 
 2722    int unmonitored_peers = 0;
 
 2723    int total_peers = 0;
 
 2726        e->
command = 
"dundi show peers [registered|include|exclude|begin]";
 
 2728            "Usage: dundi show peers [registered|include|exclude|begin]\n" 
 2729            "       Lists all known DUNDi peers.\n" 
 2730            "       If 'registered' is present, only registered peers are shown.\n";
 
 2736    if ((
a->argc != 3) && (
a->argc != 4) && (
a->argc != 5)) {
 
 2739    if ((
a->argc == 4)) {
 
 2740        if (!strcasecmp(
a->argv[3], 
"registered")) {
 
 2747    ast_cli(
a->fd, 
FORMAT2, 
"EID", 
"Host", 
"Port", 
"Model", 
"AvgTime", 
"Status");
 
 2750        int print_line = -1;
 
 2759                strcpy(
status, 
"UNREACHABLE");
 
 2771                strcpy(
status, 
"UNKNOWN");
 
 2775            strcpy(
status, 
"Unmonitored");
 
 2776            unmonitored_peers++;
 
 2781            strcpy(
avgms, 
"Unavail");
 
 2787                  if (!strcasecmp(
a->argv[3],
"include") && strstr(srch,
a->argv[4])) {
 
 2789                   } 
else if (!strcasecmp(
a->argv[3],
"exclude") && !strstr(srch,
a->argv[4])) {
 
 2791                   } 
else if (!strcasecmp(
a->argv[3],
"begin") && !strncasecmp(srch,
a->argv[4],strlen(
a->argv[4]))) {
 
 2804    ast_cli(
a->fd, 
"%d dundi peers [%d online, %d offline, %d unmonitored]\n", total_peers, online_peers, offline_peers, unmonitored_peers);
 
 
 2813#define FORMAT2 "%-47s %-5.5s %-5.5s %-3.3s %-3.3s %-3.3s\n" 
 2814#define FORMAT "%-41s:%5d %-5.5d %-5.5d %-3.3d %-3.3d %-3.3d\n" 
 2818        e->
command = 
"dundi show trans";
 
 2820            "Usage: dundi show trans\n" 
 2821            "       Lists all known DUNDi transactions.\n";
 
 
 2847        e->
command = 
"dundi show entityid";
 
 2849            "Usage: dundi show entityid\n" 
 2850            "       Displays the global entityid for this host.\n";
 
 2861    ast_cli(
a->fd, 
"Global EID for this system is '%s'\n", eid_str);
 
 
 2867#define FORMAT2 "%-15s %-15s %-15s %-3.3s %-3.3s\n" 
 2868#define FORMAT "%-15s %-15s %-15s %-3.3d %-3.3d\n" 
 2873        e->
command = 
"dundi show requests";
 
 2875            "Usage: dundi show requests\n" 
 2876            "       Lists all known pending DUNDi requests.\n";
 
 
 2900#define FORMAT2 "%-12.12s %-7.7s %-12.12s %-10.10s %-5.5s %-25.25s\n" 
 2901#define FORMAT "%-12.12s %-7s %-12.12s %-10.10s %-5.5s %-25.25s\n" 
 2907        e->
command = 
"dundi show mappings";
 
 2909            "Usage: dundi show mappings\n" 
 2910            "       Lists all known DUNDi mappings.\n";
 
 2919    ast_cli(
a->fd, 
FORMAT2, 
"DUNDi Cntxt", 
"Weight", 
"Local Cntxt", 
"Options", 
"Tech", 
"Destination");
 
 
 2934#define FORMAT2 "%-12.12s %-12.12s %-10.10s\n" 
 2935#define FORMAT "%-12.12s %-12.12s %02d:%02d:%02d\n" 
 2941        e->
command = 
"dundi show precache";
 
 2943            "Usage: dundi show precache\n" 
 2944            "       Lists all known DUNDi scheduled precache updates.\n";
 
 
 2972#define FORMAT2 "%-12.12s %-16.16s %-10.10s  %-18s %-7s %s\n" 
 2973#define FORMAT "%-12.12s %-16.16s %6d sec  %-18s %-7d %s/%s (%s)\n" 
 2978    char src_eid_str[20];
 
 2979    int expiry, tech, 
weight;
 
 2983    char *ptr, *term, *src, *
number, *context, *dst;
 
 2987        e->
command = 
"dundi show cache";
 
 2989        "Usage: dundi show cache\n" 
 2990        "       Lists all DUNDi cache entries.\n";
 
 3002    ast_cli(
a->fd, 
FORMAT2, 
"Number", 
"Context", 
"Expiration", 
"From", 
"Weight", 
"Destination (Flags)");
 
 3003    for (db_entry = db_tree; db_entry; db_entry = db_entry->
next) {
 
 3006        if ((strncmp(db_entry->
key, 
"/dundi/cache/hint/", 18) == 0) || 
ast_get_time_t(db_entry->
data, &ts, 0, &length)) {
 
 3016        ptr = db_entry->
key + 
sizeof(
"/dundi/cache");
 
 3017        strtok_r(ptr, 
"/", &rest);
 
 3019        context = strtok_r(
NULL, 
"/", &rest);
 
 3020        ptr = strtok_r(
NULL, 
"/", &rest);
 
 3026        ptr = db_entry->
data + length + 1;
 
 3028        if ((sscanf(ptr, 
"%30u/%30d/%30d/%n", &(
flags.flags), &
weight, &tech, &length) != 3)) {
 
 3034        term = strchr(ptr, 
'|');
 
 3044        src = strrchr(ptr, 
'/');
 
 3054        ast_cli(
a->fd, 
FORMAT, 
number, context, expiry, src_eid_str, 
weight, 
tech2str(tech), dst, 
dundi_flags2str(fs, 
sizeof(fs), 
flags.flags));
 
 3057    ast_cli(
a->fd, 
"Number of entries: %d\n", cnt);
 
 
 3067#define FORMAT2 "%-12.12s %-16.16s %-10.10s  %-18s\n" 
 3068#define FORMAT "%-12.12s %-16.16s %6d sec  %-18s\n" 
 3073    char src_eid_str[20];
 
 3076    char *ptr, *src, *
number, *context;
 
 3080        e->
command = 
"dundi show hints";
 
 3082            "Usage: dundi show hints\n" 
 3083            "       Lists all DUNDi 'DONTASK' hints in the cache.\n";
 
 3097    for (db_entry = db_tree; db_entry; db_entry = db_entry->
next) {
 
 3110        ptr = db_entry->
key + 
sizeof(
"/dundi/cache/hint");
 
 3111        src = strtok_r(ptr, 
"/", &rest);
 
 3113        context = strtok_r(
NULL, 
"/", &rest);
 
 3114        ptr = strtok_r(
NULL, 
"/", &rest);
 
 3126    ast_cli(
a->fd, 
"Number of entries: %d\n", cnt);
 
 
 3164    if (!(trans = 
ast_calloc(1, 
sizeof(*trans))))
 
 
 3238                    if (ms < peer->
maxms) {
 
 3282                if (write(trans->
parent->
pfds[1], 
"killa!", 6) < 0) {
 
 
 3331    if (ast_test_flag(trans, FLAG_ENCRYPT))
 
 
 3436    memset(&ied, 0, 
sizeof(ied));
 
 
 3460    int direct[1] = { 0, };
 
 3467    memset(&hmd, 0, 
sizeof(hmd));
 
 3468    memset(&
dr, 0, 
sizeof(
dr));
 
 3470    for (x=0;x<mapcount;x++)
 
 3474    for (x=0;x<ouranswers;x++) {
 
 3480        res = 
dundi_lookup_internal(
dr + ouranswers, 
MAX_RESULTS - ouranswers, 
NULL, trans->
parent->
dcontext, trans->
parent->
number, trans->
ttl, 1, &hmd, &expiration, 0, 1, &trans->
them_eid, avoid, direct);
 
 3487    if (ouranswers > 0) {
 
 3488        *foundanswers += ouranswers;
 
 3489        memset(&ied, 0, 
sizeof(ied));
 
 3498        for (x=0;x<ouranswers;x++) {
 
 3500            if (
dr[x].expiration && (expiration > 
dr[x].expiration))
 
 3501                expiration = 
dr[x].expiration;
 
 3508        if (expiration < *minexp)
 
 3509            *minexp = expiration;
 
 
 3526    memset(&ied, 0, 
sizeof(ied));
 
 
 3574            ast_debug(1, 
"Our transaction went away!\n");
 
 
 3715static void build_transactions(
struct dundi_request *
dr, 
int ttl, 
int order, 
int *
foundcache, 
int *
skipped, 
int blockempty, 
int nocache, 
int modeselect, 
dundi_eid *skip, 
dundi_eid *
avoid[], 
int directs[])
 
 3725        if (modeselect == 1) {
 
 3747                    for (x=0;avoid[x];x++) {
 
 3750                            if (directs && !directs[x])
 
 3766            } 
else if (!*skipped || (p->
order < *skipped))
 
 3767                *skipped = p->
order;
 
 
 3781            dr->dcontext, 
dr->number);
 
 3782        if (!strcasecmp(cur->
dcontext, 
dr->dcontext) &&
 
 3783            !strcasecmp(cur->
number, 
dr->number) &&
 
 3785            ast_debug(1, 
"Found existing query for '%s@%s' for '%s' crc '%08x'\n",
 
 3793        ast_debug(1, 
"Registering request for '%s@%s' on behalf of '%s' crc '%08x'\n",
 
 
 3828    uint32_t acrc32 = 0;
 
 3830    for (x=0;avoid[x];x++) {
 
 3833            acrc32 ^= 
crc32(0L, (
unsigned char *)avoid[x], 
sizeof(
dundi_eid));
 
 
 3839static int dundi_lookup_internal(
struct dundi_result *
result, 
int maxret, 
struct ast_channel *chan, 
const char *
dcontext, 
const char *
number, 
int ttl, 
int blockempty, 
struct dundi_hint_metadata *
hmd, 
int *
expiration, 
int cbypass, 
int modeselect, 
dundi_eid *skip, 
dundi_eid *avoid[], 
int direct[])
 
 3851    struct timeval start;
 
 3859    for (x=0;avoid[x];x++)
 
 3862    memset(&
dr, 0, 
sizeof(
dr));
 
 3863    if (pipe(
dr.pfds)) {
 
 3869    dr.maxcount = maxret;
 
 3870    dr.expiration = *expiration;
 
 3871    dr.cbypass = cbypass;
 
 3876        dr.root_eid = *rooteid;
 
 3883            ast_debug(1, 
"Oooh, duplicate request for '%s@%s' for '%s'\n",
 
 3890            ast_debug(1, 
"Waiting for similar request for '%s@%s' for '%s'\n",
 
 3906        build_transactions(&
dr, ttl, 
order, &foundcache, &skipped, blockempty, cbypass, modeselect, skip, avoid, direct);
 
 3935    *expiration = 
dr.expiration;
 
 
 3945    int direct[1] = { 0, };
 
 3947    memset(&hmd, 0, 
sizeof(hmd));
 
 3949    return dundi_lookup_internal(
result, maxret, chan, dcontext, 
number, 
dundi_ttl, 0, &hmd, &expiration, cbypass, 0, 
NULL, avoid, direct);
 
 
 3965        int len = 
sizeof(*qe);
 
 3966        int num_len = strlen(
number) + 1;
 
 3967        int context_len = strlen(
context) + 1;
 
 
 4016    struct timeval start;
 
 4020    int foundcache, skipped, ttlms, ms;
 
 4027        if (!strcasecmp(cur->dcontext, context))
 
 4034            if (!strcasecmp(cur->dcontext, context))
 
 4035                maps[nummaps++] = *cur;
 
 4043    memset(&dr2, 0, 
sizeof(dr2));
 
 4044    memset(&
dr, 0, 
sizeof(
dr));
 
 4045    memset(&hmd, 0, 
sizeof(hmd));
 
 4052    dr.pfds[0] = 
dr.pfds[1] = -1;
 
 4053    if (pipe(
dr.pfds) < 0) {
 
 4057    build_transactions(&
dr, ttl, 0, &foundcache, &skipped, 0, 1, 1, 
NULL, avoids, 
NULL);
 
 4062        if (
dr.expiration > 0)
 
 4065            ast_log(
LOG_NOTICE, 
"Weird, expiration = %d, but need to precache for %s@%s?!\n", 
dr.expiration, 
dr.number, 
dr.dcontext);
 
 4069        if (
dr.pfds[0] > -1) {
 
 4076    if (
dr.pfds[0] > -1) {
 
 
 4098    struct timeval start;
 
 4102    for (x=0;avoid[x];x++)
 
 4105    memset(&
dr, 0, 
sizeof(
dr));
 
 4108    dr.pfds[0] = 
dr.pfds[1] = -1;
 
 4110    memcpy(&
dr.query_eid, eid, 
sizeof(
dr.query_eid));
 
 4112        dr.root_eid = *rooteid;
 
 4114    build_transactions(&
dr, ttl, 9999, &foundcache, &skipped, blockempty, 0, 0, 
NULL, avoid, 
NULL);
 
 
 4140    memset(&hmd, 0, 
sizeof(hmd));
 
 
 4180        args.context = 
"e164";
 
 4186        for (x = 0; x < results; x++) {
 
 4188                snprintf(
buf, 
len, 
"%s/%s", 
dr[x].tech, 
dr[x].dest);
 
 
 4202    .
name = 
"DUNDILOOKUP",
 
 
 4226    .
type = 
"DUNDIQUERY",
 
 
 4260        args.context = 
"e164";
 
 4262    if (!(drds = 
ast_calloc(1, 
sizeof(*drds)))) {
 
 4267    snprintf(
buf, 
len, 
"%u", drds->
id);
 
 4274    datastore->
data = drds;
 
 
 4290    .
name = 
"DUNDIQUERY",
 
 
 4339    drds = datastore->
data;
 
 4341    if (!strcasecmp(
args.resultnum, 
"getnum")) {
 
 4347    if (sscanf(
args.resultnum, 
"%30u", &num) != 1) {
 
 4353    if (num && drds->
num_results > 0 && num <= drds->num_results) {
 
 4357        ast_log(
LOG_WARNING, 
"Result number %u is not valid for DUNDi query results for ID %s!\n", num, 
args.id);
 
 
 4364    .
name = 
"DUNDIRESULT",
 
 
 4461    if (!(perm = 
ast_calloc(1, 
sizeof(*perm) + strlen(s) + 1)))
 
 4464    strcpy(perm->
name, s);
 
 
 4496    memset(fields, 0, 
sizeof(fields));
 
 4510    } 
else if (x >= 4) {
 
 4517        } 
else if (!strncmp(fields[1], 
"${", 2) && fields[1][strlen(fields[1]) - 1] == 
'}') {
 
 4525        for (y = 4;y < x; y++) {
 
 4526            if (!strcasecmp(fields[y], 
"nounsolicited"))
 
 4528            else if (!strcasecmp(fields[y], 
"nocomunsolicit"))
 
 4530            else if (!strcasecmp(fields[y], 
"residential"))
 
 4532            else if (!strcasecmp(fields[y], 
"commercial"))
 
 4534            else if (!strcasecmp(fields[y], 
"mobile"))
 
 4536            else if (!strcasecmp(fields[y], 
"nopartial"))
 
 4542        ast_log(
LOG_WARNING, 
"Expected at least %d arguments in map, but got only %d\n", 4, x);
 
 
 4560        memset(&ied, 0, 
sizeof(ied));
 
 
 4587    if (peer->
maxms > 0) {
 
 
 4610    if (!
ast_db_get(
"dundi/dpeers", eid_str, data, 
sizeof(data))) {
 
 4627            if (sscanf(
c, 
"%5d:%30d", &port, &expire) == 2) {
 
 
 4659        if (!(peer = 
ast_calloc(1, 
sizeof(*peer)))) {
 
 4675    for (; v; v = v->
next) {
 
 4676        if (!strcasecmp(v->
name, 
"inkey")) {
 
 4678        } 
else if (!strcasecmp(v->
name, 
"outkey")) {
 
 4680        } 
else if (!strcasecmp(v->
name, 
"port")) {
 
 4681            port = atoi(v->
value);
 
 4682        } 
else if (!strcasecmp(v->
name, 
"host")) {
 
 4683            if (!strcasecmp(v->
value, 
"dynamic")) {
 
 4697        } 
else if (!strcasecmp(v->
name, 
"ustothem")) {
 
 4702        } 
else if (!strcasecmp(v->
name, 
"include")) {
 
 4704        } 
else if (!strcasecmp(v->
name, 
"permit")) {
 
 4706        } 
else if (!strcasecmp(v->
name, 
"noinclude")) {
 
 4708        } 
else if (!strcasecmp(v->
name, 
"deny")) {
 
 4710        } 
else if (!strcasecmp(v->
name, 
"register")) {
 
 4712        } 
else if (!strcasecmp(v->
name, 
"order")) {
 
 4713            if (!strcasecmp(v->
value, 
"primary"))
 
 4715            else if (!strcasecmp(v->
value, 
"secondary"))
 
 4717            else if (!strcasecmp(v->
value, 
"tertiary"))
 
 4719            else if (!strcasecmp(v->
value, 
"quartiary"))
 
 4724        } 
else if (!strcasecmp(v->
name, 
"qualify")) {
 
 4725            if (!strcasecmp(v->
value, 
"no")) {
 
 4727            } 
else if (!strcasecmp(v->
value, 
"yes")) {
 
 4729            } 
else if (sscanf(v->
value, 
"%30d", &peer->
maxms) != 1) {
 
 4730                ast_log(
LOG_WARNING, 
"Qualification of peer '%s' should be 'yes', 'no', or a number of milliseconds at line %d of dundi.conf\n",
 
 4734        } 
else if (!strcasecmp(v->
name, 
"model")) {
 
 4735            if (!strcasecmp(v->
value, 
"inbound"))
 
 4737            else if (!strcasecmp(v->
value, 
"outbound"))
 
 4739            else if (!strcasecmp(v->
value, 
"symmetric"))
 
 4741            else if (!strcasecmp(v->
value, 
"none"))
 
 4744                ast_log(
LOG_WARNING, 
"Unknown model '%s', should be 'none', 'outbound', 'inbound', or 'symmetric' at line %d\n",
 
 4747        } 
else if (!strcasecmp(v->
name, 
"precache")) {
 
 4748            if (!strcasecmp(v->
value, 
"inbound"))
 
 4750            else if (!strcasecmp(v->
value, 
"outbound"))
 
 4752            else if (!strcasecmp(v->
value, 
"symmetric"))
 
 4754            else if (!strcasecmp(v->
value, 
"none"))
 
 4757                ast_log(
LOG_WARNING, 
"Unknown pcmodel '%s', should be 'none', 'outbound', 'inbound', or 'symmetric' at line %d\n",
 
 4767    (*globalpcmode) |= peer->
pcmodel;
 
 4773        ast_log(
LOG_WARNING, 
"Peer '%s' may not be both inbound/symmetric model and outbound/symmetric precache model, discarding!\n",
 
 4777        ast_log(
LOG_WARNING, 
"Peer '%s' may not be both outbound/symmetric model and inbound/symmetric precache model, discarding!\n",
 
 4781        ast_log(
LOG_WARNING, 
"Peer '%s' is supposed to be included in outbound searches but isn't an outbound peer or inbound precache!\n",
 
 4784        ast_log(
LOG_WARNING, 
"Peer '%s' is supposed to have permission for some inbound searches but isn't an inbound peer or outbound precache!\n",
 
 
 4808    for (x=0;x<res;x++) {
 
 
 4833    const char *dundiargs;
 
 4841        for (x=0;x<res;x++) {
 
 4855        if (!strcasecmp(results[x].
tech, 
"SIP") || !strcasecmp(results[x].
tech, 
"PJSIP")) {
 
 4858            if (strcasecmp(results[x].
tech, 
"SIP")) {
 
 4859                ast_log(
LOG_WARNING, 
"%s cannot be specified by DUNDi peers (peer should use SIP for DUNDi lookups instead)\n", results[x].
tech);
 
 4869                ast_log(
LOG_WARNING, 
"PJSIP calls require an endpoint to be specified explicitly (use the pjsip_outgoing_endpoint option in dundi.conf)\n");
 
 4878            snprintf(req, 
sizeof(req), 
"%s/%s/sip:%s@%s,,%s", results[x].
tech, 
pjsip_outgoing_endpoint, 
S_OR(
number, 
""), ip, 
S_OR(dundiargs, 
""));
 
 4879            ast_debug(1, 
"Finalized PJSIP Dial: %s\n", req);
 
 4881            snprintf(req, 
sizeof(req), 
"%s/%s,,%s", results[x].
tech, results[x].
dest, 
S_OR(dundiargs, 
""));
 
 
 4897    .description = 
"DUNDi Discovered Dialplan Switch",
 
 
 4921    struct addrinfo 
hints;
 
 4932    if (gethostname(hn, 
sizeof(hn) - 1) < 0) {
 
 
 4947    static int last_port = 0;
 
 4949    int globalpcmodel = 0;
 
 4951    char bind_addr[80]={0,};
 
 4952    char bind_addr2[80]={0,};
 
 4975        if (!strcasecmp(v->
name, 
"port")){
 
 4976            port = atoi(v->
value);
 
 4977        } 
else if (!strcasecmp(v->
name, 
"bindaddr")) {
 
 4983        } 
else if (!strcasecmp(v->
name, 
"bindaddr2")) {
 
 4989        } 
else if (!strcasecmp(v->
name, 
"authdebug")) {
 
 4991        } 
else if (!strcasecmp(v->
name, 
"ttl")) {
 
 4995                ast_log(
LOG_WARNING, 
"'%s' is not a valid TTL at line %d, must be number from 1 to %d\n",
 
 4998        } 
else if (!strcasecmp(v->
name, 
"autokill")) {
 
 4999            if (sscanf(v->
value, 
"%30d", &x) == 1) {
 
 5009        } 
else if (!strcasecmp(v->
name, 
"entityid")) {
 
 5014        } 
else if (!strcasecmp(v->
name, 
"tos")) {
 
 5017        } 
else if (!strcasecmp(v->
name, 
"department")) {
 
 5019        } 
else if (!strcasecmp(v->
name, 
"organization")) {
 
 5021        } 
else if (!strcasecmp(v->
name, 
"locality")) {
 
 5023        } 
else if (!strcasecmp(v->
name, 
"stateprov")) {
 
 5025        } 
else if (!strcasecmp(v->
name, 
"country")) {
 
 5027        } 
else if (!strcasecmp(v->
name, 
"email")) {
 
 5029        } 
else if (!strcasecmp(v->
name, 
"phone")) {
 
 5031        } 
else if (!strcasecmp(v->
name, 
"storehistory")) {
 
 5033        } 
else if (!strcasecmp(v->
name, 
"outgoing_sip_tech")) {
 
 5040        } 
else if (!strcasecmp(v->
name, 
"pjsip_outgoing_endpoint")) {
 
 5042        } 
else if (!strcasecmp(v->
name, 
"cachetime")) {
 
 5043            if ((sscanf(v->
value, 
"%30d", &x) == 1)) {
 
 5046                ast_log(
LOG_WARNING, 
"'%s' is not a valid cache time at line %d. Using default value '%d'.\n",
 
 5058        sprintf(bind_addr, 
"0.0.0.0:%d", port);
 
 5064    if (last_port == 0) {
 
 5066    } 
else if (last_port != port) {
 
 5091        if (strcasecmp(cat, 
"general") && strcasecmp(cat, 
"mappings")) {
 
 5095            else if (!strcasecmp(cat, 
"*")) {
 
 
 5176    if (
set_config(
"dundi.conf", &sin, 1, &sin2))
 
 
 5201    if (
set_config(
"dundi.conf", &sin, 0, &sin2)) {
 
 5207            ast_log(
LOG_ERROR, 
"bindaddr & bindaddr2 should be different IP protocols.\n");
 
 5213        netsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
 
 5214        netsocket2 = socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP);
 
 5246            netsocket = socket(AF_INET6, SOCK_DGRAM, IPPROTO_IP);
 
 5248            netsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
 
 
 5290    .optional_modules = 
"res_crypto",
 
Access Control of various sorts.
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
struct ast_context * ast_walk_contexts(void)
void ast_cli_unregister_multiple(void)
static const struct adsi_event events[]
struct sla_ringing_trunk * last
Persistent data storage (akin to *doze registry)
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
struct ast_db_entry * ast_db_gettree(const char *family, const char *keytree)
Get a list of values within the astdb tree.
int ast_db_deltree(const char *family, const char *keytree)
Delete one or more entries in astdb.
void ast_db_freetree(struct ast_db_entry *entry)
Free structure created by ast_db_gettree()
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
static const char config_file[]
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define ast_channel_lock(chan)
int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception)
Waits for input on an fd.
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
#define ast_channel_unlock(chan)
#define AST_MAX_EXTENSION
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
#define ast_var_assign(name, value)
void ast_var_delete(struct ast_var_t *var)
Standard Command Line Interface.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Provide cryptographic signature routines.
int AST_OPTIONAL_API_NAME() ast_aes_set_encrypt_key(const unsigned char *key, ast_aes_encrypt_key *ctx)
Set an encryption key.
int AST_OPTIONAL_API_NAME() ast_aes_decrypt(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *key)
AES decrypt data.
int AST_OPTIONAL_API_NAME() ast_decrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
Decrypt a message using a given private key.
int AST_OPTIONAL_API_NAME() ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *dsig)
Sign a message signature using a given private key.
struct ast_key *AST_OPTIONAL_API_NAME() ast_key_get(const char *kname, int ktype)
Retrieve a key.
int AST_OPTIONAL_API_NAME() ast_aes_set_decrypt_key(const unsigned char *key, ast_aes_decrypt_key *ctx)
Set a decryption key.
int AST_OPTIONAL_API_NAME() ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *dsig)
Check the authenticity of a message signature using a given public key.
int AST_OPTIONAL_API_NAME() ast_aes_encrypt(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *key)
AES encrypt data.
int AST_OPTIONAL_API_NAME() ast_encrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
Encrypt a message using a given private key.
#define ast_datastore_alloc(info, uid)
int dundi_ie_append_int(struct dundi_ie_data *ied, unsigned char ie, unsigned int value)
int dundi_ie_append_encdata(struct dundi_ie_data *ied, unsigned char ie, unsigned char *iv, void *data, int datalen)
void dundi_set_output(void(*func)(const char *))
int dundi_ie_append_raw(struct dundi_ie_data *ied, unsigned char ie, void *data, int datalen)
int dundi_str_short_to_eid(dundi_eid *eid, const char *s)
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_eid(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid)
int dundi_ie_append_byte(struct dundi_ie_data *ied, unsigned char ie, unsigned char dat)
int dundi_ie_append_short(struct dundi_ie_data *ied, unsigned char ie, unsigned short value)
int dundi_ie_append(struct dundi_ie_data *ied, unsigned char ie)
char * dundi_flags2str(char *buf, int bufsiz, int flags)
int dundi_parse_ies(struct dundi_ies *ies, unsigned char *data, int datalen)
void dundi_showframe(struct dundi_hdr *fhi, int rx, struct ast_sockaddr *sin, int datalen)
int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, char *str)
char * dundi_eid_to_str_short(char *s, int maxlen, dundi_eid *eid)
int dundi_eid_zero(dundi_eid *eid)
int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *data)
void dundi_set_error(void(*func)(const char *))
int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data)
Distributed Universal Number Discovery (DUNDi) See also.
#define DUNDI_DEFAULT_VERSION
#define DUNDI_IE_CACHEBYPASS
#define DUNDI_COMMAND_NULL
@ DUNDI_FLAG_NOCOMUNSOLICIT
@ DUNDI_FLAG_NOUNSOLICITED
#define DUNDI_IE_DEPARTMENT
#define DUNDI_IE_ORGANIZATION
#define DUNDI_COMMAND_PRECACHERQ
#define DUNDI_IE_LOCALITY
#define DUNDI_IE_SIGNATURE
#define DUNDI_IE_EXPIRATION
#define DUNDI_COMMAND_PRECACHERP
#define DUNDI_IE_CALLED_CONTEXT
#define DUNDI_COMMAND_ENCREJ
#define DUNDI_DEFAULT_TTL
#define DUNDI_COMMAND_EIDQUERY
#define DUNDI_IE_CALLED_NUMBER
#define DUNDI_COMMAND_DPRESPONSE
#define DUNDI_IE_EID_DIRECT
#define DUNDI_DEFAULT_RETRANS
#define DUNDI_IE_SHAREDKEY
#define DUNDI_COMMAND_CANCEL
#define DUNDI_COMMAND_INVALID
#define DUNDI_DEFAULT_CACHE_TIME
#define DUNDI_COMMAND_DPDISCOVER
#define DUNDI_DEFAULT_RETRANS_TIMER
#define DUNDI_COMMAND_EIDRESPONSE
#define DUNDI_IE_KEYCRC32
#define DUNDI_COMMAND_ACK
#define DUNDI_COMMAND_UNKNOWN
#define DUNDI_DEFAULT_KEY_EXPIRE
#define DUNDI_COMMAND_FINAL
#define DUNDI_COMMAND_REGRESPONSE
#define DUNDI_COMMAND_ENCRYPT
#define DUNDI_COMMAND_REGREQ
#define DUNDI_IE_STATE_PROV
Generic File Format Support. Should be included by clients of the file handling routines....
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct ast_custom_function dundi_function
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
Asterisk internal frame definitions.
Support for logging to various files, console and syslog Configuration in file logger....
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
I/O Management (derived from Cheops-NG)
struct io_context * io_context_create(void)
Creates a context Create a context for I/O operations Basically mallocs an IO structure and sets up s...
int * ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data)
Adds an IO context.
void io_context_destroy(struct io_context *ioc)
Destroys a context.
int ast_io_wait(struct io_context *ioc, int howlong)
Waits for IO.
int ast_io_remove(struct io_context *ioc, int *id)
Removes an IO context.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_HEAD_NOLOCK_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_INSERT_AFTER(head, listelm, elm, field)
Inserts a list entry after a given entry.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
Asterisk locking-related definitions:
#define AST_PTHREADT_NULL
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_EXTENDED
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_FAILURE
Module could not be loaded properly.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static char * ast_sockaddr_stringify(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() with default format.
#define ast_sockaddr_port(addr)
Get the port number of a socket address.
static void ast_sockaddr_copy(struct ast_sockaddr *dst, const struct ast_sockaddr *src)
Copies the data from one ast_sockaddr to another.
int ast_sockaddr_is_ipv6(const struct ast_sockaddr *addr)
Determine if this is an IPv6 address.
int ast_bind(int sockfd, const struct ast_sockaddr *addr)
Wrapper around bind(2) that uses struct ast_sockaddr.
static char * ast_sockaddr_stringify_host(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only, suitable for a URL (with brack...
ssize_t ast_sendto(int sockfd, const void *buf, size_t len, int flags, const struct ast_sockaddr *dest_addr)
Wrapper around sendto(2) that uses ast_sockaddr.
int ast_sockaddr_resolve(struct ast_sockaddr **addrs, const char *str, int flags, int family)
Parses a string with an IPv4 or IPv6 address and place results into an array.
int ast_set_qos(int sockfd, int tos, int cos, const char *desc)
Set type of service.
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
static int ast_sockaddr_isnull(const struct ast_sockaddr *addr)
Checks if the ast_sockaddr is null. "null" in this sense essentially means uninitialized,...
ssize_t ast_recvfrom(int sockfd, void *buf, size_t len, int flags, struct ast_sockaddr *src_addr)
Wrapper around recvfrom(2) that uses struct ast_sockaddr.
int ast_sockaddr_cmp(const struct ast_sockaddr *a, const struct ast_sockaddr *b)
Compares two ast_sockaddr structures.
#define ast_sockaddr_set_port(addr, port)
Sets the port number of a socket address.
static char * ast_sockaddr_stringify_addr(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only.
static void ast_sockaddr_setnull(struct ast_sockaddr *addr)
Sets address addr to null.
int ast_sockaddr_is_ipv4(const struct ast_sockaddr *addr)
Determine if the address is an IPv4 address.
Wrapper for network related headers, masking differences between various operating systems....
Core PBX routines and definitions.
void pbx_substitute_variables_varshead(struct varshead *headp, const char *cp1, char *cp2, int count)
void ast_unregister_switch(struct ast_switch *sw)
Unregister an alternative switch.
int ast_register_switch(struct ast_switch *sw)
Register an alternative dialplan switch.
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
int ast_pbx_exec_application(struct ast_channel *chan, const char *app_name, const char *app_args)
Execute an application.
int ast_unlock_context(struct ast_context *con)
const char * ast_get_context_name(struct ast_context *con)
#define ast_custom_function_register(acf)
Register a custom function.
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
int ast_rdlock_contexts(void)
Read locks the context list.
int ast_ignore_pattern(const char *context, const char *pattern)
Checks to see if a number should be ignored.
struct ast_exten * ast_walk_context_extensions(struct ast_context *con, struct ast_exten *priority)
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch)
int ast_unlock_contexts(void)
Unlocks contexts.
const char * ast_get_extension_name(struct ast_exten *exten)
int ast_rdlock_context(struct ast_context *con)
Read locks a given context.
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
static int cache_save_hint(dundi_eid *eidpeer, struct dundi_request *req, struct dundi_hint *hint, int expiration)
static int cache_lookup(struct dundi_request *req, dundi_eid *peer_eid, uint32_t crc, int *lowexpiration)
static int socket_read(int *id, int fd, short events, void *sock)
static char * dundi_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int encrypt_memcpy(unsigned char *dst, unsigned char *src, int len, unsigned char *iv, ast_aes_encrypt_key *ecx)
static int reset_transaction(struct dundi_transaction *trans)
static void destroy_trans(struct dundi_transaction *trans, int fromtimeout)
static void apply_peer(struct dundi_transaction *trans, struct dundi_peer *p)
static int dundi_answer_query(struct dundi_transaction *trans, struct dundi_ies *ies, char *ccontext)
static struct dundi_transaction * create_transaction(struct dundi_peer *p)
static void load_password(void)
static void check_password(void)
#define DUNDI_MODEL_SYMMETRIC
static void reschedule_precache(const char *number, const char *context, int expiration)
static struct ast_switch dundi_switch
static int decrypt_memcpy(unsigned char *dst, unsigned char *src, int len, unsigned char *iv, ast_aes_decrypt_key *dcx)
static dundi_eid empty_eid
static char * dundi_show_hints(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void cancel_request(struct dundi_request *dr)
static int cache_lookup_internal(time_t now, struct dundi_request *req, char *key, char *eid_str_full, int *lowexpiration)
int dundi_precache(const char *context, const char *number)
Pre-cache to push upstream peers.
static void drds_destroy(struct dundi_result_datastore *drds)
static int handle_command_response(struct dundi_transaction *trans, struct dundi_hdr *hdr, int datalen, int encrypted)
static int dundi_precache_internal(const char *context, const char *number, int ttl, dundi_eid *avoids[])
static struct ast_sched_context * sched
static int optimize_transactions(struct dundi_request *dr, int order)
static int dundi_send(struct dundi_transaction *trans, int cmdresp, int flags, int final, struct dundi_ie_data *ied)
static char * dundi_store_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * dundi_show_peer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * dundi_show_requests(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int dundi_prop_precache(struct dundi_transaction *trans, struct dundi_ies *ies, char *ccontext)
static void build_secret(char *secret, int seclen)
#define DUNDI_FLAG_INTERNAL_NOPARTIAL
static struct ast_custom_function dundi_query_function
static int dundi_encrypt(struct dundi_transaction *trans, struct dundi_packet *pack)
static int dundifunc_read(struct ast_channel *chan, const char *cmd, char *num, char *buf, size_t len)
static int do_register_expire(const void *data)
static int global_autokilltimeout
static int append_transaction(struct dundi_request *dr, struct dundi_peer *p, int ttl, dundi_eid *avoid[])
static int get_trans_id(void)
static int has_permission(struct permissionlist *permlist, char *cont)
static void save_secret(const char *newkey, const char *oldkey)
static int outgoing_sip_tech
static int check_request(struct dundi_request *dr)
static int check_key(struct dundi_peer *peer, unsigned char *newkey, unsigned char *newsig, uint32_t keycrc32)
static char cursecret[80]
static int dundi_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static char * dundi_do_lookup(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void prune_peers(void)
int dundi_lookup(struct dundi_result *result, int maxret, struct ast_channel *chan, const char *dcontext, const char *number, int cbypass)
Lookup the given number in the given dundi context. Lookup number in a given dundi context (if unspec...
static struct dundi_peer * find_peer(dundi_eid *eid)
#define DUNDI_MODEL_INBOUND
static void build_iv(unsigned char *iv)
static int query_transactions(struct dundi_request *dr)
static void dundi_debug_output(const char *data)
static unsigned long avoid_crc32(dundi_eid *avoid[])
static void mark_mappings(void)
static int dundi_query_eid_internal(struct dundi_entity_info *dei, const char *dcontext, dundi_eid *eid, struct dundi_hint_metadata *hmd, int ttl, int blockempty, dundi_eid *avoid[])
static void * dundi_query_thread(void *data)
static int global_storehistory
static int set_config(char *config_file, struct ast_sockaddr *sin, int reload, struct ast_sockaddr *sin2)
static int cache_save(dundi_eid *eidpeer, struct dundi_request *req, int start, int unaffected, int expiration, int push)
static void dundi_ie_append_eid_appropriately(struct dundi_ie_data *ied, char *context, dundi_eid *eid, dundi_eid *us)
static char * dundi_show_entityid(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int dundi_ack(struct dundi_transaction *trans, int final)
static int dundi_cache_time
static struct dundi_hdr * dundi_decrypt(struct dundi_transaction *trans, unsigned char *dst, int *dstlen, struct dundi_hdr *ohdr, struct dundi_encblock *src, int srclen)
static void populate_addr(struct dundi_peer *peer, dundi_eid *eid)
static int dundi_result_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static void destroy_packets(struct packetlist *p)
static void sort_results(struct dundi_result *results, int count)
static void append_permission(struct permissionlist *permlist, const char *s, int allow)
static struct ast_custom_function dundi_result_function
static const struct ast_app_option dundi_query_opts[128]
static void dundi_error_output(const char *data)
static unsigned int dundi_result_id
static int register_request(struct dundi_request *dr, struct dundi_request **pending)
static int dundi_discover(struct dundi_transaction *trans)
static int get_ipaddress(char *ip, size_t size, const char *str, int family)
static int dundi_lookup_internal(struct dundi_result *result, int maxret, struct ast_channel *chan, const char *dcontext, const char *number, int ttl, int blockempty, struct dundi_hint_metadata *md, int *expiration, int cybpass, int modeselect, dundi_eid *skip, dundi_eid *avoid[], int direct[])
static const struct ast_datastore_info dundi_result_datastore_info
static pthread_t precachethreadid
static char * dundi_do_precache(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int ack_trans(struct dundi_transaction *trans, int iseqno)
static int dundi_helper(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *data, int flag)
static void set_host_ipaddr(struct ast_sockaddr *sin)
static char * dundi_show_cache(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void destroy_packet(struct dundi_packet *pack, int needfree)
static int dundi_exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static void build_transactions(struct dundi_request *dr, int ttl, int order, int *foundcache, int *skipped, int blockempty, int nocache, int modeselect, dundi_eid *skip, dundi_eid *avoid[], int directs[])
static int rescomp(const void *a, const void *b)
static int dundi_query_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static void mark_peers(void)
static uint16_t dundi_sockaddr_port(const struct ast_sockaddr *addr)
static void destroy_permissions(struct permissionlist *permlist)
static struct ast_cli_entry cli_dundi[]
static char * tech2str(int tech)
static void prune_mappings(void)
static char * dundi_do_query(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void qualify_peer(struct dundi_peer *peer, int schedonly)
#define DUNDI_MODEL_OUTBOUND
static int dundi_shutdown
static int dundi_query(struct dundi_transaction *trans)
static pthread_t netthreadid
static int precache_transactions(struct dundi_request *dr, struct dundi_mapping *maps, int mapcount, int *expiration, int *foundanswers)
static int precache_trans(struct dundi_transaction *trans, struct dundi_mapping *maps, int mapcount, int *minexp, int *foundanswers)
static int dundi_lookup_local(struct dundi_result *dr, struct dundi_mapping *map, char *called_number, dundi_eid *us_eid, int anscnt, struct dundi_hint_metadata *hmd)
static int default_expiration
static int get_mapping_weight(struct dundi_mapping *map, struct varshead *headp)
static int do_autokill(const void *data)
static void deep_copy_peer(struct dundi_peer *peer_dst, const struct dundi_peer *peer_src)
int dundi_query_eid(struct dundi_entity_info *dei, const char *dcontext, dundi_eid eid)
Retrieve information on a specific EID.
static void * network_thread(void *ignore)
static char * dundi_show_trans(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct io_context * io
static void build_peer(dundi_eid *eid, struct ast_variable *v, int *globalpcmode)
static void unregister_request(struct dundi_request *dr)
static int dundi_canmatch(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static int update_key(struct dundi_peer *peer)
#define DUNDI_SECRET_TIME
static int load_module(void)
static void build_mapping(const char *name, const char *value)
static void abort_request(struct dundi_request *dr)
static int dundi_answer_entity(struct dundi_transaction *trans, struct dundi_ies *ies, char *ccontext)
static char * dundi_show_mappings(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * complete_peer_helper(const char *line, const char *word, int pos, int state, int rpos)
static char stateprov[80]
static struct dundi_peer * any_peer
Wildcard peer.
static char * dundi_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static int str2tech(const char *str)
static int dundi_xmit(struct dundi_packet *pack)
static int unload_module(void)
static void * process_precache(void *ign)
static int dundi_rexmit(const void *data)
static void dundi_reject(struct dundi_hdr *h, struct ast_sockaddr *sin)
static void * dundi_lookup_thread(void *data)
static char * dundi_sockaddr_stringify_host(const struct ast_sockaddr *addr)
static char pjsip_outgoing_endpoint[80]
static char * dundi_flush(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct dundi_transaction * find_transaction(struct dundi_hdr *hdr, struct ast_sockaddr *sin)
static char * model2str(int model)
static void destroy_map(struct dundi_mapping *map)
static int do_qualify(const void *data)
#define DUNDI_TIMING_HISTORY
static void destroy_peer(struct dundi_peer *peer)
static void * process_clearcache(void *ignore)
static int start_network_thread(void)
static int handle_frame(struct dundi_hdr *h, struct ast_sockaddr *sin, int datalen)
static int do_register(const void *data)
static void dundi_precache_full(void)
static void drds_destroy_cb(void *data)
static char * dundi_show_precache(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static pthread_t clearcachethreadid
static void * dundi_precache_thread(void *data)
static int dundi_matchmore(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static int discover_transactions(struct dundi_request *dr)
static dundi_eid global_eid
static char secretpath[80]
Scheduler Routines (derived from cheops)
#define AST_SCHED_DEL(sched, id)
Remove a scheduler entry.
int ast_sched_add(struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result
Adds a scheduled event.
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
int ast_sched_wait(struct ast_sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
int ast_get_time_t(const char *src, time_t *dst, time_t _default, int *consumed)
Parse a time (integer) string.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Main Channel structure associated with a channel.
descriptor for a cli entry.
int args
This gets set in ast_cli_register()
ast_context: An extension context
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
struct ast_db_entry * next
An Entity ID is essentially a MAC address, brief and unique.
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
Structure used to handle boolean flags.
Socket address structure.
struct ast_var_t::@224 entries
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
struct dundi_answer * answers[DUNDI_MAX_ANSWERS+1]
dundi_eid * eids[DUNDI_MAX_STACK+1]
int eid_direct[DUNDI_MAX_STACK+1]
unsigned char * encsharedkey
struct dundi_encblock * encblock
struct dundi_mapping::@452 list
char lcontext[AST_MAX_EXTENSION]
char dcontext[AST_MAX_EXTENSION]
struct dundi_mapping * next
struct dundi_packet::@446 list
struct dundi_transaction * parent
int lookuptimes[DUNDI_TIMING_HISTORY]
unsigned char txenckey[256]
char * lookups[DUNDI_TIMING_HISTORY]
unsigned char rxenckey[256]
ast_aes_encrypt_key us_ecx
struct dundi_peer::permissionlist permit
struct dundi_transaction * regtrans
struct dundi_peer::@453 list
ast_aes_decrypt_key them_dcx
struct dundi_transaction * qualtrans
ast_aes_encrypt_key them_ecx
struct permissionlist include
ast_aes_decrypt_key us_dcx
struct dundi_precache_queue::@447 list
char called_context[AST_MAX_EXTENSION]
struct dundi_mapping * maps
int directs[DUNDI_MAX_STACK+1]
dundi_eid * eids[DUNDI_MAX_STACK+1]
char called_number[AST_MAX_EXTENSION]
struct dundi_transaction * trans
struct dundi_request::@451 list
struct dundi_entity_info * dei
struct dundi_hint_metadata * hmd
char number[AST_MAX_EXTENSION]
struct dundi_request::@450 trans
char dcontext[AST_MAX_EXTENSION]
struct dundi_result results[MAX_RESULTS]
struct dundi_transaction::@449 all
struct dundi_transaction::packetlist packets
struct dundi_transaction::@448 parentlist
struct packetlist lasttrans
dundi_eid eids[DUNDI_MAX_STACK+1]
struct dundi_request * parent
Global IO variables are now in a struct in order to be made threadsafe.
struct permission::@445 list
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_test_flag(p, flag)
#define ast_set_flag_nonstd(p, flag)
#define ast_clear_flag_nonstd(p, flag)
int ast_eid_cmp(const struct ast_eid *eid1, const struct ast_eid *eid2)
Compare two EIDs.
int ast_base64encode(char *dst, const unsigned char *src, int srclen, int max)
Encode data in base64.
#define ast_pthread_create_background(a, b, c, d)
char * ast_eid_to_str(char *s, int maxlen, struct ast_eid *eid)
Convert an EID to a string.
#define ast_clear_flag(p, flag)
long int ast_random(void)
#define ast_pthread_create_detached(a, b, c, d)
int ast_eid_is_empty(const struct ast_eid *eid)
Check if EID is empty.
#define ast_test_flag_nonstd(p, flag)
#define ast_set_flag(p, flag)
#define ast_copy_flags(dest, src, flagz)
struct ast_eid ast_eid_default
Global EID.
int ast_str_to_eid(struct ast_eid *eid, const char *s)
Convert a string into an EID.