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 7import interface_dsl 8 9def MakeInterface(): 10 mojo = interface_dsl.Interface() 11 12 f = mojo.Func('MojoCreateSharedBuffer', 'MojoResult') 13 f.Param('options').InStruct('MojoCreateSharedBufferOptions').Optional() 14 f.Param('num_bytes').In('uint64_t') 15 f.Param('shared_buffer_handle').Out('MojoHandle') 16 17 f = mojo.Func('MojoDuplicateBufferHandle', 'MojoResult') 18 f.Param('buffer_handle').In('MojoHandle') 19 f.Param('options').InStruct('MojoDuplicateBufferHandleOptions').Optional() 20 f.Param('new_buffer_handle').Out('MojoHandle') 21 22 f = mojo.Func('MojoMapBuffer', 'MojoResult') 23 f.Param('buffer_handle').In('MojoHandle') 24 f.Param('offset').In('uint64_t') 25 f.Param('num_bytes').In('uint64_t') 26 f.Param('buffer').Out('void*') 27 f.Param('flags').In('MojoMapBufferFlags') 28 29 f = mojo.Func('MojoUnmapBuffer', 'MojoResult') 30 f.Param('buffer').In('void*') 31 32 f = mojo.Func('MojoCreateDataPipe', 'MojoResult') 33 f.Param('options').InStruct('MojoCreateDataPipeOptions').Optional() 34 f.Param('data_pipe_producer_handle').Out('MojoHandle') 35 f.Param('data_pipe_consumer_handle').Out('MojoHandle') 36 37 f = mojo.Func('MojoWriteData', 'MojoResult') 38 f.Param('data_pipe_producer_handle').In('MojoHandle') 39 f.Param('elements').InArray('void', 'num_bytes') 40 f.Param('num_bytes').InOut('uint32_t') 41 f.Param('flags').In('MojoWriteDataFlags') 42 43 f = mojo.Func('MojoBeginWriteData', 'MojoResult') 44 f.Param('data_pipe_producer_handle').In('MojoHandle') 45 f.Param('buffer').Out('void*') 46 f.Param('buffer_num_bytes').InOut('uint32_t') 47 f.Param('flags').In('MojoWriteDataFlags') 48 49 f = mojo.Func('MojoEndWriteData', 'MojoResult') 50 f.Param('data_pipe_producer_handle').In('MojoHandle') 51 f.Param('num_bytes_written').In('uint32_t') 52 53 f = mojo.Func('MojoReadData', 'MojoResult') 54 f.Param('data_pipe_consumer_handle').In('MojoHandle') 55 f.Param('elements').OutArray('void', 'num_bytes') 56 f.Param('num_bytes').InOut('uint32_t') 57 f.Param('flags').In('MojoReadDataFlags') 58 59 f = mojo.Func('MojoBeginReadData', 'MojoResult') 60 f.Param('data_pipe_consumer_handle').In('MojoHandle') 61 f.Param('buffer').Out('const void*') 62 f.Param('buffer_num_bytes').InOut('uint32_t') 63 f.Param('flags').In('MojoReadDataFlags') 64 65 f = mojo.Func('MojoEndReadData', 'MojoResult') 66 f.Param('data_pipe_consumer_handle').In('MojoHandle') 67 f.Param('num_bytes_read').In('uint32_t') 68 69 f = mojo.Func('MojoGetTimeTicksNow', 'MojoTimeTicks') 70 71 f = mojo.Func('MojoClose', 'MojoResult') 72 f.Param('handle').In('MojoHandle') 73 74 f = mojo.Func('MojoWait', 'MojoResult') 75 f.Param('handle').In('MojoHandle') 76 f.Param('signals').In('MojoHandleSignals') 77 f.Param('deadline').In('MojoDeadline') 78 79 f = mojo.Func('MojoWaitMany', 'MojoResult') 80 f.Param('handles').InArray('MojoHandle', 'num_handles') 81 f.Param('signals').InArray('MojoHandleSignals', 'num_handles') 82 f.Param('num_handles').In('uint32_t') 83 f.Param('deadline').In('MojoDeadline') 84 85 f = mojo.Func('MojoCreateMessagePipe', 'MojoResult') 86 f.Param('options').InStruct('MojoCreateMessagePipeOptions').Optional() 87 f.Param('message_pipe_handle0').Out('MojoHandle') 88 f.Param('message_pipe_handle1').Out('MojoHandle') 89 90 f = mojo.Func('MojoWriteMessage', 'MojoResult') 91 f.Param('message_pipe_handle').In('MojoHandle') 92 f.Param('bytes').InArray('void', 'num_bytes').Optional() 93 f.Param('num_bytes').In('uint32_t') 94 f.Param('handles').InArray('MojoHandle', 'num_handles').Optional() 95 f.Param('num_handles').In('uint32_t') 96 f.Param('flags').In('MojoWriteMessageFlags') 97 98 f = mojo.Func('MojoReadMessage', 'MojoResult') 99 f.Param('message_pipe_handle').In('MojoHandle') 100 f.Param('bytes').OutArray('void', 'num_bytes').Optional() 101 f.Param('num_bytes').InOut('uint32_t').Optional() 102 f.Param('handles').OutArray('MojoHandle', 'num_handles').Optional() 103 f.Param('num_handles').InOut('uint32_t').Optional() 104 f.Param('flags').In('MojoReadMessageFlags') 105 106 mojo.Finalize() 107 108 return mojo 109