8 #include <types/types.h>
10 #define PB_SOCKET_PATH "/tmp/petitboot.ui"
12 #define PB_PROTOCOL_MAX_PAYLOAD_SIZE (64 * 1024)
14 enum pb_protocol_action {
15 PB_PROTOCOL_ACTION_ADD = 0x1,
16 PB_PROTOCOL_ACTION_REMOVE = 0x2,
17 PB_PROTOCOL_ACTION_BOOT = 0x3,
20 struct pb_protocol_message {
26 void pb_protocol_dump_device(const struct device *dev, const char *text,
28 int pb_protocol_device_len(const struct device *dev);
29 int pb_protocol_boot_len(const struct boot_command *boot);
30 int pb_protocol_device_cmp(const struct device *a, const struct device *b);
32 int pb_protocol_boot_option_cmp(const struct boot_option *a,
33 const struct boot_option *b);
35 int pb_protocol_serialise_string(char *pos, const char *str);
36 char *pb_protocol_deserialise_string(void *ctx,
37 const struct pb_protocol_message *message);
39 int pb_protocol_serialise_device(const struct device *dev, char *buf, int buf_len);
40 int pb_protocol_serialise_boot_command(const struct boot_command *boot,
41 char *buf, int buf_len);
43 int pb_protocol_write_message(int fd, struct pb_protocol_message *message);
45 struct pb_protocol_message *pb_protocol_create_message(void *ctx,
46 enum pb_protocol_action action, int payload_len);
48 struct pb_protocol_message *pb_protocol_read_message(void *ctx, int fd);
50 struct device *pb_protocol_deserialise_device(void *ctx,
51 const struct pb_protocol_message *message);
53 struct boot_command *pb_protocol_deserialise_boot_command(void *ctx,
54 const struct pb_protocol_message *message);
56 #endif /* _PB_PROTOCOL_H */