Asterisk - The Open Source Telephony Project  18.5.0
dundi-parser.h
Go to the documentation of this file.
1 /*
2  * Distributed Universal Number Discovery (DUNDi)
3  *
4  * Copyright (C) 2004 - 2005, Digium Inc.
5  *
6  * Written by Mark Spencer <[email protected]>
7  *
8  * This program is Free Software distributed under the terms of
9  * of the GNU General Public License.
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 {
25  int eidcount;
29  struct dundi_hint *hint;
30  int anscount;
31  int ttl;
32  int version;
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;
50  int enclen;
51  int cbypass;
52 };
53 
54 struct dundi_ie_data {
55  int pos;
56  unsigned char buf[8192];
57 };
58 
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 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
int dundi_ie_append_encdata(struct dundi_ie_data *ied, unsigned char ie, unsigned char *iv, void *data, int datalen)
Definition: dundi-parser.c:539
void dundi_set_output(void(*output)(const char *data))
dundi_eid * reqeid
Definition: dundi-parser.h:24
Distributed Universal Number Discovery (DUNDi) See also.
char * dundi_hint2str(char *s, int maxlen, int flags)
Definition: dundi-parser.c:111
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
struct dundi_answer * answers[DUNDI_MAX_ANSWERS+1]
Definition: dundi-parser.h:28
char * q_org
Definition: dundi-parser.h:38
int dundi_ie_append_addr(struct dundi_ie_data *ied, unsigned char ie, struct sockaddr_in *sin)
Definition: dundi-parser.c:586
char * causestr
Definition: dundi-parser.h:45
char * q_locality
Definition: dundi-parser.h:39
Provide cryptographic signature routines.
static const char desc[]
Definition: cdr_mysql.c:73
char * dundi_eid_to_str_short(char *s, int maxlen, dundi_eid *eid)
Definition: dundi-parser.c:54
int eid_direct[DUNDI_MAX_STACK+1]
Definition: dundi-parser.h:23
char * called_number
Definition: dundi-parser.h:27
const char * str
Definition: app_jack.c:147
int dundi_parse_ies(struct dundi_ies *ies, unsigned char *data, int datalen)
Definition: dundi-parser.c:635
char * q_country
Definition: dundi-parser.h:41
int dundi_ie_append(struct dundi_ie_data *ied, unsigned char ie)
Definition: dundi-parser.c:620
int value
Definition: syslog.c:37
dundi_eid * eids[DUNDI_MAX_STACK+1]
Definition: dundi-parser.h:22
void dundi_showframe(struct dundi_hdr *fhi, int rx, struct ast_sockaddr *sin, int datalen)
Definition: dundi-parser.c:432
Socket address structure.
Definition: netsock2.h:97
unsigned char * pubkey
Definition: dundi-parser.h:35
An Entity ID is essentially a MAC address, brief and unique.
Definition: utils.h:786
int eidcount
Definition: dundi-parser.h:25
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)
Definition: dundi-parser.c:559
struct dundi_encblock * encblock
Definition: dundi-parser.h:49
char * q_ipaddr
Definition: dundi-parser.h:44
unsigned long keycrc32
Definition: dundi-parser.h:48
int dundi_ie_append_byte(struct dundi_ie_data *ied, unsigned char ie, unsigned char dat)
Definition: dundi-parser.c:615
unsigned char * encsharedkey
Definition: dundi-parser.h:46
int expiration
Definition: dundi-parser.h:33
#define DUNDI_MAX_ANSWERS
Definition: dundi-parser.h:19
char * q_stateprov
Definition: dundi-parser.h:40
char weight
unsigned char * encsig
Definition: dundi-parser.h:47
int anscount
Definition: dundi-parser.h:30
void dundi_set_error(void(*output)(const char *data))
char * called_context
Definition: dundi-parser.h:26
int dundi_eid_zero(dundi_eid *eid)
Definition: dundi-parser.c:82
int dundi_ie_append_int(struct dundi_ie_data *ied, unsigned char ie, unsigned int value)
Definition: dundi-parser.c:591
int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data)
Definition: dundi-parser.c:518
const char * dundi_ie2str(int ie)
Definition: dundi-parser.c:373
#define DUNDI_MAX_STACK
Definition: dundi-parser.h:18
int dundi_ie_append_raw(struct dundi_ie_data *ied, unsigned char ie, void *data, int datalen)
Definition: dundi-parser.c:484
char * q_dept
Definition: dundi-parser.h:37
char * dundi_flags2str(char *s, int maxlen, int flags)
Definition: dundi-parser.c:246
int dundi_ie_append_short(struct dundi_ie_data *ied, unsigned char ie, unsigned short value)
Definition: dundi-parser.c:598
int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, char *str)
Definition: dundi-parser.c:605
int dundi_str_short_to_eid(dundi_eid *eid, const char *s)
Definition: dundi-parser.c:70
int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *desc)
Definition: dundi-parser.c:499
char * q_phone
Definition: dundi-parser.h:43
int dundi_ie_append_eid(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid)
Definition: dundi-parser.c:610
struct dundi_hint * hint
Definition: dundi-parser.h:29
int unknowncmd
Definition: dundi-parser.h:34
char * q_email
Definition: dundi-parser.h:42