Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:47:53 2009

## Asterisk developer's documentation

# dundi-parser.h

Go to the documentation of this file.

    00001 /*
    00002  * Distributed Universal Number Discovery (DUNDi)
    00003  *
    00004  * Copyright (C) 2004 - 2005, Digium Inc.
    00005  *
    00006  * Written by Mark Spencer <markster@digium.com>
    00007  *
    00008  * This program is Free Software distributed under the terms of
    00009  * of the GNU General Public License.
    00010  */
    00011
    00012 #ifndef _DUNDI_PARSER_H
    00013 #define _DUNDI_PARSER_H
    00014
    00015 #include "asterisk/dundi.h"
    00016 #include "asterisk/aes.h"
    00017
    00018 #define DUNDI_MAX_STACK 512
    00019 #define DUNDI_MAX_ANSWERS  100
    00020
    00021 struct dundi_ies {
    00022    dundi_eid *eids[DUNDI_MAX_STACK + 1];
    00023    int eid_direct[DUNDI_MAX_STACK + 1];
    00024    dundi_eid *reqeid;
    00025    int eidcount;
    00026    char *called_context;
    00027    char *called_number;
    00028    struct dundi_answer *answers[DUNDI_MAX_ANSWERS + 1];
    00029    struct dundi_hint *hint;
    00030    int anscount;
    00031    int ttl;
    00032    int version;
    00033    int expiration;
    00034    int unknowncmd;
    00035    unsigned char *pubkey;
    00036    int cause;
    00037    char *q_dept;
    00038    char *q_org;
    00039    char *q_locality;
    00040    char *q_stateprov;
    00041    char *q_country;
    00042    char *q_email;
    00043    char *q_phone;
    00044    char *q_ipaddr;
    00045    char *causestr;
    00046    unsigned char *encsharedkey;
    00047    unsigned char *encsig;
    00048    unsigned long keycrc32;
    00049    struct dundi_encblock *encblock;
    00050    int enclen;
    00051    int cbypass;
    00052 };
    00053
    00054 struct dundi_ie_data {
    00055    int pos;
    00056    unsigned char buf[8192];
    00057 };
    00058
    00059 /* Choose a different function for output */
    00060 extern void dundi_set_output(void (*output)(const char *data));
    00061 /* Choose a different function for errors */
    00062 extern void dundi_set_error(void (*output)(const char *data));
    00063 extern void dundi_showframe(struct dundi_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen);
    00064
    00065 extern const char *dundi_ie2str(int ie);
    00066
    00067 extern int dundi_ie_append_raw(struct dundi_ie_data *ied, unsigned char ie, void *data, int datalen);
    00068 extern int dundi_ie_append_addr(struct dundi_ie_data *ied, unsigned char ie, struct sockaddr_in *sin);
    00069 extern int dundi_ie_append_int(struct dundi_ie_data *ied, unsigned char ie, unsigned int value);
    00070 extern int dundi_ie_append_short(struct dundi_ie_data *ied, unsigned char ie, unsigned short value);
    00071 extern int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, char *str);
    00072 extern int dundi_ie_append_eid(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid);
    00073 extern int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *desc);
    00074 extern int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data);
    00075 extern 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 *desc);
    00076 extern int dundi_ie_append_encdata(struct dundi_ie_data *ied, unsigned char ie, unsigned char *iv, void *data, int datalen);
    00077 extern int dundi_ie_append_byte(struct dundi_ie_data *ied, unsigned char ie, unsigned char dat);
    00078 extern int dundi_ie_append(struct dundi_ie_data *ied, unsigned char ie);
    00079 extern int dundi_parse_ies(struct dundi_ies *ies, unsigned char *data, int datalen);
    00080 extern char *dundi_eid_to_str(char *s, int maxlen, dundi_eid *eid);
    00081 extern char *dundi_eid_to_str_short(char *s, int maxlen, dundi_eid *eid);
    00082 extern int dundi_str_to_eid(dundi_eid *eid, char *s);
    00083 extern int dundi_str_short_to_eid(dundi_eid *eid, char *s);
    00084 extern int dundi_eid_zero(dundi_eid *eid);
    00085 extern int dundi_eid_cmp(dundi_eid *eid1, dundi_eid *eid2);
    00086 extern char *dundi_flags2str(char *s, int maxlen, int flags);
    00087 extern char *dundi_hint2str(char *s, int maxlen, int flags);
    00088 #endif