Source code of Windows XP (NT5)
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.

289 lines
9.4 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_PTR HQ931LISTEN, *PHQ931LISTEN;
  80. typedef DWORD_PTR HQ931CALL, *PHQ931CALL;
  81. //====================================================================================
  82. // Callback definitions.
  83. //====================================================================================
  84. typedef DWORD (*Q931_CALLBACK) (BYTE bEvent, HQ931CALL hQ931Call,
  85. HQ931LISTEN hListenToken, DWORD_PTR dwUserToken, void *pEventData);
  86. typedef BOOL (*Q931_RECEIVE_PDU_CALLBACK) (Q931MESSAGE *pMessage,
  87. HQ931CALL hQ931Call, DWORD_PTR dwListenToken, DWORD_PTR 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. GUID CallIdentifier;
  112. } CSS_CALL_INCOMING, *PCSS_CALL_INCOMING;
  113. // CSS_CALL_REMOTE_HANGUP callback parameter type
  114. typedef struct
  115. {
  116. BYTE bReason;
  117. } CSS_CALL_REMOTE_HANGUP, *PCSS_CALL_REMOTE_HANGUP;
  118. // CSS_CALL_REJECTED callback parameter type
  119. typedef struct
  120. {
  121. BYTE bRejectReason;
  122. CC_CONFERENCEID ConferenceID;
  123. PCC_ADDR pAlternateAddr;
  124. PCC_NONSTANDARDDATA pNonStandardData;
  125. } CSS_CALL_REJECTED, *PCSS_CALL_REJECTED;
  126. // CSS_CALL_ACCEPTED callback parameter type
  127. typedef struct
  128. {
  129. WORD wCallReference;
  130. CC_CONFERENCEID ConferenceID;
  131. PCC_ADDR pCalleeAddr;
  132. PCC_ADDR pLocalAddr;
  133. PCC_ADDR pH245Addr;
  134. LPWSTR pszDisplay;
  135. PCC_ENDPOINTTYPE pDestinationEndpointType;
  136. PCC_NONSTANDARDDATA pNonStandardData;
  137. } CSS_CALL_ACCEPTED, *PCSS_CALL_ACCEPTED;
  138. // Q931_CALL_RINGING callback event will have pEventData set to NULL
  139. // CSS_CALL_FAILED callback paremeter type
  140. typedef struct
  141. {
  142. HRESULT error;
  143. } CSS_CALL_FAILED, *PCSS_CALL_FAILED;
  144. //====================================================================================
  145. // function declarations.
  146. //====================================================================================
  147. CS_STATUS H225Init();
  148. CS_STATUS H225DeInit();
  149. CS_STATUS Q931Init();
  150. CS_STATUS Q931DeInit();
  151. CS_STATUS Q931Listen(
  152. PHQ931LISTEN phQ931Listen,
  153. PCC_ADDR pListenAddr,
  154. DWORD_PTR dwListenToken,
  155. Q931_CALLBACK ListenCallback);
  156. CS_STATUS Q931CancelListen(
  157. HQ931LISTEN hQ931Listen);
  158. CS_STATUS Q931PlaceCall(
  159. PHQ931CALL phQ931Call,
  160. LPWSTR pszDisplay,
  161. PCC_ALIASNAMES pCallerAliasList,
  162. PCC_ALIASNAMES pCalleeAliasList,
  163. PCC_ALIASNAMES pExtraAliasList,
  164. PCC_ALIASITEM pExtensionAliasItem,
  165. PCC_NONSTANDARDDATA pNonStandardData,
  166. PCC_ENDPOINTTYPE pSourceEndpointType,
  167. LPWSTR pszCalledPartyNumber,
  168. PCC_ADDR pControlAddr,
  169. PCC_ADDR pDestinationAddr,
  170. PCC_ADDR pSourceAddr,
  171. BOOL bCallerIsMC,
  172. CC_CONFERENCEID *pConferenceID,
  173. WORD wGoal,
  174. WORD wCallType,
  175. DWORD_PTR dwUserToken,
  176. Q931_CALLBACK ConnectCallback,
  177. WORD wCRV,
  178. LPGUID pCallIdentifier);
  179. CS_STATUS Q931Hangup(
  180. HQ931CALL hQ931Call,
  181. BYTE bReason);
  182. CS_STATUS Q931Ringing(
  183. HQ931CALL hQ931Call,
  184. WORD *pwCRV);
  185. CS_STATUS Q931AcceptCall(
  186. HQ931CALL hQ931Call,
  187. LPWSTR pszDisplay,
  188. PCC_NONSTANDARDDATA pNonStandardData,
  189. PCC_ENDPOINTTYPE pDestinationEndpointType,
  190. PCC_ADDR pH245Addr,
  191. DWORD_PTR dwUserToken);
  192. CS_STATUS Q931RejectCall(
  193. HQ931CALL hQ931Call,
  194. BYTE bRejectReason,
  195. PCC_CONFERENCEID pConferenceID,
  196. PCC_ADDR pAlternateAddr,
  197. PCC_NONSTANDARDDATA pNonStandardData);
  198. CS_STATUS Q931ReOpenConnection(
  199. HQ931CALL hQ931Call);
  200. CS_STATUS Q931GetVersion(
  201. WORD wLength, // character count, not byte count.
  202. LPWSTR pszVersion);
  203. CS_STATUS Q931SetAlertingTimeout(
  204. DWORD dwDuration);
  205. void Q931SetReceivePDUHook(
  206. Q931_RECEIVE_PDU_CALLBACK Q931ReceivePDUCallback);
  207. CS_STATUS Q931SendProceedingMessage(
  208. HQ931CALL hQ931Call,
  209. WORD wCallReference,
  210. PCC_ENDPOINTTYPE pDestinationEndpointType,
  211. PCC_NONSTANDARDDATA pNonStandardData);
  212. CS_STATUS Q931SendPDU(
  213. HQ931CALL hQ931Call,
  214. BYTE* CodedPtrPDU,
  215. DWORD CodedLengthPDU);
  216. CS_STATUS Q931FlushSendQueue(
  217. HQ931CALL hQ931Call);
  218. // utility routines
  219. CS_STATUS Q931ValidateAddr(PCC_ADDR pAddr);
  220. CS_STATUS Q931ValidatePartyNumber(LPWSTR pszPartyNumber);
  221. CS_STATUS Q931ValidateAliasItem(PCC_ALIASITEM pSource);
  222. CS_STATUS Q931CopyAliasItem(PCC_ALIASITEM *ppTarget, PCC_ALIASITEM pSource);
  223. CS_STATUS Q931FreeAliasItem(PCC_ALIASITEM pSource);
  224. CS_STATUS Q931ValidateAliasNames(PCC_ALIASNAMES pSource);
  225. CS_STATUS Q931CopyAliasNames(PCC_ALIASNAMES *ppTarget, PCC_ALIASNAMES pSource);
  226. CS_STATUS Q931FreeAliasNames(PCC_ALIASNAMES pSource);
  227. CS_STATUS Q931ValidateDisplay(LPWSTR pszDisplay);
  228. CS_STATUS Q931CopyDisplay(LPWSTR *ppDest, LPWSTR pSource);
  229. CS_STATUS Q931FreeDisplay(LPWSTR pszDisplay);
  230. CS_STATUS Q931ValidateVendorInfo(PCC_VENDORINFO pVendorInfo);
  231. CS_STATUS Q931CopyVendorInfo(PCC_VENDORINFO *ppDest, PCC_VENDORINFO pSource);
  232. CS_STATUS Q931FreeVendorInfo(PCC_VENDORINFO pVendorInfo);
  233. CS_STATUS Q931ValidateNonStandardData(PCC_NONSTANDARDDATA pNonStandardData);
  234. CS_STATUS Q931CopyNonStandardData(PCC_NONSTANDARDDATA *ppDest, PCC_NONSTANDARDDATA pSource);
  235. CS_STATUS Q931FreeNonStandardData(PCC_NONSTANDARDDATA pNonStandardData);
  236. #ifdef __cplusplus
  237. }
  238. #endif
  239. #endif Q931_H
  240.