include/Session.H

Go to the documentation of this file.
00001 /* ${copyright}$ */
00002 /* $Id: Session.H 748 2006-06-06 13:47:41Z 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 
00060   void connect(const string &client_cert_file, const string &root_ca_file,
00061                const string &pem_passphrase = "");
00062 
00064   void disconnect();
00065 
00067   void send_hello();
00068 
00070 
00073   Greeting *get_greeting();
00074 
00076 
00080   void process_action(Action *action_to_be_processed, 
00081                       const string clTRID = "");
00082 
00084 
00087   string get_last_command();
00088 
00090 
00093   string get_last_response();
00094 
00096 
00099   string get_server();
00100 
00102 
00105   int get_port();
00106   
00108 
00111   void set_server(const string &server);
00112 
00114 
00117   void set_port(const int &port);
00118 
00119 private:
00121 
00124   void read_templates(const string &templates_dir = TEMPLATESDIR);
00125 
00127   auto_ptr<DomParser> _parser;
00128 
00130   auto_ptr<TransportTLS> _transport;
00131   
00133   auto_ptr<Greeting> _greeting;
00134 
00136   map < ActionType, string, less<ActionType> > _templates;
00137 
00139   string _last_command;
00140 
00142   string _last_response;
00143 
00145   string _server;
00146   
00148   int _port;
00149 };
00150 
00151 
00152 LIBEPP_NICBR_NS_END
00153 #endif //__SESSION_H__

Generated on Thu Jun 8 17:40:00 2006 for libepp_nicbr by  doxygen 1.4.6