aboutsummaryrefslogtreecommitdiff
path: root/wmediumd/grpc.h
blob: 039349595dba8cd3f8c2f966a67f7c9a40188b87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 *
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */


#define GRPC_MSG_BUF_MAX 1024

#define MSG_TYPE_REQUEST 1
#define MSG_TYPE_RESPONSE_BASE 2
#define MSG_TYPE_REQUEST_SIZE (sizeof(struct wmediumd_grpc_request_message) - sizeof(long))
#define MSG_TYPE_RESPONSE_SIZE (sizeof(struct wmediumd_grpc_response_message) - sizeof(long))

enum wmediumd_grpc_request_data_type {
    REQUEST_LOAD_CONFIG,
    REQUEST_RELOAD_CONFIG,
    REQUEST_SET_CIVICLOC,
    REQUEST_SET_LCI,
    REQUEST_SET_POSITION,
    REQUEST_SET_SNR,
    REQUEST_START_PCAP,
    REQUEST_STOP_PCAP,
};

enum wmediumd_grpc_response_data_type {
    RESPONSE_INVALID,
    RESPONSE_ACK,
};

#pragma pack(push, 1)
struct wmediumd_grpc_request_message {
    // Message queue type
    long msg_type_request;

    // Message queue payload
    long msg_type_response;
    enum wmediumd_grpc_request_data_type data_type;
    ssize_t data_size;
    char data_payload[GRPC_MSG_BUF_MAX];
};

struct wmediumd_grpc_response_message {
    // Message queue type
    long msg_type_response;

    // Message queue payload
    enum wmediumd_grpc_response_data_type data_type;
    ssize_t data_size;
    char data_payload[GRPC_MSG_BUF_MAX];
};
#pragma pack(pop)