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.

263 lines
6.1 KiB

  1. /* file: messages.cpp */
  2. #include "mbftpch.h"
  3. #include "osshelp.hpp"
  4. #include "mbft.hpp"
  5. #include "messages.hpp"
  6. #include "mbftapi.hpp"
  7. MBFTMsg::~MBFTMsg(void)
  8. {
  9. }
  10. MCSSendDataIndicationMsg::MCSSendDataIndicationMsg
  11. (
  12. T120ChannelID wChannelId,
  13. T120Priority iPriority,
  14. T120UserID SenderID,
  15. LPBYTE lpBuffer,
  16. ULONG ulDataLength,
  17. BOOL IsUniformSendData
  18. )
  19. :
  20. MBFTMsg(EnumMCSSendDataIndicationMsg),
  21. m_wChannelId(wChannelId),
  22. m_iPriority(iPriority),
  23. m_SenderID(SenderID),
  24. m_lpBuffer(lpBuffer),
  25. m_ulDataLength(ulDataLength),
  26. m_IsUniformSendData(IsUniformSendData)
  27. {
  28. }
  29. MBFTPDUMsg::MBFTPDUMsg
  30. (
  31. T120ChannelID wChannelId,
  32. T120Priority iPriority,
  33. T120UserID SenderID,
  34. LPGENERICPDU lpNewPDU,
  35. BOOL IsUniformSendData,
  36. MBFTPDUType PDUType,
  37. LPSTR lpDecodedBuffer
  38. )
  39. :
  40. MBFTMsg(EnumGenericMBFTPDUMsg),
  41. m_wChannelId(wChannelId),
  42. m_iPriority(iPriority),
  43. m_SenderID(SenderID),
  44. m_lpNewPDU(lpNewPDU),
  45. m_IsUniformSendData(IsUniformSendData),
  46. m_PDUType(PDUType),
  47. m_lpDecodedBuffer(lpDecodedBuffer)
  48. {
  49. }
  50. MBFTPDUMsg::~MBFTPDUMsg(void)
  51. {
  52. delete m_lpDecodedBuffer;
  53. delete m_lpNewPDU;
  54. }
  55. CreateSessionMsg::CreateSessionMsg
  56. (
  57. MBFT_SESSION_TYPE iSessionType,
  58. MBFTEVENTHANDLE EventHandle,
  59. T120SessionID SessionID,
  60. T120ChannelID wControlChannel,
  61. T120ChannelID wDataChannel,
  62. T120UserID SenderID,
  63. MBFTFILEHANDLE FileHandle
  64. )
  65. :
  66. MBFTMsg(EnumCreateSessionMsg),
  67. m_iSessionType(iSessionType),
  68. m_SessionID(SessionID),
  69. m_EventHandle(EventHandle),
  70. m_ControlChannel(wControlChannel),
  71. m_DataChannel(wDataChannel),
  72. m_SenderID(SenderID),
  73. m_FileHandle(FileHandle)
  74. {
  75. }
  76. SubmitFileSendMsg::SubmitFileSendMsg
  77. (
  78. T120UserID uidReceiver,
  79. T120NodeID nidReceiver,
  80. LPCSTR pszFilePath,
  81. MBFTFILEHANDLE nFileHandle,
  82. MBFTEVENTHANDLE EventHandle,
  83. BOOL bCompressFiles
  84. )
  85. :
  86. MBFTMsg(EnumSubmitFileSendMsg),
  87. m_nUserID(uidReceiver),
  88. m_nNodeID(nidReceiver),
  89. m_pszFilePath((LPSTR) pszFilePath),
  90. m_nFileHandle(nFileHandle),
  91. m_EventHandle(EventHandle),
  92. m_bCompressFiles(bCompressFiles)
  93. {
  94. }
  95. SubmitFileSendMsg::~SubmitFileSendMsg(void)
  96. {
  97. delete m_pszFilePath;
  98. }
  99. FileOfferNotifyMsg::FileOfferNotifyMsg
  100. (
  101. MBFTEVENTHANDLE EventHandle,
  102. T120UserID SenderID,
  103. T120NodeID NodeID,
  104. MBFTFILEHANDLE hFile,
  105. LPCSTR lpszFilename,
  106. ULONG FileSize,
  107. time_t FileDateTime,
  108. BOOL bAckNeeded
  109. )
  110. :
  111. MBFTMsg(EnumFileOfferNotifyMsg),
  112. m_SenderID(SenderID),
  113. m_NodeID(NodeID),
  114. m_EventHandle(EventHandle),
  115. m_FileSize(FileSize),
  116. m_hFile(hFile),
  117. m_FileDateTime(FileDateTime),
  118. m_bAckNeeded(bAckNeeded)
  119. {
  120. ::lstrcpynA(m_szFileName, lpszFilename, sizeof(m_szFileName));
  121. }
  122. FileTransferControlMsg::FileTransferControlMsg
  123. (
  124. MBFTEVENTHANDLE EventHandle,
  125. MBFTFILEHANDLE hFile,
  126. LPCSTR lpszDirectory,
  127. LPCSTR lpszFileName,
  128. FileTransferControl iControlCommand
  129. )
  130. :
  131. MBFTMsg(EnumFileTransferControlMsg),
  132. m_EventHandle(EventHandle),
  133. m_hFile(hFile),
  134. m_ControlCommand(iControlCommand)
  135. {
  136. if(lpszDirectory)
  137. {
  138. ::lstrcpynA(m_szDirectory, lpszDirectory, sizeof(m_szDirectory));
  139. #ifdef BUG_INTL
  140. ::AnsiToOem(m_szDirectory, m_szDirectory);
  141. #endif
  142. }
  143. else
  144. {
  145. m_szDirectory[0] = '\0';
  146. }
  147. if(lpszFileName)
  148. {
  149. ::lstrcpynA(m_szFileName, lpszFileName, sizeof(m_szFileName));
  150. #ifdef BUG_INTL
  151. ::AnsiToOem(m_szFileName, m_szFileName);
  152. #endif
  153. }
  154. else
  155. {
  156. m_szFileName[0] = '\0';
  157. }
  158. }
  159. FileTransmitMsg::FileTransmitMsg
  160. (
  161. MBFTEVENTHANDLE EventHandle,
  162. MBFTFILEHANDLE hFile,
  163. ULONG FileSize,
  164. ULONG BytesTransmitted,
  165. int iTransmitStatus,
  166. T120UserID iUserID,
  167. BOOL bIsBroadcastEvent
  168. )
  169. :
  170. MBFTMsg(EnumFileTransmitMsg),
  171. m_EventHandle(EventHandle),
  172. m_hFile(hFile),
  173. m_FileSize(FileSize),
  174. m_BytesTransmitted(BytesTransmitted),
  175. m_TransmitStatus(iTransmitStatus),
  176. m_UserID(iUserID),
  177. m_bIsBroadcastEvent(bIsBroadcastEvent)
  178. {
  179. }
  180. FileErrorMsg::FileErrorMsg
  181. (
  182. MBFTEVENTHANDLE EventHandle,
  183. MBFTFILEHANDLE hFile,
  184. int iErrorType,
  185. int iErrorCode,
  186. BOOL bIsLocalError,
  187. T120UserID iUserID,
  188. BOOL bIsBroadcastEvent,
  189. const char* pFileName,
  190. ULONG nFileSize
  191. )
  192. :
  193. MBFTMsg(EnumFileErrorMsg),
  194. m_EventHandle(EventHandle),
  195. m_hFile(hFile),
  196. m_ErrorCode(iErrorCode),
  197. m_ErrorType(iErrorType),
  198. m_bIsLocalError(bIsLocalError),
  199. m_UserID(iUserID),
  200. m_bIsBroadcastEvent(bIsBroadcastEvent)
  201. {
  202. ::ZeroMemory(&m_stFileInfo, sizeof(m_stFileInfo));
  203. if (pFileName)
  204. {
  205. ::lstrcpyn(m_stFileInfo.szFileName, pFileName, sizeof(m_stFileInfo.szFileName));
  206. m_stFileInfo.lFileSize = nFileSize;
  207. }
  208. }
  209. PeerMsg::PeerMsg
  210. (
  211. T120UserID NodeID,
  212. T120UserID MBFTPeerID,
  213. BOOL bIsLocalPeer,
  214. BOOL bIsProsharePeer,
  215. LPCSTR lpszAppKey,
  216. BOOL bPeerAdded,
  217. T120SessionID SessionID
  218. )
  219. :
  220. MBFTMsg(EnumPeerMsg),
  221. m_NodeID(NodeID),
  222. m_MBFTPeerID(MBFTPeerID),
  223. m_bIsProsharePeer(bIsProsharePeer),
  224. m_bIsLocalPeer(bIsLocalPeer),
  225. m_MBFTSessionID(SessionID),
  226. m_bPeerAdded(bPeerAdded)
  227. {
  228. if(lpszAppKey)
  229. {
  230. ::lstrcpynA(m_szAppKey, lpszAppKey, sizeof(m_szAppKey));
  231. }
  232. else
  233. {
  234. m_szAppKey[0] = '\0';
  235. }
  236. }
  237. PeerDeletedMsg::~PeerDeletedMsg(void)
  238. {
  239. delete m_lpPeerData;
  240. }
  241.