doc.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. // BSD 3-Clause License
  2. //
  3. // Copyright (c) 2019, Guillaume Ballet
  4. // All rights reserved.
  5. //
  6. // Redistribution and use in source and binary forms, with or without
  7. // modification, are permitted provided that the following conditions are met:
  8. //
  9. // * Redistributions of source code must retain the above copyright notice, this
  10. // list of conditions and the following disclaimer.
  11. //
  12. // * Redistributions in binary form must reproduce the above copyright notice,
  13. // this list of conditions and the following disclaimer in the documentation
  14. // and/or other materials provided with the distribution.
  15. //
  16. // * Neither the name of the copyright holder nor the names of its
  17. // contributors may be used to endorse or promote products derived from
  18. // this software without specific prior written permission.
  19. //
  20. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23. // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  24. // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  26. // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  27. // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. package pcsc
  31. const (
  32. SCardSuccess = 0x00000000 /* No error was encountered. */
  33. AutoAllocate = -1 /* see SCardFreeMemory() */
  34. ScopeUser = 0x0000 /* Scope in user space */
  35. ScopeTerminal = 0x0001 /* Scope in terminal */
  36. ScopeSystem = 0x0002 /* Scope in system */
  37. ScopeGlobal = 0x0003 /* Scope is global */
  38. ProtocolUndefined = 0x0000 /* protocol not set */
  39. ProtocolUnSet = ProtocolUndefined /* backward compat */
  40. ProtocolT0 = 0x0001 /* T=0 active protocol. */
  41. ProtocolT1 = 0x0002 /* T=1 active protocol. */
  42. ProtocolRaw = 0x0004 /* Raw active protocol. */
  43. ProtocolT15 = 0x0008 /* T=15 protocol. */
  44. ProtocolAny = (ProtocolT0 | ProtocolT1) /* IFD determines prot. */
  45. ShareExclusive = 0x0001 /* Exclusive mode only */
  46. ShareShared = 0x0002 /* Shared mode only */
  47. ShareDirect = 0x0003 /* Raw mode only */
  48. LeaveCard = 0x0000 /* Do nothing on close */
  49. ResetCard = 0x0001 /* Reset on close */
  50. UnpowerCard = 0x0002 /* Power down on close */
  51. EjectCard = 0x0003 /* Eject on close */
  52. SCardUnknown = 0x0001 /* Unknown state */
  53. SCardAbsent = 0x0002 /* Card is absent */
  54. SCardPresent = 0x0004 /* Card is present */
  55. SCardSwallowed = 0x0008 /* Card not powered */
  56. SCardPowever = 0x0010 /* Card is powered */
  57. SCardNegotiable = 0x0020 /* Ready for PTS */
  58. SCardSpecific = 0x0040 /* PTS has been set */
  59. PCSCDSockName = "/run/pcscd/pcscd.comm"
  60. )
  61. // List of commands to send to the daemon
  62. const (
  63. _ = iota
  64. SCardEstablishContext /* used by SCardEstablishContext() */
  65. SCardReleaseContext /* used by SCardReleaseContext() */
  66. SCardListReaders /* used by SCardListReaders() */
  67. SCardConnect /* used by SCardConnect() */
  68. SCardReConnect /* used by SCardReconnect() */
  69. SCardDisConnect /* used by SCardDisconnect() */
  70. SCardBeginTransaction /* used by SCardBeginTransaction() */
  71. SCardEndTransaction /* used by SCardEndTransaction() */
  72. SCardTransmit /* used by SCardTransmit() */
  73. SCardControl /* used by SCardControl() */
  74. SCardStatus /* used by SCardStatus() */
  75. SCardGetStatusChange /* not used */
  76. SCardCancel /* used by SCardCancel() */
  77. SCardCancelTransaction /* not used */
  78. SCardGetAttrib /* used by SCardGetAttrib() */
  79. SCardSetAttrib /* used by SCardSetAttrib() */
  80. CommandVersion /* get the client/server protocol version */
  81. CommandGetReaderState /* get the readers state */
  82. CommandWaitReaderStateChange /* wait for a reader state change */
  83. CommandStopWaitingReaderStateChange /* stop waiting for a reader state change */
  84. )
  85. // Protocol information
  86. const (
  87. ProtocolVersionMajor = 4 /* IPC major */
  88. ProtocolVersionMinor = 3 /* IPC minor */
  89. )