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.

280 lines
5.2 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. homenetp.h
  5. Abstract:
  6. Header file for functions shared in home network transport.
  7. Author:
  8. Jim Schmidt (jimschm) 03-Jul-2000
  9. Revision History:
  10. <alias> <date> <comments>
  11. --*/
  12. //
  13. // Includes
  14. //
  15. #include "logmsg.h"
  16. //
  17. // Strings
  18. //
  19. #define S_TRANSPORT_DAT_FILE TEXT("TRANSDB.DAT")
  20. #define S_TRANSPORT_IMG_FILE TEXT("IMG%05X.DAT")
  21. //
  22. // Constants
  23. //
  24. #define GLOBALKEY_SIZE 8
  25. #define HOMENETTR_CONVSIG 0x55534D32 //USM2
  26. #define HOMENETTR_SIG 0x55534D34 //USM4
  27. #define TRSTATUS_DIRTY 0x00000001
  28. #define TRSTATUS_READY 0x00000002
  29. #define TRSTATUS_LOCKED 0x00000003
  30. #define TRFLAG_FILE 0x01
  31. #define TRFLAG_MEMORY 0x02
  32. #define MESSAGE_ERROR 0x0000
  33. #define MESSAGE_FILE 0x0001
  34. #define MESSAGE_DONE 0x0002
  35. #define MESSAGE_KEEP_ALIVE 0x0003
  36. #define MESSAGE_DATA 0x0004
  37. #define MESSAGE_PASSWORDWRONG 0x0005
  38. #define MESSAGE_PASSWORDOK 0x0006
  39. #define MESSAGE_CANCEL 0x0007
  40. #define MAX_SOCKADDR (max(sizeof(SOCKADDR_IN),max(sizeof(SOCKADDR_IPX),sizeof(SOCKADDR_NB))))
  41. //
  42. // Macros
  43. //
  44. // None
  45. //
  46. // Types
  47. //
  48. #pragma pack(push,1)
  49. typedef struct {
  50. WORD PacketNumber;
  51. WORD DataLength;
  52. } DATAGRAM_PACKET, *PDATAGRAM_PACKET;
  53. #pragma pack(pop)
  54. typedef struct TAG_DATAGRAM_POOL_ITEM {
  55. struct TAG_DATAGRAM_POOL_ITEM *Next, *Prev;
  56. DATAGRAM_PACKET Header;
  57. PCBYTE PacketData;
  58. // PacketData follows
  59. } DATAGRAM_POOL_ITEM, *PDATAGRAM_POOL_ITEM;
  60. typedef struct {
  61. PMHANDLE Pool;
  62. PDATAGRAM_POOL_ITEM FirstItem;
  63. WORD SendSequenceNumber;
  64. WORD RecvSequenceNumber;
  65. UINT LastPacketNumber;
  66. } DATAGRAM_POOL, *PDATAGRAM_POOL;
  67. typedef struct {
  68. SOCKET Socket;
  69. BYTE LocalAddress[MAX_SOCKADDR];
  70. INT LocalAddressLen;
  71. BYTE RemoteAddress[MAX_SOCKADDR];
  72. INT RemoteAddressLen;
  73. INT Family;
  74. INT Protocol;
  75. DATAGRAM_POOL DatagramPool;
  76. BOOL Datagram;
  77. UINT LastSend;
  78. UINT KeepAliveSpacing;
  79. } CONNECTIONSOCKET, *PCONNECTIONSOCKET;
  80. typedef struct {
  81. BYTE LocalAddress[MAX_SOCKADDR];
  82. INT LocalAddressLen;
  83. BYTE RemoteAddress[MAX_SOCKADDR];
  84. INT RemoteAddressLen;
  85. INT Family;
  86. INT Protocol;
  87. BOOL Datagram;
  88. TCHAR DestinationName[MAX_COMPUTER_NAME];
  89. } CONNECTADDRESS, *PCONNECTADDRESS;
  90. typedef struct {
  91. UINT StructSize;
  92. DWORD Signature;
  93. UINT FileCount;
  94. LONGLONG TotalSize;
  95. TCHAR SourceName[MAX_COMPUTER_NAME];
  96. } TRANSFERMETRICS, *PTRANSFERMETRICS;
  97. //
  98. // Globals
  99. //
  100. extern PCTSTR g_TransportTempDir;
  101. extern PCTSTR g_StatusFile;
  102. extern HANDLE g_StatusFileHandle;
  103. extern UINT g_Platform;
  104. extern TRANSFERMETRICS g_Metrics;
  105. extern CONNECTIONSOCKET g_Connection;
  106. extern BOOL g_CompressData;
  107. extern HANDLE g_BackgroundThread;
  108. extern HANDLE g_BackgroundThreadTerminate;
  109. extern MIG_PROGRESSSLICEID g_DownloadSlice;
  110. extern UINT g_DownloadTicks;
  111. extern UINT g_DownloadSliceSize;
  112. extern CHAR g_GlobalKey [GLOBALKEY_SIZE + 1];
  113. //
  114. // Macro expansion list
  115. //
  116. // None
  117. //
  118. // Public function prototypes
  119. //
  120. BOOL
  121. FindDestination (
  122. OUT PCONNECTADDRESS Address,
  123. IN UINT Timeout, OPTIONAL
  124. IN BOOL IgnoreMultipleDests
  125. );
  126. BOOL
  127. TestConnection (
  128. IN PCONNECTADDRESS Address
  129. );
  130. BOOL
  131. ConnectToDestination (
  132. IN PCONNECTADDRESS Address,
  133. IN PTRANSFERMETRICS Metrics,
  134. OUT PCONNECTIONSOCKET Connection
  135. );
  136. DWORD
  137. SendMessageToDestination (
  138. IN PCONNECTIONSOCKET Connection,
  139. IN DWORD Message
  140. );
  141. BOOL
  142. SendFileToDestination (
  143. IN PCONNECTIONSOCKET Connection,
  144. IN PCTSTR LocalPath, OPTIONAL
  145. IN PCTSTR DestSubPath OPTIONAL
  146. );
  147. BOOL
  148. SendDataToDestination (
  149. IN PCONNECTIONSOCKET Connection,
  150. IN PCBYTE Data,
  151. IN UINT DataSize
  152. );
  153. BOOL
  154. ConnectToSource (
  155. OUT PCONNECTIONSOCKET Connection,
  156. OUT PTRANSFERMETRICS Metrics
  157. );
  158. DWORD
  159. ReceiveFromSource (
  160. IN PCONNECTIONSOCKET Connection,
  161. IN PCTSTR LocalFileRoot,
  162. OUT PBYTE *Buffer,
  163. IN UINT Timeout OPTIONAL
  164. );
  165. VOID
  166. CloseConnection (
  167. IN PCONNECTIONSOCKET Connection
  168. );
  169. DWORD
  170. GetTransportStatus (
  171. IN PCTSTR TrJournal,
  172. OUT PBOOL Compressed OPTIONAL
  173. );
  174. PCTSTR
  175. BuildImageFileName (
  176. IN UINT ImageIdx
  177. );
  178. VOID
  179. FreeImageFileName (
  180. IN PCTSTR ImageFileName
  181. );
  182. PCTSTR
  183. CreateStorageDir (
  184. VOID
  185. );
  186. PCTSTR
  187. BuildDecoratedObject (
  188. IN MIG_OBJECTTYPEID ObjectTypeId,
  189. IN ENCODEDSTRHANDLE ObjectName
  190. );
  191. VOID
  192. DestroyDecoratedObject (
  193. IN PCTSTR String
  194. );
  195. PCTSTR
  196. AllocStorageFileName (
  197. IN PCTSTR FileName OPTIONAL
  198. );
  199. VOID
  200. FreeStorageFileName (
  201. IN PCTSTR NameToFree
  202. );
  203. DWORD
  204. WINAPI
  205. DestinationBackgroundThread (
  206. PVOID DontCare
  207. );
  208. //
  209. // Macro expansion definition
  210. //
  211. // None
  212. //
  213. // ANSI/UNICODE macros
  214. //
  215. // None