2 * Copyright (c) 2020 Andreas Schneider <asn@samba.org>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef _CMDLINE_PRIVATE_H
19 #define _CMDLINE_PRIVATE_H
21 #include "lib/cmdline/cmdline.h"
24 OPT_OPTION = 0x1000000,
34 OPT_USE_KERBEROS_CCACHE,
35 OPT_USE_WINBIND_CCACHE,
36 OPT_CLIENT_PROTECTION,
39 typedef bool (*samba_cmdline_load_config)(void);
44 * @brief Initialize the commandline interface for parsing options.
46 * This the common function to initialize the command line interface. This
50 * - logging system sening logs to stdout
51 * - talloc leak reporting
53 * @param[in] mem_ctx The talloc memory context to use for allocating memory.
54 * This should be a long living context till the client
57 * @return true on success, false if an error occured.
59 bool samba_cmdline_init_common(TALLOC_CTX *mem_ctx);
62 * @brief Set the callback for loading the smb.conf file.
64 * This is needed as sourc3 and source4 have different code for loading the
67 * @param[in] fn The callback to load the smb.conf file.
69 * @return true on success, false if an error occured.
71 bool samba_cmdline_set_load_config_fn(samba_cmdline_load_config fn);
76 * @brief Set the talloc context for the command line interface.
78 * This is stored as a static pointer.
80 * @param[in] mem_ctx The talloc memory context.
82 * @return true on success, false if an error occured.
84 bool samba_cmdline_set_talloc_ctx(TALLOC_CTX *mem_ctx);
89 * @brief Get the talloc context for the cmdline interface.
91 * @return A talloc context.
93 TALLOC_CTX *samba_cmdline_get_talloc_ctx(void);
98 * @brief Set the loadparm context for the command line interface.
100 * @param[in] lp_ctx The loadparm context to use.
102 * @return true on success, false if an error occured.
104 bool samba_cmdline_set_lp_ctx(struct loadparm_context *lp_ctx);
109 * @brief Set the client credentials for the commandline interface.
111 * @param[in] creds The client credentials to use.
113 * @return true on success, false if an error occured.
115 bool samba_cmdline_set_creds(struct cli_credentials *creds);
117 #endif /* _CMDLINE_PRIVATE_H */