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.

100 lines
3.7 KiB

  1. //-------------------------------------------------------------------
  2. // This is abstract class for Reader Interface
  3. // Specific interfaces should use it as a parent device
  4. // Author: Sergey Ivanov
  5. // Log:
  6. // 11/09/99 - implemented
  7. //-------------------------------------------------------------------
  8. #ifndef __READER_INTERFACE__
  9. #define __READER_INTERFACE__
  10. #include "generic.h"
  11. #include "kernel.h"
  12. #include "rdrconfig.h"
  13. #define READER_INTERFACE_GEMCORE 1
  14. #define READER_INTERFACE_OROS 2
  15. #define READER_INTERFACE_USB 3
  16. #define READER_INTERFACE_GPR 4
  17. #define READER_MODE_NATIVE 1
  18. #define READER_MODE_ROS 2
  19. #define READER_MODE_TLP 3
  20. #define INTERFACE_OUTPUT_BUFFER_SIZE 0x1000
  21. #define INTERFACE_INPUT_BUFFER_SIZE 0x1000
  22. #define VERSION_STRING_MAX_LENGTH 16
  23. class CProtocol;
  24. class CDebug;
  25. class CMemory;
  26. class CIoPacket;
  27. #pragma PAGEDCODE
  28. class CReaderInterface
  29. {
  30. public:
  31. NTSTATUS m_Status;
  32. SAFE_DESTRUCTORS();
  33. virtual VOID dispose(){self_delete();};
  34. protected:
  35. // Internal buffers to manage Xfers...
  36. ULONG OutputBufferLength;
  37. PUCHAR pOutputBuffer;
  38. ULONG InputBufferLength;
  39. PUCHAR pInputBuffer;
  40. CDebug* debug;
  41. CProtocol* protocol;
  42. CMemory* memory;
  43. BOOL Initialized;
  44. UCHAR Version[VERSION_STRING_MAX_LENGTH];
  45. ULONG Mode;
  46. protected:
  47. CReaderInterface();
  48. virtual ~CReaderInterface();
  49. public:
  50. CReaderInterface(CProtocol* protocol);
  51. virtual ReaderConfig getConfiguration()
  52. {ReaderConfig c;
  53. c.Type = 0;
  54. c.PresenceDetection = 0;
  55. c.Vpp = 0;
  56. c.Voltage = 0;
  57. c.PTSMode = 0;
  58. c.PTS0 = 0;
  59. c.PTS1 = 0;
  60. c.PTS2 = 0;
  61. c.PTS3 = 0;
  62. c.ActiveProtocol = 0;
  63. c.PowerTimeOut = 0;
  64. return c;
  65. };
  66. virtual NTSTATUS setConfiguration(ReaderConfig configuration) {return STATUS_SUCCESS;};
  67. virtual NTSTATUS setTransparentConfig(PSCARD_CARD_CAPABILITIES cardCapabilities, BYTE NewWtx) {return STATUS_SUCCESS;};
  68. virtual NTSTATUS getReaderVersion(PUCHAR pVersion, PULONG pLength) {return STATUS_SUCCESS;};
  69. virtual ULONG getReaderState() {return 0;};
  70. virtual NTSTATUS setReaderMode(ULONG mode) {return STATUS_SUCCESS;};
  71. virtual BOOL isInitialized(){return Initialized;};
  72. virtual NTSTATUS initialize() {return STATUS_SUCCESS;};
  73. // Pure virtual functions will be implemented by specific interfaces (expl: CGemCore)...
  74. virtual NTSTATUS read(CIoPacket* Irp) {return STATUS_SUCCESS;};
  75. virtual NTSTATUS write(CIoPacket* Irp) {return STATUS_SUCCESS;};
  76. virtual NTSTATUS readAndWait(PUCHAR pRequest,ULONG RequestLength,PUCHAR pReply,ULONG* pReplyLength) {return STATUS_SUCCESS;};
  77. virtual NTSTATUS writeAndWait(PUCHAR pRequest,ULONG RequestLength,PUCHAR pReply,ULONG* pReplyLength) {return STATUS_SUCCESS;};
  78. virtual NTSTATUS ioctl(ULONG ControlCode,PUCHAR pRequest,ULONG RequestLength,PUCHAR pReply,ULONG* pReplyLength) {return STATUS_SUCCESS;};
  79. virtual NTSTATUS SwitchSpeed(ULONG ControlCode,PUCHAR pRequest,ULONG RequestLength,PUCHAR pReply,ULONG* pReplyLength) {return STATUS_SUCCESS;};
  80. virtual NTSTATUS VendorAttribute(ULONG ControlCode,PUCHAR pRequest,ULONG RequestLength,PUCHAR pReply,ULONG* pReplyLength) {return STATUS_SUCCESS;};
  81. virtual NTSTATUS power(ULONG ControlCode,PUCHAR pReply,ULONG* pReplyLength, BOOLEAN Specific) {return STATUS_SUCCESS;};
  82. virtual NTSTATUS setProtocol(ULONG ProtocolRequested) {return STATUS_SUCCESS;};
  83. virtual NTSTATUS translate_request(BYTE * pRequest,ULONG RequestLength,BYTE * pReply,ULONG* pReplyLength, PSCARD_CARD_CAPABILITIES cardCapabilities, BYTE NewWtx) {return STATUS_SUCCESS;};
  84. virtual NTSTATUS translate_response(BYTE * pRequest,ULONG RequestLength,BYTE * pReply,ULONG* pReplyLength) {return STATUS_SUCCESS;};
  85. virtual VOID cancel() {};
  86. };
  87. #endif