blob: c14713949e8ed68626261210d8fddd132e9bfe88 (
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
|
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright (C) 2018 IBM Corp. */
#ifndef PROTOCOL_H
#define PROTOCOL_H
struct mbox_context;
/*
* The GET_MBOX_INFO command is special as it can change the interface based on
* negotiation. As such we need to accommodate all response types
*/
struct protocol_get_info {
struct {
uint8_t api_version;
} req;
struct {
uint8_t api_version;
union {
struct {
uint16_t read_window_size;
uint16_t write_window_size;
} v1;
struct {
uint8_t block_size_shift;
uint16_t timeout;
} v2;
};
} resp;
};
struct protocol_ops {
int (*get_info)(struct mbox_context *context,
struct protocol_get_info *io);
};
int protocol_init(struct mbox_context *context);
void protocol_free(struct mbox_context *context);
int protocol_negotiate_version(struct mbox_context *context, uint8_t requested);
/* Protocol v1 */
int protocol_v1_get_info(struct mbox_context *context,
struct protocol_get_info *io);
/* Protocol v2 */
int protocol_v2_get_info(struct mbox_context *context,
struct protocol_get_info *io);
#endif /* PROTOCOL_H */
|