errno.h 14 KB

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