| // Copyright 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // Defines constants, etc. to be used with the |kIoctlTerminal| ioctl. |
| // |
| // TODO(vtl): Add constants for indices? |
| |
| [DartPackage="mojo_services"] |
| module mojo.files; |
| |
| // For: |
| // Ioctl(kIoctlTerminal, array<uint32>? in_values) |
| // => (Error error, array<uint32>? out_values); |
| // |
| // A file that is *not* terminal-like should always respond with error |
| // |UNIMPLEMENTED| (|out_values| is then undefined). The following applies to |
| // files that *are* terminal-like. |
| // |
| // If |in_values| is null or empty, the response should be |OK| (|out_values| is |
| // undefined). Thus |Ioctl(kIoctlTerminal, null)| can be used as a test for "is |
| // a terminal". |
| // |
| // Otherwise, |in_values[0]| should be one of "subrequest" values described |
| // below. (Subrequest values unknown to the implementation should be responded |
| // to with error |UNIMPLEMENTED|.) |
| // |
| // Unless otherwise specified, nothing in |in_values| is required. Unless |
| // otherwise specified, the presence of extra values beyond those specified (if |
| // any) should result in error |INVALID_ARGUMENT|. In contrast, extra values in |
| // |out_values| beyond those specified should be ignored. |
| |
| // Invalid subrequest. The response should error |UNIMPLEMENTED|. |
| const uint32 kIoctlTerminalInvalid = 0; |
| |
| // Get terminal ("termios") settings subrequest. On |OK|: |
| // * |out_values[0]| is "iflag" (input mode flags); |
| // * |out_values[1]| is "oflag" (output mode flags); |
| // * |out_values[2]| is "cflag" (control mode flags); |
| // * |out_values[3]| is "lflag" (local mode flags); |
| // * |out_values[4]| is "ispeed" (input speed; 0 if unavailable); |
| // * |out_values[5]| is "ospeed" (output speed; 1 if unavailable); |
| // * |out_values[6..]| are "cc" (control/special characters -- there may be |
| // any number of these). |
| // Constants for the flags, etc. are defined further below. |
| const uint32 kIoctlTerminalGetSettings = 1; |
| |
| // Set terminal ("termios") settings subrequest. |in_values[1..6]| should be |
| // like |out_values[0..5]| for |kIoctlTerminalGetSettings|, and |in_values[7..]| |
| // should be like |out_values[6..]| (any missing "cc" values are left |
| // untouched and unknown/extra "cc" values are ignored). |
| const uint32 kIoctlTerminalSetSettings = 2; |
| |
| // Get terminal "window" size subrequest. |out_values[0..1]| should be the |
| // number of rows and columns, respectively. This may also result in error |
| // |UNAVAILABLE| (and no |out_values|), if the size is not available for |
| // whatever reason. |
| // TODO(vtl): This is unlike the Linux/POSIX ioctl, I think, which will just use |
| // a previous/default value. |
| const uint32 kIoctlTerminalGetWindowSize = 3; |
| |
| // Set terminal "window" size subrequest. |in_values[1..2]| should be the |
| // requested number of rows and and columns, respectively. If the error is |OK| |
| // or |OUT_OF_RANGE|, |out_values[0..1]| should be the actual set number of rows |
| // and columns (if |OK| these should be the same as the requested values; on |
| // other errors, |out_values| is undefined). |
| const uint32 kIoctlTerminalSetWindowSize = 4; |
| |
| // Constants for "termios" fields ---------------------------------------------- |
| // no-format |
| |
| // Number of base/nonoptional fields: |
| const uint32 kIoctlTerminalTermiosBaseFieldCount = 6; |
| |
| // Indices for the base fields: |
| const uint32 kIoctlTerminalTermiosIFlagIndex = 0; |
| const uint32 kIoctlTerminalTermiosOFlagIndex = 1; |
| const uint32 kIoctlTerminalTermiosCFlagIndex = 2; |
| const uint32 kIoctlTerminalTermiosLFlagIndex = 3; |
| const uint32 kIoctlTerminalTermiosISpeedIndex = 4; |
| const uint32 kIoctlTerminalTermiosOSpeedIndex = 5; |
| |
| // Current number of "cc" fields: |
| const uint32 kIoctlTerminalTermiosCtrlCharCount = 17; |
| |
| // "cc" field indices: |
| // Note: Not all of these may be available. |
| const uint32 kIoctlTerminalTermiosCtrlCharVINTRIndex = 17; |
| const uint32 kIoctlTerminalTermiosCtrlCharVQUITIndex = 18; |
| const uint32 kIoctlTerminalTermiosCtrlCharVERASEIndex = 19; |
| const uint32 kIoctlTerminalTermiosCtrlCharVKILLIndex = 20; |
| const uint32 kIoctlTerminalTermiosCtrlCharVEOFIndex = 21; |
| const uint32 kIoctlTerminalTermiosCtrlCharVTIMEIndex = 22; |
| const uint32 kIoctlTerminalTermiosCtrlCharVMINIndex = 23; |
| const uint32 kIoctlTerminalTermiosCtrlCharVSWTCIndex = 24; |
| const uint32 kIoctlTerminalTermiosCtrlCharVSTARTIndex = 25; |
| const uint32 kIoctlTerminalTermiosCtrlCharVSTOPIndex = 26; |
| const uint32 kIoctlTerminalTermiosCtrlCharVSUSPIndex = 27; |
| const uint32 kIoctlTerminalTermiosCtrlCharVEOLIndex = 28; |
| const uint32 kIoctlTerminalTermiosCtrlCharVREPRINTIndex = 29; |
| const uint32 kIoctlTerminalTermiosCtrlCharVDISCARDIndex = 30; |
| const uint32 kIoctlTerminalTermiosCtrlCharVWERASEIndex = 31; |
| const uint32 kIoctlTerminalTermiosCtrlCharVLNEXTIndex = 32; |
| const uint32 kIoctlTerminalTermiosCtrlCharVEOL2Index = 33; |
| |
| // "iflag" flag values: |
| const uint32 kIoctlTerminalTermiosIFlagIGNBRK = 0x0001; |
| const uint32 kIoctlTerminalTermiosIFlagBRKINT = 0x0002; |
| const uint32 kIoctlTerminalTermiosIFlagIGNPAR = 0x0004; |
| const uint32 kIoctlTerminalTermiosIFlagPARMRK = 0x0008; |
| const uint32 kIoctlTerminalTermiosIFlagINPCK = 0x0010; |
| const uint32 kIoctlTerminalTermiosIFlagISTRIP = 0x0020; |
| const uint32 kIoctlTerminalTermiosIFlagINLCR = 0x0040; |
| const uint32 kIoctlTerminalTermiosIFlagIGNCR = 0x0080; |
| const uint32 kIoctlTerminalTermiosIFlagICRNL = 0x0100; |
| const uint32 kIoctlTerminalTermiosIFlagIUCLC = 0x0200; |
| const uint32 kIoctlTerminalTermiosIFlagIXON = 0x0400; |
| const uint32 kIoctlTerminalTermiosIFlagIXANY = 0x0800; |
| const uint32 kIoctlTerminalTermiosIFlagIXOFF = 0x1000; |
| const uint32 kIoctlTerminalTermiosIFlagIMAXBEL = 0x2000; |
| const uint32 kIoctlTerminalTermiosIFlagIUTF8 = 0x4000; |
| |
| // "oflag" flag values: |
| const uint32 kIoctlTerminalTermiosOFlagOPOST = 0x0001; |
| const uint32 kIoctlTerminalTermiosOFlagOLCUC = 0x0002; |
| const uint32 kIoctlTerminalTermiosOFlagONLCR = 0x0004; |
| const uint32 kIoctlTerminalTermiosOFlagOCRNL = 0x0008; |
| const uint32 kIoctlTerminalTermiosOFlagONOCR = 0x0010; |
| const uint32 kIoctlTerminalTermiosOFlagONLRET = 0x0020; |
| const uint32 kIoctlTerminalTermiosOFlagOFILL = 0x0040; |
| const uint32 kIoctlTerminalTermiosOFlagOFDEL = 0x0080; |
| |
| const uint32 kIoctlTerminalTermiosOFlagNLDLY = 0x0100; // Mask. |
| const uint32 kIoctlTerminalTermiosOFlagNL0 = 0x0000; |
| const uint32 kIoctlTerminalTermiosOFlagNL1 = 0x0100; |
| |
| const uint32 kIoctlTerminalTermiosOFlagCRDLY = 0x0600; // Mask. |
| const uint32 kIoctlTerminalTermiosOFlagCR0 = 0x0000; |
| const uint32 kIoctlTerminalTermiosOFlagCR1 = 0x0200; |
| const uint32 kIoctlTerminalTermiosOFlagCR2 = 0x0400; |
| const uint32 kIoctlTerminalTermiosOFlagCR3 = 0x0600; |
| |
| const uint32 kIoctlTerminalTermiosOFlagTABDLY = 0x1800; // Mask. |
| const uint32 kIoctlTerminalTermiosOFlagTAB0 = 0x0000; |
| const uint32 kIoctlTerminalTermiosOFlagTAB1 = 0x0800; |
| const uint32 kIoctlTerminalTermiosOFlagTAB2 = 0x1000; |
| const uint32 kIoctlTerminalTermiosOFlagTAB3 = 0x1800; |
| |
| const uint32 kIoctlTerminalTermiosOFlagBSDLY = 0x2000; // Mask. |
| const uint32 kIoctlTerminalTermiosOFlagBS0 = 0x0000; |
| const uint32 kIoctlTerminalTermiosOFlagBS1 = 0x2000; |
| |
| const uint32 kIoctlTerminalTermiosOFlagVTDLY = 0x4000; // Mask. |
| const uint32 kIoctlTerminalTermiosOFlagVT0 = 0x0000; |
| const uint32 kIoctlTerminalTermiosOFlagVT1 = 0x4000; |
| |
| const uint32 kIoctlTerminalTermiosOFlagFFDLY = 0x8000; // Mask. |
| const uint32 kIoctlTerminalTermiosOFlagFF0 = 0x0000; |
| const uint32 kIoctlTerminalTermiosOFlagFF1 = 0x8000; |
| |
| // "cflag" flag values: |
| // Note: We don't have "CBAUD" in our "cflag". |
| const uint32 kIoctlTerminalTermiosCFlagCSIZE = 0x0003; // Mask. |
| const uint32 kIoctlTerminalTermiosCFlagCS5 = 0x0000; |
| const uint32 kIoctlTerminalTermiosCFlagCS6 = 0x0001; |
| const uint32 kIoctlTerminalTermiosCFlagCS7 = 0x0002; |
| const uint32 kIoctlTerminalTermiosCFlagCS8 = 0x0003; |
| |
| const uint32 kIoctlTerminalTermiosCFlagCSTOPB = 0x0004; |
| const uint32 kIoctlTerminalTermiosCFlagCREAD = 0x0008; |
| const uint32 kIoctlTerminalTermiosCFlagPARENB = 0x0010; |
| const uint32 kIoctlTerminalTermiosCFlagPARODD = 0x0020; |
| const uint32 kIoctlTerminalTermiosCFlagHUPCL = 0x0040; |
| const uint32 kIoctlTerminalTermiosCFlagCLOCAL = 0x0080; |
| |
| // "lflag" flag values: |
| const uint32 kIoctlTerminalTermiosLFlagISIG = 0x0001; |
| const uint32 kIoctlTerminalTermiosLFlagICANON = 0x0002; |
| const uint32 kIoctlTerminalTermiosLFlagXCASE = 0x0004; |
| const uint32 kIoctlTerminalTermiosLFlagECHO = 0x0008; |
| const uint32 kIoctlTerminalTermiosLFlagECHOE = 0x0010; |
| const uint32 kIoctlTerminalTermiosLFlagECHOK = 0x0020; |
| const uint32 kIoctlTerminalTermiosLFlagECHONL = 0x0040; |
| const uint32 kIoctlTerminalTermiosLFlagNOFLSH = 0x0080; |
| const uint32 kIoctlTerminalTermiosLFlagTOSTOP = 0x0100; |
| |
| // end-no-format |