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.

288 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.2.0 $
  14. * $Date: 20 Jun 1997 14:10:50 $
  15. * $Author: MANDREWS $
  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. #define CS_MESSAGE_TOO_SHORT MAKE_Q931_ERROR(ERROR_LOCAL_BASE_ID + 0x17)
  62. // Event codes
  63. #define Q931_CALL_INCOMING 1
  64. #define Q931_CALL_REMOTE_HANGUP 2
  65. #define Q931_CALL_REJECTED 3
  66. #define Q931_CALL_ACCEPTED 4
  67. #define Q931_CALL_RINGING 5
  68. #define Q931_CALL_FAILED 6
  69. #define Q931_CALL_CONNECTION_CLOSED 7
  70. // Goal codes
  71. #define CSG_NONE 0
  72. #define CSG_JOIN 1
  73. #define CSG_CREATE 2
  74. #define CSG_INVITE 3
  75. #define CC_MAX_PARTY_NUMBER_LEN 254
  76. //====================================================================================
  77. // Q931-specific types
  78. //====================================================================================
  79. typedef HRESULT CS_STATUS;
  80. typedef DWORD HQ931LISTEN, *PHQ931LISTEN;
  81. typedef DWORD HQ931CALL, *PHQ931CALL;
  82. //====================================================================================
  83. // Callback definitions.
  84. //====================================================================================
  85. typedef DWORD (*Q931_CALLBACK) (BYTE bEvent, HQ931CALL hQ931Call,
  86. HQ931LISTEN hListenToken, DWORD dwUserToken, void *pEventData);
  87. typedef BOOL (*Q931_RECEIVE_PDU_CALLBACK) (Q931MESSAGE *pMessage,
  88. HQ931CALL hQ931Call, DWORD dwListenToken, DWORD dwUserToken);
  89. //====================================================================================
  90. // definitions of structures passed to callbacks as parameters.
  91. //====================================================================================
  92. // CSS_CALL_INCOMING callback parameter type
  93. typedef struct
  94. {
  95. WORD wCallReference;
  96. WORD wGoal;
  97. WORD wCallType;
  98. BOOL bCallerIsMC;
  99. CC_CONFERENCEID ConferenceID;
  100. LPWSTR pszCalledPartyNumber;
  101. PCC_ADDR pSourceAddr;
  102. PCC_ADDR pCallerAddr;
  103. PCC_ADDR pCalleeDestAddr;
  104. PCC_ADDR pLocalAddr;
  105. PCC_ALIASNAMES pCallerAliasList;
  106. PCC_ALIASNAMES pCalleeAliasList;
  107. PCC_ALIASNAMES pExtraAliasList;
  108. PCC_ALIASITEM pExtensionAliasItem;
  109. LPWSTR pszDisplay;
  110. PCC_ENDPOINTTYPE pSourceEndpointType;
  111. PCC_NONSTANDARDDATA pNonStandardData;
  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 Q931Init();
  148. CS_STATUS Q931DeInit();
  149. CS_STATUS Q931Listen(
  150. PHQ931LISTEN phQ931Listen,
  151. PCC_ADDR pListenAddr,
  152. DWORD dwListenToken,
  153. Q931_CALLBACK ListenCallback);
  154. CS_STATUS Q931CancelListen(
  155. HQ931LISTEN hQ931Listen);
  156. CS_STATUS Q931PlaceCall(
  157. PHQ931CALL phQ931Call,
  158. LPWSTR pszDisplay,
  159. PCC_ALIASNAMES pCallerAliasList,
  160. PCC_ALIASNAMES pCalleeAliasList,
  161. PCC_ALIASNAMES pExtraAliasList,
  162. PCC_ALIASITEM pExtensionAliasItem,
  163. PCC_NONSTANDARDDATA pNonStandardData,
  164. PCC_ENDPOINTTYPE pSourceEndpointType,
  165. LPWSTR pszCalledPartyNumber,
  166. PCC_ADDR pControlAddr,
  167. PCC_ADDR pDestinationAddr,
  168. PCC_ADDR pSourceAddr,
  169. BOOL bCallerIsMC,
  170. CC_CONFERENCEID *pConferenceID,
  171. WORD wGoal,
  172. WORD wCallType,
  173. DWORD dwUserToken,
  174. Q931_CALLBACK ConnectCallback,
  175. DWORD dwBandwidth,
  176. WORD wCRV);
  177. CS_STATUS Q931Hangup(
  178. HQ931CALL hQ931Call,
  179. BYTE bReason);
  180. CS_STATUS Q931Ringing(
  181. HQ931CALL hQ931Call,
  182. WORD *pwCRV);
  183. CS_STATUS Q931AcceptCall(
  184. HQ931CALL hQ931Call,
  185. LPWSTR pszDisplay,
  186. PCC_NONSTANDARDDATA pNonStandardData,
  187. PCC_ENDPOINTTYPE pDestinationEndpointType,
  188. PCC_ADDR pH245Addr,
  189. DWORD dwBandwidth,
  190. DWORD dwUserToken);
  191. CS_STATUS Q931RejectCall(
  192. HQ931CALL hQ931Call,
  193. BYTE bRejectReason,
  194. PCC_CONFERENCEID pConferenceID,
  195. PCC_ADDR pAlternateAddr,
  196. PCC_NONSTANDARDDATA pNonStandardData);
  197. CS_STATUS Q931ReOpenConnection(
  198. HQ931CALL hQ931Call);
  199. CS_STATUS Q931GetVersion(
  200. WORD wLength, // character count, not byte count.
  201. LPWSTR pszVersion);
  202. CS_STATUS Q931SetAlertingTimeout(
  203. DWORD dwDuration);
  204. void Q931SetReceivePDUHook(
  205. Q931_RECEIVE_PDU_CALLBACK Q931ReceivePDUCallback);
  206. CS_STATUS Q931SendProceedingMessage(
  207. HQ931CALL hQ931Call,
  208. WORD wCallReference,
  209. PCC_ENDPOINTTYPE pDestinationEndpointType,
  210. PCC_NONSTANDARDDATA pNonStandardData);
  211. CS_STATUS Q931SendPDU(
  212. HQ931CALL hQ931Call,
  213. BYTE* CodedPtrPDU,
  214. DWORD CodedLengthPDU);
  215. CS_STATUS Q931FlushSendQueue(
  216. HQ931CALL hQ931Call);
  217. // utility routines
  218. CS_STATUS Q931ValidateAddr(PCC_ADDR pAddr);
  219. CS_STATUS Q931ValidatePartyNumber(LPWSTR pszPartyNumber);
  220. CS_STATUS Q931ValidateAliasItem(PCC_ALIASITEM pSource);
  221. CS_STATUS Q931CopyAliasItem(PCC_ALIASITEM *ppTarget, PCC_ALIASITEM pSource);
  222. CS_STATUS Q931FreeAliasItem(PCC_ALIASITEM pSource);
  223. CS_STATUS Q931ValidateAliasNames(PCC_ALIASNAMES pSource);
  224. CS_STATUS Q931CopyAliasNames(PCC_ALIASNAMES *ppTarget, PCC_ALIASNAMES pSource);
  225. CS_STATUS Q931FreeAliasNames(PCC_ALIASNAMES pSource);
  226. CS_STATUS Q931ValidateDisplay(LPWSTR pszDisplay);
  227. CS_STATUS Q931CopyDisplay(LPWSTR *ppDest, LPWSTR pSource);
  228. CS_STATUS Q931FreeDisplay(LPWSTR pszDisplay);
  229. CS_STATUS Q931ValidateVendorInfo(PCC_VENDORINFO pVendorInfo);
  230. CS_STATUS Q931CopyVendorInfo(PCC_VENDORINFO *ppDest, PCC_VENDORINFO pSource);
  231. CS_STATUS Q931FreeVendorInfo(PCC_VENDORINFO pVendorInfo);
  232. CS_STATUS Q931ValidateNonStandardData(PCC_NONSTANDARDDATA pNonStandardData);
  233. CS_STATUS Q931CopyNonStandardData(PCC_NONSTANDARDDATA *ppDest, PCC_NONSTANDARDDATA pSource);
  234. CS_STATUS Q931FreeNonStandardData(PCC_NONSTANDARDDATA pNonStandardData);
  235. #ifdef __cplusplus
  236. }
  237. #endif
  238. #endif Q931_H