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.

371 lines
12 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. line.h
  5. Abstract:
  6. Definitions for H.323 TAPI Service Provider line device.
  7. Environment:
  8. User Mode - Win32
  9. Revision History:
  10. --*/
  11. #ifndef _INC_LINE
  12. #define _INC_LINE
  13. ///////////////////////////////////////////////////////////////////////////////
  14. // //
  15. // Header files //
  16. // //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #include "call.h"
  19. ///////////////////////////////////////////////////////////////////////////////
  20. // //
  21. // Line device GUID //
  22. // //
  23. ///////////////////////////////////////////////////////////////////////////////
  24. DEFINE_GUID(LINE_H323,
  25. 0xe41e1898, 0x7292, 0x11d2, 0xba, 0xd6, 0x00, 0xc0, 0x4f, 0x8e, 0xf6, 0xe3);
  26. ///////////////////////////////////////////////////////////////////////////////
  27. // //
  28. // Type definitions //
  29. // //
  30. ///////////////////////////////////////////////////////////////////////////////
  31. typedef enum _H323_LINESTATE {
  32. H323_LINESTATE_ALLOCATED = 0,
  33. H323_LINESTATE_WAITING_FOR_ID,
  34. H323_LINESTATE_CLOSED,
  35. H323_LINESTATE_OPENED,
  36. H323_LINESTATE_CLOSING,
  37. H323_LINESTATE_LISTENING
  38. } H323_LINESTATE, *PH323_LINESTATE;
  39. typedef struct _H323_LINE {
  40. CRITICAL_SECTION Lock; // synchronization object
  41. H323_LINESTATE nState; // state of line object
  42. BOOL fIsMarkedForDeletion; // additional state
  43. // DWORD dwIPAddr; // network interface ip address
  44. // DWORD dwIPPort; // network interface ip port
  45. DWORD dwNextPort; // next rtp/rtcp port
  46. HDRVLINE hdLine; // tspi line handle
  47. HTAPILINE htLine; // tapi line handle
  48. DWORD dwDeviceID; // tapi line device id
  49. DWORD dwTSPIVersion; // tapi selected version
  50. DWORD dwMediaModes; // tapi selected media modes
  51. DWORD dwNextMSPHandle; // bogus msp handle count
  52. CC_HLISTEN hccListen; // intelcc listen handle
  53. PH323_CALL_TABLE pCallTable; // table of allocated calls
  54. WCHAR wszAddr[H323_MAXADDRNAMELEN+1]; // line address
  55. } H323_LINE, *PH323_LINE;
  56. typedef struct _H323_LINE_TABLE {
  57. DWORD dwNumSlots; // number of entries
  58. DWORD dwNumInUse; // number of entries in use
  59. DWORD dwNumAllocated; // number of entries allocated
  60. DWORD dwNextAvailable; // next available table index
  61. PH323_LINE pLines[ANYSIZE]; // array of object pointers
  62. } H323_LINE_TABLE, *PH323_LINE_TABLE;
  63. ///////////////////////////////////////////////////////////////////////////////
  64. // //
  65. // Global variables //
  66. // //
  67. ///////////////////////////////////////////////////////////////////////////////
  68. extern PH323_LINE_TABLE g_pLineTable;
  69. ///////////////////////////////////////////////////////////////////////////////
  70. // //
  71. // Line capabilities //
  72. // //
  73. ///////////////////////////////////////////////////////////////////////////////
  74. #define H323_LINE_ADDRESSMODES LINEADDRESSMODE_ADDRESSID
  75. #define H323_LINE_ADDRESSTYPES (LINEADDRESSTYPE_DOMAINNAME | \
  76. LINEADDRESSTYPE_IPADDRESS | \
  77. LINEADDRESSTYPE_PHONENUMBER | \
  78. LINEADDRESSTYPE_EMAILNAME)
  79. #define H323_LINE_BEARERMODES (LINEBEARERMODE_DATA | \
  80. LINEBEARERMODE_VOICE)
  81. #define H323_LINE_DEFMEDIAMODES LINEMEDIAMODE_AUTOMATEDVOICE
  82. #define H323_LINE_DEVCAPFLAGS (LINEDEVCAPFLAGS_CLOSEDROP | \
  83. LINEDEVCAPFLAGS_MSP)
  84. #define H323_LINE_DEVSTATUSFLAGS (LINEDEVSTATUSFLAGS_CONNECTED | \
  85. LINEDEVSTATUSFLAGS_INSERVICE)
  86. #define H323_LINE_MAXRATE 1048576
  87. #define H323_LINE_MEDIAMODES (H323_LINE_DEFMEDIAMODES | \
  88. LINEMEDIAMODE_INTERACTIVEVOICE | \
  89. LINEMEDIAMODE_VIDEO)
  90. #define H323_LINE_LINEFEATURES LINEFEATURE_MAKECALL
  91. ///////////////////////////////////////////////////////////////////////////////
  92. // //
  93. // Address capabilities //
  94. // //
  95. ///////////////////////////////////////////////////////////////////////////////
  96. #define H323_ADDR_ADDRESSSHARING LINEADDRESSSHARING_PRIVATE
  97. #define H323_ADDR_ADDRFEATURES LINEADDRFEATURE_MAKECALL
  98. #define H323_ADDR_CALLFEATURES (LINECALLFEATURE_ACCEPT | \
  99. LINECALLFEATURE_ANSWER | \
  100. LINECALLFEATURE_DROP | \
  101. LINECALLFEATURE_RELEASEUSERUSERINFO | \
  102. LINECALLFEATURE_SENDUSERUSER | \
  103. LINECALLFEATURE_MONITORDIGITS | \
  104. LINECALLFEATURE_GENERATEDIGITS)
  105. #define H323_ADDR_CALLINFOSTATES LINECALLINFOSTATE_MEDIAMODE
  106. #define H323_ADDR_CALLPARTYIDFLAGS LINECALLPARTYID_NAME
  107. #define H323_ADDR_CALLERIDFLAGS (LINECALLPARTYID_NAME | \
  108. LINECALLPARTYID_ADDRESS)
  109. #define H323_ADDR_CALLEDIDFLAGS LINECALLPARTYID_NAME
  110. #define H323_ADDR_CALLSTATES (H323_CALL_INBOUNDSTATES | \
  111. H323_CALL_OUTBOUNDSTATES)
  112. #define H323_ADDR_CAPFLAGS (LINEADDRCAPFLAGS_DIALED | \
  113. LINEADDRCAPFLAGS_ORIGOFFHOOK)
  114. #define H323_ADDR_DISCONNECTMODES (LINEDISCONNECTMODE_BADADDRESS | \
  115. LINEDISCONNECTMODE_BUSY | \
  116. LINEDISCONNECTMODE_NOANSWER | \
  117. LINEDISCONNECTMODE_NORMAL | \
  118. LINEDISCONNECTMODE_REJECT | \
  119. LINEDISCONNECTMODE_UNAVAIL)
  120. ///////////////////////////////////////////////////////////////////////////////
  121. // //
  122. // Macros //
  123. // //
  124. ///////////////////////////////////////////////////////////////////////////////
  125. #define H323IsLineAllocated(_pLine_) \
  126. ((_pLine_) != NULL)
  127. #define H323IsLineInUse(_pLine_) \
  128. (H323IsLineAllocated(_pLine_) && \
  129. ((_pLine_)->nState > H323_LINESTATE_ALLOCATED))
  130. #define H323IsLineEqual(_pLine_,_hdLine_) \
  131. (H323IsLineInUse(_pLine_) && \
  132. ((_pLine_)->hdLine == (_hdLine_)))
  133. #define H323IsLineEqualIP(_pLine_,_dwIPAddr_) \
  134. (H323IsLineInUse(_pLine_) && \
  135. ((_pLine_)->dwIPAddr == (_dwIPAddr_)))
  136. #define H323IsLineClosed(_pLine_) \
  137. ((_pLine_)->nState == H323_LINESTATE_CLOSED)
  138. #define H323IsLineOpen(_pLine_) \
  139. ((_pLine_)->nState >= H323_LINESTATE_OPENED)
  140. #define H323IsLineAvailable(_pLine_) \
  141. ((_pLine_)->pCallTable->dwNumInUse < H323_MAXCALLSPERLINE)
  142. #define H323IsValidAddressID(_dwID_) \
  143. ((_dwID_) == 0)
  144. #define H323IsTapiControlCode(_wch_) \
  145. (((_wch_) == L'T') || ((_wch_) == L'P'))
  146. #define H323IsSeparator(_wch_) \
  147. ((_wch_) == L'/')
  148. #define H323IsListening(_pLine_) \
  149. ((_pLine_)->nState == H323_LINESTATE_LISTENING)
  150. #define H323IsClosing(_pLine_) \
  151. ((_pLine_)->nState == H323_LINESTATE_CLOSING)
  152. #define H323IsMediaDetectionEnabled(_pLine_) \
  153. (((_pLine_)->dwMediaModes != 0) && \
  154. ((_pLine_)->dwMediaModes != LINEMEDIAMODE_UNKNOWN))
  155. #define H323IsVideoDetectionEnabled(_pLine_) \
  156. ((_pLine_)->dwMediaModes & LINEMEDIAMODE_VIDEO)
  157. #define H323IsAudioDetectionEnabled(_pLine_) \
  158. (H323IsVideoDetectionEnabled(_pLine_) || \
  159. ((_pLine_)->dwMediaModes & LINEMEDIAMODE_AUTOMATEDVOICE) || \
  160. ((_pLine_)->dwMediaModes & LINEMEDIAMODE_INTERACTIVEVOICE))
  161. #define H323IsValidInterface(_dwAddr_) \
  162. (((_dwAddr_) != 0) && \
  163. ((_dwAddr_) != htonl(INADDR_LOOPBACK)))
  164. #define H323GetLineTableIndex(_hdLine_) \
  165. ((DWORD)(_hdLine_))
  166. #define H323CreateLineHandle(_i_) \
  167. ((HDRVLINE)(DWORD)(_i_))
  168. ///////////////////////////////////////////////////////////////////////////////
  169. // //
  170. // Public prototypes //
  171. // //
  172. ///////////////////////////////////////////////////////////////////////////////
  173. BOOL
  174. H323GetLineAndLock(
  175. PH323_LINE * ppLine,
  176. HDRVLINE hdLine
  177. );
  178. BOOL
  179. H323GetLineFromIDAndLock(
  180. PH323_LINE * ppLine,
  181. DWORD dwDeviceID
  182. );
  183. BOOL
  184. H323InitializeLine(
  185. PH323_LINE pLine,
  186. DWORD dwDeviceID
  187. );
  188. BOOL
  189. H323CallListen(
  190. PH323_LINE pLine
  191. );
  192. BOOL
  193. H323StartListening(
  194. PH323_LINE pLine
  195. );
  196. BOOL
  197. H323StopListening(
  198. PH323_LINE pLine
  199. );
  200. BOOL
  201. H323AllocLineTable(
  202. PH323_LINE_TABLE * ppLineTable
  203. );
  204. BOOL
  205. H323FreeLineTable(
  206. PH323_LINE_TABLE pLineTable
  207. );
  208. BOOL
  209. H323CloseLineTable(
  210. PH323_LINE_TABLE pLineTable
  211. );
  212. BOOL
  213. H323InitializeLineTable(
  214. PH323_LINE_TABLE pLineTable,
  215. DWORD dwLineDeviceIDBase
  216. );
  217. BOOL
  218. H323AllocLineFromTable(
  219. PH323_LINE * ppLine,
  220. PH323_LINE_TABLE * ppLineTable
  221. );
  222. BOOL
  223. H323FreeLineFromTable(
  224. PH323_LINE pLine,
  225. PH323_LINE_TABLE pLineTable
  226. );
  227. BOOL
  228. H323ProcessCloseChannelCommand(
  229. PH323_CALL pCall,
  230. PH323MSG_CLOSE_CHANNEL_COMMAND pCommand
  231. );
  232. BOOL
  233. H323ProcessAcceptChannelResponse(
  234. PH323_CALL pCall,
  235. PH323MSG_ACCEPT_CHANNEL_RESPONSE pResponse
  236. );
  237. BOOL
  238. H323ProcessOpenChannelRequest(
  239. PH323_CALL pCall,
  240. PH323MSG_OPEN_CHANNEL_REQUEST pRequest
  241. );
  242. BOOL
  243. H323ProcessFlowControlCommand(
  244. PH323_CALL pCall,
  245. PH323MSG_FLOW_CONTROL_COMMAND pCommand
  246. );
  247. BOOL
  248. H323ProcessVideoFastUpdatePictureCommand(
  249. PH323_CALL pCall,
  250. PH323MSG_VIDEO_FAST_UPDATE_PICTURE_COMMAND pCommand
  251. );
  252. BOOL
  253. H323ProcessQoSEventIndication(
  254. PH323_CALL pCall,
  255. PH323MSG_QOS_EVENT pCommand
  256. );
  257. BOOL
  258. H323ProcessConfigT120Command(
  259. PH323MSG_CONFIG_T120_COMMAND pCommand
  260. );
  261. BOOL
  262. H323ProcessConfigCapabilityCommand(
  263. PH323MSG_CONFIG_CAPABILITY_COMMAND pCommand
  264. );
  265. #if defined(USE_PROVIDER_LOCK)
  266. #define H323LockLine(_pLine_) H323LockProvider();
  267. #define H323UnlockLine(_pLine_) H323UnlockProvider();
  268. #elif defined(DBG) && defined(DEBUG_CRITICAL_SECTIONS)
  269. VOID
  270. H323LockLine(
  271. PH323_LINE pLine
  272. );
  273. VOID
  274. H323UnlockLine(
  275. PH323_LINE pLine
  276. );
  277. #else
  278. #define H323LockLine(_pLine_) \
  279. {EnterCriticalSection(&(_pLine_)->Lock);}
  280. #define H323UnlockLine(_pLine_) \
  281. {LeaveCriticalSection(&(_pLine_)->Lock);}
  282. #endif
  283. #endif // _INC_LINE