OpenVPN
Data Structures | Macros | Functions | Variables
console.h File Reference
#include "basic.h"
Include dependency graph for console.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _query_user
 Configuration setup for declaring what kind of information to ask a user for. More...
 

Macros

#define QUERY_USER_NUMSLOTS   10
 

Functions

void query_user_clear (void)
 Wipes all data put into all of the query_user structs. More...
 
void query_user_add (char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo)
 Adds an item to ask the user for. More...
 
bool query_user_exec_builtin (void)
 Executes a configured setup, using the built-in method for querying the user. More...
 
static bool query_user_exec (void)
 Wrapper function enabling query_user_exec() if no alternative methods have been enabled. More...
 
static bool query_user_SINGLE (char *prompt, size_t prompt_len, char *resp, size_t resp_len, bool echo)
 A plain "make Gert happy" wrapper. More...
 

Variables

struct _query_user query_user []
 Global variable, declared in console.c. More...
 

Macro Definition Documentation

◆ QUERY_USER_NUMSLOTS

#define QUERY_USER_NUMSLOTS   10

Definition at line 42 of file console.h.

Referenced by query_user_add(), query_user_clear(), and query_user_exec_builtin().

Function Documentation

◆ query_user_add()

void query_user_add ( char *  prompt,
size_t  prompt_len,
char *  resp,
size_t  resp_len,
bool  echo 
)

Adds an item to ask the user for.

Parameters
promptPrompt to display to the user
prompt_lenLength of the prompt string
respString containing the user response
resp_lenLength of the response string
echoShould the user input be echoed to the user? If False, input will be masked

Definition at line 59 of file console.c.

References ASSERT, _query_user::echo, _query_user::prompt, _query_user::prompt_len, query_user, QUERY_USER_NUMSLOTS, _query_user::response, and _query_user::response_len.

Referenced by get_user_pass_cr(), and query_user_SINGLE().

◆ query_user_clear()

void query_user_clear ( void  )

Wipes all data put into all of the query_user structs.

Definition at line 47 of file console.c.

References CLEAR, query_user, and QUERY_USER_NUMSLOTS.

Referenced by get_user_pass_cr(), and query_user_SINGLE().

◆ query_user_exec()

static bool query_user_exec ( void  )
static

Wrapper function enabling query_user_exec() if no alternative methods have been enabled.

Definition at line 95 of file console.h.

References query_user_exec_builtin().

Referenced by get_user_pass_cr(), and query_user_SINGLE().

◆ query_user_exec_builtin()

bool query_user_exec_builtin ( void  )

Executes a configured setup, using the built-in method for querying the user.

This method uses the console/TTY directly.

Parameters
setupPointer to the setup defining what to ask the user
Returns
True if executing all the defined steps completed successfully

Executes a configured setup, using the built-in method for querying the user.

Default method for querying user using default stdin/stdout on a console. This needs to be available as a backup interface for the alternative implementations in case they cannot query through their implementation specific methods.

If no alternative implementation is declared, a wrapper in console.h will ensure query_user_exec() will call this function instead.

Definition at line 270 of file console_builtin.c.

References _query_user::echo, get_console_input(), _query_user::prompt, query_user, QUERY_USER_NUMSLOTS, _query_user::response, and _query_user::response_len.

Referenced by query_user_exec().

◆ query_user_SINGLE()

static bool query_user_SINGLE ( char *  prompt,
size_t  prompt_len,
char *  resp,
size_t  resp_len,
bool  echo 
)
inlinestatic

A plain "make Gert happy" wrapper.

Same arguments as

FIXME/TODO: Remove this when refactoring the complete user query process to be called at start-up initialization of OpenVPN.

Definition at line 110 of file console.h.

References query_user_add(), query_user_clear(), and query_user_exec().

Referenced by get_user_pass_cr().

Variable Documentation

◆ query_user

struct _query_user query_user[]

Global variable, declared in console.c.

Definition at line 43 of file console.c.

Referenced by query_user_add(), query_user_clear(), and query_user_exec_builtin().