Home | History | Annotate | Download | only in bindings
      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.interfacecontrol"]
      6 module mojo.interface_control;
      7 
      8 // For each user-defined interface, some control functions are provided by the
      9 // interface endpoints at both sides.
     10 
     11 ////////////////////////////////////////////////////////////////////////////////
     12 // Run@0xFFFFFFFF(RunInput input) => (RunOutput? output);
     13 //
     14 // This control function runs the input command. If the command is not
     15 // supported, |output| is set to null; otherwise |output| stores the result,
     16 // whose type depends on the input.
     17 
     18 const uint32 kRunMessageId = 0xFFFFFFFF;
     19 
     20 struct RunMessageParams {
     21   RunInput input;
     22 };
     23 union RunInput {
     24   QueryVersion query_version;
     25   FlushForTesting flush_for_testing;
     26 };
     27 
     28 struct RunResponseMessageParams {
     29   RunOutput? output;
     30 };
     31 union RunOutput {
     32   QueryVersionResult query_version_result;
     33 };
     34 
     35 // Queries the max supported version of the user-defined interface.
     36 // Sent by the interface client side.
     37 struct QueryVersion {
     38 };
     39 struct QueryVersionResult {
     40   uint32 version;
     41 };
     42 
     43 // Sent by either side of the interface.
     44 struct FlushForTesting {
     45 };
     46 
     47 ////////////////////////////////////////////////////////////////////////////////
     48 // RunOrClosePipe@0xFFFFFFFE(RunOrClosePipeInput input);
     49 //
     50 // This control function runs the input command. If the operation fails or the
     51 // command is not supported, the message pipe is closed.
     52 
     53 const uint32 kRunOrClosePipeMessageId = 0xFFFFFFFE;
     54 
     55 struct RunOrClosePipeMessageParams {
     56   RunOrClosePipeInput input;
     57 };
     58 union RunOrClosePipeInput {
     59   RequireVersion require_version;
     60 };
     61 
     62 // If the specified version of the user-defined interface is not supported, the
     63 // function fails and the pipe is closed.
     64 // Sent by the interface client side.
     65 struct RequireVersion {
     66   uint32 version;
     67 };
     68