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