include/Session.H

Go to the documentation of this file.
00001 /* ${copyright}$ */
00002 /* $Id: Session.H 768 2006-06-19 21:33:19Z koji $ */
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   string get_last_command();
00094 
00096 
00099   string get_last_response();
00100 
00102 
00105   string get_server();
00106 
00108 
00111   int get_port();
00112   
00114 
00117   void set_server(const string &server);
00118 
00120 
00123   void set_port(const int &port);
00124 
00125 private:
00127 
00130   void read_templates(const string &templates_dir = TEMPLATESDIR);
00131 
00133   auto_ptr<DomParser> _parser;
00134 
00136   auto_ptr<TransportTLS> _transport;
00137   
00139   auto_ptr<Greeting> _greeting;
00140 
00142   map < ActionType, string, less<ActionType> > _templates;
00143 
00145   string _last_command;
00146 
00148   string _last_response;
00149 
00151   string _server;
00152   
00154   int _port;
00155 
00157   bool _cert_common_name_check_enabled;
00158 };
00159 
00160 
00161 LIBEPP_NICBR_NS_END
00162 #endif //__SESSION_H__

Generated on Tue Mar 20 13:02:18 2007 for libepp_nicbr by  doxygen 1.4.7