aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/include/initsock.h10
-rw-r--r--lib/init/init_socket_send_request.c14
2 files changed, 22 insertions, 2 deletions
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 <unistd.h>
#include <string.h>
+#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#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));