00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _ASTERISK_DUNDI_H
00025 #define _ASTERISK_DUNDI_H
00026
00027 #include "asterisk/channel.h"
00028
00029 #define DUNDI_PORT 4520
00030
00031
00032 struct _dundi_eid {
00033 unsigned char eid[6];
00034 } __attribute__ ((__packed__));
00035
00036 typedef struct _dundi_eid dundi_eid;
00037
00038 struct dundi_hdr {
00039 unsigned short strans;
00040 unsigned short dtrans;
00041 unsigned char iseqno;
00042 unsigned char oseqno;
00043 unsigned char cmdresp;
00044 unsigned char cmdflags;
00045 unsigned char ies[0];
00046 } __attribute__ ((__packed__));
00047
00048 struct dundi_ie_hdr {
00049 unsigned char ie;
00050 unsigned char len;
00051 unsigned char iedata[0];
00052 } __attribute__ ((__packed__));
00053
00054 #define DUNDI_FLAG_RETRANS (1 << 16)
00055 #define DUNDI_FLAG_RESERVED (1 << 16)
00056
00057 #define DUNDI_PROTO_NONE 0
00058 #define DUNDI_PROTO_IAX 1
00059 #define DUNDI_PROTO_SIP 2
00060 #define DUNDI_PROTO_H323 3
00061
00062 #define DUNDI_FLAG_NONEXISTENT (0)
00063 #define DUNDI_FLAG_EXISTS (1 << 0)
00064 #define DUNDI_FLAG_MATCHMORE (1 << 1)
00065 #define DUNDI_FLAG_CANMATCH (1 << 2)
00066 #define DUNDI_FLAG_IGNOREPAT (1 << 3)
00067 #define DUNDI_FLAG_RESIDENTIAL (1 << 4)
00068 #define DUNDI_FLAG_COMMERCIAL (1 << 5)
00069 #define DUNDI_FLAG_MOBILE (1 << 6)
00070 #define DUNDI_FLAG_NOUNSOLICITED (1 << 7)
00071 #define DUNDI_FLAG_NOCOMUNSOLICIT (1 << 8)
00072
00073 #define DUNDI_HINT_NONE (0)
00074 #define DUNDI_HINT_TTL_EXPIRED (1 << 0)
00075 #define DUNDI_HINT_DONT_ASK (1 << 1)
00076 #define DUNDI_HINT_UNAFFECTED (1 << 2)
00077
00078 struct dundi_encblock {
00079 unsigned char iv[16];
00080 unsigned char encdata[0];
00081 } __attribute__ ((__packed__));
00082
00083 struct dundi_answer {
00084 dundi_eid eid;
00085 unsigned char protocol;
00086 unsigned short flags;
00087 unsigned short weight;
00088 unsigned char data[0];
00089 } __attribute__ ((__packed__));
00090
00091 struct dundi_hint {
00092 unsigned short flags;
00093 unsigned char data[0];
00094 } __attribute__ ((__packed__));
00095
00096 #define DUNDI_CAUSE_SUCCESS 0
00097 #define DUNDI_CAUSE_GENERAL 1
00098 #define DUNDI_CAUSE_DYNAMIC 2
00099 #define DUNDI_CAUSE_NOAUTH 3
00100 #define DUNDI_CAUSE_DUPLICATE 4
00101 #define DUNDI_CAUSE_TTL_EXPIRED 5
00102 #define DUNDI_CAUSE_NEEDKEY 6
00103 #define DUNDI_CAUSE_BADENCRYPT 7
00104
00105 struct dundi_cause {
00106 unsigned char causecode;
00107 char desc[0];
00108 } __attribute__ ((__packed__));
00109
00110 struct dundi_peer_status {
00111 unsigned int flags;
00112 unsigned short netlag;
00113 unsigned short querylag;
00114 dundi_eid peereid;
00115 } __attribute__ ((__packed__));
00116
00117 #define DUNDI_PEER_PRIMARY (1 << 0)
00118 #define DUNDI_PEER_SECONDARY (1 << 1)
00119 #define DUNDI_PEER_UNAVAILABLE (1 << 2)
00120 #define DUNDI_PEER_REGISTERED (1 << 3)
00121 #define DUNDI_PEER_MOD_OUTBOUND (1 << 4)
00122 #define DUNDI_PEER_MOD_INBOUND (1 << 5)
00123 #define DUNDI_PEER_PCMOD_OUTBOUND (1 << 6)
00124 #define DUNDI_PEER_PCMOD_INBOUND (1 << 7)
00125
00126 #define DUNDI_COMMAND_FINAL (0x80)
00127
00128 #define DUNDI_COMMAND_ACK (0 | 0x40)
00129 #define DUNDI_COMMAND_DPDISCOVER 1
00130 #define DUNDI_COMMAND_DPRESPONSE (2 | 0x40)
00131 #define DUNDI_COMMAND_EIDQUERY 3
00132 #define DUNDI_COMMAND_EIDRESPONSE (4 | 0x40)
00133 #define DUNDI_COMMAND_PRECACHERQ 5
00134 #define DUNDI_COMMAND_PRECACHERP (6 | 0x40)
00135 #define DUNDI_COMMAND_INVALID (7 | 0x40)
00136 #define DUNDI_COMMAND_UNKNOWN (8 | 0x40)
00137 #define DUNDI_COMMAND_NULL 9
00138 #define DUNDI_COMMAND_REGREQ (10)
00139 #define DUNDI_COMMAND_REGRESPONSE (11 | 0x40)
00140 #define DUNDI_COMMAND_CANCEL (12)
00141 #define DUNDI_COMMAND_ENCRYPT (13)
00142 #define DUNDI_COMMAND_ENCREJ (14 | 0x40)
00143
00144 #define DUNDI_COMMAND_STATUS 15
00145
00146
00147
00148
00149
00150
00151 #define DUNDI_IE_EID 1
00152 #define DUNDI_IE_CALLED_CONTEXT 2
00153 #define DUNDI_IE_CALLED_NUMBER 3
00154 #define DUNDI_IE_EID_DIRECT 4
00155 #define DUNDI_IE_ANSWER 5
00156 #define DUNDI_IE_TTL 6
00157 #define DUNDI_IE_VERSION 10
00158 #define DUNDI_IE_EXPIRATION 11
00159 #define DUNDI_IE_UNKNOWN 12
00160 #define DUNDI_IE_CAUSE 14
00161 #define DUNDI_IE_REQEID 15
00162 #define DUNDI_IE_ENCDATA 16
00163 #define DUNDI_IE_SHAREDKEY 17
00164 #define DUNDI_IE_SIGNATURE 18
00165 #define DUNDI_IE_KEYCRC32 19
00166 #define DUNDI_IE_HINT 20
00167
00168 #define DUNDI_IE_DEPARTMENT 21
00169 #define DUNDI_IE_ORGANIZATION 22
00170 #define DUNDI_IE_LOCALITY 23
00171 #define DUNDI_IE_STATE_PROV 24
00172 #define DUNDI_IE_COUNTRY 25
00173 #define DUNDI_IE_EMAIL 26
00174 #define DUNDI_IE_PHONE 27
00175 #define DUNDI_IE_IPADDR 28
00176 #define DUNDI_IE_CACHEBYPASS 29
00177
00178 #define DUNDI_IE_PEERSTATUS 30
00179
00180 #define DUNDI_FLUFF_TIME 2000
00181 #define DUNDI_TTL_TIME 200
00182
00183 #define DUNDI_DEFAULT_RETRANS 5
00184 #define DUNDI_DEFAULT_RETRANS_TIMER 1000
00185 #define DUNDI_DEFAULT_TTL 120
00186 #define DUNDI_DEFAULT_VERSION 1
00187 #define DUNDI_DEFAULT_CACHE_TIME 3600
00188 #define DUNDI_DEFAULT_KEY_EXPIRE 3600
00189 #define DUNDI_DEF_EMPTY_CACHE_TIME 60
00190 #define DUNDI_WINDOW 1
00191
00192 #define DEFAULT_MAXMS 2000
00193
00194 struct dundi_result {
00195 unsigned int flags;
00196 int weight;
00197 int expiration;
00198 int techint;
00199 dundi_eid eid;
00200 char eid_str[20];
00201 char tech[10];
00202 char dest[256];
00203 };
00204
00205 struct dundi_entity_info {
00206 char country[80];
00207 char stateprov[80];
00208 char locality[80];
00209 char org[80];
00210 char orgunit[80];
00211 char email[80];
00212 char phone[80];
00213 char ipaddr[80];
00214 };
00215
00216
00217
00218 int dundi_lookup(struct dundi_result *result, int maxret, struct ast_channel *chan, const char *dcontext, const char *number, int nocache);
00219
00220
00221 int dundi_query_eid(struct dundi_entity_info *dei, const char *dcontext, dundi_eid eid);
00222
00223
00224 int dundi_precache(const char *dcontext, const char *number);
00225
00226 #endif