libeis: push the new brei_message one level up into eisproto

This is the proto parser and it'll know when we need an fd on the message, so
let's make sure we have everything in place to fetch the fd.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2020-08-21 13:19:40 +10:00
parent 397bb3f19d
commit fef9580319
3 changed files with 7 additions and 7 deletions

View file

@ -391,8 +391,7 @@ client_message_callback(struct brei_message *bmsg, void *userdata)
struct eis_client *client = userdata;
size_t consumed;
_cleanup_message_ struct message *msg =
eis_proto_parse_message(bmsg->data, bmsg->len, &consumed);
_cleanup_message_ struct message *msg = eis_proto_parse_message(bmsg, &consumed);
if (!msg)
return -EBADMSG;

View file

@ -174,16 +174,16 @@ eis_proto_send_device_resumed(struct eis_client *client, struct eis_device *devi
}
struct message *
eis_proto_parse_message(const char *msgdata, size_t msglen, size_t *consumed)
eis_proto_parse_message(struct brei_message *bmsg, size_t *consumed)
{
_cleanup_(message_freep) struct message *msg = xalloc(sizeof(*msg));
ClientMessage *proto = client_message__unpack(NULL, msglen,
(const unsigned char*)msgdata);
ClientMessage *proto = client_message__unpack(NULL, bmsg->len,
(const unsigned char*)bmsg->data);
if (!proto) {
return NULL;
}
*consumed = msglen;
*consumed = bmsg->len;
bool success = true;
switch (proto->msg_case) {

View file

@ -28,6 +28,7 @@
#include "util-macros.h"
#include "util-mem.h"
#include "brei-shared.h"
#include "libeis-private.h"
/* The message type for the wire format */
@ -116,4 +117,4 @@ eis_proto_send_device_resumed(struct eis_client *client,
struct eis_device *device);
struct message *
eis_proto_parse_message(const char *data, size_t len, size_t *consumed);
eis_proto_parse_message(struct brei_message *msg, size_t *consumed);