Public Types | Public Member Functions
command_line_parser Class Reference

Public Types

using registers_type = ioctl::registers_type
 
using arg_type = std::string
 
using arg_list_type = std::vector< arg_type >
 
using filename_type = file::filename_type
 
using cpuid_type = ioctl::cpuid_type
 
using vcpuid_type = ioctl::vcpuid_type
 
using command_type = command_line_parser_command::type
 

Public Member Functions

 command_line_parser ()
 
virtual ~command_line_parser ()=default
 
virtual void parse (const arg_list_type &args)
 
virtual command_type cmd () const noexcept
 
virtual const filename_typemodules () const noexcept
 
virtual cpuid_type cpuid () const noexcept
 
virtual vcpuid_type vcpuid () const noexcept
 
virtual const registers_typeregisters () const noexcept
 
virtual const filename_typeifile () const noexcept
 
virtual const filename_typeofile () const noexcept
 

Detailed Description

Command Line Parser

The command line parser is responsible for taking the command line arguments that are given to main(), and parse them for the bareflank manager. All of the commands that are accepted, should be contained in this class. Other classes can use the information that this class gathers to decide how to operate.

Definition at line 54 of file command_line_parser.h.

Member Typedef Documentation

◆ registers_type

Definition at line 58 of file command_line_parser.h.

◆ arg_type

using command_line_parser::arg_type = std::string

Definition at line 59 of file command_line_parser.h.

◆ arg_list_type

Definition at line 60 of file command_line_parser.h.

◆ filename_type

Definition at line 61 of file command_line_parser.h.

◆ cpuid_type

Definition at line 62 of file command_line_parser.h.

◆ vcpuid_type

Definition at line 63 of file command_line_parser.h.

◆ command_type

Definition at line 64 of file command_line_parser.h.

Constructor & Destructor Documentation

◆ command_line_parser()

command_line_parser::command_line_parser ( )

Command Line Parser Constructor

Precondition
expects: none
Postcondition
ensures: none

Definition at line 33 of file command_line_parser.cpp.

◆ ~command_line_parser()

virtual command_line_parser::~command_line_parser ( )
virtualdefault

Command Line Parser Destructor

Precondition
expects: none
Postcondition
ensures: none

Member Function Documentation

◆ parse()

void command_line_parser::parse ( const arg_list_type args)
virtual

Parse Command Line

Parses the command line. Upon successful completion, resets the internal state to resemble the provided arguments. On failure, this function throws an exception, and resets it's internal state. If an empty list is provided, this function resets the internal state to that of the default constructor

Precondition
expects: none
Postcondition
ensures: none
Parameters
argsthe arguments to parse

Definition at line 37 of file command_line_parser.cpp.

◆ cmd()

command_line_parser::command_type command_line_parser::cmd ( ) const
virtualnoexcept

Command

Precondition
expects: none
Postcondition
ensures: none
Returns
command provided by the arguments

Definition at line 98 of file command_line_parser.cpp.

◆ modules()

const command_line_parser::filename_type & command_line_parser::modules ( ) const
virtualnoexcept

Modules

If the command provided by the arguments is "load", a list of modules must be provided for the arguments to make sense. This function returns the filename of the module file that was provided

Precondition
expects: none
Postcondition
ensures: none
Returns
module list filename

Definition at line 102 of file command_line_parser.cpp.

◆ cpuid()

command_line_parser::cpuid_type command_line_parser::cpuid ( ) const
virtualnoexcept

CPU ID

Precondition
expects: none
Postcondition
ensures: none
Returns
returns the cpuid provided by the user

Definition at line 106 of file command_line_parser.cpp.

◆ vcpuid()

command_line_parser::vcpuid_type command_line_parser::vcpuid ( ) const
virtualnoexcept

vCPU ID

Precondition
expects: none
Postcondition
ensures: none
Returns
returns the vcpuid provided by the user

Definition at line 110 of file command_line_parser.cpp.

◆ registers()

const command_line_parser::registers_type & command_line_parser::registers ( ) const
virtualnoexcept

VMCall Registers

When a VMCall command is provided, this struct is filled in which is then sent to the driver to be delivered to the hypervisor for processing.

Precondition
expects: none
Postcondition
ensures: none
Returns
returns the vmcall registers provided by the user

Definition at line 114 of file command_line_parser.cpp.

◆ ifile()

const command_line_parser::filename_type & command_line_parser::ifile ( ) const
virtualnoexcept

Input File

Precondition
expects: none
Postcondition
ensures: none
Returns
input filename for "data" vmcall

Definition at line 118 of file command_line_parser.cpp.

◆ ofile()

const command_line_parser::filename_type & command_line_parser::ofile ( ) const
virtualnoexcept

Output File

Precondition
expects: none
Postcondition
ensures: none
Returns
output filename for "data" vmcall

Definition at line 122 of file command_line_parser.cpp.


The documentation for this class was generated from the following files: