OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview Interface for representing a low-level gnubby device. |
| 7 */ |
| 8 'use strict'; |
| 9 |
| 10 /** |
| 11 * Low level gnubby 'driver'. One per physical USB device. |
| 12 * @interface |
| 13 */ |
| 14 function llGnubby() {} |
| 15 |
| 16 // Commands of the USB interface. |
| 17 // //depot/google3/security/tools/gnubby/gnubbyd/gnubby_if.h |
| 18 llGnubby.CMD_PING = 0x81; |
| 19 llGnubby.CMD_ATR = 0x82; |
| 20 llGnubby.CMD_APDU = 0x83; |
| 21 llGnubby.CMD_LOCK = 0x84; |
| 22 llGnubby.CMD_SYSINFO = 0x85; |
| 23 llGnubby.CMD_PROMPT = 0x87; |
| 24 llGnubby.CMD_WINK = 0x88; |
| 25 llGnubby.CMD_USB_TEST = 0xb9; |
| 26 llGnubby.CMD_DFU = 0xba; |
| 27 llGnubby.CMD_SYNC = 0xbc; |
| 28 llGnubby.CMD_ERROR = 0xbf; |
| 29 |
| 30 // Low-level error codes. |
| 31 // //depot/google3/security/tools/gnubby/gnubbyd/gnubby_if.h |
| 32 // //depot/google3/security/tools/gnubby/client/gnubby_error_codes.h |
| 33 llGnubby.OK = 0; |
| 34 llGnubby.INVALID_CMD = 1; |
| 35 llGnubby.INVALID_PAR = 2; |
| 36 llGnubby.INVALID_LEN = 3; |
| 37 llGnubby.INVALID_SEQ = 4; |
| 38 llGnubby.TIMEOUT = 5; |
| 39 llGnubby.BUSY = 6; |
| 40 llGnubby.ACCESS_DENIED = 7; |
| 41 llGnubby.GONE = 8; |
| 42 llGnubby.VERIFY_ERROR = 9; |
| 43 llGnubby.LOCK_REQUIRED = 10; |
| 44 llGnubby.SYNC_FAIL = 11; |
| 45 llGnubby.OTHER = 127; |
| 46 |
| 47 // Remote helper errors. |
| 48 llGnubby.NOTREMOTE = 263; |
| 49 llGnubby.COULDNOTDIAL = 264; |
| 50 |
| 51 // chrome.usb-related errors. |
| 52 llGnubby.NODEVICE = 512; |
| 53 llGnubby.NOPERMISSION = 666; |
| 54 |
| 55 /** Destroys this low-level device instance. */ |
| 56 llGnubby.prototype.destroy = function() {}; |
| 57 |
| 58 /** |
| 59 * Register a client for this gnubby. |
| 60 * @param {*} who The client. |
| 61 */ |
| 62 llGnubby.prototype.registerClient = function(who) {}; |
| 63 |
| 64 /** |
| 65 * De-register a client. |
| 66 * @param {*} who The client. |
| 67 * @return {number} The number of remaining listeners for this device, or -1 |
| 68 * if this had no clients to start with. |
| 69 */ |
| 70 llGnubby.prototype.deregisterClient = function(who) {}; |
| 71 |
| 72 /** |
| 73 * @param {*} who The client. |
| 74 * @return {boolean} Whether this device has who as a client. |
| 75 */ |
| 76 llGnubby.prototype.hasClient = function(who) {}; |
| 77 |
| 78 /** |
| 79 * Queue command to be sent. |
| 80 * If queue was empty, initiate the write. |
| 81 * @param {number} cid The client's channel ID. |
| 82 * @param {number} cmd The command to send. |
| 83 * @param {ArrayBuffer} data |
| 84 */ |
| 85 llGnubby.prototype.queueCommand = function(cid, cmd, data) {}; |
OLD | NEW |