libepp_nicbr
Functions
SheppCommandFunctions.H File Reference

EPP command-line shell client command functions include file. More...

#include <fstream>
#include <unistd.h>
#include <termios.h>
#include <iostream>
#include "SheppGlobal.H"
#include "SheppStrUtil.H"
#include "SheppObjSet.H"
#include "SheppPrint.H"
#include "IoException.H"
#include "TransportException.H"
#include "EppException.H"
#include "XmlException.H"
#include "Login.H"
#include "Logout.H"

Go to the source code of this file.

Functions

int cmd_source (vector< string > &)
 
int cmd_login (vector< string > &args)
 Send an EPP Login. More...
 
int cmd_logout (vector< string > &args)
 Send an EPP Logout. More...
 
int cmd_hello (vector< string > &args)
 Send an EPP HELLO. More...
 
int cmd_poll (vector< string > &)
 main poll command More...
 
int cmd_domain (vector< string > &)
 main domain command More...
 
int cmd_contact (vector< string > &)
 main contact command More...
 
int cmd_def_reg (vector< string > &)
 main defensive registration command More...
 
int cmd_xmlcmd (vector< string > &args)
 Shows last XML command. More...
 
int cmd_xmlrsp (vector< string > &args)
 Shows last XML response. More...
 
int cmd_runxml (vector< string > &args)
 Run XML input command. More...
 
int cmd_server (vector< string > &args)
 Sets server address [and port] based on input command-line. More...
 
int cmd_port (vector< string > &args)
 Sets server port based on input command-line. More...
 
int cmd_client_pem (vector< string > &args)
 Sets client.pem certificate file location. More...
 
int cmd_root_pem (vector< string > &args)
 Sets root.pem certificate file location. More...
 
int cmd_pass (vector< string > &args)
 Sets SSL certificate passphrase based on input command-line. More...
 
int cmd_user (vector< string > &args)
 Sets login user based on input command-line. More...
 
int cmd_login_pw (vector< string > &args)
 Sets EPP login password based on input command-line. More...
 
int cmd_login_new_pw (vector< string > &args)
 Sets new EPP login password based on input command-line. More...
 
int cmd_lang (vector< string > &args)
 Sets text language based on input command-line. More...
 
int cmd_connect (vector< string > &args)
 Connects to previously specified server and port. More...
 
int cmd_disconnect (vector< string > &args)
 Closes connection. More...
 
int cmd_cltrid (vector< string > &args)
 Sets the client transaction id for the next commands. More...
 
int cmd_help (vector< string > &args)
 Prints help. More...
 
int cmd_about (vector< string > &args)
 Prints version information. More...
 
int cmd_quit (vector< string > &args)
 Leaves shepp. More...
 
int cmd_beauty (vector< string > &args)
 Turns XML beautifier ON and OFF. More...
 
int cmd_debug (vector< string > &args)
 Turns debug messages ON and OFF. More...
 
int cmd_autorsp (vector< string > &args)
 Turns auto-show response ON and OFF. More...
 
int cmd_keepalive (vector< string > &args)
 Turns keep-alive ON and OFF. More...
 
int cmd_peer_crt_check (vector< string > &args)
 Turn peer's certificate check ON and OFF. More...
 
string getpasswd (string prompt)
 Function to read from stdin without echoing. More...
 
void init_commands ()
 Populates set of available commands.
 
const SheppCommandfind_command (string name)
 Given a word check if it's a valid SheppCommand. More...
 
int executeInputFile (const string &file)
 
void print_cmd_sent_ok ()
 Prints "command sent ok" message.
 
int process_action (Action &act)
 Send and EPP Action. More...
 

Detailed Description

EPP command-line shell client command functions include file.

Function Documentation

int cmd_about ( vector< string > &  args)

Prints version information.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References about().

Referenced by init_commands().

int cmd_autorsp ( vector< string > &  args)

Turns auto-show response ON and OFF.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_beauty ( vector< string > &  args)

Turns XML beautifier ON and OFF.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_client_pem ( vector< string > &  args)

Sets client.pem certificate file location.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_cltrid ( vector< string > &  args)

Sets the client transaction id for the next commands.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References _session.

Referenced by init_commands().

int cmd_connect ( vector< string > &  args)

Connects to previously specified server and port.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References _server, _session, cmd_server(), cmd_xmlrsp(), GeneralException::get_code(), GeneralException::get_low_level_msg(), and GeneralException::get_msg().

Referenced by init_commands().

int cmd_contact ( vector< string > &  args)

main contact command

Parameters
argcommand-line input arguments
Returns
0 if ok, -1 otherwise

References cmd_contact_check(), cmd_contact_create(), cmd_contact_delete(), cmd_contact_help(), cmd_contact_info(), cmd_contact_renew(), cmd_contact_transfer(), and cmd_contact_update().

Referenced by init_commands().

int cmd_debug ( vector< string > &  args)

Turns debug messages ON and OFF.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_def_reg ( vector< string > &  args)

main defensive registration command

Parameters
argcommand-line input arguments
Returns
0 if ok, -1 otherwise

