]>
Commit | Line | Data |
---|---|---|
cc73685d | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
92e35018 CB |
2 | |
3 | #ifndef __LXC_COMMANDS_UTILS_H | |
4 | #define __LXC_COMMANDS_UTILS_H | |
5 | ||
1160ce89 CB |
6 | #include "config.h" |
7 | ||
92e35018 CB |
8 | #include <stdio.h> |
9 | ||
10 | #include "state.h" | |
c01c2be6 | 11 | #include "commands.h" |
92e35018 | 12 | |
94a5e86b CB |
13 | __hidden extern int lxc_make_abstract_socket_name(char *path, size_t pathlen, const char *lxcname, |
14 | const char *lxcpath, const char *hashed_sock_name, | |
15 | const char *suffix); | |
bbf5cf35 | 16 | |
92e35018 CB |
17 | /* lxc_cmd_sock_get_state Register a new state client fd in the container's |
18 | * in-memory handler and retrieve the requested | |
19 | * states. | |
20 | * | |
21 | * @param[in] name Name of container to connect to. | |
22 | * @param[in] lxcpath The lxcpath in which the container is running. | |
23 | * @param[in] states The states to wait for. | |
24 | * @return Return < 0 on error | |
25 | * < MAX_STATE current container state | |
26 | */ | |
94a5e86b CB |
27 | __hidden extern int lxc_cmd_sock_get_state(const char *name, const char *lxcpath, |
28 | lxc_state_t states[MAX_STATE], int timeout); | |
92e35018 CB |
29 | |
30 | /* lxc_cmd_sock_rcv_state Retrieve the requested state from a state client | |
31 | * fd registerd in the container's in-memory | |
32 | * handler. | |
33 | * | |
34 | * @param[int] state_client_fd The state client fd from which the state can be | |
35 | * received. | |
36 | * @return Return < 0 on error | |
37 | * < MAX_STATE current container state | |
38 | */ | |
94a5e86b | 39 | __hidden extern int lxc_cmd_sock_rcv_state(int state_client_fd, int timeout); |
92e35018 | 40 | |
c01c2be6 CB |
41 | /* lxc_add_state_client Add a new state client to the container's |
42 | * in-memory handler. | |
43 | * | |
44 | * @param[int] state_client_fd The state client fd to add. | |
45 | * @param[int] handler The container's in-memory handler. | |
46 | * @param[in] states The states to wait for. | |
47 | * | |
48 | * @return Return < 0 on error | |
49 | * 0 on success | |
50 | */ | |
94a5e86b CB |
51 | __hidden extern int lxc_add_state_client(int state_client_fd, struct lxc_handler *handler, |
52 | lxc_state_t states[MAX_STATE]); | |
c01c2be6 CB |
53 | |
54 | /* lxc_cmd_connect Connect to the container's command socket. | |
55 | * | |
56 | * @param[in] name Name of container to connect to. | |
57 | * @param[in] lxcpath The lxcpath in which the container is running. | |
58 | * @param[in] hashed_sock_name The hashed name of the socket (optional). Can be | |
59 | * NULL. | |
60 | * | |
61 | * @return Return < 0 on error | |
62 | * >= 0 client fd | |
63 | */ | |
94a5e86b CB |
64 | __hidden extern int lxc_cmd_connect(const char *name, const char *lxcpath, |
65 | const char *hashed_sock_name, const char *suffix); | |
c01c2be6 | 66 | |
241670e7 CB |
67 | __hidden extern void lxc_cmd_notify_state_listeners(const char *name, |
68 | const char *lxcpath, | |
69 | lxc_state_t state); | |
92e35018 | 70 | #endif /* __LXC_COMMANDS_UTILS_H */ |