1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-05-19 20:26:14 +02:00
init/lib/include/initsock.h
David Oberhollenzer affe9e4b88 Use fixed size integer for init socket request
Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2019-03-27 17:48:32 +01:00

47 lines
890 B
C

/* SPDX-License-Identifier: ISC */
#ifndef INITSOCK_H
#define INITSOCK_H
#include <stdint.h>
#include "config.h"
#include "service.h"
#define INIT_SOCK_PATH SOCKDIR "/init.sock"
typedef enum {
EIR_STATUS = 0x00,
} E_INIT_REQUEST;
typedef enum {
ESS_NONE = 0x00,
ESS_RUNNING = 0x01,
ESS_ENQUEUED = 0x02,
ESS_DONE = 0x03,
ESS_FAILED = 0x04
} E_SERVICE_STATE;
typedef struct {
uint8_t rq;
} init_request_t;
typedef struct {
E_SERVICE_STATE state;
int exit_status;
char *filename;
char *service_name;
} init_status_response_t;
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_status(int fd, const void *dest_addr, size_t addrlen,
E_SERVICE_STATE state, service_t *svc);
int init_socket_recv_status(int fd, init_status_response_t *resp);
#endif /* INITSOCK_H */