Asterisk - The Open Source Telephony Project GIT-master-f36a736
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 <markster@digium.com>
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
21struct dundi_ies {
31 int ttl;
35 unsigned char *pubkey;
36 int cause;
37 char *q_dept;
38 char *q_org;
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;
52};
53
55 int pos;
56 unsigned char buf[8192];
57};
58
59/* Choose a different function for output */
60extern void dundi_set_output(void (*output)(const char *data));
61/* Choose a different function for errors */
62extern void dundi_set_error(void (*output)(const char *data));
63extern void dundi_showframe(struct dundi_hdr *fhi, int rx, struct ast_sockaddr *sin, int datalen);
64
65extern const char *dundi_ie2str(int ie);
66
67extern int dundi_ie_append_raw(struct dundi_ie_data *ied, unsigned char ie, void *data, int datalen);
68extern int dundi_ie_append_addr(struct dundi_ie_data *ied, unsigned char ie, struct sockaddr_in *sin);
69extern int dundi_ie_append_int(struct dundi_ie_data *ied, unsigned char ie, unsigned int value);
70extern int dundi_ie_append_short(struct dundi_ie_data *ied, unsigned char ie, unsigned short value);
71extern int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, char *str);
72extern int dundi_ie_append_eid(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid);
73extern int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *desc);
74extern int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data);
75extern 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);
76extern int dundi_ie_append_encdata(struct dundi_ie_data *ied, unsigned char ie, unsigned char *iv, void *data, int datalen);
77extern int dundi_ie_append_byte(struct dundi_ie_data *ied, unsigned char ie, unsigned char dat);
78extern int dundi_ie_append(struct dundi_ie_data *ied, unsigned char ie);
79extern int dundi_parse_ies(struct dundi_ies *ies, unsigned char *data, int datalen);
80extern char *dundi_eid_to_str_short(char *s, int maxlen, dundi_eid *eid);
81extern int dundi_str_short_to_eid(dundi_eid *eid, const char *s);
82extern int dundi_eid_zero(dundi_eid *eid);
83extern char *dundi_flags2str(char *s, int maxlen, int flags);
84extern char *dundi_hint2str(char *s, int maxlen, int flags);
85#endif
char weight
const char * str
Definition: app_jack.c:147
static const char desc[]
Definition: cdr_radius.c:84
Provide cryptographic signature routines.
int dundi_ie_append_int(struct dundi_ie_data *ied, unsigned char ie, unsigned int value)
Definition: dundi-parser.c:593
int dundi_ie_append_encdata(struct dundi_ie_data *ied, unsigned char ie, unsigned char *iv, void *data, int datalen)
Definition: dundi-parser.c:541
char * dundi_flags2str(char *s, int maxlen, int flags)
Definition: dundi-parser.c:248
int dundi_ie_append_raw(struct dundi_ie_data *ied, unsigned char ie, void *data, int datalen)
Definition: dundi-parser.c:486
int dundi_str_short_to_eid(dundi_eid *eid, const char *s)
Definition: dundi-parser.c:70
int dundi_ie_append_eid(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid)
Definition: dundi-parser.c:612
int dundi_ie_append_byte(struct dundi_ie_data *ied, unsigned char ie, unsigned char dat)
Definition: dundi-parser.c:617
int dundi_ie_append_short(struct dundi_ie_data *ied, unsigned char ie, unsigned short value)
Definition: dundi-parser.c:600
int dundi_ie_append_addr(struct dundi_ie_data *ied, unsigned char ie, struct sockaddr_in *sin)
Definition: dundi-parser.c:588
int dundi_ie_append(struct dundi_ie_data *ied, unsigned char ie)
Definition: dundi-parser.c:622
int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *desc)
Definition: dundi-parser.c:501
int dundi_parse_ies(struct dundi_ies *ies, unsigned char *data, int datalen)
Definition: dundi-parser.c:637
#define DUNDI_MAX_STACK
Definition: dundi-parser.h:18
void dundi_showframe(struct dundi_hdr *fhi, int rx, struct ast_sockaddr *sin, int datalen)
Definition: dundi-parser.c:434
int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, char *str)
Definition: dundi-parser.c:607
char * dundi_hint2str(char *s, int maxlen, int flags)
Definition: dundi-parser.c:111
char * dundi_eid_to_str_short(char *s, int maxlen, dundi_eid *eid)
Definition: dundi-parser.c:54
int dundi_eid_zero(dundi_eid *eid)
Definition: dundi-parser.c:82
#define DUNDI_MAX_ANSWERS
Definition: dundi-parser.h:19
const char * dundi_ie2str(int ie)
Definition: dundi-parser.c:375
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:561
void dundi_set_error(void(*output)(const char *data))
void dundi_set_output(void(*output)(const char *data))
int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data)
Definition: dundi-parser.c:520
Distributed Universal Number Discovery (DUNDi) See also.
An Entity ID is essentially a MAC address, brief and unique.
Definition: utils.h:813
Socket address structure.
Definition: netsock2.h:97
unsigned char buf[8192]
Definition: dundi-parser.h:56
struct dundi_answer * answers[DUNDI_MAX_ANSWERS+1]
Definition: dundi-parser.h:28
char * causestr
Definition: dundi-parser.h:45
char * q_org
Definition: dundi-parser.h:38
dundi_eid * reqeid
Definition: dundi-parser.h:24
dundi_eid * eids[DUNDI_MAX_STACK+1]
Definition: dundi-parser.h:22
char * called_context
Definition: dundi-parser.h:26
int eid_direct[DUNDI_MAX_STACK+1]
Definition: dundi-parser.h:23
char * q_country
Definition: dundi-parser.h:41
int unknowncmd
Definition: dundi-parser.h:34
char * q_phone
Definition: dundi-parser.h:43
char * q_locality
Definition: dundi-parser.h:39
char * q_ipaddr
Definition: dundi-parser.h:44
char * called_number
Definition: dundi-parser.h:27
int eidcount
Definition: dundi-parser.h:25
unsigned long keycrc32
Definition: dundi-parser.h:48
unsigned char * encsharedkey
Definition: dundi-parser.h:46
struct dundi_hint * hint
Definition: dundi-parser.h:29
int anscount
Definition: dundi-parser.h:30
char * q_email
Definition: dundi-parser.h:42
unsigned char * encsig
Definition: dundi-parser.h:47
char * q_dept
Definition: dundi-parser.h:37
int expiration
Definition: dundi-parser.h:33
char * q_stateprov
Definition: dundi-parser.h:40
unsigned char * pubkey
Definition: dundi-parser.h:35
struct dundi_encblock * encblock
Definition: dundi-parser.h:49
int value
Definition: syslog.c:37