1 /* 2 * 3 * Copyright (C) 2023 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 */ 18 19 20 #define GRPC_MSG_BUF_MAX 1024 21 22 #define MSG_TYPE_REQUEST 1 23 #define MSG_TYPE_RESPONSE_BASE 2 24 #define MSG_TYPE_REQUEST_SIZE (sizeof(struct wmediumd_grpc_request_message) - sizeof(long)) 25 #define MSG_TYPE_RESPONSE_SIZE (sizeof(struct wmediumd_grpc_response_message) - sizeof(long)) 26 27 enum wmediumd_grpc_request_data_type { 28 REQUEST_LIST_STATIONS, 29 REQUEST_LOAD_CONFIG, 30 REQUEST_RELOAD_CONFIG, 31 REQUEST_SET_CIVICLOC, 32 REQUEST_SET_LCI, 33 REQUEST_SET_POSITION, 34 REQUEST_SET_SNR, 35 REQUEST_SET_TX_POWER, 36 REQUEST_START_PCAP, 37 REQUEST_STOP_PCAP, 38 }; 39 40 enum wmediumd_grpc_response_data_type { 41 RESPONSE_INVALID, 42 RESPONSE_ACK, 43 RESPONSE_ACK_LIST_STATIONS, 44 }; 45 46 #pragma pack(push, 1) 47 struct wmediumd_grpc_request_message { 48 // Message queue type 49 long msg_type_request; 50 51 // Message queue payload 52 long msg_type_response; 53 enum wmediumd_grpc_request_data_type data_type; 54 ssize_t data_size; 55 char data_payload[GRPC_MSG_BUF_MAX]; 56 }; 57 58 struct wmediumd_grpc_response_message { 59 // Message queue type 60 long msg_type_response; 61 62 // Message queue payload 63 enum wmediumd_grpc_response_data_type data_type; 64 ssize_t data_size; 65 char data_payload[GRPC_MSG_BUF_MAX]; 66 }; 67 #pragma pack(pop) 68