Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

285 lines
9.5 KiB

  1. /****************************************************************************
  2. *
  3. * $Archive: S:/STURGEON/SRC/INCLUDE/VCS/q931.h_v $
  4. *
  5. * INTEL Corporation Prorietary Information
  6. *
  7. * This listing is supplied under the terms of a license agreement
  8. * with INTEL Corporation and may not be copied nor disclosed except
  9. * in accordance with the terms of that agreement.
  10. *
  11. * Copyright (c) 1993-1996 Intel Corporation.
  12. *
  13. * $Revision: 1.49 $
  14. * $Date: 08 Jan 1997 18:02:54 $
  15. * $Author: EHOWARDX $
  16. *
  17. * Deliverable:
  18. *
  19. * Abstract:
  20. *
  21. *
  22. * Notes:
  23. *
  24. ***************************************************************************/
  25. #ifndef Q931_H
  26. #define Q931_H
  27. #include "incommon.h"
  28. #include "q931pdu.h"
  29. #include "apierror.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. //====================================================================================
  34. // Q931-specific codes
  35. //====================================================================================
  36. // Status codes
  37. #define CS_OK NOERROR
  38. #define CS_BAD_PARAM MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x1)
  39. #define CS_DUPLICATE_LISTEN MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x2)
  40. #define CS_INTERNAL_ERROR MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x3)
  41. #define CS_BAD_SIZE MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x4)
  42. #define CS_NO_MEMORY MAKE_Q931_ERROR(ERROR_OUTOFMEMORY)
  43. #define CS_NOT_IMPLEMENTED MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x6)
  44. #define CS_NOT_INITIALIZED MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x7)
  45. #define CS_DUPLICATE_INITIALIZE MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x8)
  46. #define CS_SUBSYSTEM_FAILURE MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x9)
  47. #define CS_OUT_OF_SEQUENCE MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0xA)
  48. #define CS_PEER_UNREACHABLE MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0xB)
  49. #define CS_SETUP_TIMER_EXPIRED MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0xC)
  50. #define CS_RINGING_TIMER_EXPIRED MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0xD)
  51. #define CS_INCOMPATIBLE_VERSION MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0xE)
  52. // parsing error cases
  53. #define CS_OPTION_NOT_IMPLEMENTED MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0xF)
  54. #define CS_ENDOFINPUT MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x10)
  55. #define CS_INVALID_FIELD MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x11)
  56. #define CS_NO_FIELD_DATA MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x12)
  57. #define CS_INVALID_PROTOCOL MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x13)
  58. #define CS_INVALID_MESSAGE_TYPE MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x14)
  59. #define CS_MANDATORY_IE_MISSING MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x15)
  60. #define CS_BAD_IE_CONTENT MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x16)
  61. // Event codes
  62. #define Q931_CALL_INCOMING 1
  63. #define Q931_CALL_REMOTE_HANGUP 2
  64. #define Q931_CALL_REJECTED 3
  65. #define Q931_CALL_ACCEPTED 4
  66. #define Q931_CALL_RINGING 5
  67. #define Q931_CALL_FAILED 6
  68. #define Q931_CALL_CONNECTION_CLOSED 7
  69. // Goal codes
  70. #define CSG_NONE 0
  71. #define CSG_JOIN 1
  72. #define CSG_CREATE 2
  73. #define CSG_INVITE 3
  74. #define CC_MAX_PARTY_NUMBER_LEN 254
  75. //====================================================================================
  76. // Q931-specific types
  77. //====================================================================================
  78. typedef HRESULT CS_STATUS;
  79. typedef DWORD HQ931LISTEN, *PHQ931LISTEN;
  80. typedef DWORD HQ931CALL, *PHQ931CALL;
  81. //====================================================================================
  82. // Callback definitions.
  83. //====================================================================================
  84. typedef DWORD (*Q931_CALLBACK) (BYTE bEvent, HQ931CALL hQ931Call,
  85. HQ931LISTEN hListenToken, DWORD dwUserToken, void *pEventData);
  86. typedef BOOL (*Q931_RECEIVE_PDU_CALLBACK) (Q931MESSAGE *pMessage,
  87. HQ931CALL hQ931Call, DWORD dwListenToken, DWORD dwUserToken);
  88. //====================================================================================
  89. // definitions of structures passed to callbacks as parameters.
  90. //====================================================================================
  91. // CSS_CALL_INCOMING callback parameter type
  92. typedef struct
  93. {
  94. WORD wCallReference;
  95. WORD wGoal;
  96. WORD wCallType;
  97. BOOL bCallerIsMC;
  98. CC_CONFERENCEID ConferenceID;
  99. LPWSTR pszCalledPartyNumber;
  100. PCC_ADDR pSourceAddr;
  101. PCC_ADDR pCallerAddr;
  102. PCC_ADDR pCalleeDestAddr;
  103. PCC_ADDR pLocalAddr;
  104. PCC_ALIASNAMES pCallerAliasList;
  105. PCC_ALIASNAMES pCalleeAliasList;
  106. PCC_ALIASNAMES pExtraAliasList;
  107. PCC_ALIASITEM pExtensionAliasItem;
  108. LPWSTR pszDisplay;
  109. PCC_ENDPOINTTYPE pSourceEndpointType;
  110. PCC_NONSTANDARDDATA pNonStandardData;
  111. } CSS_CALL_INCOMING, *PCSS_CALL_INCOMING;
  112. // CSS_CALL_REMOTE_HANGUP callback parameter type
  113. typedef struct
  114. {
  115. BYTE bReason;
  116. } CSS_CALL_REMOTE_HANGUP, *PCSS_CALL_REMOTE_HANGUP;
  117. // CSS_CALL_REJECTED callback parameter type
  118. typedef struct
  119. {
  120. BYTE bRejectReason;
  121. CC_CONFERENCEID ConferenceID;
  122. PCC_ADDR pAlternateAddr;
  123. PCC_NONSTANDARDDATA pNonStandardData;
  124. } CSS_CALL_REJECTED, *PCSS_CALL_REJECTED;
  125. // CSS_CALL_ACCEPTED callback parameter type
  126. typedef struct
  127. {
  128. WORD wCallReference;
  129. CC_CONFERENCEID ConferenceID;
  130. PCC_ADDR pCalleeAddr;
  131. PCC_ADDR pLocalAddr;
  132. PCC_ADDR pH245Addr;
  133. LPWSTR pszDisplay;
  134. PCC_ENDPOINTTYPE pDestinationEndpointType;
  135. PCC_NONSTANDARDDATA pNonStandardData;
  136. } CSS_CALL_ACCEPTED, *PCSS_CALL_ACCEPTED;
  137. // Q931_CALL_RINGING callback event will have pEventData set to NULL
  138. // CSS_CALL_FAILED callback paremeter type
  139. typedef struct
  140. {
  141. HRESULT error;
  142. } CSS_CALL_FAILED, *PCSS_CALL_FAILED;
  143. //====================================================================================
  144. // function declarations.
  145. //====================================================================================
  146. CS_STATUS Q931Init();
  147. CS_STATUS Q931DeInit();
  148. CS_STATUS Q931Listen(
  149. PHQ931LISTEN phQ931Listen,
  150. PCC_ADDR pListenAddr,
  151. DWORD dwListenToken,
  152. Q931_CALLBACK ListenCallback);
  153. CS_STATUS Q931CancelListen(
  154. HQ931LISTEN hQ931Listen);
  155. CS_STATUS Q931PlaceCall(
  156. PHQ931CALL phQ931Call,
  157. LPWSTR pszDisplay,
  158. PCC_ALIASNAMES pCallerAliasList,
  159. PCC_ALIASNAMES pCalleeAliasList,
  160. PCC_ALIASNAMES pExtraAliasList,
  161. PCC_ALIASITEM pExtensionAliasItem,
  162. PCC_NONSTANDARDDATA pNonStandardData,
  163. PCC_ENDPOINTTYPE pSourceEndpointType,
  164. LPWSTR pszCalledPartyNumber,
  165. PCC_ADDR pControlAddr,
  166. PCC_ADDR pDestinationAddr,
  167. PCC_ADDR pSourceAddr,
  168. BOOL bCallerIsMC,
  169. CC_CONFERENCEID *pConferenceID,
  170. WORD wGoal,
  171. WORD wCallType,
  172. DWORD dwUserToken,
  173. Q931_CALLBACK ConnectCallback,
  174. WORD wCRV);
  175. CS_STATUS Q931Hangup(
  176. HQ931CALL hQ931Call,
  177. BYTE bReason);
  178. CS_STATUS Q931Ringing(
  179. HQ931CALL hQ931Call,
  180. WORD *pwCRV);
  181. CS_STATUS Q931AcceptCall(
  182. HQ931CALL hQ931Call,
  183. LPWSTR pszDisplay,
  184. PCC_NONSTANDARDDATA pNonStandardData,
  185. PCC_ENDPOINTTYPE pDestinationEndpointType,
  186. PCC_ADDR pH245Addr,
  187. DWORD dwUserToken);
  188. CS_STATUS Q931RejectCall(
  189. HQ931CALL hQ931Call,
  190. BYTE bRejectReason,
  191. PCC_CONFERENCEID pConferenceID,
  192. PCC_ADDR pAlternateAddr,
  193. PCC_NONSTANDARDDATA pNonStandardData);
  194. CS_STATUS Q931ReOpenConnection(
  195. HQ931CALL hQ931Call);
  196. CS_STATUS Q931GetVersion(
  197. WORD wLength, // character count, not byte count.
  198. LPWSTR pszVersion);
  199. CS_STATUS Q931SetAlertingTimeout(
  200. DWORD dwDuration);
  201. void Q931SetReceivePDUHook(
  202. Q931_RECEIVE_PDU_CALLBACK Q931ReceivePDUCallback);
  203. CS_STATUS Q931SendProceedingMessage(
  204. HQ931CALL hQ931Call,
  205. WORD wCallReference,
  206. PCC_ENDPOINTTYPE pDestinationEndpointType,
  207. PCC_NONSTANDARDDATA pNonStandardData);
  208. CS_STATUS Q931SendPDU(
  209. HQ931CALL hQ931Call,
  210. BYTE* CodedPtrPDU,
  211. DWORD CodedLengthPDU);
  212. CS_STATUS Q931FlushSendQueue(
  213. HQ931CALL hQ931Call);
  214. // utility routines
  215. CS_STATUS Q931ValidateAddr(PCC_ADDR pAddr);
  216. CS_STATUS Q931ValidatePartyNumber(LPWSTR pszPartyNumber);
  217. CS_STATUS Q931ValidateAliasItem(PCC_ALIASITEM pSource);
  218. CS_STATUS Q931CopyAliasItem(PCC_ALIASITEM *ppTarget, PCC_ALIASITEM pSource);
  219. CS_STATUS Q931FreeAliasItem(PCC_ALIASITEM pSource);
  220. CS_STATUS Q931ValidateAliasNames(PCC_ALIASNAMES pSource);
  221. CS_STATUS Q931CopyAliasNames(PCC_ALIASNAMES *ppTarget, PCC_ALIASNAMES pSource);
  222. CS_STATUS Q931FreeAliasNames(PCC_ALIASNAMES pSource);
  223. CS_STATUS Q931ValidateDisplay(LPWSTR pszDisplay);
  224. CS_STATUS Q931CopyDisplay(LPWSTR *ppDest, LPWSTR pSource);
  225. CS_STATUS Q931FreeDisplay(LPWSTR pszDisplay);
  226. CS_STATUS Q931ValidateVendorInfo(PCC_VENDORINFO pVendorInfo);
  227. CS_STATUS Q931CopyVendorInfo(PCC_VENDORINFO *ppDest, PCC_VENDORINFO pSource);
  228. CS_STATUS Q931FreeVendorInfo(PCC_VENDORINFO pVendorInfo);
  229. CS_STATUS Q931ValidateNonStandardData(PCC_NONSTANDARDDATA pNonStandardData);
  230. CS_STATUS Q931CopyNonStandardData(PCC_NONSTANDARDDATA *ppDest, PCC_NONSTANDARDDATA pSource);
  231. CS_STATUS Q931FreeNonStandardData(PCC_NONSTANDARDDATA pNonStandardData);
  232. #ifdef __cplusplus
  233. }
  234. #endif
  235. #endif Q931_H