OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 // Defines constants, etc. to be used with the |kIoctlTerminal| ioctl. | |
6 // | |
7 // TODO(vtl): Add constants for indices? | |
8 | |
9 [DartPackage="mojo_services"] | |
10 module mojo.files; | |
11 | |
12 // For: | |
13 // Ioctl(kIoctlTerminal, array<uint32>? in_values) | |
14 // => (Error error, array<uint32>? out_values); | |
15 // | |
16 // A file that is *not* terminal-like should always respond with error | |
17 // |UNIMPLEMENTED| (|out_values| is then undefined). The following applies to | |
18 // files that *are* terminal-like. | |
19 // | |
20 // If |in_values| is null or empty, the response should be |OK| (|out_values| is | |
21 // undefined). Thus |Ioctl(kIoctlTerminal, null)| can be used as a test for "is | |
22 // a terminal". | |
23 // | |
24 // Otherwise, |in_values[0]| should be one of "subrequest" values described | |
25 // below. (Subrequest values unknown to the implementation should be responded | |
26 // to with error |UNIMPLEMENTED|.) | |
27 // | |
28 // Unless otherwise specified, nothing in |in_values| is required. Unless | |
29 // otherwise specified, the presence of extra values beyond those specified (if | |
30 // any) should result in error |INVALID_ARGUMENT|. In contrast, extra values in | |
31 // |out_values| beyond those specified should be ignored. | |
32 | |
33 // Invalid subrequest. The response should error |UNIMPLEMENTED|. | |
34 const uint32 kIoctlTerminalInvalid = 0; | |
35 | |
36 // Get terminal ("termios") settings subrequest. On |OK|: | |
37 // * |out_values[0]| is "iflag" (input mode flags); | |
38 // * |out_values[1]| is "oflag" (output mode flags); | |
39 // * |out_values[2]| is "cflag" (control mode flags); | |
40 // * |out_values[3]| is "lflag" (local mode flags); | |
41 // * |out_values[4]| is "ispeed" (input speed; 0 if unavailable); | |
42 // * |out_values[5]| is "ospeed" (output speed; 1 if unavailable); | |
43 // * |out_values[6..]| are "cc" (control/special characters -- there may be | |
44 // any number of these). | |
45 // Constants for the flags, etc. are defined further below. | |
46 const uint32 kIoctlTerminalGetSettings = 1; | |
47 | |
48 // Set terminal ("termios") settings subrequest. |in_values[1..6]| should be | |
49 // like |out_values[0..5]| for |kIoctlTerminalGetSettings|, and |in_values[7..]| | |
50 // should be like |out_values[6..]| (any missing "cc" values are left | |
51 // untouched and unknown/extra "cc" values are ignored). | |
52 const uint32 kIoctlTerminalSetSettings = 2; | |
53 | |
54 // Get terminal "window" size subrequest. |out_values[0..1]| should be the | |
55 // number of rows and columns, respectively. This may also result in error | |
56 // |UNAVAILABLE| (and no |out_values|), if the size is not available for | |
57 // whatever reason. | |
58 // TODO(vtl): This is unlike the Linux/POSIX ioctl, I think, which will just use | |
59 // a previous/default value. | |
60 const uint32 kIoctlTerminalGetWindowSize = 3; | |
61 | |
62 // Set terminal "window" size subrequest. |in_values[1..2]| should be the | |
63 // requested number of rows and and columns, respectively. If the error is |OK| | |
64 // or |OUT_OF_RANGE|, |out_values[0..1]| should be the actual set number of rows | |
65 // and columns (if |OK| these should be the same as the requested values; on | |
66 // other errors, |out_values| is undefined). | |
67 const uint32 kIoctlTerminalSetWindowSize = 4; | |
68 | |
69 // Constants for "termios" fields ---------------------------------------------- | |
70 | |
71 // Number of base/nonoptional fields: | |
72 const uint32 kIoctlTerminalTermiosBaseFieldCount = 6; | |
73 | |
74 // Indices for the base fields: | |
75 const uint32 kIoctlTerminalTermiosIFlagIndex = 0; | |
76 const uint32 kIoctlTerminalTermiosOFlagIndex = 1; | |
77 const uint32 kIoctlTerminalTermiosCFlagIndex = 2; | |
78 const uint32 kIoctlTerminalTermiosLFlagIndex = 3; | |
79 const uint32 kIoctlTerminalTermiosISpeedIndex = 4; | |
80 const uint32 kIoctlTerminalTermiosOSpeedIndex = 5; | |
81 | |
82 // Current number of "cc" fields: | |
83 const uint32 kIoctlTerminalTermiosCtrlCharCount = 17; | |
84 | |
85 // "cc" field indices: | |
86 // Note: Not all of these may be available. | |
87 const uint32 kIoctlTerminalTermiosCtrlCharVINTRIndex = 17; | |
88 const uint32 kIoctlTerminalTermiosCtrlCharVQUITIndex = 18; | |
89 const uint32 kIoctlTerminalTermiosCtrlCharVERASEIndex = 19; | |
90 const uint32 kIoctlTerminalTermiosCtrlCharVKILLIndex = 20; | |
91 const uint32 kIoctlTerminalTermiosCtrlCharVEOFIndex = 21; | |
92 const uint32 kIoctlTerminalTermiosCtrlCharVTIMEIndex = 22; | |
93 const uint32 kIoctlTerminalTermiosCtrlCharVMINIndex = 23; | |
94 const uint32 kIoctlTerminalTermiosCtrlCharVSWTCIndex = 24; | |
95 const uint32 kIoctlTerminalTermiosCtrlCharVSTARTIndex = 25; | |
96 const uint32 kIoctlTerminalTermiosCtrlCharVSTOPIndex = 26; | |
97 const uint32 kIoctlTerminalTermiosCtrlCharVSUSPIndex = 27; | |
98 const uint32 kIoctlTerminalTermiosCtrlCharVEOLIndex = 28; | |
99 const uint32 kIoctlTerminalTermiosCtrlCharVREPRINTIndex = 29; | |
100 const uint32 kIoctlTerminalTermiosCtrlCharVDISCARDIndex = 30; | |
101 const uint32 kIoctlTerminalTermiosCtrlCharVWERASEIndex = 31; | |
102 const uint32 kIoctlTerminalTermiosCtrlCharVLNEXTIndex = 32; | |
103 const uint32 kIoctlTerminalTermiosCtrlCharVEOL2Index = 33; | |
104 | |
105 // "iflag" flag values: | |
106 const uint32 kIoctlTerminalTermiosIFlagIGNBRK = 0x0001; | |
107 const uint32 kIoctlTerminalTermiosIFlagBRKINT = 0x0002; | |
108 const uint32 kIoctlTerminalTermiosIFlagIGNPAR = 0x0004; | |
109 const uint32 kIoctlTerminalTermiosIFlagPARMRK = 0x0008; | |
110 const uint32 kIoctlTerminalTermiosIFlagINPCK = 0x0010; | |
111 const uint32 kIoctlTerminalTermiosIFlagISTRIP = 0x0020; | |
112 const uint32 kIoctlTerminalTermiosIFlagINLCR = 0x0040; | |
113 const uint32 kIoctlTerminalTermiosIFlagIGNCR = 0x0080; | |
114 const uint32 kIoctlTerminalTermiosIFlagICRNL = 0x0100; | |
115 const uint32 kIoctlTerminalTermiosIFlagIUCLC = 0x0200; | |
116 const uint32 kIoctlTerminalTermiosIFlagIXON = 0x0400; | |
117 const uint32 kIoctlTerminalTermiosIFlagIXANY = 0x0800; | |
118 const uint32 kIoctlTerminalTermiosIFlagIXOFF = 0x1000; | |
119 const uint32 kIoctlTerminalTermiosIFlagIMAXBEL = 0x2000; | |
120 const uint32 kIoctlTerminalTermiosIFlagIUTF8 = 0x4000; | |
121 | |
122 // "oflag" flag values: | |
123 const uint32 kIoctlTerminalTermiosOFlagOPOST = 0x0001; | |
124 const uint32 kIoctlTerminalTermiosOFlagOLCUC = 0x0002; | |
125 const uint32 kIoctlTerminalTermiosOFlagONLCR = 0x0004; | |
126 const uint32 kIoctlTerminalTermiosOFlagOCRNL = 0x0008; | |
127 const uint32 kIoctlTerminalTermiosOFlagONOCR = 0x0010; | |
128 const uint32 kIoctlTerminalTermiosOFlagONLRET = 0x0020; | |
129 const uint32 kIoctlTerminalTermiosOFlagOFILL = 0x0040; | |
130 const uint32 kIoctlTerminalTermiosOFlagOFDEL = 0x0080; | |
131 | |
132 const uint32 kIoctlTerminalTermiosOFlagNLDLY = 0x0100; // Mask. | |
133 const uint32 kIoctlTerminalTermiosOFlagNL0 = 0x0000; | |
134 const uint32 kIoctlTerminalTermiosOFlagNL1 = 0x0100; | |
135 | |
136 const uint32 kIoctlTerminalTermiosOFlagCRDLY = 0x0600; // Mask. | |
137 const uint32 kIoctlTerminalTermiosOFlagCR0 = 0x0000; | |
138 const uint32 kIoctlTerminalTermiosOFlagCR1 = 0x0200; | |
139 const uint32 kIoctlTerminalTermiosOFlagCR2 = 0x0400; | |
140 const uint32 kIoctlTerminalTermiosOFlagCR3 = 0x0600; | |
141 | |
142 const uint32 kIoctlTerminalTermiosOFlagTABDLY = 0x1800; // Mask. | |
143 const uint32 kIoctlTerminalTermiosOFlagTAB0 = 0x0000; | |
144 const uint32 kIoctlTerminalTermiosOFlagTAB1 = 0x0800; | |
145 const uint32 kIoctlTerminalTermiosOFlagTAB2 = 0x1000; | |
146 const uint32 kIoctlTerminalTermiosOFlagTAB3 = 0x1800; | |
147 | |
148 const uint32 kIoctlTerminalTermiosOFlagBSDLY = 0x2000; // Mask. | |
149 const uint32 kIoctlTerminalTermiosOFlagBS0 = 0x0000; | |
150 const uint32 kIoctlTerminalTermiosOFlagBS1 = 0x2000; | |
151 | |
152 const uint32 kIoctlTerminalTermiosOFlagVTDLY = 0x4000; // Mask. | |
153 const uint32 kIoctlTerminalTermiosOFlagVT0 = 0x0000; | |
154 const uint32 kIoctlTerminalTermiosOFlagVT1 = 0x4000; | |
155 | |
156 const uint32 kIoctlTerminalTermiosOFlagFFDLY = 0x8000; // Mask. | |
157 const uint32 kIoctlTerminalTermiosOFlagFF0 = 0x0000; | |
158 const uint32 kIoctlTerminalTermiosOFlagFF1 = 0x8000; | |
159 | |
160 // "cflag" flag values: | |
161 // Note: We don't have "CBAUD" in our "cflag". | |
162 const uint32 kIoctlTerminalTermiosCFlagCSIZE = 0x0003; // Mask. | |
163 const uint32 kIoctlTerminalTermiosCFlagCS5 = 0x0000; | |
164 const uint32 kIoctlTerminalTermiosCFlagCS6 = 0x0001; | |
165 const uint32 kIoctlTerminalTermiosCFlagCS7 = 0x0002; | |
166 const uint32 kIoctlTerminalTermiosCFlagCS8 = 0x0003; | |
167 | |
168 const uint32 kIoctlTerminalTermiosCFlagCSTOPB = 0x0004; | |
169 const uint32 kIoctlTerminalTermiosCFlagCREAD = 0x0008; | |
170 const uint32 kIoctlTerminalTermiosCFlagPARENB = 0x0010; | |
171 const uint32 kIoctlTerminalTermiosCFlagPARODD = 0x0020; | |
172 const uint32 kIoctlTerminalTermiosCFlagHUPCL = 0x0040; | |
173 const uint32 kIoctlTerminalTermiosCFlagCLOCAL = 0x0080; | |
174 | |
175 // "lflag" flag values: | |
176 const uint32 kIoctlTerminalTermiosLFlagISIG = 0x0001; | |
177 const uint32 kIoctlTerminalTermiosLFlagICANON = 0x0002; | |
178 const uint32 kIoctlTerminalTermiosLFlagXCASE = 0x0004; | |
179 const uint32 kIoctlTerminalTermiosLFlagECHO = 0x0008; | |
180 const uint32 kIoctlTerminalTermiosLFlagECHOE = 0x0010; | |
181 const uint32 kIoctlTerminalTermiosLFlagECHOK = 0x0020; | |
182 const uint32 kIoctlTerminalTermiosLFlagECHONL = 0x0040; | |
183 const uint32 kIoctlTerminalTermiosLFlagNOFLSH = 0x0080; | |
184 const uint32 kIoctlTerminalTermiosLFlagTOSTOP = 0x0100; | |
OLD | NEW |