Team Fortress 2 Source Code as on 22/4/2020
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.

180 lines
8.0 KiB

  1. /*
  2. File: PMIOModule.h
  3. Contains: Mac OS X Printing Manager IO Module Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1999-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __CFSTRING__
  11. #include <CFString.h>
  12. #endif
  13. #ifndef __PMTICKET__
  14. #include <PMTicket.h>
  15. #endif
  16. #ifndef __PMPLUGINHEADER__
  17. #include <PMPluginHeader.h>
  18. #endif
  19. #ifndef __PMERRORS__
  20. #include <PMErrors.h>
  21. #endif
  22. /* context ID for IO Modules */
  23. #if PRAGMA_ONCE
  24. #pragma once
  25. #endif
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. #if PRAGMA_IMPORT
  30. #pragma import on
  31. #endif
  32. #if PRAGMA_STRUCT_ALIGN
  33. #pragma options align=mac68k
  34. #elif PRAGMA_STRUCT_PACKPUSH
  35. #pragma pack(push, 2)
  36. #elif PRAGMA_STRUCT_PACK
  37. #pragma pack(2)
  38. #endif
  39. typedef struct OpaqueIOMContext* IOMContext;
  40. /* kPMPrinterURI corresponds to a CFString to a connection-specific
  41. address specification for the printer. For instance, on an lpd connection
  42. this would be an address of the form lpd://<host>/<queue name>. */
  43. #define kPMPrinterURI CFSTR("Printer URI")
  44. /* System-supported connection type names used in identifying the different connection types
  45. and for requesting lookup information from Printer Modules. PrintCenter does not use these
  46. strings in its UI, instead it gets the actual UI strings from the Printer Browser Module. */
  47. #define kPMAppleTalkConnection CFSTR("AppleTalk")
  48. #define kPMUSBConnection CFSTR("USB")
  49. #define kPMLPRConnection CFSTR("LPR")
  50. #define kPMDirServicesConnection CFSTR("Directory Services")
  51. /* possible attributes that can be requested from an IO Module and allow clients to determine various
  52. characteristics about the IOM, its connection type, and the target printer. The same attribute can
  53. be used for getting a value or setting it. */
  54. #define kPMBiDiAttr CFSTR("Supports BiDirectional Communication")
  55. /* bi-directional communication capability */
  56. #define kPM8BitChannelAttr CFSTR("Supports 8-bit Channel")
  57. /* full 8-bit per byte data (vs. 7) */
  58. #define kPMTransparentByteRange CFSTR("Supports Transparent Byte Range")
  59. /* transparent byte range */
  60. #define kPMJobIDAttr CFSTR("Supports JobID")
  61. /* in-printer-jobID */
  62. #define kPMTimeoutAttr CFSTR("Supports Timeout")
  63. /* get/set timeout duration */
  64. #define kPMTStatusAttr CFSTR("Supports T Status Request")
  65. /* status on the T channel */
  66. /* Used with the IOMGetAttribute call, a supporting IO Module will hand back
  67. * a copy of a CFStringRef describing the last error encountered. If there was
  68. * no last error, or if there is no available string then NULL is passed back.
  69. */
  70. #define kPMLastErrorStrAttr CFSTR("Last Error")
  71. /* Type ID, interface ID for the IOM CFPlugin */
  72. #define kIOModuleTypeIDStr "EE5A5E5C-C2DD-11D3-84B5-00050209D9C1"
  73. #define kIOModuleIntfIDStr "F4F7510C-C2DD-11D3-93A5-00050209D9C1"
  74. /* IOM API version numbers (see PMPluginHeader.h for the meaning of these defintions) */
  75. enum {
  76. kIOMBuildVersionMajor = 1,
  77. kIOMBuildVersionMinor = 0,
  78. kIOMBaseVersionMajor = 1,
  79. kIOMBaseVersionMinor = 0
  80. };
  81. typedef CALLBACK_API_C( OSStatus , PMIOModuleGetConnectionInfoProc )(CFStringRef *connectionType, CFStringRef *pbmPath);
  82. typedef CALLBACK_API_C( OSStatus , PMIOModuleInitializeProc )(CFDataRef printerAddress, IOMContext *ioModuleContextPtr);
  83. typedef CALLBACK_API_C( OSStatus , PMIOModuleOpenProc )(IOMContext ioModuleContext, PMTicketRef jobTicket, UInt32 *bufferSize);
  84. typedef CALLBACK_API_C( OSStatus , PMIOModuleReadProc )(IOMContext ioModuleContext, Ptr buffer, UInt32 *size, Boolean *eoj);
  85. typedef CALLBACK_API_C( OSStatus , PMIOModuleWriteProc )(IOMContext ioModuleContext, Ptr buffer, UInt32 *size, Boolean eoj);
  86. typedef CALLBACK_API_C( OSStatus , PMIOModuleStatusProc )(IOMContext ioModuleContext, CFStringRef *status);
  87. typedef CALLBACK_API_C( OSStatus , PMIOModuleGetAttributeProc )(IOMContext ioModuleContext, CFStringRef attribute, CFTypeRef *result);
  88. typedef CALLBACK_API_C( OSStatus , PMIOModuleSetAttributeProc )(IOMContext ioModuleContext, CFStringRef attribute, CFTypeRef data);
  89. typedef CALLBACK_API_C( OSStatus , PMIOModuleCloseProc )(IOMContext ioModuleContext, Boolean abort);
  90. typedef CALLBACK_API_C( OSStatus , PMIOModuleTerminateProc )(IOMContext * ioModuleContextPtr);
  91. /* IOMProcs contains the routines required to be exported by an IOM Module. */
  92. struct IOMProcs {
  93. /* The plugin header is required with all plugins and must proceed object's layout.*/
  94. PMPlugInHeader pluginHeader;
  95. /* The actual IO Module routine Procs*/
  96. /* GetConnectionInfo: returns the connection type and the path to the companion browser module relative */
  97. /* to /Library/Printers/. The connection types: AppleTalk, USB, LPR, and Directory Services are reserved by Apple.*/
  98. PMIOModuleGetConnectionInfoProc GetConnectionInfo;
  99. /* Initialize: creates a context to store local variables during an IO session. printerAddress of*/
  100. /* the target printer is passed as CFDataRef as defined by the protocol and set by the Printer Browser Module*/
  101. PMIOModuleInitializeProc Initialize;
  102. /* Open: open IO connection with the target device. The parameter buffSize is set*/
  103. /* by the IOM to return its maximum write buffer size.*/
  104. PMIOModuleOpenProc Open;
  105. /* Read: read data from the device over the read channel, if any. */
  106. PMIOModuleReadProc Read;
  107. /* Write: write data to the device*/
  108. PMIOModuleWriteProc Write;
  109. /* Status: get status from the device*/
  110. PMIOModuleStatusProc Status;
  111. /* GetAttribute: checks if a defined IO attribute is supported by the target IO connection. If the requested */
  112. /* 'attribute' is supported and available, it's returned in 'result'. If supported but not available, error code */
  113. /* kAttrNotAvailable is returned. If the attribute is not supported, kPMNotImplemented is returned.*/
  114. PMIOModuleGetAttributeProc GetAttribute;
  115. /* SetAttribute: sets a pre-defined 'attribute' to a given value passed in 'data'. Only supported attributes*/
  116. /* can be set; otherwise kAttrNotAvailable or kPMNotImplemented is returned.*/
  117. PMIOModuleSetAttributeProc SetAttribute;
  118. /* Close: close IO connection with the target device. The parameter 'abort' indicates whether the current job*/
  119. /* is to be canceled before closing connection (true; i.e. user cancels) or not (false; i.e. normal job completion).*/
  120. PMIOModuleCloseProc Close;
  121. /* Terminate: dispose of any data allocated in Initialize.*/
  122. PMIOModuleTerminateProc Terminate;
  123. };
  124. typedef struct IOMProcs IOMProcs;
  125. /* IOM interface is an object containing addresses to the module's entry points:*/
  126. struct IOMInterface {
  127. const IOMProcs * vtable;
  128. };
  129. typedef struct IOMInterface IOMInterface;
  130. typedef const IOMInterface * IOMInterfaceRef;
  131. #if PRAGMA_STRUCT_ALIGN
  132. #pragma options align=reset
  133. #elif PRAGMA_STRUCT_PACKPUSH
  134. #pragma pack(pop)
  135. #elif PRAGMA_STRUCT_PACK
  136. #pragma pack()
  137. #endif
  138. #ifdef PRAGMA_IMPORT_OFF
  139. #pragma import off
  140. #elif PRAGMA_IMPORT
  141. #pragma import reset
  142. #endif
  143. #ifdef __cplusplus
  144. }
  145. #endif