libssh 0.12.1 The SSH library

Loading...
Searching...
No Matches
config_parser.h
1/*
2 * config_parser.h - Common configuration file parser functions
3 *
4 * This file is part of the SSH Library
5 *
6 * Copyright (c) 2019 by Red Hat, Inc.
7 *
8 * Author: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
9 *
10 * The SSH Library is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or (at your
13 * option) any later version.
14 *
15 * The SSH Library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with the SSH Library; see the file COPYING. If not, write to
22 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23 * MA 02111-1307, USA.
24 */
25
26#ifndef CONFIG_PARSER_H_
27#define CONFIG_PARSER_H_
28
29#ifdef __cplusplus
30 extern "C" {
31#endif
32
33#include "libssh/libssh.h"
34#include <stdbool.h>
35
36 char *ssh_config_get_cmd(char **str);
37
38 char *ssh_config_get_token(char **str);
39
40 long ssh_config_get_long(char **str, long notfound);
41
42 const char *ssh_config_get_str_tok(char **str, const char *def);
43
44 int ssh_config_get_yesno(char **str, int notfound);
45
46/* @brief Parse SSH URI in format [user@]host[:port] from the given string
47 *
48 * @param[in] tok String to parse
49 * @param[out] username Pointer to the location, where the new username will
50 * be stored or NULL if we do not care about the result.
51 * @param[out] hostname Pointer to the location, where the new hostname will
52 * be stored or NULL if we do not care about the result.
53 * @param[out] port Pointer to the location, where the new port will
54 * be stored or NULL if we do not care about the result.
55 * @param[in] ignore_port Set to true if we should not attempt to parse
56 * port number.
57 *
58 * @returns SSH_OK if the provided string is in format of SSH URI,
59 * SSH_ERROR on failure
60 */
61 int ssh_config_parse_uri(const char *tok,
62 char **username,
63 char **hostname,
64 char **port,
65 bool ignore_port);
66
78 int ssh_config_parse_proxy_jump(ssh_session session,
79 const char *s,
80 bool do_parsing);
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif /* LIBSSH_CONFIG_H_ */