| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
#ifndef _DUNDI_PARSER_H |
| 13 |
#define _DUNDI_PARSER_H |
| 14 |
|
| 15 |
#include "asterisk/dundi.h" |
| 16 |
#include "asterisk/crypto.h" |
| 17 |
|
| 18 |
#define DUNDI_MAX_STACK 512 |
| 19 |
#define DUNDI_MAX_ANSWERS 100 |
| 20 |
|
| 21 |
struct dundi_ies { |
| 22 |
dundi_eid *eids[DUNDI_MAX_STACK + 1]; |
| 23 |
int eid_direct[DUNDI_MAX_STACK + 1]; |
| 24 |
dundi_eid *reqeid; |
| 25 |
int eidcount; |
| 26 |
char *called_context; |
| 27 |
char *called_number; |
| 28 |
struct dundi_answer *answers[DUNDI_MAX_ANSWERS + 1]; |
| 29 |
struct dundi_hint *hint; |
| 30 |
int anscount; |
| 31 |
int ttl; |
| 32 |
int version; |
| 33 |
int expiration; |
| 34 |
int unknowncmd; |
| 35 |
unsigned char *pubkey; |
| 36 |
int cause; |
| 37 |
char *q_dept; |
| 38 |
char *q_org; |
| 39 |
char *q_locality; |
| 40 |
char *q_stateprov; |
| 41 |
char *q_country; |
| 42 |
char *q_email; |
| 43 |
char *q_phone; |
| 44 |
char *q_ipaddr; |
| 45 |
char *causestr; |
| 46 |
unsigned char *encsharedkey; |
| 47 |
unsigned char *encsig; |
| 48 |
unsigned long keycrc32; |
| 49 |
struct dundi_encblock *encblock; |
| 50 |
int enclen; |
| 51 |
int cbypass; |
| 52 |
}; |
| 53 |
|
| 54 |
struct dundi_ie_data { |
| 55 |
int pos; |
| 56 |
unsigned char buf[8192]; |
| 57 |
}; |
| 58 |
|
| 59 |
|
| 60 |
extern void dundi_set_output(void (*output)(const char *data)); |
| 61 |
|
| 62 |
extern void dundi_set_error(void (*output)(const char *data)); |
| 63 |
extern void dundi_showframe(struct dundi_hdr *fhi, int rx, struct ast_sockaddr *sin, int datalen); |
| 64 |
|
| 65 |
extern const char *dundi_ie2str(int ie); |
| 66 |
|
| 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_short(char *s, int maxlen, dundi_eid *eid); |
| 81 |
extern int dundi_str_short_to_eid(dundi_eid *eid, const char *s); |
| 82 |
extern int dundi_eid_zero(dundi_eid *eid); |
| 83 |
extern char *dundi_flags2str(char *s, int maxlen, int flags); |
| 84 |
extern char *dundi_hint2str(char *s, int maxlen, int flags); |
| 85 |
#endif |