2 * Distributed Universal Number Discovery (DUNDi)
4 * Copyright (C) 2004 - 2005, Digium Inc.
6 * Written by Mark Spencer <markster@digium.com>
8 * This program is Free Software distributed under the terms of
9 * of the GNU General Public License.
12 #ifndef _DUNDI_PARSER_H
13 #define _DUNDI_PARSER_H
15 #include "asterisk/dundi.h"
16 #include "asterisk/aes.h"
18 #define DUNDI_MAX_STACK 512
19 #define DUNDI_MAX_ANSWERS 100
22 dundi_eid
*eids
[DUNDI_MAX_STACK
+ 1];
23 int eid_direct
[DUNDI_MAX_STACK
+ 1];
28 struct dundi_answer
*answers
[DUNDI_MAX_ANSWERS
+ 1];
29 struct dundi_hint
*hint
;
35 unsigned char *pubkey
;
46 unsigned char *encsharedkey
;
47 unsigned char *encsig
;
48 unsigned long keycrc32
;
49 struct dundi_encblock
*encblock
;
54 struct dundi_ie_data
{
56 unsigned char buf
[8192];
59 /* Choose a different function for output */
60 extern void dundi_set_output(void (*output
)(const char *data
));
61 /* Choose a different function for errors */
62 extern void dundi_set_error(void (*output
)(const char *data
));
63 extern void dundi_showframe(struct dundi_hdr
*fhi
, int rx
, struct sockaddr_in
*sin
, int datalen
);
65 extern const char *dundi_ie2str(int ie
);
67 extern int dundi_ie_append_raw(struct dundi_ie_data
*ied
, unsigned char ie
, void *data
, int datalen
);
68 extern int dundi_ie_append_addr(struct dundi_ie_data
*ied
, unsigned char ie
, struct sockaddr_in
*sin
);
69 extern int dundi_ie_append_int(struct dundi_ie_data
*ied
, unsigned char ie
, unsigned int value
);
70 extern int dundi_ie_append_short(struct dundi_ie_data
*ied
, unsigned char ie
, unsigned short value
);
71 extern int dundi_ie_append_str(struct dundi_ie_data
*ied
, unsigned char ie
, char *str
);
72 extern int dundi_ie_append_eid(struct dundi_ie_data
*ied
, unsigned char ie
, dundi_eid
*eid
);
73 extern int dundi_ie_append_cause(struct dundi_ie_data
*ied
, unsigned char ie
, unsigned char cause
, char *desc
);
74 extern int dundi_ie_append_hint(struct dundi_ie_data
*ied
, unsigned char ie
, unsigned short flags
, char *data
);
75 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
);
76 extern int dundi_ie_append_encdata(struct dundi_ie_data
*ied
, unsigned char ie
, unsigned char *iv
, void *data
, int datalen
);
77 extern int dundi_ie_append_byte(struct dundi_ie_data
*ied
, unsigned char ie
, unsigned char dat
);
78 extern int dundi_ie_append(struct dundi_ie_data
*ied
, unsigned char ie
);
79 extern int dundi_parse_ies(struct dundi_ies
*ies
, unsigned char *data
, int datalen
);
80 extern char *dundi_eid_to_str(char *s
, int maxlen
, dundi_eid
*eid
);
81 extern char *dundi_eid_to_str_short(char *s
, int maxlen
, dundi_eid
*eid
);
82 extern int dundi_str_to_eid(dundi_eid
*eid
, char *s
);
83 extern int dundi_str_short_to_eid(dundi_eid
*eid
, char *s
);
84 extern int dundi_eid_zero(dundi_eid
*eid
);
85 extern int dundi_eid_cmp(dundi_eid
*eid1
, dundi_eid
*eid2
);
86 extern char *dundi_flags2str(char *s
, int maxlen
, int flags
);
87 extern char *dundi_hint2str(char *s
, int maxlen
, int flags
);