OpenVPN
|
#include "buffer.h"
Go to the source code of this file.
Data Structures | |
struct | argv |
Functions | |
struct argv | argv_new (void) |
Allocates a new struct argv and ensures it is initialised. More... | |
void | argv_free (struct argv *a) |
Frees all memory allocations allocated by the struct argv related functions. More... | |
const char * | argv_str (const struct argv *a, struct gc_arena *gc, const unsigned int flags) |
Generate a single string with all the arguments in a struct argv concatenated. More... | |
struct argv | argv_insert_head (const struct argv *a, const char *head) |
Inserts an argument string in front of all other argument slots. More... | |
void | argv_msg (const int msglev, const struct argv *a) |
Write the arguments stored in a struct argv via the msg() command. More... | |
void | argv_msg_prefix (const int msglev, const struct argv *a, const char *prefix) |
Similar to argv_msg() but prefixes the messages being written with a given string. More... | |
void | argv_parse_cmd (struct argv *a, const char *s) |
Parses a command string, tokenizes it and puts each element into a separate struct argv argument slot. More... | |
bool | argv_printf (struct argv *a, const char *format,...) |
printf() variant which populates a struct argv. More... | |
bool | argv_printf_cat (struct argv *a, const char *format,...) |
printf() inspired argv concatenation. More... | |
void argv_free | ( | struct argv * | a | ) |
Frees all memory allocations allocated by the struct argv related functions.
*a | Valid pointer to a struct argv to release memory from |
Definition at line 102 of file argv.c.
References argv::gc, and gc_free().
Referenced by add_route(), add_route_ipv6(), argv_insert_head__empty_argv__head_only(), argv_insert_head__non_empty_argv__head_added(), argv_parse_cmd__command_and_extra_options__argc_correct(), argv_parse_cmd__command_string__argc_correct(), argv_printf__combined_path_with_spaces__argc_correct(), argv_printf__embedded_format_directive__replaced_in_output(), argv_printf__empty_parameter__argc_correct(), argv_printf__group_sep_in_arg__fail_no_ouput(), argv_printf__long_args__data_correct(), argv_printf__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__used_twice__argc_correct(), argv_str__empty_argv__empty_output(), argv_str__multiple_argv__correct_output(), check_cmd_access(), cleanup(), delete_route(), delete_route_ipv6(), do_dns_domain_wmic(), do_ifconfig_ipv4(), do_ifconfig_ipv6(), do_route(), init(), ipconfig_register_dns(), learn_address_script(), link_socket_connection_initiated(), multi_client_connect_call_plugin_v1(), multi_client_connect_call_script(), multi_client_disconnect_script(), netsh_delete_address_dns(), netsh_enable_dhcp(), netsh_ifconfig(), netsh_ifconfig_options(), netsh_set_dns6_servers(), plugin_call_item(), run_up_down(), set_lladdr(), tls_crypt_v2_verify_metadata(), undo_ifconfig_ipv4(), undo_ifconfig_ipv6(), verify_cert_call_command(), verify_cert_call_plugin(), verify_crresponse_script(), and verify_user_pass_script().
Inserts an argument string in front of all other argument slots.
*a | Valid pointer to the struct argv to insert the argument into |
*head | Pointer to the char * string with the argument to insert |
Definition at line 208 of file argv.c.
References argv_clone(), and string_alloc().
Referenced by argv_insert_head__empty_argv__head_only(), argv_insert_head__non_empty_argv__head_added(), and plugin_call_item().
void argv_msg | ( | const int | msglev, |
const struct argv * | a | ||
) |
Write the arguments stored in a struct argv via the msg() command.
msglev | Integer with the message level used by msg(). |
*a | Valid pointer to the struct argv with the arguments to write. |
Definition at line 243 of file argv.c.
References argv_str(), gc_free(), gc_new(), and msg.
Referenced by add_route(), add_route_ipv6(), delete_route(), delete_route_ipv6(), do_ifconfig_ipv4(), do_ifconfig_ipv6(), ipconfig_register_dns(), run_up_down(), set_lladdr(), undo_ifconfig_ipv4(), and undo_ifconfig_ipv6().
void argv_msg_prefix | ( | const int | msglev, |
const struct argv * | a, | ||
const char * | prefix | ||
) |
Similar to argv_msg() but prefixes the messages being written with a given string.
msglev | Integer with the message level used by msg(). |
*a | Valid pointer to the struct argv with the arguments to write |
*prefix | Valid char * pointer to the prefix string |
Definition at line 260 of file argv.c.
References argv_str(), gc_free(), gc_new(), and msg.
Referenced by exec_command(), tls_crypt_v2_verify_metadata(), and verify_cert_call_command().
struct argv argv_new | ( | void | ) |
Allocates a new struct argv and ensures it is initialised.
Note that it does not return a pointer, but a struct argv directly.
Definition at line 88 of file argv.c.
References argv_init().
Referenced by add_route(), add_route_ipv6(), argv_insert_head__empty_argv__head_only(), argv_insert_head__non_empty_argv__head_added(), argv_parse_cmd__command_and_extra_options__argc_correct(), argv_parse_cmd__command_string__argc_correct(), argv_printf__combined_path_with_spaces__argc_correct(), argv_printf__embedded_format_directive__replaced_in_output(), argv_printf__empty_parameter__argc_correct(), argv_printf__group_sep_in_arg__fail_no_ouput(), argv_printf__long_args__data_correct(), argv_printf__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__used_twice__argc_correct(), argv_str__empty_argv__empty_output(), argv_str__multiple_argv__correct_output(), check_cmd_access(), cleanup(), delete_route(), delete_route_ipv6(), do_dns_domain_wmic(), do_ifconfig_ipv4(), do_ifconfig_ipv6(), do_route(), init(), ipconfig_register_dns(), learn_address_script(), link_socket_connection_initiated(), multi_client_connect_call_plugin_v1(), multi_client_connect_call_script(), multi_client_disconnect_script(), netsh_delete_address_dns(), netsh_enable_dhcp(), netsh_ifconfig(), netsh_ifconfig_options(), netsh_set_dns6_servers(), run_up_down(), set_lladdr(), tls_crypt_v2_verify_metadata(), undo_ifconfig_ipv4(), undo_ifconfig_ipv6(), verify_cert_call_command(), verify_cert_call_plugin(), verify_crresponse_script(), and verify_user_pass_script().
void argv_parse_cmd | ( | struct argv * | argres, |
const char * | cmdstr | ||
) |
Parses a command string, tokenizes it and puts each element into a separate struct argv argument slot.
@params *argres Valid pointer to a struct argv where the parsed result will be found. @params *cmdstr Char * based string to parse
Definition at line 483 of file argv.c.
References argv_append(), argv_reset(), D_ARGV_PARSE_CMD, argv::gc, MAX_PARMS, parse_line(), and string_alloc().
Referenced by argv_parse_cmd__command_and_extra_options__argc_correct(), argv_parse_cmd__command_string__argc_correct(), check_cmd_access(), do_route(), ipchange_fmt(), learn_address_script(), multi_client_connect_call_script(), multi_client_disconnect_script(), run_up_down(), tls_crypt_v2_verify_metadata(), verify_cert_call_command(), verify_crresponse_script(), and verify_user_pass_script().
bool argv_printf | ( | struct argv * | argres, |
const char * | format, | ||
... | |||
) |
printf() variant which populates a struct argv.
It processes the format string with the provided arguments. For each space separator found in the format string, a new argument will be added to the resulting struct argv.
This will always reset and ensure the result is based on a pristine struct argv.
*argres | Valid pointer to a struct argv where the result will be put. |
*format | printf() compliant (char *) format string. |
Definition at line 440 of file argv.c.
References argv_printf_arglist(), and argv_reset().
Referenced by add_route(), add_route_ipv6(), argv_insert_head__non_empty_argv__head_added(), argv_printf__combined_path_with_spaces__argc_correct(), argv_printf__embedded_format_directive__replaced_in_output(), argv_printf__empty_parameter__argc_correct(), argv_printf__group_sep_in_arg__fail_no_ouput(), argv_printf__long_args__data_correct(), argv_printf__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__used_twice__argc_correct(), argv_str__multiple_argv__correct_output(), cleanup(), delete_route(), delete_route_ipv6(), do_dns_domain_wmic(), do_ifconfig_ipv4(), do_ifconfig_ipv6(), init(), ipchange_fmt(), ipconfig_register_dns(), learn_address_script(), multi_client_connect_call_plugin_v1(), netsh_delete_address_dns(), netsh_enable_dhcp(), netsh_ifconfig(), netsh_ifconfig_options(), netsh_set_dns6_servers(), run_up_down(), set_lladdr(), undo_ifconfig_ipv4(), undo_ifconfig_ipv6(), and verify_cert_call_plugin().
bool argv_printf_cat | ( | struct argv * | argres, |
const char * | format, | ||
... | |||
) |
printf() inspired argv concatenation.
Adds arguments to an existing struct argv and populets the argument slots based on the printf() based format string.
*argres | Valid pointer to a struct argv where the result will be put. |
*format | printf() compliant (char *) format string. |
Definition at line 464 of file argv.c.
References argv_printf_arglist().
Referenced by add_route(), add_route_ipv6(), argv_parse_cmd__command_and_extra_options__argc_correct(), argv_printf_cat__multiple_spaces_in_format__parsed_as_one(), argv_printf_cat__used_twice__argc_correct(), argv_str__multiple_argv__correct_output(), delete_route_ipv6(), ipchange_fmt(), learn_address_script(), multi_client_connect_call_script(), netsh_ifconfig_options(), netsh_set_dns6_servers(), run_up_down(), verify_cert_call_command(), verify_crresponse_script(), and verify_user_pass_script().
Generate a single string with all the arguments in a struct argv concatenated.
*a | Valid pointer to the struct argv with the arguments to list |
*gc | Pointer to a struct gc_arena managed buffer |
flags | Flags passed to the print_argv() function. |
Definition at line 231 of file argv.c.
References argv::argv, argv::gc, and print_argv().
Referenced by argv_msg(), argv_msg_prefix(), argv_str__empty_argv__empty_output(), and argv_str__multiple_argv__correct_output().