OLD | NEW |
| (Empty) |
1 # Copyright 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 # pylint: disable=F0401 | |
6 | |
7 import interface_dsl | |
8 | |
9 def MakeInterface(): | |
10 mojo = interface_dsl.Interface() | |
11 | |
12 # This function is not provided by the Mojo system APIs, but instead allows | |
13 # trusted code to provide a handle for use by untrusted code. See the | |
14 # implementation in mojo_syscall.cc.tmpl. | |
15 f = mojo.Func('_MojoGetInitialHandle', 'MojoResult') | |
16 f.Param('handle').Out('MojoHandle') | |
17 | |
18 f = mojo.Func('MojoGetTimeTicksNow', 'MojoTimeTicks') | |
19 | |
20 f = mojo.Func('MojoClose', 'MojoResult') | |
21 f.Param('handle').In('MojoHandle') | |
22 | |
23 f = mojo.Func('MojoGetRights', 'MojoResult') | |
24 f.Param('handle').In('MojoHandle') | |
25 f.Param('rights').Out('MojoHandleRights') | |
26 | |
27 f = mojo.Func('MojoDuplicateHandleWithReducedRights', 'MojoResult') | |
28 f.Param('handle').In('MojoHandle') | |
29 f.Param('rights_to_remove').In('MojoHandleRights') | |
30 f.Param('new_handle').Out('MojoHandle') | |
31 | |
32 f = mojo.Func('MojoDuplicateHandle', 'MojoResult') | |
33 f.Param('handle').In('MojoHandle') | |
34 f.Param('new_handle').Out('MojoHandle') | |
35 | |
36 f = mojo.Func('MojoWait', 'MojoResult') | |
37 f.Param('handle').In('MojoHandle') | |
38 f.Param('signals').In('MojoHandleSignals') | |
39 f.Param('deadline').In('MojoDeadline') | |
40 f.Param('signals_state').OutFixedStruct('MojoHandleSignalsState').Optional() | |
41 | |
42 f = mojo.Func('MojoWaitMany', 'MojoResult') | |
43 f.Param('handles').InArray('MojoHandle', 'num_handles') | |
44 f.Param('signals').InArray('MojoHandleSignals', 'num_handles') | |
45 f.Param('num_handles').In('uint32_t') | |
46 f.Param('deadline').In('MojoDeadline') | |
47 f.Param('result_index').Out('uint32_t').Optional() | |
48 p = f.Param('signals_states') | |
49 p.OutFixedStructArray('MojoHandleSignalsState', 'num_handles').Optional() | |
50 | |
51 f = mojo.Func('MojoCreateMessagePipe', 'MojoResult') | |
52 p = f.Param('options') | |
53 p.InExtensibleStruct('MojoCreateMessagePipeOptions').Optional() | |
54 f.Param('message_pipe_handle0').Out('MojoHandle') | |
55 f.Param('message_pipe_handle1').Out('MojoHandle') | |
56 | |
57 f = mojo.Func('MojoWriteMessage', 'MojoResult') | |
58 f.Param('message_pipe_handle').In('MojoHandle') | |
59 f.Param('bytes').InArray('void', 'num_bytes').Optional() | |
60 f.Param('num_bytes').In('uint32_t') | |
61 f.Param('handles').InArray('MojoHandle', 'num_handles').Optional() | |
62 f.Param('num_handles').In('uint32_t') | |
63 f.Param('flags').In('MojoWriteMessageFlags') | |
64 | |
65 f = mojo.Func('MojoReadMessage', 'MojoResult') | |
66 f.Param('message_pipe_handle').In('MojoHandle') | |
67 f.Param('bytes').OutArray('void', 'num_bytes').Optional() | |
68 f.Param('num_bytes').InOut('uint32_t').Optional() | |
69 f.Param('handles').OutArray('MojoHandle', 'num_handles').Optional() | |
70 f.Param('num_handles').InOut('uint32_t').Optional() | |
71 f.Param('flags').In('MojoReadMessageFlags') | |
72 | |
73 f = mojo.Func('MojoCreateDataPipe', 'MojoResult') | |
74 p = f.Param('options') | |
75 p.InExtensibleStruct('MojoCreateDataPipeOptions').Optional() | |
76 f.Param('data_pipe_producer_handle').Out('MojoHandle') | |
77 f.Param('data_pipe_consumer_handle').Out('MojoHandle') | |
78 | |
79 f = mojo.Func('MojoSetDataPipeProducerOptions', 'MojoResult') | |
80 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
81 p = f.Param('options') | |
82 p.InExtensibleStruct('MojoDataPipeProducerOptions').Optional() | |
83 | |
84 f = mojo.Func('MojoGetDataPipeProducerOptions', 'MojoResult') | |
85 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
86 p = f.Param('options') | |
87 p.OutExtensibleStruct('MojoDataPipeProducerOptions', 'options_num_bytes') | |
88 f.Param('options_num_bytes').In('uint32_t') | |
89 | |
90 f = mojo.Func('MojoWriteData', 'MojoResult') | |
91 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
92 f.Param('elements').InArray('void', 'num_bytes') | |
93 f.Param('num_bytes').InOut('uint32_t') | |
94 f.Param('flags').In('MojoWriteDataFlags') | |
95 | |
96 f = mojo.Func('MojoBeginWriteData', 'MojoResult') | |
97 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
98 f.Param('buffer').Out('void*') | |
99 f.Param('buffer_num_bytes').InOut('uint32_t') | |
100 f.Param('flags').In('MojoWriteDataFlags') | |
101 # TODO(ncbray): support two-stage reads and writes. | |
102 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
103 f.IsBrokenInNaCl() | |
104 | |
105 f = mojo.Func('MojoEndWriteData', 'MojoResult') | |
106 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
107 f.Param('num_bytes_written').In('uint32_t') | |
108 | |
109 f = mojo.Func('MojoSetDataPipeConsumerOptions', 'MojoResult') | |
110 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
111 p = f.Param('options') | |
112 p.InExtensibleStruct('MojoDataPipeConsumerOptions').Optional() | |
113 | |
114 f = mojo.Func('MojoGetDataPipeConsumerOptions', 'MojoResult') | |
115 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
116 p = f.Param('options') | |
117 p.OutExtensibleStruct('MojoDataPipeConsumerOptions', 'options_num_bytes') | |
118 f.Param('options_num_bytes').In('uint32_t') | |
119 | |
120 f = mojo.Func('MojoReadData', 'MojoResult') | |
121 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
122 f.Param('elements').OutArray('void', 'num_bytes') | |
123 f.Param('num_bytes').InOut('uint32_t') | |
124 f.Param('flags').In('MojoReadDataFlags') | |
125 | |
126 f = mojo.Func('MojoBeginReadData', 'MojoResult') | |
127 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
128 f.Param('buffer').Out('const void*') | |
129 f.Param('buffer_num_bytes').InOut('uint32_t') | |
130 f.Param('flags').In('MojoReadDataFlags') | |
131 # TODO(ncbray): support two-stage reads and writes. | |
132 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
133 f.IsBrokenInNaCl() | |
134 | |
135 f = mojo.Func('MojoEndReadData', 'MojoResult') | |
136 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
137 f.Param('num_bytes_read').In('uint32_t') | |
138 | |
139 f = mojo.Func('MojoCreateSharedBuffer', 'MojoResult') | |
140 p = f.Param('options') | |
141 p.InExtensibleStruct('MojoCreateSharedBufferOptions').Optional() | |
142 f.Param('num_bytes').In('uint64_t') | |
143 f.Param('shared_buffer_handle').Out('MojoHandle') | |
144 | |
145 f = mojo.Func('MojoDuplicateBufferHandle', 'MojoResult') | |
146 f.Param('buffer_handle').In('MojoHandle') | |
147 p = f.Param('options') | |
148 p.InExtensibleStruct('MojoDuplicateBufferHandleOptions').Optional() | |
149 f.Param('new_buffer_handle').Out('MojoHandle') | |
150 | |
151 f = mojo.Func('MojoGetBufferInformation', 'MojoResult') | |
152 f.Param('buffer_handle').In('MojoHandle') | |
153 p = f.Param('info') | |
154 p.OutExtensibleStruct('MojoBufferInformation', 'info_num_bytes') | |
155 f.Param('info_num_bytes').In('uint32_t') | |
156 | |
157 f = mojo.Func('MojoMapBuffer', 'MojoResult') | |
158 f.Param('buffer_handle').In('MojoHandle') | |
159 f.Param('offset').In('uint64_t') | |
160 f.Param('num_bytes').In('uint64_t') | |
161 f.Param('buffer').Out('void*') | |
162 f.Param('flags').In('MojoMapBufferFlags') | |
163 # TODO(ncbray): support mmaping. | |
164 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
165 f.IsBrokenInNaCl() | |
166 | |
167 f = mojo.Func('MojoUnmapBuffer', 'MojoResult') | |
168 f.Param('buffer').In('void*') | |
169 # TODO(ncbray): support mmaping. | |
170 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
171 f.IsBrokenInNaCl() | |
172 | |
173 mojo.Finalize() | |
174 | |
175 return mojo | |
OLD | NEW |