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.

180 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. SDPSP.h
  5. Abstract:
  6. Definitions for multicast service provider.
  7. Author:
  8. Mu Han (muhan) 1-April-1997
  9. --*/
  10. #ifndef __CONFTSP_H
  11. #define __CONFTSP_H
  12. // There is no phone devices in this provider.
  13. #define IPCONF_NUMPHONES 0
  14. // By default we have just one line.
  15. #define IPCONF_NUMLINES 1
  16. // Each network interface has only one address.
  17. #define IPCONF_NUMADDRESSESPERLINE 1
  18. #define IPCONF_LINE_HANDLE 'CONF'
  19. // The number of calls for each address.
  20. #define MAXCALLSPERADDRESS 32768
  21. #define IPCONF_MEDIAMODES (LINEMEDIAMODE_INTERACTIVEVOICE | \
  22. LINEMEDIAMODE_AUTOMATEDVOICE | \
  23. LINEMEDIAMODE_VIDEO | \
  24. LINEMEDIAMODE_UNKNOWN)
  25. #define IPCONF_BEARERMODES (LINEBEARERMODE_DATA | LINEBEARERMODE_VOICE)
  26. #define IPCONF_ADDRESSMODES LINEADDRESSMODE_ADDRESSID
  27. #define IPCONF_BUFSIZE 255
  28. #define MAXUSERNAMELEN 255
  29. #define MemAlloc(size) (LocalAlloc(LPTR, size))
  30. #define MemFree(p) if (p) LocalFree((HLOCAL)p)
  31. // {28B853D5-FC04-11d1-8302-00A0244D2298}
  32. DEFINE_GUID(GUID_LINE,
  33. 0x28b853d5, 0xfc04, 0x11d1, 0x83, 0x2, 0x0, 0xa0, 0x24, 0x4d, 0x22, 0x98);
  34. // {0F1BE7F7-45CA-11d2-831F-00A0244D2298}
  35. DEFINE_GUID(CLSID_CONFMSP,
  36. 0x0F1BE7F7,0x45CA, 0x11d2, 0x83, 0x1F, 0x0, 0xA0, 0x24, 0x4D, 0x22, 0x98);
  37. typedef struct _LINE
  38. {
  39. BOOL bOpened; // This line is opened or not.
  40. HTAPILINE htLine; // The handle for this line in TAPI's space.
  41. DWORD dwDeviceID;
  42. DWORD dwNumCalls; // Number of calls made on this line.
  43. DWORD dwNextMSPHandle; // This is a hack to keep tapi happy.
  44. } LINE, *PLINE;
  45. typedef struct _Call
  46. {
  47. DWORD
  48. Init(
  49. IN HTAPICALL htCall,
  50. IN LPLINECALLPARAMS const lpCallParams
  51. );
  52. void
  53. SetCallState(
  54. IN DWORD dwCallState,
  55. IN DWORD dwCallStateMode
  56. );
  57. DWORD SendMSPStartMessage(
  58. IN LPCWSTR lpszDestAddress
  59. );
  60. DWORD SendMSPStopMessage();
  61. DWORD hdLine() { return m_hdLine; }
  62. DWORD dwState() { return m_dwState; }
  63. DWORD dwMediaMode() { return m_dwMediaMode; }
  64. DWORD dwStateMode() { return m_dwStateMode; }
  65. HTAPICALL htCall() { return m_htCall; }
  66. DWORD dwAudioQOSLevel() { return m_dwAudioQOSLevel; }
  67. DWORD dwVideoQOSLevel() { return m_dwVideoQOSLevel; }
  68. private:
  69. DWORD m_hdLine; // The handle for this line in this provider.
  70. // It is the offset of the Line structure in
  71. // a global array.
  72. HTAPICALL m_htCall; // The hadle of this call in TAPI's space.
  73. DWORD m_dwState; // The state of this call.
  74. DWORD m_dwMediaMode;
  75. DWORD m_dwStateMode;
  76. DWORD m_dwAudioQOSLevel;
  77. DWORD m_dwVideoQOSLevel;
  78. } CALL, *PCALL;
  79. const DWORD DELTA = 8;
  80. template <class T, DWORD delta = DELTA>
  81. class SimpleVector
  82. {
  83. public:
  84. SimpleVector() : m_dwSize(0), m_dwCapacity(0), m_Elements(NULL) {};
  85. ~SimpleVector() {if (m_Elements) free(m_Elements); }
  86. void Init()
  87. {
  88. m_dwSize = 0;
  89. m_dwCapacity = 0;
  90. m_Elements = NULL;
  91. }
  92. BOOL add(T& elem)
  93. {
  94. return grow() ? (m_Elements[m_dwSize ++] = elem, TRUE) : FALSE;
  95. }
  96. BOOL add()
  97. {
  98. return grow() ? (m_dwSize ++, TRUE) : FALSE;
  99. }
  100. DWORD size() const { return m_dwSize; }
  101. T& operator [] (DWORD index) { return m_Elements[index]; }
  102. const T* elements() const { return m_Elements; };
  103. void shrink() {if (m_dwSize > 0) m_dwSize --;}
  104. void reset()
  105. {
  106. m_dwSize = 0;
  107. m_dwCapacity = 0;
  108. if (m_Elements) free(m_Elements);
  109. m_Elements = NULL;
  110. }
  111. protected:
  112. BOOL grow()
  113. {
  114. if (m_dwSize >= m_dwCapacity)
  115. {
  116. T *p = (T*)realloc(m_Elements, (sizeof T)*(m_dwCapacity+delta));
  117. if (p == NULL)
  118. {
  119. return FALSE;
  120. }
  121. m_Elements = p;
  122. m_dwCapacity += delta;
  123. }
  124. return TRUE;
  125. }
  126. protected:
  127. DWORD m_dwSize;
  128. DWORD m_dwCapacity;
  129. T * m_Elements;
  130. };
  131. typedef SimpleVector<CALL *> CCallList;
  132. #endif //__CONFTSP_H