References cmd_def_reg_check(), cmd_def_reg_create(), cmd_def_reg_delete(), cmd_def_reg_help(), cmd_def_reg_info(), cmd_def_reg_renew(), cmd_def_reg_transfer(), and cmd_def_reg_update().

Referenced by init_commands().

int cmd_disconnect ( vector< string > &  args)

Closes connection.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References _server, _session, GeneralException::get_code(), GeneralException::get_low_level_msg(), and GeneralException::get_msg().

Referenced by init_commands().

int cmd_domain ( vector< string > &  args)

main domain command

Parameters
argcommand-line input arguments
Returns
0 if ok, -1 otherwise

References cmd_domain_check(), cmd_domain_create(), cmd_domain_delete(), cmd_domain_help(), cmd_domain_info(), cmd_domain_renew(), cmd_domain_transfer(), and cmd_domain_update().

Referenced by init_commands().

int cmd_hello ( vector< string > &  args)

Send an EPP HELLO.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References _session, GeneralException::get_code(), GeneralException::get_low_level_msg(), GeneralException::get_msg(), and print_cmd_sent_ok().

Referenced by init_commands().

int cmd_help ( vector< string > &  args)

Prints help.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References _commands.

Referenced by init_commands().

int cmd_keepalive ( vector< string > &  args)

Turns keep-alive ON and OFF.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_lang ( vector< string > &  args)

Sets text language based on input command-line.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_login ( vector< string > &  args)

Send an EPP Login.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References LoginCmd::add_extURI(), Login::get_command(), process_action(), LoginCmd::set_clID(), LoginCmd::set_lang(), LoginCmd::set_new_pw(), and LoginCmd::set_pw().

Referenced by init_commands().

int cmd_login_new_pw ( vector< string > &  args)

Sets new EPP login password based on input command-line.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References getpasswd().

Referenced by init_commands().

int cmd_login_pw ( vector< string > &  args)

Sets EPP login password based on input command-line.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References getpasswd().

Referenced by init_commands().

int cmd_logout ( vector< string > &  args)

Send an EPP Logout.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References process_action().

Referenced by init_commands().

int cmd_pass ( vector< string > &  args)

Sets SSL certificate passphrase based on input command-line.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References getpasswd().

Referenced by init_commands().

int cmd_peer_crt_check ( vector< string > &  args)

Turn peer's certificate check ON and OFF.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_poll ( vector< string > &  args)

main poll command

Parameters
argcommand-line input arguments
Returns
0 if ok, -1 otherwise

References cmd_poll_help(), Poll::get_command(), PollCmd::get_msgID(), PollCmd::get_op(), process_action(), PollCmd::set_msgID(), and PollCmd::set_op().

Referenced by init_commands().

int cmd_port ( vector< string > &  args)

Sets server port based on input command-line.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_quit ( vector< string > &  args)

Leaves shepp.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References _session.

Referenced by init_commands(), and main().

int cmd_root_pem ( vector< string > &  args)

Sets root.pem certificate file location.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_runxml ( vector< string > &  args)

Run XML input command.

Returns
0 if ok, -1 otherwise

References _session, GeneralException::get_code(), GeneralException::get_low_level_msg(), GeneralException::get_msg(), and print_cmd_sent_ok().

Referenced by init_commands().

int cmd_server ( vector< string > &  args)

Sets server address [and port] based on input command-line.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References _server, and SheppStrUtil::split().

Referenced by cmd_connect(), init_commands(), and main().

int cmd_source ( vector< string > &  args)

Given a input file, read and execute all shepp commands in this file

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References executeInputFile().

Referenced by init_commands().

int cmd_user ( vector< string > &  args)

Sets login user based on input command-line.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

Referenced by init_commands().

int cmd_xmlcmd ( vector< string > &  args)

Shows last XML command.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References _session, GeneralException::get_code(), GeneralException::get_msg(), StrUtil::iso88591_to_utf8(), and StrUtil::xml_beautifier().

Referenced by init_commands().

int cmd_xmlrsp ( vector< string > &  args)

Shows last XML response.

Parameters
argsinput command-line
Returns
0 if ok, -1 otherwise

References GeneralException::get_code(), GeneralException::get_msg(), and StrUtil::xml_beautifier().

Referenced by cmd_connect(), init_commands(), and print_cmd_sent_ok().

int executeInputFile ( const string &  file)

Given a input file, read and execute all shepp commands in this file

Parameters
inputFileinput file with shepp commands
Returns
0 if ok, -1 otherwise

References find_command(), SheppCommand::function, init_commands(), SheppStrUtil::parse_line(), and SheppStrUtil::trim().

Referenced by cmd_source(), and main().

const SheppCommand* find_command ( string  name)

Given a word check if it's a valid SheppCommand.

Parameters
nameof command check validity
Returns
pointer to a SheppCommand if found, NULL pointer if not found

References _commands.

Referenced by execute(), and executeInputFile().

string getpasswd ( string  prompt)

Function to read from stdin without echoing.

Parameters
promptprompt to be echoed
Returns
content read from stdin

Referenced by cmd_login_new_pw(), cmd_login_pw(), and cmd_pass().

int process_action ( Action act)