From d16d26018126d381954110e8cdb788650eb41d9e Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Wed, 27 Mar 2019 17:48:13 +0100 Subject: Add filter argument to status request Signed-off-by: David Oberhollenzer --- lib/include/initsock.h | 10 +++++++++- lib/init/init_socket_send_request.c | 14 +++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/include/initsock.h b/lib/include/initsock.h index 76b2924..55321db 100644 --- a/lib/include/initsock.h +++ b/lib/include/initsock.h @@ -23,6 +23,14 @@ typedef enum { typedef struct { uint8_t rq; + uint8_t padd[3]; + + union { + struct { + uint8_t filter; + uint8_t padd[3]; + } status; + } arg; } init_request_t; typedef struct { @@ -36,7 +44,7 @@ int init_socket_create(void); int init_socket_open(const char *tmppath); -int init_socket_send_request(int fd, E_INIT_REQUEST rq); +int init_socket_send_request(int fd, E_INIT_REQUEST rq, ...); int init_socket_send_status(int fd, const void *dest_addr, size_t addrlen, E_SERVICE_STATE state, service_t *svc); diff --git a/lib/init/init_socket_send_request.c b/lib/init/init_socket_send_request.c index dd88856..e9c7cb9 100644 --- a/lib/init/init_socket_send_request.c +++ b/lib/init/init_socket_send_request.c @@ -1,19 +1,31 @@ /* SPDX-License-Identifier: ISC */ #include #include +#include #include #include #include "initsock.h" -int init_socket_send_request(int fd, E_INIT_REQUEST rq) +int init_socket_send_request(int fd, E_INIT_REQUEST rq, ...) { init_request_t request; ssize_t ret; + va_list ap; memset(&request, 0, sizeof(request)); request.rq = rq; + va_start(ap, rq); + switch (rq) { + case EIR_STATUS: + request.arg.status.filter = va_arg(ap, E_SERVICE_STATE); + break; + default: + break; + } + va_end(ap); + retry: ret = write(fd, &request, sizeof(request)); -- cgit v1.2.3