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.

843 lines
25 KiB

  1. /*****************************************************************************\
  2. * MODULE: webipp.h
  3. *
  4. * This is the header module for webipp.c. This contains the IPP 1.1 parser
  5. * that encodes/decodes data for transfering across the HTTP wire.
  6. *
  7. *
  8. * Copyright (C) 1996-1998 Microsoft Corporation
  9. * Copyright (C) 1996-1998 Hewlett Packard
  10. *
  11. * history:
  12. * 27-Oct-1997 <chriswil/v-chrisw> created.
  13. *
  14. \*****************************************************************************/
  15. #ifndef _WEBIPP_H
  16. #define _WEBIPP_H
  17. #include <time.h>
  18. #ifdef __cplusplus // Place this here to prevent decorating of symbols
  19. extern "C" { // when doing C++ stuff.
  20. #endif
  21. /***********************************************\
  22. * Common Macros
  23. *
  24. \***********************************************/
  25. #define offs(type, identifier) ((ULONG_PTR)&(((type)0)->identifier))
  26. /***********************************************\
  27. * Constant Values
  28. *
  29. \***********************************************/
  30. #define IPP_BLOCK_SIZE 1024
  31. #define IPP_VERSION ((WORD)0x0100)
  32. #define IPP_GETJOB_ALL ((DWORD)0x7FFFFFFF)
  33. #define IPPOBJ_MASK_SIZE 2
  34. #define IPPTYPE_UNKNOWN 0
  35. #define IPPTYPE_PRT 1
  36. #define IPPTYPE_JOB 2
  37. #define IPPTYPE_AUTH 3
  38. #define IPP_ATR_ABSOLUTE 0
  39. #define IPP_ATR_OFFSET -1
  40. #define IPP_ATR_OFFSETCONV -2
  41. #define IPP_ATR_TAG -4
  42. /***********************************************\
  43. * IPP Element Sizes
  44. *
  45. * These are used to identify the size of
  46. * IPP element values.
  47. *
  48. \***********************************************/
  49. #define IPP_SIZEOFREQ sizeof(WORD) // 2 bytes
  50. #define IPP_SIZEOFVER sizeof(WORD) // 2 bytes
  51. #define IPP_SIZEOFLEN sizeof(WORD) // 2 bytes
  52. #define IPP_SIZEOFTAG sizeof(BYTE) // 1 byte
  53. #define IPP_SIZEOFINT sizeof(DWORD) // 4 bytes
  54. #define IPP_SIZEOFBYTE sizeof(BYTE) // 1 bytes
  55. #define IPP_SIZEOFHDR (IPP_SIZEOFVER + IPP_SIZEOFREQ + IPP_SIZEOFINT)
  56. /***********************************************\
  57. * IPP Attribute Sizes
  58. *
  59. \***********************************************/
  60. #define SIZE_TEXT 1023
  61. #define SIZE_NAME 255
  62. #define SIZE_KEYWORD 255
  63. #define SIZE_KEYWORDNAME 255
  64. #define SIZE_ENUM 4
  65. #define SIZE_URI 1023
  66. #define SIZE_URISCHEME 63
  67. #define SIZE_CHARSET 63
  68. #define SIZE_NATLANG 63
  69. #define SIZE_MIMEMEDIA 63
  70. #define SIZE_OCTSTRING 1023
  71. #define SIZE_BOOLEAN 1
  72. #define SIZE_INTEGER 4
  73. #define SIZE_RANGEINTEGER 8
  74. #define SIZE_DATETIME 11
  75. #define SIZE_RESOLUTION 9
  76. /***********************************************\
  77. * IPP Job-State Codes
  78. *
  79. \***********************************************/
  80. #define IPP_JOBSTATE_UNKNOWN ((BYTE)0)
  81. #define IPP_JOBSTATE_PENDING ((BYTE)3)
  82. #define IPP_JOBSTATE_PENDINGHELD ((BYTE)4)
  83. #define IPP_JOBSTATE_PROCESSING ((BYTE)5)
  84. #define IPP_JOBSTATE_PROCESSEDSTOPPED ((BYTE)6)
  85. #define IPP_JOBSTATE_CANCELLED ((BYTE)7)
  86. #define IPP_JOBSTATE_ABORTED ((BYTE)8)
  87. #define IPP_JOBSTATE_COMPLETED ((BYTE)9)
  88. /***********************************************\
  89. * IPP Printer-State Codes
  90. *
  91. \***********************************************/
  92. #define IPP_PRNSTATE_UNKNOWN ((DWORD)0)
  93. #define IPP_PRNSTATE_IDLE ((DWORD)3)
  94. #define IPP_PRNSTATE_PROCESSING ((DWORD)4)
  95. #define IPP_PRNSTATE_STOPPED ((DWORD)5)
  96. /***********************************************\
  97. * IPP Request/Response Codes
  98. *
  99. \***********************************************/
  100. #define IPP_REQ_GETOPERATION ((WORD)0x0001)
  101. #define IPP_REQ_PRINTJOB ((WORD)0x0002) // Implemented
  102. #define IPP_REQ_PRINTURI ((WORD)0x0003)
  103. #define IPP_REQ_VALIDATEJOB ((WORD)0x0004) // Implemented
  104. #define IPP_REQ_CREATEJOB ((WORD)0x0005)
  105. #define IPP_REQ_SENDDOC ((WORD)0x0006)
  106. #define IPP_REQ_SENDURI ((WORD)0x0007)
  107. #define IPP_REQ_CANCELJOB ((WORD)0x0008) // Implemented
  108. #define IPP_REQ_GETJOB ((WORD)0x0009) // Implemented
  109. #define IPP_REQ_ENUJOB ((WORD)0x000A) // Implemented
  110. #define IPP_REQ_GETPRN ((WORD)0x000B) // Implemented
  111. #define IPP_REQ_PAUSEJOB ((WORD)0x000C) // Implemented
  112. #define IPP_REQ_RESUMEJOB ((WORD)0x000D) // Implemented
  113. #define IPP_REQ_RESTARTJOB ((WORD)0x000E) // Implemented
  114. #define IPP_REQ_REPROCESSJOB ((WORD)0x000F)
  115. #define IPP_REQ_PAUSEPRN ((WORD)0x0010) // Implemented
  116. #define IPP_REQ_RESUMEPRN ((WORD)0x0011) // Implemented
  117. #define IPP_REQ_CANCELPRN ((WORD)0x0012) // Implemented
  118. #define IPP_REQ_FORCEAUTH ((WORD)0x4000)
  119. #define IPP_RESPONSE ((WORD)0x1000)
  120. #define IPP_RET_PRINTJOB (IPP_RESPONSE | IPP_REQ_PRINTJOB)
  121. #define IPP_RET_VALIDATEJOB (IPP_RESPONSE | IPP_REQ_VALIDATEJOB)
  122. #define IPP_RET_CANCELJOB (IPP_RESPONSE | IPP_REQ_CANCELJOB)
  123. #define IPP_RET_GETJOB (IPP_RESPONSE | IPP_REQ_GETJOB)
  124. #define IPP_RET_ENUJOB (IPP_RESPONSE | IPP_REQ_ENUJOB)
  125. #define IPP_RET_GETPRN (IPP_RESPONSE | IPP_REQ_GETPRN)
  126. #define IPP_RET_PAUSEJOB (IPP_RESPONSE | IPP_REQ_PAUSEJOB)
  127. #define IPP_RET_RESUMEJOB (IPP_RESPONSE | IPP_REQ_RESUMEJOB)
  128. #define IPP_RET_RESTARTJOB (IPP_RESPONSE | IPP_REQ_RESTARTJOB)
  129. #define IPP_RET_PAUSEPRN (IPP_RESPONSE | IPP_REQ_PAUSEPRN)
  130. #define IPP_RET_RESUMEPRN (IPP_RESPONSE | IPP_REQ_RESUMEPRN)
  131. #define IPP_RET_CANCELPRN (IPP_RESPONSE | IPP_REQ_CANCELPRN)
  132. #define IPP_RET_FORCEAUTH (IPP_RESPONSE | IPP_REQ_FORCEAUTH)
  133. /***********************************************\
  134. * IPP Response Error Codes
  135. *
  136. \***********************************************/
  137. #define IPPRSP_SUCCESS ((WORD)0x0000) // Standard
  138. #define IPPRSP_SUCCESS1 ((WORD)0x0001) // Standard
  139. #define IPPRSP_SUCCESS2 ((WORD)0x0002) // Standard
  140. #define IPPRSP_ERROR_400 ((WORD)0x0400) // Standard
  141. #define IPPRSP_ERROR_401 ((WORD)0x0401) // Standard
  142. #define IPPRSP_ERROR_402 ((WORD)0x0402) // Standard
  143. #define IPPRSP_ERROR_403 ((WORD)0x0403) // Standard
  144. #define IPPRSP_ERROR_404 ((WORD)0x0404) // Standard
  145. #define IPPRSP_ERROR_405 ((WORD)0x0405) // Standard
  146. #define IPPRSP_ERROR_406 ((WORD)0x0406) // Standard
  147. #define IPPRSP_ERROR_407 ((WORD)0x0407) // Standard
  148. #define IPPRSP_ERROR_408 ((WORD)0x0408) // Standard
  149. #define IPPRSP_ERROR_409 ((WORD)0x0409) // Standard
  150. #define IPPRSP_ERROR_40A ((WORD)0x040A) // Standard
  151. #define IPPRSP_ERROR_40B ((WORD)0x040B) // Standard
  152. #define IPPRSP_ERROR_40C ((WORD)0x040C) // Standard
  153. #define IPPRSP_ERROR_40D ((WORD)0x040D) // Standard
  154. #define IPPRSP_ERROR_40E ((WORD)0x040E) // Standard
  155. #define IPPRSP_ERROR_500 ((WORD)0x0500) // Standard
  156. #define IPPRSP_ERROR_501 ((WORD)0x0501) // Standard
  157. #define IPPRSP_ERROR_502 ((WORD)0x0502) // Standard
  158. #define IPPRSP_ERROR_503 ((WORD)0x0503) // Standard
  159. #define IPPRSP_ERROR_504 ((WORD)0x0504) // Standard
  160. #define IPPRSP_ERROR_505 ((WORD)0x0505) // Standard
  161. #define IPPRSP_ERROR_506 ((WORD)0x0506) // Standard
  162. #define IPPRSP_ERROR_540 ((WORD)0x0540) // Extended
  163. #define SUCCESS_RANGE(wRsp) ((BOOL)((wRsp >= 0x0000) && (wRsp <= 0x00FF)))
  164. #define ERROR_RANGE(wReq) \
  165. (((wReq >= IPPRSP_ERROR_400) && (wReq <= IPPRSP_ERROR_40E)) || \
  166. ((wReq >= IPPRSP_ERROR_500) && (wReq <= IPPRSP_ERROR_506)) || \
  167. ((wReq == IPPRSP_ERROR_540)))
  168. #define REQID_RANGE(idReq) (((DWORD)idReq >= 1) && ((DWORD)idReq <= 0x7FFFFFFF))
  169. /***********************************************\
  170. * IPP Attribute Delimiter Tags
  171. *
  172. \***********************************************/
  173. #define IPP_TAG_DEL_RESERVED ((BYTE)0x00) //
  174. #define IPP_TAG_DEL_OPERATION ((BYTE)0x01) //
  175. #define IPP_TAG_DEL_JOB ((BYTE)0x02) //
  176. #define IPP_TAG_DEL_DATA ((BYTE)0x03) //
  177. #define IPP_TAG_DEL_PRINTER ((BYTE)0x04) //
  178. #define IPP_TAG_DEL_UNSUPPORTED ((BYTE)0x05) //
  179. #define IPP_TAG_OUT_UNSUPPORTED ((BYTE)0x10) //
  180. #define IPP_TAG_OUT_DEFAULT ((BYTE)0x11) //
  181. #define IPP_TAG_OUT_NONE ((BYTE)0x12) //
  182. #define IPP_TAG_OUT_COMPOUND ((BYTE)0x13) //
  183. #define IPP_TAG_INT_INTEGER ((BYTE)0x21) // sizeof(DWORD)
  184. #define IPP_TAG_INT_BOOLEAN ((BYTE)0x22) // sizeof(BYTE)
  185. #define IPP_TAG_INT_ENUM ((BYTE)0x23) // sizeof(DWORD)
  186. #define IPP_TAG_OCT_STRING ((BYTE)0x30) // UTF-8
  187. #define IPP_TAG_OCT_DATETIME ((BYTE)0x31) // UTF-8
  188. #define IPP_TAG_OCT_RESOLUTION ((BYTE)0x32) // UTF-8
  189. #define IPP_TAG_OCT_RANGEOFINT ((BYTE)0x33) // UTF-8
  190. #define IPP_TAG_OCT_DICTIONARY ((BYTE)0x34) // UTF-8
  191. #define IPP_TAG_OCT_TXTWITHLANG ((BYTE)0x35)
  192. #define IPP_TAG_OCT_NMEWITHLANG ((BYTE)0x36)
  193. #define IPP_TAG_CHR_TEXT ((BYTE)0x41) // CharSet Dependent
  194. #define IPP_TAG_CHR_NAME ((BYTE)0x42) // CharSet Dependent
  195. #define IPP_TAG_CHR_KEYWORD ((BYTE)0x44) // US-ASCII
  196. #define IPP_TAG_CHR_URI ((BYTE)0x45) // US-ASCII
  197. #define IPP_TAG_CHR_URISCHEME ((BYTE)0x46) // US-ASCII
  198. #define IPP_TAG_CHR_CHARSET ((BYTE)0x47) // US-ASCII
  199. #define IPP_TAG_CHR_NATURAL ((BYTE)0x48) // US-ASCII
  200. #define IPP_TAG_CHR_MEDIA ((BYTE)0x49) // US-ASCII
  201. #define IPP_MANDITORY ((BYTE)0x00)
  202. #define IPP_OPTIONAL ((BYTE)0x10)
  203. #define IPP_MULTIPLE ((BYTE)0x20)
  204. #define IPP_HIT ((BYTE)0x80)
  205. /***********************************************\
  206. * IPP Tag-Value Ranges
  207. *
  208. \***********************************************/
  209. #define IS_TAG_DELIMITER(bTag) ((BOOL)((bTag >= 0x00) && (bTag <= 0x0F)))
  210. #define IS_TAG_ATTRIBUTE(bTag) ((BOOL)((bTag >= 0x10) && (bTag <= 0xFF)))
  211. #define IS_TAG_OUTBOUND(bTag) ((BOOL)((bTag >= 0x10) && (bTag <= 0x1F)))
  212. #define IS_TAG_INTEGER(bTag) ((BOOL)((bTag >= 0x20) && (bTag <= 0x2F)))
  213. #define IS_TAG_OCTSTR(bTag) ((BOOL)((bTag >= 0x30) && (bTag <= 0x3F)))
  214. #define IS_TAG_CHRSTR(bTag) ((BOOL)((bTag >= 0x40) && (bTag <= 0x5F)))
  215. #define IS_TAG_CHARSETSTR(bTag) ((BOOL)((bTag == 0x41) || (bTag == 0x42)))
  216. #define IS_RANGE_DELIMITER(bTag) ((BOOL)((bTag >= 0x00) && (bTag <= 0x05)))
  217. #define IS_TAG_COMPOUND(bTag) ((BOOL)((bTag == 0x35) || (bTag == 0x36)))
  218. /***********************************************\
  219. * IPP Request Flags
  220. *
  221. \***********************************************/
  222. #define RA_JOBURI 0x00000001
  223. #define RA_JOBID 0x00000002
  224. #define RA_JOBSTATE 0x00000004
  225. #define RA_JOBNAME 0x00000008
  226. #define RA_JOBSIZE 0x00000010
  227. #define RA_JOBUSER 0x00000020
  228. #define RA_JOBPRIORITY 0x00000040
  229. #define RA_JOBFORMAT 0x00000080
  230. #define RA_JOBSTATE_REASONS 0x00000100
  231. #define RA_JOBSTATE_MESSAGE 0x00000200
  232. #define RA_JOBCOUNT 0x00000400
  233. #define RA_SHEETSTOTAL 0x00000800
  234. #define RA_SHEETSCOMPLETED 0x00001000
  235. #define RA_PRNURI 0x00002000
  236. #define RA_PRNSTATE 0x00004000
  237. #define RA_PRNNAME 0x00008000
  238. #define RA_PRNMAKE 0x00010000
  239. #define RA_URISUPPORTED 0x00020000
  240. #define RA_URISECURITY 0x00040000
  241. #define RA_ACCEPTINGJOBS 0x00080000
  242. #define RA_CHRSETCONFIGURED 0x00100000
  243. #define RA_CHRSETSUPPORTED 0x00200000
  244. #define RA_NATLNGCONFIGURED 0x00400000
  245. #define RA_NATLNGSUPPORTED 0x00800000
  246. #define RA_DOCDEFAULT 0x01000000
  247. #define RA_DOCSUPPORTED 0x02000000
  248. #define RA_PDLOVERRIDE 0x04000000
  249. #define RA_UPTIME 0x08000000
  250. #define RA_OPSSUPPORTED 0x10000001
  251. #define RA_JOBKSUPPORTED 0x10000002
  252. #define RA_JOBSCOMPLETED 0x10000004
  253. #define RA_JOBSUNCOMPLETED 0x10000008
  254. #define RA_TIMEATCREATION 0x10000010
  255. #define IPP_REQALL_IDX 8
  256. #define IPP_REQENU_IDX 9
  257. #define IPP_REQJDSC_IDX 10
  258. #define IPP_REQJTMP_IDX 11
  259. #define IPP_REQPDSC_IDX 12
  260. #define IPP_REQPTMP_IDX 13
  261. #define IPP_REQCLEAR_IDX 14
  262. #define IPP_REQALL ((DWORD)0x80000000)
  263. #define IPP_REQENU ((DWORD)0x90000000)
  264. #define IPP_REQJDSC ((DWORD)0xA0000000)
  265. #define IPP_REQJTMP ((DWORD)0xB0000000)
  266. #define IPP_REQPDSC ((DWORD)0xC0000000)
  267. #define IPP_REQPTMP ((DWORD)0xD0000000)
  268. #define IPP_REQCLEAR ((DWORD)0xE0000000)
  269. /***********************************************\
  270. * WebIppRcvData Return Codes
  271. *
  272. * Receive API codes. These are our internal
  273. * return-codes for the WebIpp routines. They
  274. * have no connection to the IPP spec, but are
  275. * needed to let the caller know status of our
  276. * IPP handler-routines.
  277. *
  278. \***********************************************/
  279. #define WEBIPP_OK 0
  280. #define WEBIPP_FAIL 1
  281. #define WEBIPP_MOREDATA 2
  282. #define WEBIPP_BADHANDLE 3
  283. #define WEBIPP_NOMEMORY 4
  284. /***********************************************\
  285. * IPP Job/Printer Structures
  286. *
  287. * These are meant to provide additional
  288. * information to the standard W32 Spooler
  289. * structures.
  290. *
  291. \***********************************************/
  292. typedef struct _JOB_INFO_IPP {
  293. LPTSTR pPrnUri;
  294. LPTSTR pJobUri;
  295. DWORD cJobs;
  296. } JOB_INFO_IPP;
  297. typedef JOB_INFO_IPP *PJOB_INFO_IPP;
  298. typedef JOB_INFO_IPP *LPJOB_INFO_IPP;
  299. typedef struct _IPPJI2 {
  300. JOB_INFO_2 ji2;
  301. JOB_INFO_IPP ipp;
  302. } IPPJI2;
  303. typedef IPPJI2 *PIPPJI2;
  304. typedef IPPJI2 *LPIPPJI2;
  305. typedef struct _PRINTER_INFO_IPP {
  306. LPTSTR pPrnUri;
  307. LPTSTR pUsrName;
  308. time_t dwPowerUpTime; // This stores the T0 time of the printer in UCT, it is intentionally
  309. // signed so that we can support Printers who's T0 is smaller than
  310. // our T0 (1 Jan 1970)
  311. } PRINTER_INFO_IPP;
  312. typedef PRINTER_INFO_IPP *PPRINTER_INFO_IPP;
  313. typedef PRINTER_INFO_IPP *LPPRINTER_INFO_IPP;
  314. typedef struct _IPPPI2 {
  315. PRINTER_INFO_2 pi2;
  316. PRINTER_INFO_IPP ipp;
  317. } IPPPI2;
  318. typedef IPPPI2 *PIPPPI2;
  319. typedef IPPPI2 *LPIPPPI2;
  320. /***********************************************\
  321. * IPP Return Structures
  322. *
  323. * IPPRET_JOB - Job Information Response.
  324. * IPPRET_PRN - Printer Information Response.
  325. * IPPRET_ENUJOB - Enum-Job.
  326. * IPPRET_AUTH - Authentication.
  327. *
  328. \***********************************************/
  329. typedef struct _IPPRET_ALL {
  330. DWORD cbSize; // Size of entire structure.
  331. DWORD dwLastError; // LastError.
  332. WORD wRsp; // Response Code.
  333. BOOL bRet; // Return Code.
  334. } IPPRET_ALL;
  335. typedef IPPRET_ALL *PIPPRET_ALL;
  336. typedef IPPRET_ALL *LPIPPRET_ALL;
  337. typedef IPPRET_ALL *PIPPRET_AUTH;
  338. typedef IPPRET_ALL *LPIPPRET_AUTH;
  339. typedef struct _IPPRET_JOB {
  340. DWORD cbSize; // Size of entire structure.
  341. DWORD dwLastError; // LastError for failed calls.
  342. WORD wRsp; // Response Code.
  343. BOOL bRet; // Return code for job calls.
  344. BOOL bValidate; // Is this only a validation request.
  345. IPPJI2 ji; // Job-Information.
  346. } IPPRET_JOB;
  347. typedef IPPRET_JOB *PIPPRET_JOB;
  348. typedef IPPRET_JOB *LPIPPRET_JOB;
  349. typedef struct _IPPRET_PRN {
  350. DWORD cbSize; // Size of entire structure.
  351. DWORD dwLastError; // LastError for failed calls.
  352. WORD wRsp; // Response Code.
  353. BOOL bRet; // Return code for printer calls.
  354. IPPPI2 pi; // Printer-Information.
  355. } IPPRET_PRN;
  356. typedef IPPRET_PRN *PIPPRET_PRN;
  357. typedef IPPRET_PRN *LPIPPRET_PRN;
  358. typedef struct _IPPRET_ENUJOB {
  359. DWORD cbSize; // Size of entire structure (including enum-data).
  360. DWORD dwLastError; // LastError for failed calls.
  361. WORD wRsp; // Response Code.
  362. BOOL bRet; // EnumJob/Get Return-Code.
  363. DWORD cItems; // Number of items in enum.
  364. DWORD cbItems; // Size of Enum Data.
  365. LPIPPJI2 pItems; //
  366. } IPPRET_ENUJOB;
  367. typedef IPPRET_ENUJOB *PIPPRET_ENUJOB;
  368. typedef IPPRET_ENUJOB *LPIPPRET_ENUJOB;
  369. /***********************************************\
  370. * IPP Request Structures
  371. *
  372. * IPPREQ_PRTJOB - Print-Job/Validate-Job.
  373. * IPPREQ_ENUJOB - Enum-Job.
  374. * IPPREQ_GETJOB - Get-Job.
  375. * IPPREQ_SETJOB - Set-Job.
  376. * IPPREQ_GETPRN - Get-Printer.
  377. * IPPREQ_SETPRN - Set-Printer.
  378. * IPPREQ_AUTH - Authentication.
  379. *
  380. \***********************************************/
  381. typedef struct _IPPREQ_ALL {
  382. DWORD cbSize; // Size of entire structure.
  383. } IPPREQ_ALL;
  384. typedef IPPREQ_ALL *PIPPREQ_ALL;
  385. typedef IPPREQ_ALL *LPIPPREQ_ALL;
  386. typedef IPPREQ_ALL IPPREQ_AUTH;
  387. typedef IPPREQ_ALL *PIPPREQ_AUTH;
  388. typedef IPPREQ_ALL *LPIPPREQ_AUTH;
  389. typedef struct _IPPREQ_PRTJOB {
  390. DWORD cbSize; // Size of entire structure.
  391. BOOL bValidate; // Indicates whether this is only a validation.
  392. LPTSTR pDocument; // Document name.
  393. LPTSTR pUserName; // Requesting User name.
  394. LPTSTR pPrnUri; // Printer Uri string.
  395. } IPPREQ_PRTJOB;
  396. typedef IPPREQ_PRTJOB *PIPPREQ_PRTJOB;
  397. typedef IPPREQ_PRTJOB *LPIPPREQ_PRTJOB;
  398. typedef struct _IPPREQ_SETJOB {
  399. DWORD cbSize; // Size of entire structure.
  400. DWORD dwCmd; // Job command.
  401. DWORD idJob; // Job ID.
  402. LPTSTR pPrnUri; // Job Uri.
  403. } IPPREQ_SETJOB;
  404. typedef IPPREQ_SETJOB *PIPPREQ_SETJOB;
  405. typedef IPPREQ_SETJOB *LPIPPREQ_SETJOB;
  406. typedef struct _IPPREQ_ENUJOB {
  407. DWORD cbSize;
  408. DWORD cJobs;
  409. LPTSTR pPrnUri;
  410. } IPPREQ_ENUJOB;
  411. typedef IPPREQ_ENUJOB *PIPPREQ_ENUJOB;
  412. typedef IPPREQ_ENUJOB *LPIPPREQ_ENUJOB;
  413. typedef struct _IPPREQ_GETPRN {
  414. DWORD cbSize;
  415. DWORD dwAttr;
  416. LPTSTR pPrnUri;
  417. } IPPREQ_GETPRN;
  418. typedef IPPREQ_GETPRN *PIPPREQ_GETPRN;
  419. typedef IPPREQ_GETPRN *LPIPPREQ_GETPRN;
  420. typedef struct _IPPREQ_GETJOB {
  421. DWORD cbSize;
  422. DWORD idJob;
  423. LPTSTR pPrnUri;
  424. } IPPREQ_GETJOB;
  425. typedef IPPREQ_GETJOB *PIPPREQ_GETJOB;
  426. typedef IPPREQ_GETJOB *LPIPPREQ_GETJOB;
  427. typedef struct _IPPREQ_SETPRN {
  428. DWORD cbSize;
  429. DWORD dwCmd;
  430. LPTSTR pUserName;
  431. LPTSTR pPrnUri;
  432. } IPPREQ_SETPRN;
  433. typedef IPPREQ_SETPRN *PIPPREQ_SETPRN;
  434. typedef IPPREQ_SETPRN *LPIPPREQ_SETPRN;
  435. /***********************************************\
  436. * IPP Attribute Structure.
  437. *
  438. \***********************************************/
  439. typedef struct _IPPATTR {
  440. BYTE bTag;
  441. WORD cbName;
  442. LPTSTR lpszName;
  443. WORD cbValue;
  444. LPVOID lpValue;
  445. } IPPATTR;
  446. typedef IPPATTR *PIPPATTR;
  447. typedef IPPATTR *LPIPPATTR;
  448. /***********************************************\
  449. * IPP Error-Mappings
  450. *
  451. \***********************************************/
  452. typedef struct _IPPERROR {
  453. WORD wRsp;
  454. DWORD dwLE;
  455. PCTSTR pszStr;
  456. } IPPERROR;
  457. typedef IPPERROR *PIPPERROR;
  458. typedef IPPERROR *LPIPPERROR;
  459. /***********************************************\
  460. * IPP Default-Error-Mappings
  461. *
  462. \***********************************************/
  463. typedef struct _IPPDEFERROR {
  464. DWORD dwLE;
  465. WORD wRsp;
  466. } IPPDEFERROR;
  467. typedef IPPDEFERROR *PIPPDEFERROR;
  468. typedef IPPDEFERROR *LPIPPDEFERROR;
  469. #define IPPFLG_VALID 1
  470. #define IPPFLG_CHARSET 2
  471. #define IPPFLG_NATLANG 4
  472. #define IPPFLG_USEFIDELITY 8
  473. /***********************************************\
  474. * IPP Object Structure.
  475. *
  476. \***********************************************/
  477. typedef struct _IPPOBJ {
  478. WORD wReq; // Open Request being processed.
  479. WORD wError; // Used to store ipp errors during receive processing.
  480. DWORD idReq; // Request Id.
  481. UINT uCPRcv; // Codepage translation for receiving IPP Streams.
  482. DWORD fState; //
  483. DWORD cbIppMax; // Maximum size of hdr-Buffer.
  484. DWORD cbIppHdr; // Current size of hdr-buffer data.
  485. LPBYTE lpIppHdr; // Buffer to contain IPP-Stream-Header.
  486. LPBYTE lpRawDta; // Aligned (temporary) data buffer.
  487. LPWEBLST pwlUns; // Unsupported attributes list.
  488. DWORD fReq[IPPOBJ_MASK_SIZE];
  489. } IPPOBJ;
  490. typedef IPPOBJ *PIPPOBJ;
  491. typedef IPPOBJ *LPIPPOBJ;
  492. /***********************************************\
  493. * Request Info
  494. *
  495. \***********************************************/
  496. typedef struct _REQINFO {
  497. DWORD idReq;
  498. UINT cpReq;
  499. PWEBLST pwlUns;
  500. BOOL bFidelity;
  501. DWORD fReq[IPPOBJ_MASK_SIZE];
  502. } REQINFO;
  503. typedef REQINFO *PREQINFO;
  504. typedef REQINFO *LPREQINFO;
  505. /***********************************************\
  506. * TypeDefs
  507. *
  508. \***********************************************/
  509. typedef DWORD (*PFNRET)(LPIPPOBJ lpObj, LPBYTE* lplpRawHdr, LPDWORD lpcbRawHdr);
  510. /***********************************************\
  511. * IPP Attribute Structre (X)
  512. *
  513. \***********************************************/
  514. typedef struct _IPPATTRX {
  515. BYTE bTag;
  516. DWORD fReq;
  517. int nVal;
  518. LPCTSTR pszNam;
  519. LPVOID pvVal;
  520. } IPPATTRX;
  521. typedef IPPATTRX *PIPPATTRX;
  522. typedef IPPATTRX *LPIPPATTRX;
  523. /***********************************************\
  524. * IPP Attribute Structre (Y)
  525. *
  526. \***********************************************/
  527. typedef struct _IPPATTRY {
  528. LPSTR pszNam;
  529. DWORD cbNam;
  530. LPSTR pszVal;
  531. DWORD cbVal;
  532. } IPPATTRY;
  533. typedef IPPATTRY *PIPPATTRY;
  534. typedef IPPATTRY *LPIPPATTRY;
  535. /***********************************************\
  536. * IPP Conversion Structure
  537. *
  538. \***********************************************/
  539. typedef struct _IPPSNDRCV {
  540. WORD wReq;
  541. PBYTE pbReqForm;
  542. PBYTE pbRspForm;
  543. LPIPPATTRX paReq;
  544. DWORD cbReq;
  545. LPIPPATTRX paRsp;
  546. DWORD cbRsp;
  547. PFNRET pfnRcvRet;
  548. } IPPSNDRCV;
  549. typedef IPPSNDRCV *PIPPSNDRCV;
  550. typedef IPPSNDRCV *LPIPPSNDRCV;
  551. /***********************************************\
  552. * Flag/String Structure.
  553. *
  554. \***********************************************/
  555. typedef struct _FLGSTR {
  556. DWORD fFlag;
  557. LPCTSTR pszStr;
  558. } FLGSTR;
  559. typedef FLGSTR *PFLGSTR;
  560. typedef FLGSTR *LPFLGSTR;
  561. /************************************************
  562. ** Definition of Allocator (for outside functions)
  563. ************************************************/
  564. typedef LPVOID (*ALLOCATORFN)(DWORD cb);
  565. /***********************************************\
  566. * WebIpp Object routines.
  567. *
  568. \***********************************************/
  569. DWORD WebIppSndData(
  570. WORD wReq,
  571. LPREQINFO lpri,
  572. LPBYTE lpDta,
  573. DWORD cbDta,
  574. LPBYTE* lpOut,
  575. LPDWORD lpcbOut);
  576. HANDLE WebIppRcvOpen(
  577. WORD);
  578. DWORD WebIppRcvData(
  579. HANDLE hIpp,
  580. LPBYTE lpData,
  581. DWORD cbData,
  582. LPBYTE *lplpHdr,
  583. LPDWORD lpdwHdr,
  584. LPBYTE *lplpDta,
  585. LPDWORD lpdwDta);
  586. BOOL WebIppRcvClose(
  587. HANDLE hIpp);
  588. WORD WebIppGetError(
  589. HANDLE hIpp);
  590. WORD WebIppLeToRsp(
  591. DWORD dwLastError);
  592. DWORD WebIppRspToLe(
  593. WORD wRsp);
  594. BOOL WebIppGetReqInfo(
  595. HANDLE hIpp,
  596. LPREQINFO lpri);
  597. BOOL WebIppFreeMem(
  598. LPVOID lpMem);
  599. LPIPPJI2 WebIppCvtJI2toIPPJI2(
  600. IN LPCTSTR lpszJobBase,
  601. IN OUT LPDWORD lpcbJobs,
  602. IN DWORD cJobs,
  603. IN LPJOB_INFO_2 lpJI2Src);
  604. LPJOB_INFO_2 WebIppPackJI2(
  605. IN LPJOB_INFO_2 lpji2,
  606. OUT LPDWORD lpcbSize,
  607. IN ALLOCATORFN pfnAlloc
  608. );
  609. /***********************************************\
  610. * Request Creation Routines
  611. *
  612. \***********************************************/
  613. PIPPREQ_PRTJOB WebIppCreatePrtJobReq(
  614. BOOL bValidate,
  615. LPCTSTR lpszUser,
  616. LPCTSTR lpszDoc,
  617. LPCTSTR lpszPrnUri);
  618. PIPPREQ_ENUJOB WebIppCreateEnuJobReq(
  619. DWORD cJobs,
  620. LPCTSTR lpszPrnUri);
  621. PIPPREQ_SETJOB WebIppCreateSetJobReq(
  622. DWORD idJob,
  623. DWORD dwCmd,
  624. LPCTSTR lpszPrnUri);
  625. PIPPREQ_GETJOB WebIppCreateGetJobReq(
  626. DWORD idJob,
  627. LPCTSTR lpszPrnUri);
  628. PIPPREQ_GETPRN WebIppCreateGetPrnReq(
  629. DWORD dwAttr,
  630. LPCTSTR lpszPrnUri);
  631. PIPPREQ_SETPRN WebIppCreateSetPrnReq(
  632. DWORD dwCmd,
  633. LPCTSTR lpszPrnName,
  634. LPCTSTR lpszPrnUri);
  635. PIPPREQ_AUTH WebIppCreateAuthReq(VOID);
  636. /***********************************************\
  637. * Response Creation Routines
  638. *
  639. \***********************************************/
  640. PIPPRET_JOB WebIppCreateJobRet(
  641. WORD wRsp,
  642. BOOL bRet,
  643. BOOL bValidate,
  644. LPJOB_INFO_2 lpji2,
  645. LPJOB_INFO_IPP lpipp);
  646. PIPPRET_PRN WebIppCreatePrnRet(
  647. WORD wRsp,
  648. BOOL bRet,
  649. LPPRINTER_INFO_2 lppi2,
  650. LPPRINTER_INFO_IPP lpipp);
  651. PIPPRET_ENUJOB WebIppCreateEnuJobRet(
  652. WORD wRsp,
  653. BOOL bRet,
  654. DWORD cbJobs,
  655. DWORD cJobs,
  656. LPIPPJI2 lpbJobs);
  657. PIPPRET_ALL WebIppCreateBadRet(
  658. WORD wRsp,
  659. BOOL bRet);
  660. PIPPRET_AUTH WebIppCreateAuthRet(
  661. WORD wRsp,
  662. BOOL bRet);
  663. BOOL WebIppConvertSystemTime(
  664. IN OUT LPSYSTEMTIME pSystemTime,
  665. IN time_t dwPrinterT0);
  666. #ifdef UNICODE
  667. #define WEB_IPP_ASSERT(Expr) ASSERT(Expr)
  668. #else
  669. #define WEB_IPP_ASSERT(Expr) // Need to figure out what to do here
  670. #endif
  671. #ifdef __cplusplus // Place this here to prevent decorating of symbols
  672. } // when doing C++ stuff.
  673. #endif //
  674. #endif