PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/pjlib-util/include/pjlib-util/errno.h

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