uuu
uuu (Universal Update Utility), mfgtools 3.0
 
Loading...
Searching...
No Matches
cmd.cpp File Reference
#include <regex>
#include <iterator>
#include <memory>
#include <string.h>
#include "cmd.h"
#include "libcomm.h"
#include "liberror.h"
#include "libuuu.h"
#include "config.h"
#include "trans.h"
#include "sdps.h"
#include <atomic>
#include "buffer.h"
#include "sdp.h"
#include "fastboot.h"
#include <sys/stat.h>
#include <thread>
#include <stdio.h>
#include <stdlib.h>

Macros

#define _popen   popen
 
#define _pclose   pclose
 

Typedefs

typedef void *(* FN) ()
 

Functions

int insert_env_variable (string key, string value)
 
string get_env_variable (string key)
 
int clear_env ()
 
bool is_env_exist (string key)
 
int get_string_in_square_brackets (const std::string &cmd, std::string &context)
 
int parser_cmd_list_file (shared_ptr< DataBuffer > pbuff, CmdMap *pCmdMap=nullptr)
 
std::string remove_square_brackets (const std::string &cmd)
 
template<class T>
void * create_object ()
 
string get_next_param (const string &cmd, size_t &pos, char separate)
 
string remove_square_brackets (const string &cmd)
 
int get_string_in_square_brackets (const string &cmd, string &context)
 
template<typename T, uint64_t MAX_VAL>
str_to_uint (const std::string &str, bool *conversion_succeeded)
 
uint16_t str_to_uint16 (const string &str, bool *conversion_succeeded)
 
uint32_t str_to_uint32 (const string &str, bool *conversion_succeeded)
 
uint64_t str_to_uint64 (const string &str, bool *conversion_succeeded)
 
template<class T>
shared_ptr< CmdBasenew_cmd_obj (char *p)
 
shared_ptr< CmdBasecreate_cmd_obj (string cmd)
 
int uuu_run_cmd (const char *cmd, int dry)
 
int run_cmd (CmdCtx *pCtx, const char *cmd, int dry)
 
int run_cmds (const char *protocol, CmdCtx *p)
 
static int insert_one_cmd (const char *cmd, CmdMap *pCmdMap)
 
static int added_default_boot_cmd (const char *filename)
 
int check_version (string str)
 
int uuu_run_cmd_script (const char *buff, int)
 
int uuu_auto_detect_file (const char *filename)
 
int notify_done (uuu_notify nt, void *p)
 
int uuu_wait_uuu_finish (int deamon, int dry)
 

Variables

static CmdMap g_cmd_map
 
static CmdObjCreateMap g_cmd_create_map
 
static string g_cmd_list_file
 
static map< thread::id, map< string, string > > g_environment
 
FN g_fn = create_object<int>
 

Macro Definition Documentation

◆ _pclose

#define _pclose   pclose

◆ _popen

#define _popen   popen

Typedef Documentation

◆ FN

typedef void *(* FN) ()

Function Documentation

◆ added_default_boot_cmd()

static int added_default_boot_cmd ( const char * filename)
static

◆ check_version()

int check_version ( string str)

◆ clear_env()

int clear_env ( )

◆ create_cmd_obj()

shared_ptr< CmdBase > create_cmd_obj ( string cmd)

◆ create_object()

template<class T>
void * create_object ( )

◆ get_env_variable()

string get_env_variable ( string key)

◆ get_next_param()

string get_next_param ( const string & cmd,
size_t & pos,
char separate )

◆ get_string_in_square_brackets() [1/2]

int get_string_in_square_brackets ( const std::string & cmd,
std::string & context )

◆ get_string_in_square_brackets() [2/2]

int get_string_in_square_brackets ( const string & cmd,
string & context )

◆ insert_env_variable()

int insert_env_variable ( string key,
string value )

◆ insert_one_cmd()

static int insert_one_cmd ( const char * cmd,
CmdMap * pCmdMap )
static

◆ is_env_exist()

bool is_env_exist ( string key)

◆ new_cmd_obj()

template<class T>
shared_ptr< CmdBase > new_cmd_obj ( char * p)

◆ notify_done()

int notify_done ( uuu_notify nt,
void * p )

◆ parser_cmd_list_file()

int parser_cmd_list_file ( shared_ptr< DataBuffer > pbuff,
CmdMap * pCmdMap = nullptr )

◆ remove_square_brackets() [1/2]

std::string remove_square_brackets ( const std::string & cmd)

◆ remove_square_brackets() [2/2]

string remove_square_brackets ( const string & cmd)

◆ run_cmd()

int run_cmd ( CmdCtx * pCtx,
const char * cmd,
int dry )

◆ run_cmds()

int run_cmds ( const char * protocol,
CmdCtx * p )

◆ str_to_uint()

template<typename T, uint64_t MAX_VAL>
T str_to_uint ( const std::string & str,
bool * conversion_succeeded )

◆ str_to_uint16()

uint16_t str_to_uint16 ( const string & str,
bool * conversion_succeeded )

◆ str_to_uint32()

uint32_t str_to_uint32 ( const string & str,
bool * conversion_succeeded )

◆ str_to_uint64()

uint64_t str_to_uint64 ( const string & str,
bool * conversion_succeeded )

◆ uuu_auto_detect_file()

int uuu_auto_detect_file ( const char * filename)

◆ uuu_run_cmd()

int uuu_run_cmd ( const char * cmd,
int dry )

◆ uuu_run_cmd_script()

int uuu_run_cmd_script ( const char * buff,
int dry )

◆ uuu_wait_uuu_finish()

int uuu_wait_uuu_finish ( int deamon,
int dry )

Variable Documentation

◆ g_cmd_create_map

CmdObjCreateMap g_cmd_create_map
static

◆ g_cmd_list_file

string g_cmd_list_file
static

◆ g_cmd_map

CmdMap g_cmd_map
static

◆ g_environment

map<thread::id, map<string, string> > g_environment
static

◆ g_fn

FN g_fn = create_object<int>