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.

307 lines
9.7 KiB

  1. //--------------------------------------------------------------------
  2. // Copyright (C)1998 Microsoft Corporation, All Rights Reserved.
  3. //
  4. // bftp.h
  5. //
  6. // Constants and Types for the Binary File Transfer Protocol
  7. // (bFTP). This is the file transfer protocol for IrTran-P V1.0.
  8. //
  9. // NOTE: That IrTran-P is a big-endian protocol when on the net.
  10. //
  11. // NOTE: That the protocol data structures below assume that the
  12. // compiler generates structures with natural alignment by
  13. // field type.
  14. //
  15. // Author:
  16. //
  17. // Edward Reus (edwardr) 02-26-98 Initial coding.
  18. //
  19. //--------------------------------------------------------------------
  20. #ifndef _BFTP_H_
  21. #define _BFTP_H_
  22. //--------------------------------------------------------------------
  23. // Constants:
  24. //--------------------------------------------------------------------
  25. #define BFTP_NAME_SIZE 4
  26. #define ATTR_TYPE_BINARY 0x00
  27. #define ATTR_TYPE_CHAR 0x01
  28. #define ATTR_TYPE_TIME 0x06
  29. #define ATTR_FLAG_DEFAULT 0x00
  30. // These are the attribute names, converted from character strings
  31. // to values (see: FTP_ATTRIBUTE_MAP_ENTRY field dwWhichAttr):
  32. #define FIL0 0
  33. #define LFL0 1
  34. #define TIM0 2
  35. #define TYP0 3
  36. #define TMB0 4
  37. #define BDY0 5
  38. #define CMD0 6
  39. #define WHT0 7
  40. #define ERR0 8
  41. #define RPL0 9
  42. #define RIMG 100 // Convert WHT0 values as well.
  43. #define RINF 101
  44. #define RCMD 102
  45. #define CMD0_ATTR_VALUE 0x40001000 // Byte swapped: 0x00010040.
  46. #define INVALID_ATTR 0xffffffff
  47. // bFTP Operations:
  48. #define BFTP_QUERY 0x00000001
  49. #define BFTP_QUERY_RIMG 0x00000011
  50. #define BFTP_QUERY_RINF 0x00000021
  51. #define BFTP_QUERY_RCMD 0x00000031
  52. #define BFTP_PUT 0x00000100
  53. #define BFTP_ERROR 0x00000200
  54. #define BFTP_UNKNOWN 0xffffffff
  55. #define BFTP_QUERY_MASK 0x00000001
  56. // bFTP WHT0 subtypes:
  57. #define WHT0_ATTRIB_SIZE 4
  58. #define SZ_RINF "RINF"
  59. #define SZ_RCMD "RCMD"
  60. #define SZ_RIMG "RIMG"
  61. // UPF File Constants:
  62. #define UPF_HEADER_SIZE 240
  63. #define UPF_ENTRY_SIZE 36
  64. #define UPF_TOTAL_HEADER_SIZE 384
  65. //--------------------------------------------------------------------
  66. // Macro functions
  67. //--------------------------------------------------------------------
  68. #define Match4( pName1, pName2 ) \
  69. ( ((pName1)[0] == (pName2)[0]) \
  70. && ((pName1)[1] == (pName2)[1]) \
  71. && ((pName1)[2] == (pName2)[2]) \
  72. && ((pName1)[3] == (pName2)[3]) )
  73. #define IsBftpQuery(dwBftpOp) \
  74. (((dwBftpOp)&BFTP_QUERY_MASK) != 0)
  75. #define IsBftpPut(dwBftpOp) \
  76. ((dwBftpOp) == BFTP_PUT)
  77. #define IsBftpError(dwBftpOp) \
  78. ((dwBftpOp) == BFTP_ERROR)
  79. #define BftpValueLength(length) \
  80. ((length) - 2)
  81. // Note: that the Length field in the BFTP_ATTRIBUE is
  82. // two bytes longer than the actual value length.
  83. //--------------------------------------------------------------------
  84. // bFTP Protocol Headers:
  85. //--------------------------------------------------------------------
  86. // There can (optionally) be a bFTP attribute for the picture
  87. // create/modify date/time. If there then it will be exactly
  88. // this size:
  89. //
  90. #define BFTP_DATE_TIME_SIZE 14
  91. // Turn off warning for zero-sized array...
  92. #pragma warning(disable:4200)
  93. #pragma pack(1)
  94. typedef struct _BFTP_ATTRIBUTE
  95. {
  96. UCHAR Name[BFTP_NAME_SIZE]; // Attribute Name.
  97. DWORD Length; // Attribute Length.
  98. UCHAR Type; // Attribute Type (see ATTR_TYPE_xxx).
  99. UCHAR Flag; // Attribute Flag.
  100. UCHAR Value[]; // Attribute Data.
  101. } BFTP_ATTRIBUTE;
  102. typedef struct _BFTP_ATTRIBUTE_MAP_ENTRY
  103. {
  104. DWORD dwWhichAttr;
  105. CHAR *pName;
  106. UCHAR Type;
  107. } BFTP_ATTRIBUTE_MAP_ENTRY;
  108. //--------------------------------------------------------------------
  109. // Internal parts of a .UPF file:
  110. //--------------------------------------------------------------------
  111. typedef struct _UPF_HEADER
  112. {
  113. UCHAR UpfDeclaration[8]; // "SSS V100", no trailing zero.
  114. UCHAR FileDeclaration[8]; // "UPF V100", no trailing zero.
  115. USHORT FileId; // Should be 0x0100
  116. USHORT FileVersion; // Should be 0x0100
  117. UCHAR CreateDate[8]; // See "Date Format" note below.
  118. UCHAR EditDate[8]; // See "Date Format" note below.
  119. UCHAR MarkerModelCode[4]; //
  120. UCHAR EditMarkerModelCode[4];
  121. UCHAR Reserve[16];
  122. UCHAR NumDataEntries;
  123. UCHAR NumTables;
  124. UCHAR Reserve1;
  125. UCHAR CharSetCode; // See "Character Set Codes" below.
  126. UCHAR Title[128];
  127. UCHAR Reserve2[48];
  128. } UPF_HEADER; // 240 Bytes
  129. // NOTE: Date format for the UPF header:
  130. //
  131. // Date/time are held in an 8-byte binary block:
  132. //
  133. // Field Size Meaning
  134. // ----------- ---- -------
  135. // Time Offset 1 Difference from UTC (in 15 minute
  136. // units). 0x80 implies N/A.
  137. //
  138. // Year 2 4-digit year (0xFFFF == N/A).
  139. // Month 1 Month (0xFF == N/A).
  140. // Day 1 Day of month (0xFF == N/A).
  141. // Hour 1 Hour 0-23 (0xFF == N/A).
  142. // Minute 1 Minute 0-59 (0xFF == N/A).
  143. // Second 1 Second 0-59 (0xFF == N/A).
  144. //
  145. // So, below are the char[] array offsets for each of the date/time
  146. // fields:
  147. #define UPF_GMT_OFFSET 0
  148. #define UPF_YEAR 1
  149. #define UPF_MONTH 3
  150. #define UPF_DAY 4
  151. #define UPF_HOUR 5
  152. #define UPF_MINUTE 6
  153. #define UPF_SECOND 7
  154. //
  155. // Character Set Codes:
  156. //
  157. #define UPF_CCODE_ASCII 0x00
  158. #define UPF_CCODE_ISO_8859_1 0x01
  159. #define UPF_CCODE_SHIFT_JIS 0x02
  160. #define UPF_CCODE_NONE 0xFF
  161. //
  162. // There are usually two of these, one for a thumbnail and one for
  163. // the image itself. Note that the UPF_ENTRY for the thumbnail will
  164. // usually be present event if there isn't a thumbnail. There is
  165. // space for four of these in the UPF header area.
  166. //
  167. typedef struct _UPF_ENTRY
  168. {
  169. DWORD dwStartAddress;
  170. DWORD dwDataSize;
  171. UCHAR DataTypeId;
  172. UCHAR Reserve;
  173. UCHAR InformationData[26];
  174. } UPF_ENTRY; // 36 Bytes.
  175. typedef struct _PICTURE_INFORMATION_DATA
  176. {
  177. USHORT ImageWidth;
  178. USHORT ImageHieght;
  179. UCHAR PixelConfiguration;
  180. UCHAR RotationSet; // Amount to rotate image (counter-clockwise).
  181. UCHAR Reserved1;
  182. UCHAR CompressionRatio;
  183. UCHAR WhiteLevel;
  184. UCHAR InputDevice;
  185. UCHAR Reserved2[3];
  186. UCHAR DummyData; // This is like a border.
  187. USHORT XBegin; // This is the inset of the picture.
  188. USHORT YBegin;
  189. USHORT XSize; // Embedded size of the picture.
  190. USHORT YSize;
  191. UCHAR NonCompressionId;
  192. UCHAR Reserved3[3];
  193. } PICTURE_INFORMATION_DATA; // 26 Bytes.
  194. // Image Rotation Flags. This is the amount to rotate the image in
  195. // a counter clockwise direction. Note that most cameras don't know
  196. // the camera orientation, so ROTATE_0 means upright or unknown
  197. // orientation:
  198. //
  199. #define ROTATE_0 0x00
  200. #define ROTATE_90 0x01
  201. #define ROTATE_180 0x02
  202. #define ROTATE_270 0x03
  203. typedef struct _CAMERA_INFORMATION_TABLE
  204. {
  205. UCHAR TableID; // 0x24
  206. UCHAR NextTableOffset;
  207. USHORT ShutterSpeed; // In 1/100ths APEX units (0x8000=Undefined).
  208. USHORT Aperture; // In 1/100ths APEX units (0x8000=Undefined).
  209. USHORT Brightness; // In 1/100ths APEX units (0x8000=Undefined).
  210. USHORT Exposurebias; // In 1/100ths APEX units (0x8000=Undefined).
  211. USHORT MaxApertureRatio; // In 1/100ths APEX units (0x8000=Undefined).
  212. USHORT FocalLength; // In 1/10th mm (0xFFFF=Undefined)
  213. USHORT SubjectDistance; // In 1/10th m (0xFFFE=Infinite,0xFFFF=Undefined)
  214. UCHAR MeteringMode;
  215. UCHAR LightSource;
  216. UCHAR FlashMode;
  217. UCHAR Reserved1;
  218. USHORT IntervalInformation;
  219. UCHAR Reserved2[2];
  220. } CAMERA_INFORMATION_TABLE; // 24 Bytes.
  221. // APEX Units:
  222. //
  223. // ShutterSpeed to Exposure Time (seconds)
  224. //
  225. // APEX -5 -4 -3 -2 -1 0 1 2 3 4
  226. // Exposure Time 30 15 8 4 2 1 1/2 1/4 1/8 1/16
  227. //
  228. // APEX 5 6 7 8 9 10 11
  229. // Exposure Time 1/30 1/60 1/125 1/250 1/500 1/1000 1/2000
  230. //
  231. // Aperture to F-Number
  232. //
  233. // APEX 0 1 2 3 4 5 6 7 8 9 10
  234. // F-Number 1 1.4 2 2.8 5 5.6 8 11 16 22 32
  235. //
  236. // Brightness to Foot Lambert
  237. //
  238. // APEX -2 -1 0 1 2 3 4 5
  239. // Foot Lambert 1/4 1/2 1 2 4 8 15 30
  240. //
  241. // MeteringMode:
  242. #define METERING_AVERAGED 0x00
  243. #define METERING_CENTER_WEIGHTED 0x01
  244. #define METERING_SPOT 0x02
  245. #define METERING_MULTI_SPOT 0x03
  246. // LightSource:
  247. #define LIGHT_SOURCE_DAYLIGHT 0x00
  248. #define LIGHT_SOURCE_FLUORESCENT 0x01
  249. #define LIGHT_SOURCE_TUNGSTEN 0x03
  250. #define LIGHT_SOURCE_STANDARD_A 0x10
  251. #define LIGHT_SOURCE_STANDARD_B 0x11
  252. #define LIGHT_SOURCE_STANDARD_C 0x12
  253. #define LIGHT_SOURCE_D55 0x20
  254. #define LIGHT_SOURCE_D65 0x21
  255. #define LIGHT_SOURCE_D75 0x22
  256. #define LIGHT_SOURCE_UNDEFINED 0xFF
  257. // FlashMode:
  258. #define FLASH_NO_FLASH 0x00
  259. #define FLASH_FLASH 0x01
  260. #define FLASH_UNKNOWN 0xFF
  261. #pragma warning(default:4200)
  262. #pragma pack()
  263. #endif //_BFTP_H_