include/Session.H

Go to the documentation of this file.
00001 /* ${copyright}$ */
00002 /* $Id: Session.H 543 2006-03-07 12:31:53Z cesar $ */
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 send_hello();
00065 
00067 
00070   Greeting *get_greeting();
00071 
00073 
00077   void process_action(Action *action_to_be_processed, 
00078                       const string clTRID = "");
00079 
00081 
00084   string get_last_command();
00085 
00087 
00090   string get_last_response();
00091 
00093 
00096   string get_server();
00097 
00099 
00102   int get_port();
00103   
00105 
00108   void set_server(const string &server);
00109 
00111 
00114   void set_port(const int &port);
00115 
00116 private:
00118 
00121   void read_templates(const string &templates_dir = TEMPLATESDIR);
00122 
00124   auto_ptr<DomParser> _parser;
00125 
00127   auto_ptr<TransportTLS> _transport;
00128   
00130   auto_ptr<Greeting> _greeting;
00131 
00133   map < ActionType, string, less<ActionType> > _templates;
00134 
00136   string _last_command;
00137 
00139   string _last_response;
00140 
00142   string _server;
00143   
00145   int _port;
00146 };
00147 
00148 
00149 LIBEPP_NICBR_NS_END
00150 #endif //__SESSION_H__

Generated on Wed May 3 15:32:48 2006 for libepp_nicbr by  doxygen 1.4.6