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.

191 lines
6.2 KiB

  1. // File: iMbft.h
  2. //
  3. // Interface to Multipoint Binary File Transfer
  4. #ifndef _IMBFT_H_
  5. #define _IMBFT_H_
  6. #include <t120type.h>
  7. const unsigned int _iMBFT_MAX_APP_KEY = 64; //Max characters in lpszAppKey parameter passed to MBFTInitialize
  8. const unsigned int _iMBFT_MAX_FILE_NAME = MAX_PATH; //Max characters in filename
  9. typedef UINT MBFTFILEHANDLE;
  10. typedef UINT MBFTEVENTHANDLE;
  11. typedef enum
  12. {
  13. iMBFT_OK = 0,
  14. iMBFT_FIRST_ERROR = 0x100,
  15. iMBFT_NOT_INITIALIZED,
  16. iMBFT_ALREADY_INITIALIZED,
  17. iMBFT_INVALID_SESSION_ID,
  18. iMBFT_INVALID_ATTACHMENT_HANDLE,
  19. iMBFT_NO_MORE_RECIPIENTS,
  20. iMBFT_NO_MORE_FILES,
  21. iMBFT_INVALID_EVENT_HANDLE,
  22. iMBFT_INVALID_FILE_HANDLE,
  23. iMBFT_INSUFFICIENT_DISK_SPACE,
  24. iMBFT_FILE_NOT_FOUND,
  25. iMBFT_FILE_IO_ERROR,
  26. iMBFT_MEMORY_ALLOCATION_ERROR,
  27. iMBFT_ASN1_ENCODING_ERROR,
  28. iMBFT_RECIPIENT_NOT_FOUND,
  29. iMBFT_SENDER_ABORTED,
  30. iMBFT_RECEIVER_ABORTED,
  31. iMBFT_MULT_RECEIVER_ABORTED,
  32. iMBFT_RECEIVER_REJECTED,
  33. iMBFT_INVALID_PARAMETERS,
  34. iMBFT_COMPRESSION_ERROR,
  35. iMBFT_DECOMPRESSION_ERROR,
  36. iMBFT_INVALID_PATH,
  37. iMBFT_FILE_ACCESS_DENIED,
  38. iMBFT_FILE_HARD_IO_ERROR,
  39. iMBFT_FILE_SHARING_VIOLATION,
  40. iMBFT_DIRECTORY_FULL_ERROR,
  41. iMBFT_TOO_MANY_OPEN_FILES,
  42. iMBFT_OPERATION_IN_PROGRESS,
  43. iMBFT_INSUFFICIENT_PRIVILEGE,
  44. iMBFT_CONDUCTOR_ABORTED,
  45. iMBFT_PACKET_SIZE_ERROR,
  46. iMBFT_UNKNOWN_ERROR,
  47. iMBFT_TIMEOUT_ERROR
  48. } MBFT_ERROR_CODE;
  49. // Return codes (Should be in imsconf2.idl)
  50. #define FT_ERR_FAC 0xF000
  51. #define FT_E(e) (0x81000000UL | FT_ERR_FAC | (ULONG) (e))
  52. enum
  53. {
  54. NM_E_FT_NO_RECIPIENTS = FT_E(0x01FF),
  55. NM_E_FT_CANCELED = FT_E(0x01FE),
  56. NM_E_FT_MULT_CANCELED = FT_E(0x01FD),
  57. NM_E_FT_RECDIR = FT_E(0x01FC),
  58. NM_E_FT_REJECTED = FT_E(0x01FB)
  59. };
  60. #define HRESULT_FROM_IMBFT(iMbftError) FT_E(iMbftError)
  61. // This matches "ErrorType" in T.MBFT spec
  62. typedef enum
  63. {
  64. MBFT_INFORMATIVE_ERROR = 0, // Information only
  65. MBFT_TRANSIENT_ERROR, // Current transfer failed, retry might work
  66. MBFT_PERMANENT_ERROR // Error occurs consistently
  67. } MBFT_ERROR_TYPES;
  68. typedef struct _T_MBFT_PEER_INFO
  69. {
  70. T120NodeID NodeID; // MCS userID of GCC on peer's node
  71. T120UserID MBFTPeerID; // MCS userID of peer app
  72. T120SessionID MBFTSessionID; // Session ID
  73. BOOL bIsProShareApp; // ProShare MBFT peer
  74. char szAppKey[_iMBFT_MAX_APP_KEY]; // see MBFTInitialize
  75. } MBFT_PEER_INFO;
  76. typedef struct _T_MBFT_SEND_FILE_INFO
  77. {
  78. char * lpszFilePath; //Canonical path to file to be sent, upto [_iMBFT_MAX_PATH] bytes
  79. MBFTFILEHANDLE hFile; // unique identifier for file (filled in on return)
  80. ULONG lFileSize; // File size in bytes
  81. time_t FileDateTime;
  82. } MBFT_SEND_FILE_INFO;
  83. typedef struct _T_MBFT_RECEIVE_FILE_INFO
  84. {
  85. char szFileName[_iMBFT_MAX_FILE_NAME]; // Just the File name
  86. MBFTFILEHANDLE hFile; // unique identifier for file
  87. ULONG lFileSize; // File size in bytes
  88. time_t FileDateTime;
  89. } MBFT_RECEIVE_FILE_INFO;
  90. typedef struct _T_MBFT_FILE_OFFER
  91. {
  92. MBFTEVENTHANDLE hEvent;
  93. T120UserID SenderID; // MCS ID of sender-to-be
  94. T120NodeID NodeID;
  95. ULONG uNumFiles; // Number of files offered
  96. BOOL bIsBroadcastEvent;
  97. MBFT_RECEIVE_FILE_INFO FAR * lpFileInfoList; // Array of structs with file info
  98. } MBFT_FILE_OFFER;
  99. typedef struct _T_MBFT_FILE_PROGRESS
  100. {
  101. MBFTEVENTHANDLE hEvent;
  102. MBFTFILEHANDLE hFile;
  103. ULONG lFileSize;
  104. ULONG lBytesTransmitted;
  105. BOOL bIsBroadcastEvent;
  106. } MBFT_FILE_PROGRESS;
  107. typedef struct _T_MBFT_EVENT_ERROR
  108. {
  109. MBFTEVENTHANDLE hEvent;
  110. BOOL bIsLocalError; // If error in local MBFT provider
  111. T120UserID UserID; // MCS ID of peer who reported error
  112. MBFTFILEHANDLE hFile; // File associated with error
  113. BOOL bIsBroadcastEvent;
  114. MBFT_ERROR_TYPES eErrorType; // Severity of error
  115. MBFT_ERROR_CODE eErrorCode;
  116. } MBFT_EVENT_ERROR;
  117. #undef INTERFACE
  118. #define INTERFACE IMbftEvents
  119. DECLARE_INTERFACE(IMbftEvents)
  120. {
  121. STDMETHOD(OnInitializeComplete)( THIS) PURE;
  122. STDMETHOD(OnPeerAdded)( THIS_
  123. MBFT_PEER_INFO *pInfo) PURE;
  124. STDMETHOD(OnPeerRemoved)( THIS_
  125. MBFT_PEER_INFO *pInfo) PURE;
  126. STDMETHOD(OnFileOffer)( THIS_
  127. MBFT_FILE_OFFER *pOffer) PURE;
  128. STDMETHOD(OnFileProgress)( THIS_
  129. MBFT_FILE_PROGRESS *pProgress) PURE;
  130. STDMETHOD(OnFileEnd)( THIS_
  131. MBFTFILEHANDLE hFile) PURE;
  132. STDMETHOD(OnFileError)( THIS_
  133. MBFT_EVENT_ERROR *pEvent) PURE;
  134. STDMETHOD(OnFileEventEnd)( THIS_
  135. MBFTEVENTHANDLE hEvent) PURE;
  136. STDMETHOD(OnSessionEnd)( THIS) PURE;
  137. };
  138. #undef INTERFACE
  139. #define INTERFACE IMbftControl
  140. DECLARE_INTERFACE(IMbftControl)
  141. {
  142. STDMETHOD_(void, ReleaseInterface)( THIS) PURE;
  143. STDMETHOD_(void, Update)( THIS) PURE;
  144. STDMETHOD_(void, CancelFt)( THIS_
  145. MBFTEVENTHANDLE hEvent,
  146. MBFTFILEHANDLE hFile) PURE;
  147. STDMETHOD(AcceptFileOffer)( THIS_
  148. MBFT_FILE_OFFER *pOffer,
  149. LPCSTR pszRecDir,
  150. LPCSTR pszFileName) PURE;
  151. STDMETHOD_(void, RejectFileOffer)( THIS_
  152. MBFT_FILE_OFFER *pOffer) PURE;
  153. STDMETHOD(SendFile)( THIS_
  154. LPCSTR pszFileName,
  155. T120NodeID nidReceiver,
  156. MBFTEVENTHANDLE *phEvent,
  157. MBFTFILEHANDLE *phFile) PURE;
  158. };
  159. typedef HRESULT (WINAPI * PFNCREATEMBFTOBJECT) (IMbftControl**, IMbftEvents *);
  160. HRESULT WINAPI FT_CreateInterface(IMbftControl **ppMbft, IMbftEvents *pEvents);
  161. #endif /* _IMBFT_H */
  162.