1 /* 2 * This file is provided under a dual BSD/GPLv2 license. When using or 3 * redistributing this file, you may do so under either license. 4 * 5 * GPL LICENSE SUMMARY 6 * 7 * Copyright(c) 2016 Google Inc. All rights reserved. 8 * Copyright(c) 2016 Linaro Ltd. All rights reserved. 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of version 2 of the GNU General Public License as 12 * published by the Free Software Foundation. 13 * 14 * This program is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License version 2 for more details. 18 * 19 * BSD LICENSE 20 * 21 * Copyright(c) 2016 Google Inc. All rights reserved. 22 * Copyright(c) 2016 Linaro Ltd. All rights reserved. 23 * 24 * Redistribution and use in source and binary forms, with or without 25 * modification, are permitted provided that the following conditions 26 * are met: 27 * 28 * * Redistributions of source code must retain the above copyright 29 * notice, this list of conditions and the following disclaimer. 30 * * Redistributions in binary form must reproduce the above copyright 31 * notice, this list of conditions and the following disclaimer in 32 * the documentation and/or other materials provided with the 33 * distribution. 34 * * Neither the name of Google Inc. or Linaro Ltd. nor the names of 35 * its contributors may be used to endorse or promote products 36 * derived from this software without specific prior written 37 * permission. 38 * 39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 40 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 41 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 42 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. OR 43 * LINARO LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 44 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 45 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 46 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 47 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 48 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 49 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 50 */ 51 52 #ifndef __ARPC_H 53 #define __ARPC_H 54 55 /* APBridgeA RPC (ARPC) */ 56 57 enum arpc_result { 58 ARPC_SUCCESS = 0x00, 59 ARPC_NO_MEMORY = 0x01, 60 ARPC_INVALID = 0x02, 61 ARPC_TIMEOUT = 0x03, 62 ARPC_UNKNOWN_ERROR = 0xff, 63 }; 64 65 struct arpc_request_message { 66 __le16 id; /* RPC unique id */ 67 __le16 size; /* Size in bytes of header + payload */ 68 __u8 type; /* RPC type */ 69 __u8 data[0]; /* ARPC data */ 70 } __packed; 71 72 struct arpc_response_message { 73 __le16 id; /* RPC unique id */ 74 __u8 result; /* Result of RPC */ 75 } __packed; 76 77 /* ARPC requests */ 78 #define ARPC_TYPE_CPORT_CONNECTED 0x01 79 #define ARPC_TYPE_CPORT_QUIESCE 0x02 80 #define ARPC_TYPE_CPORT_CLEAR 0x03 81 #define ARPC_TYPE_CPORT_FLUSH 0x04 82 #define ARPC_TYPE_CPORT_SHUTDOWN 0x05 83 84 struct arpc_cport_connected_req { 85 __le16 cport_id; 86 } __packed; 87 88 struct arpc_cport_quiesce_req { 89 __le16 cport_id; 90 __le16 peer_space; 91 __le16 timeout; 92 } __packed; 93 94 struct arpc_cport_clear_req { 95 __le16 cport_id; 96 } __packed; 97 98 struct arpc_cport_flush_req { 99 __le16 cport_id; 100 } __packed; 101 102 struct arpc_cport_shutdown_req { 103 __le16 cport_id; 104 __le16 timeout; 105 __u8 phase; 106 } __packed; 107 108 #endif /* __ARPC_H */ 109