2024-09-22 20:02:25 +00:00
|
|
|
#ifndef _GNU_SOURCE
|
2024-08-29 05:53:47 +00:00
|
|
|
#define _GNU_SOURCE
|
2024-09-22 20:02:25 +00:00
|
|
|
#endif
|
2024-08-29 05:53:47 +00:00
|
|
|
|
|
|
|
#ifndef INCLUDE_FLOCK_H
|
|
|
|
#define INCLUDE_FLOCK_H
|
|
|
|
#include "lib/birdlib.h"
|
2024-10-08 20:02:48 +00:00
|
|
|
#include "lib/cbor.h"
|
2024-09-10 09:16:49 +00:00
|
|
|
#include "lib/event.h"
|
|
|
|
#include "lib/obstacle.h"
|
2024-09-09 12:14:49 +00:00
|
|
|
#include "lib/resource.h"
|
2024-09-10 10:04:44 +00:00
|
|
|
#include "lib/socket.h"
|
2024-08-29 05:53:47 +00:00
|
|
|
|
2024-09-17 20:51:19 +00:00
|
|
|
void hypervisor_container_fork(void);
|
2024-08-29 05:53:47 +00:00
|
|
|
void hypervisor_exposed_fork(void);
|
2024-09-04 19:33:43 +00:00
|
|
|
void hypervisor_control_socket(void);
|
2024-08-29 05:53:47 +00:00
|
|
|
|
|
|
|
struct flock_config {
|
|
|
|
const char *hypervisor_name;
|
|
|
|
const char *exec_name;
|
2024-09-04 19:33:43 +00:00
|
|
|
const char *control_socket_path;
|
2024-08-29 05:53:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct flock_config flock_config;
|
|
|
|
|
2024-10-11 18:27:43 +00:00
|
|
|
struct hcs_parser_stream *hcs_parser_init(sock *s);
|
2024-09-09 12:14:49 +00:00
|
|
|
|
2024-10-11 18:27:43 +00:00
|
|
|
enum cbor_parse_result
|
|
|
|
hcs_parse(struct cbor_channel *cch, enum cbor_parse_result res);
|
|
|
|
|
|
|
|
void hcs_parser_cleanup(struct hcs_parser_stream *ctx);
|
|
|
|
const char *hcs_error(struct hcs_parser_stream *ctx);
|
|
|
|
bool hcs_complete(struct hcs_parser_stream *ctx);
|
|
|
|
|
|
|
|
struct hcs_parser_channel;
|
|
|
|
void hexp_get_telnet(struct hcs_parser_channel *);
|
2024-09-10 18:43:55 +00:00
|
|
|
|
2024-09-14 20:34:09 +00:00
|
|
|
union flock_machine_config {
|
|
|
|
struct flock_machine_common_config {
|
|
|
|
const char *name;
|
|
|
|
enum {
|
|
|
|
FLOCK_MACHINE_NONE = 0,
|
|
|
|
FLOCK_MACHINE_CONTAINER = 1,
|
|
|
|
} type;
|
|
|
|
} cf;
|
|
|
|
struct flock_machine_container_config {
|
|
|
|
struct flock_machine_common_config cf;
|
|
|
|
const char *workdir;
|
|
|
|
const char *basedir;
|
|
|
|
} container;
|
|
|
|
};
|
|
|
|
|
2024-10-08 20:02:48 +00:00
|
|
|
void hypervisor_container_start(struct cbor_channel *, struct flock_machine_container_config *);
|
|
|
|
void hypervisor_container_shutdown(struct cbor_channel *, struct flock_machine_container_config *);
|
2024-09-27 19:38:56 +00:00
|
|
|
int container_ctl_fd(const char *name);
|
2024-09-14 20:34:09 +00:00
|
|
|
|
2024-10-02 12:48:26 +00:00
|
|
|
void hexp_cleanup_after_fork(void);
|
|
|
|
|
2024-09-10 09:16:49 +00:00
|
|
|
extern event reboot_event, poweroff_event;
|
|
|
|
extern event_list shutdown_event_list;
|
|
|
|
|
|
|
|
extern struct shutdown_placeholder {
|
|
|
|
struct obstacle_target obstacles;
|
|
|
|
} shutdown_placeholder;
|
2024-08-29 05:53:47 +00:00
|
|
|
#endif
|