| 
									
										
										
										
											2004-10-18 21:45:13 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Distributed Universal Number Discovery (DUNDi) | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2005-01-21 07:06:25 +00:00
										 |  |  |  * Copyright (C) 2004 - 2005, Digium Inc. | 
					
						
							| 
									
										
										
										
											2004-10-18 21:45:13 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Written by Mark Spencer <markster@digium.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is Free Software distributed under the terms of | 
					
						
							|  |  |  |  * of the GNU General Public License. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef _DUNDI_PARSER_H
 | 
					
						
							|  |  |  | #define _DUNDI_PARSER_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-21 06:02:45 +00:00
										 |  |  | #include "asterisk/dundi.h"
 | 
					
						
							| 
									
										
										
										
											2010-07-21 19:11:32 +00:00
										 |  |  | #include "asterisk/crypto.h"
 | 
					
						
							| 
									
										
										
										
											2004-10-18 21:45:13 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define DUNDI_MAX_STACK 512
 | 
					
						
							|  |  |  | #define DUNDI_MAX_ANSWERS	100
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct dundi_ies { | 
					
						
							|  |  |  | 	dundi_eid *eids[DUNDI_MAX_STACK + 1]; | 
					
						
							|  |  |  | 	int eid_direct[DUNDI_MAX_STACK + 1]; | 
					
						
							|  |  |  | 	dundi_eid *reqeid; | 
					
						
							|  |  |  | 	int eidcount; | 
					
						
							|  |  |  | 	char *called_context; | 
					
						
							|  |  |  | 	char *called_number; | 
					
						
							|  |  |  | 	struct dundi_answer *answers[DUNDI_MAX_ANSWERS + 1]; | 
					
						
							|  |  |  | 	struct dundi_hint *hint; | 
					
						
							|  |  |  | 	int anscount; | 
					
						
							|  |  |  | 	int ttl; | 
					
						
							|  |  |  | 	int version; | 
					
						
							|  |  |  | 	int expiration; | 
					
						
							|  |  |  | 	int unknowncmd; | 
					
						
							|  |  |  | 	unsigned char *pubkey; | 
					
						
							|  |  |  | 	int cause; | 
					
						
							| 
									
										
										
										
											2005-09-02 19:15:03 +00:00
										 |  |  | 	char *q_dept; | 
					
						
							|  |  |  | 	char *q_org; | 
					
						
							|  |  |  | 	char *q_locality; | 
					
						
							|  |  |  | 	char *q_stateprov; | 
					
						
							|  |  |  | 	char *q_country; | 
					
						
							|  |  |  | 	char *q_email; | 
					
						
							|  |  |  | 	char *q_phone; | 
					
						
							|  |  |  | 	char *q_ipaddr; | 
					
						
							|  |  |  | 	char *causestr; | 
					
						
							| 
									
										
										
										
											2004-10-18 21:45:13 +00:00
										 |  |  | 	unsigned char *encsharedkey; | 
					
						
							|  |  |  | 	unsigned char *encsig; | 
					
						
							|  |  |  | 	unsigned long keycrc32; | 
					
						
							|  |  |  | 	struct dundi_encblock *encblock; | 
					
						
							|  |  |  | 	int enclen; | 
					
						
							| 
									
										
										
										
											2004-10-24 05:51:57 +00:00
										 |  |  | 	int cbypass; | 
					
						
							| 
									
										
										
										
											2004-10-18 21:45:13 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct dundi_ie_data { | 
					
						
							|  |  |  | 	int pos; | 
					
						
							|  |  |  | 	unsigned char buf[8192]; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Choose a different function for output */ | 
					
						
							|  |  |  | extern void dundi_set_output(void (*output)(const char *data)); | 
					
						
							|  |  |  | /* Choose a different function for errors */ | 
					
						
							|  |  |  | extern void dundi_set_error(void (*output)(const char *data)); | 
					
						
							|  |  |  | extern void dundi_showframe(struct dundi_hdr *fhi, int rx, struct sockaddr_in *sin, int datalen); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern const char *dundi_ie2str(int ie); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern int dundi_ie_append_raw(struct dundi_ie_data *ied, unsigned char ie, void *data, int datalen); | 
					
						
							|  |  |  | extern int dundi_ie_append_addr(struct dundi_ie_data *ied, unsigned char ie, struct sockaddr_in *sin); | 
					
						
							|  |  |  | extern int dundi_ie_append_int(struct dundi_ie_data *ied, unsigned char ie, unsigned int value); | 
					
						
							|  |  |  | extern int dundi_ie_append_short(struct dundi_ie_data *ied, unsigned char ie, unsigned short value); | 
					
						
							| 
									
										
										
										
											2005-09-02 19:15:03 +00:00
										 |  |  | extern int dundi_ie_append_str(struct dundi_ie_data *ied, unsigned char ie, char *str); | 
					
						
							| 
									
										
										
										
											2004-10-18 21:45:13 +00:00
										 |  |  | extern int dundi_ie_append_eid(struct dundi_ie_data *ied, unsigned char ie, dundi_eid *eid); | 
					
						
							| 
									
										
										
										
											2005-09-02 19:15:03 +00:00
										 |  |  | extern int dundi_ie_append_cause(struct dundi_ie_data *ied, unsigned char ie, unsigned char cause, char *desc); | 
					
						
							|  |  |  | extern int dundi_ie_append_hint(struct dundi_ie_data *ied, unsigned char ie, unsigned short flags, char *data); | 
					
						
							|  |  |  | 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); | 
					
						
							| 
									
										
										
										
											2004-10-18 21:45:13 +00:00
										 |  |  | extern int dundi_ie_append_encdata(struct dundi_ie_data *ied, unsigned char ie, unsigned char *iv, void *data, int datalen); | 
					
						
							|  |  |  | extern int dundi_ie_append_byte(struct dundi_ie_data *ied, unsigned char ie, unsigned char dat); | 
					
						
							|  |  |  | extern int dundi_ie_append(struct dundi_ie_data *ied, unsigned char ie); | 
					
						
							|  |  |  | extern int dundi_parse_ies(struct dundi_ies *ies, unsigned char *data, int datalen); | 
					
						
							|  |  |  | extern char *dundi_eid_to_str_short(char *s, int maxlen, dundi_eid *eid); | 
					
						
							| 
									
										
										
										
											2007-11-14 13:18:40 +00:00
										 |  |  | extern int dundi_str_short_to_eid(dundi_eid *eid, const char *s); | 
					
						
							| 
									
										
										
										
											2004-10-18 21:45:13 +00:00
										 |  |  | extern int dundi_eid_zero(dundi_eid *eid); | 
					
						
							|  |  |  | extern char *dundi_flags2str(char *s, int maxlen, int flags); | 
					
						
							|  |  |  | extern char *dundi_hint2str(char *s, int maxlen, int flags); | 
					
						
							|  |  |  | #endif
 |