1 /* 2 * Copyright 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef AVB_IPC_H_ 18 #define AVB_IPC_H_ 19 20 #include "avb_messages.h" 21 22 namespace avb { 23 24 enum avb_command { 25 AVB_REQ_SHIFT = 1, 26 AVB_RESP_BIT = 1, 27 28 READ_ROLLBACK_INDEX = (0 << AVB_REQ_SHIFT), 29 WRITE_ROLLBACK_INDEX = (1 << AVB_REQ_SHIFT), 30 AVB_GET_VERSION = (2 << AVB_REQ_SHIFT), 31 READ_PERMANENT_ATTRIBUTES = (3 << AVB_REQ_SHIFT), 32 WRITE_PERMANENT_ATTRIBUTES = (4 << AVB_REQ_SHIFT), 33 READ_LOCK_STATE = (5 << AVB_REQ_SHIFT), 34 WRITE_LOCK_STATE = (6 << AVB_REQ_SHIFT), 35 LOCK_BOOT_STATE = (7 << AVB_REQ_SHIFT), 36 }; 37 38 // struct avb_message - Generic message format for communicating with AVB server 39 // @cmd: one of enum avb_command 40 // @result: one of enum AvbError 41 // @payload: start of the serialized command specific message 42 struct avb_message { 43 uint32_t cmd; 44 AvbError result; 45 uint8_t payload[0]; 46 }; 47 48 } // namespace avb 49 50 #endif // AVB_IPC_H_ 51