errordef.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. *******************************************************************************
  3. * Copyright (c) 2010-2016 VATICS Inc. All rights reserved.
  4. *
  5. * +-----------------------------------------------------------------+
  6. * | THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED |
  7. * | AND COPIED IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF SUCH |
  8. * | A LICENSE AND WITH THE INCLUSION OF THE THIS COPY RIGHT NOTICE. |
  9. * | THIS SOFTWARE OR ANY OTHER COPIES OF THIS SOFTWARE MAY NOT BE |
  10. * | PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON. THE |
  11. * | OWNERSHIP AND TITLE OF THIS SOFTWARE IS NOT TRANSFERRED. |
  12. * | |
  13. * | THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT |
  14. * | ANY PRIOR NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY |
  15. * | VATICS INC. |
  16. * +-----------------------------------------------------------------+
  17. *
  18. *******************************************************************************
  19. */
  20. #ifndef _VIVOERRORDEF_
  21. #define _VIVOERRORDEF_
  22. //
  23. // SCODEs are 32 bit values layed out as follows:
  24. //
  25. // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  26. // 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
  27. // +-+-----------------------------+-------------------------------+
  28. // |S| Facility | Code |
  29. // +-+-----------------------------+-------------------------------+
  30. //
  31. // where
  32. //
  33. // S - Severity - indicates success/fail
  34. //
  35. // 0 - Success
  36. // 1 - Fail
  37. //
  38. // Facility - is the facility code
  39. //
  40. // Code - is the facility's status code
  41. //
  42. //
  43. // Define the facility codes
  44. //
  45. #define FACILITY_CODEC_VIDEO 1
  46. #define FACILITY_CODEC_AUDIO 2
  47. #define FACILITY_PROTOCOL 3
  48. #define FACILITY_APP 4
  49. #define FACILITY_DATABASE 5
  50. //
  51. // return type
  52. //
  53. // to avoid conflicting with windows type
  54. #if !defined(__wtypes_h__) && !defined(_SCODE_)
  55. typedef long SCODE;
  56. #define _SCODE_
  57. #endif
  58. //
  59. // Severity values
  60. //
  61. #ifndef SEVERITY_SUCCESS
  62. #define SEVERITY_SUCCESS 0
  63. #endif
  64. #ifndef SEVERITY_ERROR
  65. #define SEVERITY_ERROR 1
  66. #endif
  67. //
  68. // Generic test for success on any status value.
  69. //
  70. #ifndef IS_SUCCESS
  71. #define IS_SUCCESS(Status) ((unsigned long)(Status) >> 31 == SEVERITY_SUCCESS)
  72. #endif
  73. //
  74. // Generic test for error on any status value.
  75. //
  76. #ifndef IS_FAIL
  77. #define IS_FAIL(Status) ((unsigned long)(Status) >> 31 == SEVERITY_ERROR)
  78. #endif
  79. //
  80. // Return the code
  81. //
  82. #ifndef SCODE_CODE
  83. #define SCODE_CODE(sc) ((sc) & 0xFFFF)
  84. #endif
  85. //
  86. // Return the facility
  87. //
  88. #ifndef SCODE_FACILITY
  89. #define SCODE_FACILITY(sc) (((sc) >> 16) & 0x1fff)
  90. #endif
  91. //
  92. // Create an SCODE value from component pieces
  93. //
  94. #ifndef MAKE_SCODE
  95. #define MAKE_SCODE(sev,fac,code) \
  96. ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
  97. #endif
  98. //
  99. // general return codes
  100. //
  101. #ifndef S_OK
  102. #define S_OK ((SCODE) 0)
  103. #endif
  104. #ifndef S_FAIL
  105. #define S_FAIL ((SCODE) -1)
  106. #endif
  107. //--------------------------------------------------------------------------------
  108. // VNDP Genaral API Error Codes
  109. //--------------------------------------------------------------------------------
  110. //
  111. // MessageId: ERR_INVALID_HANDLE
  112. //
  113. // MessageText:
  114. //
  115. // Invalid object handle.
  116. //
  117. #define ERR_INVALID_HANDLE ((SCODE) 0x80000001)
  118. //
  119. // MessageId: ERR_OUT_OF_MEMORY
  120. //
  121. // MessageText:
  122. //
  123. // Memory allocate fail.
  124. //
  125. #define ERR_OUT_OF_MEMORY ((SCODE) 0x80000002)
  126. //
  127. // MessageId: ERR_INVALID_ARG
  128. //
  129. // MessageText:
  130. //
  131. // One or more arguments are invalid.
  132. //
  133. #define ERR_INVALID_ARG ((SCODE) 0x80000003)
  134. //
  135. // MessageId: ERR_NOT_IMPLEMENT
  136. //
  137. // MessageText:
  138. //
  139. // Not implemented
  140. //
  141. #define ERR_NOT_IMPLEMENT ((SCODE) 0x80000004)
  142. //
  143. // MessageId: ERR_INVALID_VERSION
  144. //
  145. // MessageText:
  146. //
  147. // Invalid version number
  148. //
  149. #define ERR_INVALID_VERSION ((SCODE) 0x80000005)
  150. #endif //_VIVOERRORDEF_