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 module mojo.spy_api { 6 7 enum Result { 8 ALL_OK, 9 INTERNAL_ERROR, 10 INVALID_ID, 11 NO_MORE_IDS, 12 INVALID_CALL, 13 INVALID_PARAMS, 14 BAD_STATE, 15 RESOURCE_LIMIT 16 }; 17 18 struct Version { 19 uint32 v_major; 20 uint32 v_minor; 21 }; 22 23 enum ConnectionOptions { 24 SKIP, 25 PAUSE, 26 RESUME, 27 PEEK_MESSAGES 28 }; 29 30 struct Message { 31 uint32 id; 32 uint32 time; 33 uint8[]? data; 34 }; 35 36 [Client=SpyClient] 37 interface SpyServer { 38 StartSession(Version? version) => (Result result, string? name); 39 StopSession() => (Result result); 40 TrackConnection(uint32 id, ConnectionOptions options) => (Result result); 41 }; 42 43 interface SpyClient { 44 OnFatalError(Result result); 45 OnSessionEnd(Result result); 46 OnClientConnection(string? name, uint32 id, ConnectionOptions options); 47 OnMessage(Message? message); 48 }; 49 50 } 51