apierr.h
上传用户:hnnddl
上传日期:2007-01-06
资源大小:3580k
文件大小:8k
源码类别:

IP电话/视频会议

开发平台:

WINDOWS

  1. /*
  2.  * $Revision: 1.8 $
  3.  * $Date: 1998/10/13 15:13:00 $
  4.  */
  5. ////////////////////////////////////////////////////////////////
  6. //               Copyright (c) 1996,97 Lucent Technologies    //
  7. //                       All Rights Reserved                  //
  8. //                                                            //
  9. //                       THIS IS UNPUBLISHED                  //
  10. //                       PROPRIETARY SOURCE                   //
  11. //                   CODE OF Lucent Technologies              //
  12. //                                                            //
  13. //           The copyright notice above does not evidence any //
  14. //          actual or intended publication of such source code//
  15. ////////////////////////////////////////////////////////////////
  16. /////////////////////////////////////////////////////////////////
  17. // File : apierr.h        //
  18. //                                                             //
  19. //    //
  20. //    //
  21. // History:    //
  22. //    //
  23. //  2_Feb_1997 Created    //
  24. // 30_Jun_1997 right shifts must be logical in Extrt err codes //
  25. // 08_Jul_1997 Merged Sun5 changes.    //
  26. // 09_Jul_1997 Unixware compilation, changed all enums to     //
  27. //    unsigned #defines..    //
  28. // 15_Oct_1997 Added new PROT_CODE for software expiry.    //
  29. // 1_July_1997 Added support for H.450.    //
  30. //    //
  31. /////////////////////////////////////////////////////////////////
  32. #if !defined(__APIERR_H__)
  33. #define __APIERR_H__
  34. //  Format of return codes for all APIs
  35. //
  36. //   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  37. //   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  38. //  +---+-----------+---------------+-------------------------------+
  39. //  |Sev| Facility  | Fac-Sub-Code  |               Code            |
  40. //  +---+-----------+---------------+-------------------------------+
  41. //
  42. //  where
  43. //
  44. //      Sev - is the severity code (2 bits)
  45. //
  46. //          00 - Success
  47. //          01 - Informational
  48. //          10 - Warning
  49. //          11 - Error
  50. //
  51. //      R - is a reserved bit (2 bits)
  52. //
  53. //      Facility - is the facility code ( 6 bits)
  54. //
  55. // Fac-Sub-Code - is the facility sub code.
  56. //
  57. //      Code - is the facility's status code (16 bits)
  58. //
  59. #define PROT_MASK(BITS,SHIFT) (((1U << (BITS)) - 1) << (SHIFT))
  60. #define PROT_CODE_SHIFT    0U
  61. #define PROT_CODE_BITS    16U
  62. #define PROT_CODE_MASK    PROT_MASK(PROT_CODE_BITS,
  63. PROT_CODE_SHIFT)
  64. #define PROT_FACILITY_SUB_CODE_SHIFT   16U
  65. #define PROT_FACILITY_SUB_CODE_BITS   8U
  66. #define PROT_FACILITY_SUB_CODE_MASK   PROT_MASK(PROT_FACILITY_SUB_CODE_BITS,
  67. PROT_FACILITY_SUB_CODE_SHIFT)
  68. #define PROT_FACILITY_CODE_SHIFT    24U
  69. #define PROT_FACILITY_CODE_BITS    6U
  70. #define PROT_FACILITY_CODE_MASK    PROT_MASK(PROT_FACILITY_CODE_BITS,
  71. PROT_FACILITY_CODE_SHIFT)
  72. #define PROT_SEVERITY_SHIFT    30U
  73. #define PROT_SEVERITY_BITS 2U
  74. #define PROT_SEVERITY_MASK    PROT_MASK(PROT_SEVERITY_BITS,
  75. PROT_SEVERITY_SHIFT)
  76. // Severity codes
  77. #define PROT_SEVERITY_SUCCESS   0U
  78. #define PROT_SEVERITY_INFORMATIONAL   1U
  79. #define PROT_SEVERITY_WARNING   2U
  80. #define PROT_SEVERITY_ERROR   3U
  81. // Well known facility codes
  82. #define PROT_FACILITY_CODE_OS  1U
  83. #define PROT_FACILITY_CODE_TRANSPORT 2U
  84. #define PROT_FACILITY_CODE_RTP 3U
  85. #define PROT_FACILITY_CODE_Q931 4U
  86. #define PROT_FACILITY_CODE_H225 5U
  87. #define PROT_FACILITY_CODE_H245 6U
  88. #define PROT_FACILITY_CODE_GKTK 7U
  89. #define PROT_FACILITY_CODE_H450 8U
  90. // Well known facility sub codes
  91. // The sockets sub system like winsock etc...
  92. #define PROT_FACILITY_SUB_CODE_SOCKETS 1U
  93. // The connection manager...
  94. #define PROT_FACILITY_SUB_CODE_CONNMGR 2U
  95. // Basic H245 Signalling
  96. #define PROT_FACILITY_SUB_CODE_H245ENGINE 3U
  97. // H245 Signalling ASN independent API
  98. #define PROT_FACILITY_SUB_CODE_H245SIG 4U
  99. // RAS portion of H225
  100. #define PROT_FACILITY_SUB_CODE_H225RAS 5U
  101. // Call signalling portion of H225
  102. #define PROT_FACILITY_SUB_CODE_H225CS  6U
  103. // Generic functional protocol H.450.1
  104. #define PROT_FACILITY_SUB_CODE_H4501  7U
  105. // call transfer supp services H.450.2
  106. #define PROT_FACILITY_SUB_CODE_H4502  8U
  107. // call dervision supp services H.450.3
  108. #define PROT_FACILITY_SUB_CODE_H4503  9U
  109. // supplementary services ASN.1 level
  110. #define PROT_FACILITY_SUB_CODE_ASN1  10U
  111. // List of codes common to all modules
  112. #define PROT_CODE_PENDING 1U
  113. #define PROT_CODE_INVALID_PARAM 2U
  114. #define PROT_CODE_NOT_IMPLEMENTED 3U
  115. #define PROT_CODE_MEM_ALLOC_FAILED 4U
  116. #define PROT_CODE_UNKNOWN_ERROR 5U
  117. #define PROT_CODE_NOT_SUPPORTED 6U
  118. #define PROT_CODE_ITEM_NOT_PRESENT 7U
  119. #define PROT_CODE_BUFFER_TOO_SMALL 8U
  120. #define PROT_CODE_SOFTWARE_EXPIRED 9U
  121. #define PROT_CODE_MAX  256U
  122. #define PROT_STATUS(SEV,FAC,SUB,CODE)
  123. (((SEV) << PROT_SEVERITY_SHIFT) & PROT_SEVERITY_MASK) |
  124. (((FAC) << PROT_FACILITY_CODE_SHIFT) & PROT_FACILITY_CODE_MASK) |
  125. (((SUB) << PROT_FACILITY_SUB_CODE_SHIFT) & PROT_FACILITY_SUB_CODE_MASK) |
  126. (((CODE) << PROT_CODE_SHIFT) & PROT_CODE_MASK)
  127. #define PROT_SUCC(FAC,SUB,CODE) PROT_STATUS(PROT_SEVERITY_SUCCESS,
  128. FAC,SUB,CODE)
  129. #define PROT_WARN(FAC,SUB,CODE) PROT_STATUS(PROT_SEVERITY_WARNING,
  130. FAC,SUB,CODE)
  131. #define PROT_INFO(FAC,SUB,CODE) PROT_STATUS(PROT_SEVERITY_INFORMATIONAL,
  132. FAC,SUB,CODE)
  133. #define PROT_ERR(FAC,SUB,CODE) PROT_STATUS(PROT_SEVERITY_ERROR,
  134. FAC,SUB,CODE)
  135. #define PROT_GET_CODE(STATUS)
  136. ((unsigned int)((STATUS) & PROT_CODE_MASK) >> PROT_CODE_SHIFT)
  137. #define PROT_EXTRACT_CODES(STATUS,LSEV,LFAC,LSUB,LCODE)
  138. {
  139. (LSEV) = ((unsigned int)((STATUS) & PROT_SEVERITY_MASK) >>
  140.  PROT_SEVERITY_SHIFT);
  141. (LFAC) = ((unsigned int)((STATUS) & PROT_FACILITY_CODE_MASK) >>
  142.  PROT_FACILITY_CODE_SHIFT);
  143. (LSUB) = ((unsigned int)((STATUS) & PROT_FACILITY_SUB_CODE_MASK) >>
  144.  PROT_FACILITY_SUB_CODE_SHIFT);
  145. (LCODE) = ((unsigned int)((STATUS) & PROT_CODE_MASK) >> PROT_CODE_SHIFT);
  146. }
  147. #define PROT_IS_SUCCESS(STATUS)
  148. ((((STATUS) &  PROT_SEVERITY_MASK) >> PROT_SEVERITY_SHIFT)
  149.  == PROT_SEVERITY_SUCCESS)
  150. #define PROT_IS_PENDING(STATUS)
  151. ((((STATUS) & PROT_CODE_MASK) >> PROT_CODE_SHIFT) == PROT_CODE_PENDING)
  152. #define PROT_IS_ERROR(STATUS) 
  153. ((((STATUS) & PROT_SEVERITY_MASK) >> PROT_SEVERITY_SHIFT)
  154.  == PROT_SEVERITY_ERROR)
  155. typedef unsigned int ProtReturnCode;
  156. // Various additional logging levels we use...
  157. #define LOG_FLAG_DUMP_PACKET (1U << 31U)
  158. // Flag to control dumping of objects like Q931Message, Q931IE etc.
  159. #define LOG_FLAG_DUMP_OBJECT (1U << 30U)
  160. // Names under which various api classes log debugging information.
  161. #define LOG_NAME_H225RASASN1 "H225RASASN1"
  162. #define LOG_NAME_H225CSASN1 "H225CSASN1"
  163. #define LOG_NAME_H245ASN1 "H245ASN1"
  164. #define LOG_NAME_H225RAS "H225RAS"
  165. #define LOG_NAME_H225Q931CLIENT "H225Q931CLIENT"
  166. #define LOG_NAME_Q931ENGINE "Q931ENGINE"
  167. #define LOG_NAME_Q931IE "Q931IE"
  168. #define LOG_NAME_Q931MESSAGE "Q931MESSAGE"
  169. #define LOG_NAME_H225CSPROTOCOL "H225CSPROTOCOL"
  170. #define LOG_NAME_H245CLIENT "H245CLIENT"
  171. #define LOG_NAME_H245ENGINE "H245ENGINE"
  172. #define LOG_NAME_H245CODEC "H245CODEC"
  173. #define LOG_NAME_H245PROTOCOL "H245PROTOCOL"
  174. #define LOG_NAME_RTPSESSION "RTPSESSION"
  175. #define LOG_NAME_RTPPACKET "RTPPACKET"
  176. #define LOG_NAME_RTCPPACKET "RTCPPACKET"
  177. #define LOG_NAME_RTPENDPOINTINFO "RTPENDPOINTINFO"
  178. #define LOG_NAME_SOCKTRANS "SOCKTRANS"
  179. #define LOG_NAME_SOCKTHREAD "SOCKTHREAD"
  180. #define LOG_NAME_CONNMGR "CONNECTIONMANAGER"
  181. #define LOG_NAME_H450ASN1 "H450ASN1"
  182. #define LOG_NAME_H450CALLTR "H450CALLTRANSFER"
  183. #define LOG_NAME_H450CALLDR "H450CALLDIVERSION"
  184. #endif //__APIERR_H__