include/Session.H

Go to the documentation of this file.
00001 /* ${copyright}$ */
00002 /* $Id: Session.H 923 2008-06-26 18:41:30Z eduardo $ */
00007 #ifndef __SESSION_H__
00008 #define __SESSION_H__
00009 
00010 #include <map>
00011 
00012 #include "libepp_nicbr.H"
00013 
00014 #include "DomParser.H"
00015 #include "TransportTLS.H"
00016 #include "Greeting.H"
00017 #include "Action.H"
00018 
00019 //for systems that don't have srandomdev (e.g. Linux)
00020 #ifndef HAVE_SRANDOMDEV
00021 #define srandomdev() srand((unsigned) time(NULL))
00022 #endif
00023 
00024 using std::auto_ptr;
00025 using std::map;
00026 
00027 LIBEPP_NICBR_NS_BEGIN
00028 
00030 class Session
00031 {
00032 public:
00034 
00039   Session(const string &server = "localhost", const int port = 700, 
00040           const string &templates_dir = TEMPLATESDIR);
00041   
00043   ~Session();
00044   
00046 
00049   void enable_xml_validation(const string &schemas_dir = SCHEMASDIR);
00050 
00052   void disable_xml_validation();
00053 
00055   void enable_cert_common_name_check();
00056 
00058   void disable_cert_common_name_check();
00059 
00061 
00066   void connect(const string &client_cert_file, const string &root_ca_file,
00067                const string &pem_passphrase = "");
00068 
00070   void disconnect();
00071 
00073   void send_hello();
00074 
00076 
00079   Greeting *get_greeting();
00080 
00082 
00086   void process_action(Action *action_to_be_processed, 
00087                       const string clTRID = "");
00088 
00090 
00093   void runXML(string input);
00094 
00096 
00099   string get_last_command();
00100 
00102 
00105   string get_last_response();
00106 
00108 
00111   string get_server();
00112 
00114 
00117   int get_port();
00118   
00120 
00123   void set_server(const string &server);
00124 
00126 
00129   void set_port(const int &port);
00130 
00131 private:
00133 
00136   void read_templates(const string &templates_dir = TEMPLATESDIR);
00137 
00139   auto_ptr<DomParser> _parser;
00140 
00142   auto_ptr<TransportTLS> _transport;
00143   
00145   auto_ptr<Greeting> _greeting;
00146 
00148   map < ActionType, string, less<ActionType> > _templates;
00149 
00151   string _last_command;
00152 
00154   string _last_response;
00155 
00157   string _server;
00158   
00160   int _port;
00161 
00163   bool _cert_common_name_check_enabled;
00164 };
00165 
00166 
00167 LIBEPP_NICBR_NS_END
00168 #endif //__SESSION_H__

Generated on Tue Mar 17 16:03:07 2009 for libepp_nicbr by  doxygen 1.4.7