| 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 f = mojo.Func('MojoCreateSharedBuffer', 'MojoResult') | |
| 13 p = f.Param('options') | |
| 14 p.InExtensibleStruct('MojoCreateSharedBufferOptions').Optional() | |
| 15 f.Param('num_bytes').In('uint64_t') | |
| 16 f.Param('shared_buffer_handle').Out('MojoHandle') | |
| 17 | |
| 18 f = mojo.Func('MojoDuplicateBufferHandle', 'MojoResult') | |
| 19 f.Param('buffer_handle').In('MojoHandle') | |
| 20 p = f.Param('options') | |
| 21 p.InExtensibleStruct('MojoDuplicateBufferHandleOptions').Optional() | |
| 22 f.Param('new_buffer_handle').Out('MojoHandle') | |
| 23 | |
| 24 f = mojo.Func('MojoMapBuffer', 'MojoResult') | |
| 25 f.Param('buffer_handle').In('MojoHandle') | |
| 26 f.Param('offset').In('uint64_t') | |
| 27 f.Param('num_bytes').In('uint64_t') | |
| 28 f.Param('buffer').Out('void*') | |
| 29 f.Param('flags').In('MojoMapBufferFlags') | |
| 30 # TODO(ncbray): support mmaping. | |
| 31 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
| 32 f.IsBrokenInNaCl() | |
| 33 | |
| 34 f = mojo.Func('MojoUnmapBuffer', 'MojoResult') | |
| 35 f.Param('buffer').In('void*') | |
| 36 # TODO(ncbray): support mmaping. | |
| 37 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
| 38 f.IsBrokenInNaCl() | |
| 39 | |
| 40 f = mojo.Func('MojoCreateDataPipe', 'MojoResult') | |
| 41 p = f.Param('options') | |
| 42 p.InExtensibleStruct('MojoCreateDataPipeOptions').Optional() | |
| 43 f.Param('data_pipe_producer_handle').Out('MojoHandle') | |
| 44 f.Param('data_pipe_consumer_handle').Out('MojoHandle') | |
| 45 | |
| 46 f = mojo.Func('MojoWriteData', 'MojoResult') | |
| 47 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
| 48 f.Param('elements').InArray('void', 'num_bytes') | |
| 49 f.Param('num_bytes').InOut('uint32_t') | |
| 50 f.Param('flags').In('MojoWriteDataFlags') | |
| 51 | |
| 52 f = mojo.Func('MojoBeginWriteData', 'MojoResult') | |
| 53 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
| 54 f.Param('buffer').Out('void*') | |
| 55 f.Param('buffer_num_bytes').InOut('uint32_t') | |
| 56 f.Param('flags').In('MojoWriteDataFlags') | |
| 57 # TODO(ncbray): support two-stage reads and writes. | |
| 58 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
| 59 f.IsBrokenInNaCl() | |
| 60 | |
| 61 f = mojo.Func('MojoEndWriteData', 'MojoResult') | |
| 62 f.Param('data_pipe_producer_handle').In('MojoHandle') | |
| 63 f.Param('num_bytes_written').In('uint32_t') | |
| 64 | |
| 65 f = mojo.Func('MojoReadData', 'MojoResult') | |
| 66 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
| 67 f.Param('elements').OutArray('void', 'num_bytes') | |
| 68 f.Param('num_bytes').InOut('uint32_t') | |
| 69 f.Param('flags').In('MojoReadDataFlags') | |
| 70 | |
| 71 f = mojo.Func('MojoBeginReadData', 'MojoResult') | |
| 72 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
| 73 f.Param('buffer').Out('const void*') | |
| 74 f.Param('buffer_num_bytes').InOut('uint32_t') | |
| 75 f.Param('flags').In('MojoReadDataFlags') | |
| 76 # TODO(ncbray): support two-stage reads and writes. | |
| 77 # https://code.google.com/p/chromium/issues/detail?id=401761 | |
| 78 f.IsBrokenInNaCl() | |
| 79 | |
| 80 f = mojo.Func('MojoEndReadData', 'MojoResult') | |
| 81 f.Param('data_pipe_consumer_handle').In('MojoHandle') | |
| 82 f.Param('num_bytes_read').In('uint32_t') | |
| 83 | |
| 84 f = mojo.Func('MojoGetTimeTicksNow', 'MojoTimeTicks') | |
| 85 | |
| 86 f = mojo.Func('MojoClose', 'MojoResult') | |
| 87 f.Param('handle').In('MojoHandle') | |
| 88 | |
| 89 f = mojo.Func('MojoWait', 'MojoResult') | |
| 90 f.Param('handle').In('MojoHandle') | |
| 91 f.Param('signals').In('MojoHandleSignals') | |
| 92 f.Param('deadline').In('MojoDeadline') | |
| 93 f.Param('signals_state').OutFixedStruct('MojoHandleSignalsState').Optional() | |
| 94 | |
| 95 f = mojo.Func('MojoWaitMany', 'MojoResult') | |
| 96 f.Param('handles').InArray('MojoHandle', 'num_handles') | |
| 97 f.Param('signals').InArray('MojoHandleSignals', 'num_handles') | |
| 98 f.Param('num_handles').In('uint32_t') | |
| 99 f.Param('deadline').In('MojoDeadline') | |
| 100 f.Param('result_index').Out('uint32_t').Optional() | |
| 101 p = f.Param('signals_states') | |
| 102 p.OutFixedStructArray('MojoHandleSignalsState', 'num_handles').Optional() | |
| 103 | |
| 104 f = mojo.Func('MojoCreateMessagePipe', 'MojoResult') | |
| 105 p = f.Param('options') | |
| 106 p.InExtensibleStruct('MojoCreateMessagePipeOptions').Optional() | |
| 107 f.Param('message_pipe_handle0').Out('MojoHandle') | |
| 108 f.Param('message_pipe_handle1').Out('MojoHandle') | |
| 109 | |
| 110 f = mojo.Func('MojoWriteMessage', 'MojoResult') | |
| 111 f.Param('message_pipe_handle').In('MojoHandle') | |
| 112 f.Param('bytes').InArray('void', 'num_bytes').Optional() | |
| 113 f.Param('num_bytes').In('uint32_t') | |
| 114 f.Param('handles').InArray('MojoHandle', 'num_handles').Optional() | |
| 115 f.Param('num_handles').In('uint32_t') | |
| 116 f.Param('flags').In('MojoWriteMessageFlags') | |
| 117 | |
| 118 f = mojo.Func('MojoReadMessage', 'MojoResult') | |
| 119 f.Param('message_pipe_handle').In('MojoHandle') | |
| 120 f.Param('bytes').OutArray('void', 'num_bytes').Optional() | |
| 121 f.Param('num_bytes').InOut('uint32_t').Optional() | |
| 122 f.Param('handles').OutArray('MojoHandle', 'num_handles').Optional() | |
| 123 f.Param('num_handles').InOut('uint32_t').Optional() | |
| 124 f.Param('flags').In('MojoReadMessageFlags') | |
| 125 | |
| 126 # This function is not provided by the Mojo system APIs, but instead allows | |
| 127 # trusted code to provide a handle for use by untrusted code. See the | |
| 128 # implementation in mojo_syscall.cc.tmpl. | |
| 129 f = mojo.Func('_MojoGetInitialHandle', 'MojoResult') | |
| 130 f.Param('handle').Out('MojoHandle') | |
| 131 | |
| 132 mojo.Finalize() | |
| 133 | |
| 134 return mojo | |
| OLD | NEW |