blob: e224c6a91e2356ea6f27c05a136f31f87e6be704 [file] [log] [blame]
Alexandre Lision8af73cb2013-12-10 14:11:20 -05001/* $Id$ */
2/*
3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __PJLIB_UTIL_ERRNO_H__
21#define __PJLIB_UTIL_ERRNO_H__
22
23
24#include <pj/errno.h>
25
26/**
27 * @defgroup PJLIB_UTIL_ERROR Error Codes
28 * @ingroup PJLIB_UTIL_BASE
29 * @{
30 */
31
32/**
33 * Start of error code relative to PJ_ERRNO_START_USER.
34 * This value is 320000.
35 */
36#define PJLIB_UTIL_ERRNO_START (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*3)
37
38
39/************************************************************
40 * STUN ERROR
41 ***********************************************************/
42/**
43 * @hideinitializer
44 * Unable to resolve STUN server
45 */
46#define PJLIB_UTIL_ESTUNRESOLVE (PJLIB_UTIL_ERRNO_START+1) /* 320001 */
47/**
48 * @hideinitializer
49 * Unknown STUN message type.
50 */
51#define PJLIB_UTIL_ESTUNINMSGTYPE (PJLIB_UTIL_ERRNO_START+2) /* 320002 */
52/**
53 * @hideinitializer
54 * Invalid STUN message length
55 */
56#define PJLIB_UTIL_ESTUNINMSGLEN (PJLIB_UTIL_ERRNO_START+3) /* 320003 */
57/**
58 * @hideinitializer
59 * Invalid STUN attribute length
60 */
61#define PJLIB_UTIL_ESTUNINATTRLEN (PJLIB_UTIL_ERRNO_START+4) /* 320004 */
62/**
63 * @hideinitializer
64 * Invalid STUN attribute type
65 */
66#define PJLIB_UTIL_ESTUNINATTRTYPE (PJLIB_UTIL_ERRNO_START+5) /* 320005 */
67/**
68 * @hideinitializer
69 * Invalid STUN server/socket index
70 */
71#define PJLIB_UTIL_ESTUNININDEX (PJLIB_UTIL_ERRNO_START+6) /* 320006 */
72/**
73 * @hideinitializer
74 * No STUN binding response in the message
75 */
76#define PJLIB_UTIL_ESTUNNOBINDRES (PJLIB_UTIL_ERRNO_START+7) /* 320007 */
77/**
78 * @hideinitializer
79 * Received STUN error attribute
80 */
81#define PJLIB_UTIL_ESTUNRECVERRATTR (PJLIB_UTIL_ERRNO_START+8) /* 320008 */
82/**
83 * @hideinitializer
84 * No STUN mapped address attribute
85 */
86#define PJLIB_UTIL_ESTUNNOMAP (PJLIB_UTIL_ERRNO_START+9) /* 320009 */
87/**
88 * @hideinitializer
89 * Received no response from STUN server
90 */
91#define PJLIB_UTIL_ESTUNNOTRESPOND (PJLIB_UTIL_ERRNO_START+10) /* 320010 */
92/**
93 * @hideinitializer
94 * Symetric NAT detected by STUN
95 */
96#define PJLIB_UTIL_ESTUNSYMMETRIC (PJLIB_UTIL_ERRNO_START+11) /* 320011 */
97/**
98 * @hideinitializer
99 * Invalid STUN magic value
100 */
101#define PJLIB_UTIL_ESTUNNOTMAGIC (PJLIB_UTIL_ERRNO_START+12) /* 320012 */
102/**
103 * @hideinitializer
104 * Invalid STUN fingerprint value
105 */
106#define PJLIB_UTIL_ESTUNFINGERPRINT (PJLIB_UTIL_ERRNO_START+13) /* 320013 */
107
108
109
110/************************************************************
111 * XML ERROR
112 ***********************************************************/
113/**
114 * @hideinitializer
115 * General invalid XML message.
116 */
117#define PJLIB_UTIL_EINXML (PJLIB_UTIL_ERRNO_START+20) /* 320020 */
118
119
120
121/************************************************************
122 * DNS ERROR
123 ***********************************************************/
124/**
125 * @hideinitializer
126 * DNS query packet buffer is too small.
127 * This error occurs when the user supplied buffer for creating DNS
128 * query (#pj_dns_make_query() function) is too small.
129 */
130#define PJLIB_UTIL_EDNSQRYTOOSMALL (PJLIB_UTIL_ERRNO_START+40) /* 320040 */
131/**
132 * @hideinitializer
133 * Invalid DNS packet length.
134 * This error occurs when the received DNS response packet does not
135 * match all the fields length.
136 */
137#define PJLIB_UTIL_EDNSINSIZE (PJLIB_UTIL_ERRNO_START+41) /* 320041 */
138/**
139 * @hideinitializer
140 * Invalid DNS class.
141 * This error occurs when the received DNS response contains network
142 * class other than IN (Internet).
143 */
144#define PJLIB_UTIL_EDNSINCLASS (PJLIB_UTIL_ERRNO_START+42) /* 320042 */
145/**
146 * @hideinitializer
147 * Invalid DNS name pointer.
148 * This error occurs when parsing the compressed names inside DNS
149 * response packet, when the name pointer points to an invalid address
150 * or the parsing has triggerred too much recursion.
151 */
152#define PJLIB_UTIL_EDNSINNAMEPTR (PJLIB_UTIL_ERRNO_START+43) /* 320043 */
153/**
154 * @hideinitializer
155 * Invalid DNS nameserver address. If hostname was specified for nameserver
156 * address, this error means that the function was unable to resolve
157 * the nameserver hostname.
158 */
159#define PJLIB_UTIL_EDNSINNSADDR (PJLIB_UTIL_ERRNO_START+44) /* 320044 */
160/**
161 * @hideinitializer
162 * No nameserver is in DNS resolver. No nameserver is configured in the
163 * resolver.
164 */
165#define PJLIB_UTIL_EDNSNONS (PJLIB_UTIL_ERRNO_START+45) /* 320045 */
166/**
167 * @hideinitializer
168 * No working DNS nameserver. All nameservers have been queried,
169 * but none was able to serve any DNS requests. These "bad" nameservers
170 * will be re-tested again for "goodness" after some period.
171 */
172#define PJLIB_UTIL_EDNSNOWORKINGNS (PJLIB_UTIL_ERRNO_START+46) /* 320046 */
173/**
174 * @hideinitializer
175 * No answer record in the DNS response.
176 */
177#define PJLIB_UTIL_EDNSNOANSWERREC (PJLIB_UTIL_ERRNO_START+47) /* 320047 */
178/**
179 * @hideinitializer
180 * Invalid DNS answer. This error is raised for example when the DNS
181 * answer does not have a query section, or the type of RR in the answer
182 * doesn't match the query.
183 */
184#define PJLIB_UTIL_EDNSINANSWER (PJLIB_UTIL_ERRNO_START+48) /* 320048 */
185
186
187/* DNS ERRORS MAPPED FROM RCODE: */
188
189/**
190 * Start of error code mapped from DNS RCODE
191 */
192#define PJLIB_UTIL_DNS_RCODE_START (PJLIB_UTIL_ERRNO_START+50) /* 320050 */
193
194/**
195 * Map DNS RCODE status into pj_status_t.
196 */
197#define PJ_STATUS_FROM_DNS_RCODE(rcode) (rcode==0 ? PJ_SUCCESS : \
198 PJLIB_UTIL_DNS_RCODE_START+rcode)
199/**
200 * @hideinitializer
201 * Format error - The name server was unable to interpret the query.
202 * This corresponds to DNS RCODE 1.
203 */
204#define PJLIB_UTIL_EDNS_FORMERR PJ_STATUS_FROM_DNS_RCODE(1) /* 320051 */
205/**
206 * @hideinitializer
207 * Server failure - The name server was unable to process this query due to a
208 * problem with the name server.
209 * This corresponds to DNS RCODE 2.
210 */
211#define PJLIB_UTIL_EDNS_SERVFAIL PJ_STATUS_FROM_DNS_RCODE(2) /* 320052 */
212/**
213 * @hideinitializer
214 * Name Error - Meaningful only for responses from an authoritative name
215 * server, this code signifies that the domain name referenced in the query
216 * does not exist.
217 * This corresponds to DNS RCODE 3.
218 */
219#define PJLIB_UTIL_EDNS_NXDOMAIN PJ_STATUS_FROM_DNS_RCODE(3) /* 320053 */
220/**
221 * @hideinitializer
222 * Not Implemented - The name server does not support the requested kind of
223 * query.
224 * This corresponds to DNS RCODE 4.
225 */
226#define PJLIB_UTIL_EDNS_NOTIMPL PJ_STATUS_FROM_DNS_RCODE(4) /* 320054 */
227/**
228 * @hideinitializer
229 * Refused - The name server refuses to perform the specified operation for
230 * policy reasons.
231 * This corresponds to DNS RCODE 5.
232 */
233#define PJLIB_UTIL_EDNS_REFUSED PJ_STATUS_FROM_DNS_RCODE(5) /* 320055 */
234/**
235 * @hideinitializer
236 * The name exists.
237 * This corresponds to DNS RCODE 6.
238 */
239#define PJLIB_UTIL_EDNS_YXDOMAIN PJ_STATUS_FROM_DNS_RCODE(6) /* 320056 */
240/**
241 * @hideinitializer
242 * The RRset (name, type) exists.
243 * This corresponds to DNS RCODE 7.
244 */
245#define PJLIB_UTIL_EDNS_YXRRSET PJ_STATUS_FROM_DNS_RCODE(7) /* 320057 */
246/**
247 * @hideinitializer
248 * The RRset (name, type) does not exist.
249 * This corresponds to DNS RCODE 8.
250 */
251#define PJLIB_UTIL_EDNS_NXRRSET PJ_STATUS_FROM_DNS_RCODE(8) /* 320058 */
252/**
253 * @hideinitializer
254 * The requestor is not authorized to perform this operation.
255 * This corresponds to DNS RCODE 9.
256 */
257#define PJLIB_UTIL_EDNS_NOTAUTH PJ_STATUS_FROM_DNS_RCODE(9) /* 320059 */
258/**
259 * @hideinitializer
260 * The zone specified is not a zone.
261 * This corresponds to DNS RCODE 10.
262 */
263#define PJLIB_UTIL_EDNS_NOTZONE PJ_STATUS_FROM_DNS_RCODE(10)/* 320060 */
264
265
266/************************************************************
267 * NEW STUN ERROR
268 ***********************************************************/
269/* Messaging errors */
270/**
271 * @hideinitializer
272 * Too many STUN attributes.
273 */
274#define PJLIB_UTIL_ESTUNTOOMANYATTR (PJLIB_UTIL_ERRNO_START+110)/* 320110 */
275/**
276 * @hideinitializer
277 * Unknown STUN attribute. This error happens when the decoder encounters
278 * mandatory attribute type which it doesn't understand.
279 */
280#define PJLIB_UTIL_ESTUNUNKNOWNATTR (PJLIB_UTIL_ERRNO_START+111)/* 320111 */
281/**
282 * @hideinitializer
283 * Invalid STUN socket address length.
284 */
285#define PJLIB_UTIL_ESTUNINADDRLEN (PJLIB_UTIL_ERRNO_START+112)/* 320112 */
286/**
287 * @hideinitializer
288 * STUN IPv6 attribute not supported
289 */
290#define PJLIB_UTIL_ESTUNIPV6NOTSUPP (PJLIB_UTIL_ERRNO_START+113)/* 320113 */
291/**
292 * @hideinitializer
293 * Expecting STUN response message.
294 */
295#define PJLIB_UTIL_ESTUNNOTRESPONSE (PJLIB_UTIL_ERRNO_START+114)/* 320114 */
296/**
297 * @hideinitializer
298 * STUN transaction ID mismatch.
299 */
300#define PJLIB_UTIL_ESTUNINVALIDID (PJLIB_UTIL_ERRNO_START+115)/* 320115 */
301/**
302 * @hideinitializer
303 * Unable to find handler for the request.
304 */
305#define PJLIB_UTIL_ESTUNNOHANDLER (PJLIB_UTIL_ERRNO_START+116)/* 320116 */
306/**
307 * @hideinitializer
308 * Found non-FINGERPRINT attribute after MESSAGE-INTEGRITY. This is not
309 * valid since MESSAGE-INTEGRITY MUST be the last attribute or the
310 * attribute right before FINGERPRINT before the message.
311 */
312#define PJLIB_UTIL_ESTUNMSGINTPOS (PJLIB_UTIL_ERRNO_START+118)/* 320118 */
313/**
314 * @hideinitializer
315 * Found attribute after FINGERPRINT. This is not valid since FINGERPRINT
316 * MUST be the last attribute in the message.
317 */
318#define PJLIB_UTIL_ESTUNFINGERPOS (PJLIB_UTIL_ERRNO_START+119)/* 320119 */
319/**
320 * @hideinitializer
321 * Missing STUN USERNAME attribute.
322 * When credential is included in the STUN message (MESSAGE-INTEGRITY is
323 * present), the USERNAME attribute must be present in the message.
324 */
325#define PJLIB_UTIL_ESTUNNOUSERNAME (PJLIB_UTIL_ERRNO_START+120)/* 320120 */
326/**
327 * @hideinitializer
328 * Unknown STUN username/credential.
329 */
330#define PJLIB_UTIL_ESTUNUSERNAME (PJLIB_UTIL_ERRNO_START+121)/* 320121 */
331/**
332 * @hideinitializer
333 * Missing/invalidSTUN MESSAGE-INTEGRITY attribute.
334 */
335#define PJLIB_UTIL_ESTUNMSGINT (PJLIB_UTIL_ERRNO_START+122)/* 320122 */
336/**
337 * @hideinitializer
338 * Found duplicate STUN attribute.
339 */
340#define PJLIB_UTIL_ESTUNDUPATTR (PJLIB_UTIL_ERRNO_START+123)/* 320123 */
341/**
342 * @hideinitializer
343 * Missing STUN REALM attribute.
344 */
345#define PJLIB_UTIL_ESTUNNOREALM (PJLIB_UTIL_ERRNO_START+124)/* 320124 */
346/**
347 * @hideinitializer
348 * Missing/stale STUN NONCE attribute value.
349 */
350#define PJLIB_UTIL_ESTUNNONCE (PJLIB_UTIL_ERRNO_START+125)/* 320125 */
351/**
352 * @hideinitializer
353 * STUN transaction terminates with failure.
354 */
355#define PJLIB_UTIL_ESTUNTSXFAILED (PJLIB_UTIL_ERRNO_START+126)/* 320126 */
356
357
358//#define PJ_STATUS_FROM_STUN_CODE(code) (PJLIB_UTIL_ERRNO_START+code)
359
360/************************************************************
361 * HTTP Client ERROR
362 ***********************************************************/
363/**
364 * @hideinitializer
365 * Invalid URL format
366 */
367#define PJLIB_UTIL_EHTTPINURL (PJLIB_UTIL_ERRNO_START+151)/* 320151 */
368/**
369 * @hideinitializer
370 * Invalid port number
371 */
372#define PJLIB_UTIL_EHTTPINPORT (PJLIB_UTIL_ERRNO_START+152)/* 320152 */
373/**
374 * @hideinitializer
375 * Incomplete headers received
376 */
377#define PJLIB_UTIL_EHTTPINCHDR (PJLIB_UTIL_ERRNO_START+153)/* 320153 */
378/**
379 * @hideinitializer
380 * Insufficient buffer
381 */
382#define PJLIB_UTIL_EHTTPINSBUF (PJLIB_UTIL_ERRNO_START+154)/* 320154 */
383/**
384 * @hideinitializer
385 * Connection lost
386 */
387#define PJLIB_UTIL_EHTTPLOST (PJLIB_UTIL_ERRNO_START+155)/* 320155 */
388
389/************************************************************
390 * CLI ERROR
391 ***********************************************************/
392
393/**
394 * @hideinitializer
395 * End the current session. This is a special error code returned by
396 * pj_cli_sess_exec() to indicate that "exit" or equivalent command has been
397 * called to end the current session.
398 */
399#define PJ_CLI_EEXIT (PJLIB_UTIL_ERRNO_START+201)/* 320201 */
400/**
401 * @hideinitializer
402 * A required CLI argument is not specified.
403 */
404#define PJ_CLI_EMISSINGARG (PJLIB_UTIL_ERRNO_START+202)/* 320202 */
405 /**
406 * @hideinitializer
407 * Too many CLI arguments.
408 */
409#define PJ_CLI_ETOOMANYARGS (PJLIB_UTIL_ERRNO_START+203)/* 320203 */
410/**
411 * @hideinitializer
412 * Invalid CLI argument. Typically this is caused by extra characters
413 * specified in the command line which does not match any arguments.
414 */
415#define PJ_CLI_EINVARG (PJLIB_UTIL_ERRNO_START+204)/* 320204 */
416/**
417 * @hideinitializer
418 * CLI command with the specified name already exist.
419 */
420#define PJ_CLI_EBADNAME (PJLIB_UTIL_ERRNO_START+205)/* 320205 */
421/**
422 * @hideinitializer
423 * CLI command with the specified id already exist.
424 */
425#define PJ_CLI_EBADID (PJLIB_UTIL_ERRNO_START+206)/* 320206 */
426/**
427 * @hideinitializer
428 * Invalid XML format for CLI command specification.
429 */
430#define PJ_CLI_EBADXML (PJLIB_UTIL_ERRNO_START+207)/* 320207 */
431/**
432 * @hideinitializer
433 * CLI command entered by user match with more than one command/argument
434 * specification.
435 */
436#define PJ_CLI_EAMBIGUOUS (PJLIB_UTIL_ERRNO_START+208)/* 320208 */
437/**
438 * @hideinitializer
439 * Telnet connection lost.
440 */
441#define PJ_CLI_ETELNETLOST (PJLIB_UTIL_ERRNO_START+211)/* 320211 */
442
443/**
444 * @}
445 */
446
447#endif /* __PJLIB_UTIL_ERRNO_H__ */