sip_errno.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  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 __PJSIP_SIP_ERRNO_H__
  20. #define __PJSIP_SIP_ERRNO_H__
  21. /**
  22. * @file sip_errno.h
  23. * @brief PJSIP Specific Error Code
  24. */
  25. #include <pj/errno.h>
  26. PJ_BEGIN_DECL
  27. /**
  28. * @defgroup PJSIP_CORE_ERRNO PJSIP Specific Error Code
  29. * @ingroup PJSIP_BASE
  30. * @brief PJSIP specific error constants.
  31. * @{
  32. */
  33. /*
  34. * PJSIP error codes occupies 170000 - 219000, and mapped as follows:
  35. * - 170100 - 170799: mapped to SIP status code in response msg.
  36. * - 171000 - 171999: mapped to errors generated from PJSIP core.
  37. */
  38. /**
  39. * Start of error code relative to PJ_ERRNO_START_USER.
  40. */
  41. #define PJSIP_ERRNO_START (PJ_ERRNO_START_USER)
  42. /**
  43. * Create error value from SIP status code.
  44. * @param code SIP status code.
  45. * @return Error code in pj_status_t namespace.
  46. */
  47. #define PJSIP_ERRNO_FROM_SIP_STATUS(code) (PJSIP_ERRNO_START+code)
  48. /**
  49. * Get SIP status code from error value.
  50. * If conversion to SIP status code is not available, a SIP status code
  51. * 599 will be returned.
  52. *
  53. * @param status Error code in pj_status_t namespace.
  54. * @return SIP status code.
  55. */
  56. #define PJSIP_ERRNO_TO_SIP_STATUS(status) \
  57. ((status>=PJSIP_ERRNO_FROM_SIP_STATUS(100) && \
  58. status<PJSIP_ERRNO_FROM_SIP_STATUS(800)) ? \
  59. status-PJSIP_ERRNO_FROM_SIP_STATUS(0) : 599)
  60. /**
  61. * Start of PJSIP generated error code values.
  62. */
  63. #define PJSIP_ERRNO_START_PJSIP (PJSIP_ERRNO_START + 1000)
  64. /************************************************************
  65. * GENERIC/GENERAL SIP ERRORS
  66. ***********************************************************/
  67. /**
  68. * @hideinitializer
  69. * SIP object is busy.
  70. */
  71. #define PJSIP_EBUSY (PJSIP_ERRNO_START_PJSIP + 1) /* 171001 */
  72. /**
  73. * @hideinitializer
  74. * SIP object with the same type already exists.
  75. */
  76. #define PJSIP_ETYPEEXISTS (PJSIP_ERRNO_START_PJSIP + 2) /* 171002 */
  77. /**
  78. * @hideinitializer
  79. * SIP stack is shutting down.
  80. */
  81. #define PJSIP_ESHUTDOWN (PJSIP_ERRNO_START_PJSIP + 3) /* 171003 */
  82. /**
  83. * @hideinitializer
  84. * SIP object is not initialized.
  85. */
  86. #define PJSIP_ENOTINITIALIZED (PJSIP_ERRNO_START_PJSIP + 4) /* 171004 */
  87. /**
  88. * @hideinitializer
  89. * Missing route set (for tel: URI)
  90. */
  91. #define PJSIP_ENOROUTESET (PJSIP_ERRNO_START_PJSIP + 5) /* 171005 */
  92. /************************************************************
  93. * MESSAGING ERRORS
  94. ***********************************************************/
  95. /**
  96. * @hideinitializer
  97. * General invalid message error (e.g. syntax error)
  98. */
  99. #define PJSIP_EINVALIDMSG (PJSIP_ERRNO_START_PJSIP + 20) /* 171020 */
  100. /**
  101. * @hideinitializer
  102. * Expecting request message.
  103. */
  104. #define PJSIP_ENOTREQUESTMSG (PJSIP_ERRNO_START_PJSIP + 21) /* 171021 */
  105. /**
  106. * @hideinitializer
  107. * Expecting response message.
  108. */
  109. #define PJSIP_ENOTRESPONSEMSG (PJSIP_ERRNO_START_PJSIP + 22) /* 171022 */
  110. /**
  111. * @hideinitializer
  112. * Message too long. See also PJSIP_ERXOVERFLOW.
  113. */
  114. #define PJSIP_EMSGTOOLONG (PJSIP_ERRNO_START_PJSIP + 23) /* 171023 */
  115. /**
  116. * @hideinitializer
  117. * Message not completely received.
  118. */
  119. #define PJSIP_EPARTIALMSG (PJSIP_ERRNO_START_PJSIP + 24) /* 171024 */
  120. /**
  121. * @hideinitializer
  122. * Status code is invalid.
  123. */
  124. #define PJSIP_EINVALIDSTATUS (PJSIP_ERRNO_START_PJSIP + 30) /* 171030 */
  125. /**
  126. * @hideinitializer
  127. * General Invalid URI error.
  128. */
  129. #define PJSIP_EINVALIDURI (PJSIP_ERRNO_START_PJSIP + 39) /* 171039 */
  130. /**
  131. * @hideinitializer
  132. * Unsupported URL scheme.
  133. */
  134. #define PJSIP_EINVALIDSCHEME (PJSIP_ERRNO_START_PJSIP + 40) /* 171040 */
  135. /**
  136. * @hideinitializer
  137. * Missing Request-URI.
  138. */
  139. #define PJSIP_EMISSINGREQURI (PJSIP_ERRNO_START_PJSIP + 41) /* 171041 */
  140. /**
  141. * @hideinitializer
  142. * Invalid request URI.
  143. */
  144. #define PJSIP_EINVALIDREQURI (PJSIP_ERRNO_START_PJSIP + 42) /* 171042 */
  145. /**
  146. * @hideinitializer
  147. * URI is too long.
  148. */
  149. #define PJSIP_EURITOOLONG (PJSIP_ERRNO_START_PJSIP + 43) /* 171043 */
  150. /**
  151. * @hideinitializer
  152. * Missing required header(s).
  153. */
  154. #define PJSIP_EMISSINGHDR (PJSIP_ERRNO_START_PJSIP + 50) /* 171050 */
  155. /**
  156. * @hideinitializer
  157. * Invalid header field.
  158. */
  159. #define PJSIP_EINVALIDHDR (PJSIP_ERRNO_START_PJSIP + 51) /* 171051 */
  160. /**
  161. * @hideinitializer
  162. * Invalid Via header in response (sent-by, etc).
  163. */
  164. #define PJSIP_EINVALIDVIA (PJSIP_ERRNO_START_PJSIP + 52) /* 171052 */
  165. /**
  166. * @hideinitializer
  167. * Multiple Via headers in response.
  168. */
  169. #define PJSIP_EMULTIPLEVIA (PJSIP_ERRNO_START_PJSIP + 53) /* 171053 */
  170. /**
  171. * @hideinitializer
  172. * Missing message body.
  173. */
  174. #define PJSIP_EMISSINGBODY (PJSIP_ERRNO_START_PJSIP + 54) /* 171054 */
  175. /**
  176. * @hideinitializer
  177. * Invalid/unexpected method.
  178. */
  179. #define PJSIP_EINVALIDMETHOD (PJSIP_ERRNO_START_PJSIP + 55) /* 171055 */
  180. /************************************************************
  181. * TRANSPORT ERRORS
  182. ***********************************************************/
  183. /**
  184. * @hideinitializer
  185. * Unsupported transport type.
  186. */
  187. #define PJSIP_EUNSUPTRANSPORT (PJSIP_ERRNO_START_PJSIP + 60) /* 171060 */
  188. /**
  189. * @hideinitializer
  190. * Buffer is being sent, operation still pending.
  191. */
  192. #define PJSIP_EPENDINGTX (PJSIP_ERRNO_START_PJSIP + 61) /* 171061 */
  193. /**
  194. * @hideinitializer
  195. * Rx buffer overflow. See also PJSIP_EMSGTOOLONG.
  196. */
  197. #define PJSIP_ERXOVERFLOW (PJSIP_ERRNO_START_PJSIP + 62) /* 171062 */
  198. /**
  199. * @hideinitializer
  200. * This is not really an error, it just informs application that
  201. * transmit data has been deleted on return of pjsip_tx_data_dec_ref().
  202. */
  203. #define PJSIP_EBUFDESTROYED (PJSIP_ERRNO_START_PJSIP + 63) /* 171063 */
  204. /**
  205. * @hideinitializer
  206. * Unsuitable transport selected. This error occurs when application
  207. * has explicitly requested to use a particular transport/listener,
  208. * but the selected transport is not suitable to send request to
  209. * the specified destination.
  210. */
  211. #define PJSIP_ETPNOTSUITABLE (PJSIP_ERRNO_START_PJSIP + 64) /* 171064 */
  212. /**
  213. * @hideinitializer
  214. * Transport not available. This error occurs for example when the SIP stack
  215. * is trying to use a SIP transport while the transport is being paused by
  216. * application.
  217. */
  218. #define PJSIP_ETPNOTAVAIL (PJSIP_ERRNO_START_PJSIP + 65) /* 171065 */
  219. /************************************************************
  220. * TRANSACTION ERRORS
  221. ***********************************************************/
  222. /**
  223. * @hideinitializer
  224. * Transaction has just been destroyed.
  225. */
  226. #define PJSIP_ETSXDESTROYED (PJSIP_ERRNO_START_PJSIP + 70) /* 171070 */
  227. /**
  228. * @hideinitializer
  229. * No transaction.
  230. */
  231. #define PJSIP_ENOTSX (PJSIP_ERRNO_START_PJSIP + 71) /* 171071 */
  232. /************************************************************
  233. * URI COMPARISON RESULTS
  234. ***********************************************************/
  235. /**
  236. * @hideinitializer
  237. * Scheme mismatch.
  238. */
  239. #define PJSIP_ECMPSCHEME (PJSIP_ERRNO_START_PJSIP + 80) /* 171080 */
  240. /**
  241. * @hideinitializer
  242. * User part mismatch.
  243. */
  244. #define PJSIP_ECMPUSER (PJSIP_ERRNO_START_PJSIP + 81) /* 171081 */
  245. /**
  246. * @hideinitializer
  247. * Password part mismatch.
  248. */
  249. #define PJSIP_ECMPPASSWD (PJSIP_ERRNO_START_PJSIP + 82) /* 171082 */
  250. /**
  251. * @hideinitializer
  252. * Host part mismatch.
  253. */
  254. #define PJSIP_ECMPHOST (PJSIP_ERRNO_START_PJSIP + 83) /* 171083 */
  255. /**
  256. * @hideinitializer
  257. * Port part mismatch.
  258. */
  259. #define PJSIP_ECMPPORT (PJSIP_ERRNO_START_PJSIP + 84) /* 171084 */
  260. /**
  261. * @hideinitializer
  262. * Transport parameter part mismatch.
  263. */
  264. #define PJSIP_ECMPTRANSPORTPRM (PJSIP_ERRNO_START_PJSIP + 85) /* 171085 */
  265. /**
  266. * @hideinitializer
  267. * TTL parameter part mismatch.
  268. */
  269. #define PJSIP_ECMPTTLPARAM (PJSIP_ERRNO_START_PJSIP + 86) /* 171086 */
  270. /**
  271. * @hideinitializer
  272. * User parameter part mismatch.
  273. */
  274. #define PJSIP_ECMPUSERPARAM (PJSIP_ERRNO_START_PJSIP + 87) /* 171087 */
  275. /**
  276. * @hideinitializer
  277. * Method parameter part mismatch.
  278. */
  279. #define PJSIP_ECMPMETHODPARAM (PJSIP_ERRNO_START_PJSIP + 88) /* 171088 */
  280. /**
  281. * @hideinitializer
  282. * Maddr parameter part mismatch.
  283. */
  284. #define PJSIP_ECMPMADDRPARAM (PJSIP_ERRNO_START_PJSIP + 89) /* 171089 */
  285. /**
  286. * @hideinitializer
  287. * Parameter part in other_param mismatch.
  288. */
  289. #define PJSIP_ECMPOTHERPARAM (PJSIP_ERRNO_START_PJSIP + 90) /* 171090 */
  290. /**
  291. * @hideinitializer
  292. * Parameter part in header_param mismatch.
  293. */
  294. #define PJSIP_ECMPHEADERPARAM (PJSIP_ERRNO_START_PJSIP + 91) /* 171091 */
  295. /************************************************************
  296. * AUTHENTICATION FRAMEWORK
  297. ***********************************************************/
  298. /**
  299. * @hideinitializer
  300. * Credential failed to authenticate. For this failure, right credential
  301. * for the realm has been found and used to authenticate against the challenge,
  302. * but the server has rejected the authorization request with 401/407 response
  303. * (either with no stale parameter or with "stale=false" parameter). In most
  304. * cases, this indicates that the username/password combination is incorrect.
  305. */
  306. #define PJSIP_EFAILEDCREDENTIAL (PJSIP_ERRNO_START_PJSIP + 100) /* 171100 */
  307. /**
  308. * @hideinitializer
  309. * No suitable credential is found to authenticate the request against
  310. * the received authentication challenge in 401/407 response. This often
  311. * is caused by different realm supplied in the credential than the realm
  312. * found in the challenge.
  313. */
  314. #define PJSIP_ENOCREDENTIAL (PJSIP_ERRNO_START_PJSIP + 101) /* 171101 */
  315. /**
  316. * @hideinitializer
  317. * Invalid/unsupported algorithm.
  318. */
  319. #define PJSIP_EINVALIDALGORITHM (PJSIP_ERRNO_START_PJSIP + 102) /* 171102 */
  320. /**
  321. * @hideinitializer
  322. * Invalid/unsupported qop.
  323. */
  324. #define PJSIP_EINVALIDQOP (PJSIP_ERRNO_START_PJSIP + 103) /* 171103 */
  325. /**
  326. * @hideinitializer
  327. * Invalid/unsupported authentication scheme.
  328. */
  329. #define PJSIP_EINVALIDAUTHSCHEME (PJSIP_ERRNO_START_PJSIP + 104)/* 171104 */
  330. /**
  331. * @hideinitializer
  332. * No previous challenge.
  333. */
  334. #define PJSIP_EAUTHNOPREVCHAL (PJSIP_ERRNO_START_PJSIP + 105) /* 171105 */
  335. /**
  336. * @hideinitializer
  337. * No authorization is found.
  338. */
  339. #define PJSIP_EAUTHNOAUTH (PJSIP_ERRNO_START_PJSIP + 106) /* 171106 */
  340. /**
  341. * @hideinitializer
  342. * Account not found.
  343. */
  344. #define PJSIP_EAUTHACCNOTFOUND (PJSIP_ERRNO_START_PJSIP + 107) /* 171107 */
  345. /**
  346. * @hideinitializer
  347. * Account is disabled.
  348. */
  349. #define PJSIP_EAUTHACCDISABLED (PJSIP_ERRNO_START_PJSIP + 108) /* 171108 */
  350. /**
  351. * @hideinitializer
  352. * Invalid realm.
  353. */
  354. #define PJSIP_EAUTHINVALIDREALM (PJSIP_ERRNO_START_PJSIP + 109) /* 171109 */
  355. /**
  356. * @hideinitializer
  357. * Invalid digest.
  358. */
  359. #define PJSIP_EAUTHINVALIDDIGEST (PJSIP_ERRNO_START_PJSIP+110) /* 171110 */
  360. /**
  361. * @hideinitializer
  362. * Maximum number of stale retries exceeded. This happens when server
  363. * keeps rejecting our authorization request with stale=true.
  364. */
  365. #define PJSIP_EAUTHSTALECOUNT (PJSIP_ERRNO_START_PJSIP + 111) /* 171111 */
  366. /**
  367. * @hideinitializer
  368. * Invalid nonce value in the challenge.
  369. */
  370. #define PJSIP_EAUTHINNONCE (PJSIP_ERRNO_START_PJSIP + 112) /* 171112 */
  371. /**
  372. * @hideinitializer
  373. * Invalid AKA credential.
  374. */
  375. #define PJSIP_EAUTHINAKACRED (PJSIP_ERRNO_START_PJSIP + 113) /* 171113 */
  376. /**
  377. * No challenge is found in the challenge.
  378. */
  379. #define PJSIP_EAUTHNOCHAL (PJSIP_ERRNO_START_PJSIP + 114) /* 171114 */
  380. /************************************************************
  381. * UA AND DIALOG ERRORS
  382. ***********************************************************/
  383. /**
  384. * @hideinitializer
  385. * Missing From/To tag.
  386. */
  387. #define PJSIP_EMISSINGTAG (PJSIP_ERRNO_START_PJSIP+120) /* 171120 */
  388. /**
  389. * @hideinitializer
  390. * Expecting REFER method
  391. */
  392. #define PJSIP_ENOTREFER (PJSIP_ERRNO_START_PJSIP+121) /* 171121 */
  393. /**
  394. * @hideinitializer
  395. * Not associated with REFER subscription
  396. */
  397. #define PJSIP_ENOREFERSESSION (PJSIP_ERRNO_START_PJSIP+122) /* 171122 */
  398. /************************************************************
  399. * INVITE SESSIONS ERRORS
  400. ***********************************************************/
  401. /**
  402. * @hideinitializer
  403. * Session already terminated.
  404. */
  405. #define PJSIP_ESESSIONTERMINATED (PJSIP_ERRNO_START_PJSIP+140) /* 171140 */
  406. /**
  407. * @hideinitializer
  408. * Invalid session state for the specified operation.
  409. */
  410. #define PJSIP_ESESSIONSTATE (PJSIP_ERRNO_START_PJSIP+141) /* 171141 */
  411. /**
  412. * @hideinitializer
  413. * The feature being requested requires the use of secure session or
  414. * transport.
  415. */
  416. #define PJSIP_ESESSIONINSECURE (PJSIP_ERRNO_START_PJSIP+142) /* 171142 */
  417. /************************************************************
  418. * TLS TRANSPORT ERRORS
  419. ***********************************************************/
  420. /**
  421. * @hideinitializer
  422. * Unknown TLS error
  423. */
  424. #define PJSIP_TLS_EUNKNOWN (PJSIP_ERRNO_START_PJSIP+160) /* 171160 */
  425. /**
  426. * @hideinitializer
  427. * Invalid SSL protocol method.
  428. */
  429. #define PJSIP_TLS_EINVMETHOD (PJSIP_ERRNO_START_PJSIP+161) /* 171161 */
  430. /**
  431. * @hideinitializer
  432. * Error loading/verifying SSL CA list file.
  433. */
  434. #define PJSIP_TLS_ECACERT (PJSIP_ERRNO_START_PJSIP+162) /* 171162 */
  435. /**
  436. * @hideinitializer
  437. * Error loading SSL certificate chain file.
  438. */
  439. #define PJSIP_TLS_ECERTFILE (PJSIP_ERRNO_START_PJSIP+163) /* 171163 */
  440. /**
  441. * @hideinitializer
  442. * Error adding private key from SSL certificate file.
  443. */
  444. #define PJSIP_TLS_EKEYFILE (PJSIP_ERRNO_START_PJSIP+164) /* 171164 */
  445. /**
  446. * @hideinitializer
  447. * Error setting SSL cipher list.
  448. */
  449. #define PJSIP_TLS_ECIPHER (PJSIP_ERRNO_START_PJSIP+165) /* 171165 */
  450. /**
  451. * @hideinitializer
  452. * Error creating SSL context.
  453. */
  454. #define PJSIP_TLS_ECTX (PJSIP_ERRNO_START_PJSIP+166) /* 171166 */
  455. /**
  456. * @hideinitializer
  457. * Error creating SSL connection object.
  458. */
  459. #define PJSIP_TLS_ESSLCONN (PJSIP_ERRNO_START_PJSIP+167) /* 171167 */
  460. /**
  461. * @hideinitializer
  462. * Unknown error when performing SSL connect().
  463. */
  464. #define PJSIP_TLS_ECONNECT (PJSIP_ERRNO_START_PJSIP+168) /* 171168 */
  465. /**
  466. * @hideinitializer
  467. * Unknown error when performing SSL accept().
  468. */
  469. #define PJSIP_TLS_EACCEPT (PJSIP_ERRNO_START_PJSIP+169) /* 171169 */
  470. /**
  471. * @hideinitializer
  472. * Unknown error when sending SSL data
  473. */
  474. #define PJSIP_TLS_ESEND (PJSIP_ERRNO_START_PJSIP+170) /* 171170 */
  475. /**
  476. * @hideinitializer
  477. * Unknown error when reading SSL data
  478. */
  479. #define PJSIP_TLS_EREAD (PJSIP_ERRNO_START_PJSIP+171) /* 171171 */
  480. /**
  481. * @hideinitializer
  482. * SSL negotiation has exceeded the maximum configured timeout.
  483. */
  484. #define PJSIP_TLS_ETIMEDOUT (PJSIP_ERRNO_START_PJSIP+172) /* 171172 */
  485. /**
  486. * @hideinitializer
  487. * SSL certificate verification error.
  488. */
  489. #define PJSIP_TLS_ECERTVERIF (PJSIP_ERRNO_START_PJSIP+173) /* 171173 */
  490. /**
  491. * Get error message for the specified error code. Note that this
  492. * function is only able to decode PJSIP specific error code.
  493. * Application should use pj_strerror(), which should be able to
  494. * decode all error codes belonging to all subsystems (e.g. pjlib,
  495. * pjmedia, pjsip, etc).
  496. *
  497. * @param status The error code.
  498. * @param buffer The buffer where to put the error message.
  499. * @param bufsize Size of the buffer.
  500. *
  501. * @return The error message as NULL terminated string,
  502. * wrapped with pj_str_t.
  503. */
  504. PJ_DECL(pj_str_t) pjsip_strerror(pj_status_t status,
  505. char *buffer, pj_size_t bufsize);
  506. PJ_END_DECL
  507. /**
  508. * @}
  509. */
  510. #endif /* __PJSIP_SIP_ERRNO_H__ */