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[JavaPackage="org.chromium.mojo.bindings"] 6module mojo; 7 8// For each user-defined interface, some control functions are provided at the 9// same end of the message pipe as the user-defined interface, providing 10// information about the user-defined interface. 11 12//////////////////////////////////////////////////////////////////////////////// 13// Run@0xFFFFFFFF(RunInput input) => (RunOutput? output); 14// 15// This control function runs the input command. If the command is not 16// supported, |output| is set to null; otherwise |output| stores the result, 17// whose type depends on the input. 18// 19// TODO(yzshen): Once union support is ready, switch the following definition 20// to: 21// struct RunMessageParams { 22// RunInput input; 23// }; 24// union RunInput { 25// QueryVersion query_version; 26// }; 27// 28// struct RunResponseMessageParams { 29// RunOutput? output; 30// }; 31// union RunOutput { 32// QueryVersionResult query_version_result; 33// }; 34 35const uint32 kRunMessageId = 0xFFFFFFFF; 36 37struct RunMessageParams { 38 // The reserved fields make the layout compatible with the RunInput union 39 // described above. 40 uint32 reserved0; // Must be set to 16. 41 uint32 reserved1; // Must be set to 0; 42 QueryVersion query_version; 43}; 44 45struct RunResponseMessageParams { 46 // The reserved fields make the layout compatible with the RunOutput union 47 // described above. 48 uint32 reserved0; // Must be set to 16. 49 uint32 reserved1; // Must be set to 0. 50 QueryVersionResult query_version_result; 51}; 52 53// Queries the max supported version of the user-defined interface. 54struct QueryVersion { 55}; 56struct QueryVersionResult { 57 uint32 version; 58}; 59 60//////////////////////////////////////////////////////////////////////////////// 61// RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input); 62// 63// This control function runs the input command. If the operation fails or the 64// command is not supported, the message pipe is closed. 65// 66// TODO(yzshen): Once union support is ready, switch the following definition 67// to: 68// struct RunOrClosePipeMessageParams { 69// RunOrClosePipeInput input; 70// }; 71// union RunOrClosePipeInput { 72// RequireVersion require_version; 73// }; 74 75const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE; 76 77struct RunOrClosePipeMessageParams { 78 // The reserved fields make the layout compatible with the RunOrClosePipeInput 79 // union described above. 80 uint32 reserved0; // Must be set to 16. 81 uint32 reserved1; // Must be set to 0. 82 RequireVersion require_version; 83}; 84 85// If the specified version of the user-defined interface is not supported, the 86// function fails and the pipe is closed. 87struct RequireVersion { 88 uint32 version; 89}; 90