From: Asbjorn M. <ste...@us...> - 2002-03-14 18:37:57
|
Update of /cvsroot/epp-rtk/epp-rtk/c++/src/transport In directory usw-pr-cvs1:/tmp/cvs-serv14959 Modified Files: epp_TransportBase.h epp_TransportConn.h epp_TransportIOStream.cc epp_TransportIOStream.h epp_TransportSSL.cc epp_TransportSSL.h epp_TransportTCP.cc epp_TransportTCP.h transports.h Log Message: Added JavaDocs documentation to all files, and minor cleanups. Index: epp_TransportBase.h =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportBase.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** epp_TransportBase.h 13 Mar 2002 13:55:19 -0000 1.5 --- epp_TransportBase.h 14 Mar 2002 18:37:50 -0000 1.6 *************** *** 29,32 **** --- 29,37 ---- #define __EPP_TRANSPORTBASE_H + /** @file epp_TransportBase.h + * @brief Definition of epp_TransportBase and epp_TrException + * @author Asbjorn Steira Mikkelsen + */ + #include <domtools/refcount.h> #include <string> *************** *** 35,46 **** namespace epptransport { ! class epp_TransportBase { protected: ! string m_type; public: epp_TransportBase() { --- 40,53 ---- namespace epptransport { ! ! /// Abstract class defining common methods and attributes used in all transport classes class epp_TransportBase { protected: ! string m_type; /**< Transport type */ public: + /// Null constructor epp_TransportBase() { *************** *** 48,64 **** --- 55,93 ---- }; + /// Destructor virtual ~epp_TransportBase() {}; + /// Abstract function, writing data to server + /// @param xml_string Data to write to server virtual void writeToServer(const string & xml_string) = 0; + + /// Abstract function, reading data from server + /// @return Data read from server virtual string readFromServer() = 0; + /// Connects to server virtual void connect() {}; + + /// Disconnects from server virtual void disconnect() {}; + /// Returning the port of the server + /// @return Server port virtual unsigned long getServerPort() { return 0;}; + + /// Setting the port of the server + /// @param serverPort Server port virtual void setServerPort(const unsigned long & serverPort) {}; + + /// Returning the name of the server + /// @return Server name virtual string getServerName() { return "";}; + + /// Setting the name of the server + /// @param serverName Server name virtual void setServerName(const string & serverName) {}; + /// Returning type of transport + /// @return Transport type virtual string getType() { *************** *** 67,82 **** }; typedef refcnt_ptr<epp_TransportBase> epp_TransportBase_ref; ! class epp_TrException : public exception { public: ! ! string m_error_message; epp_TrException() {}; virtual ~epp_TrException() {}; epp_TrException(const string & data) throw() { --- 96,115 ---- }; + /// Typedef for the ref to the epp_TransportBase class typedef refcnt_ptr<epp_TransportBase> epp_TransportBase_ref; ! /// Exception class containing information about errors encountered in transport handling class epp_TrException : public exception { public: ! string m_error_message; /**< Text describing the encountered error */ + /// Null constructor epp_TrException() {}; + + /// Destructor virtual ~epp_TrException() {}; + /// Constructor with error data epp_TrException(const string & data) throw() { *************** *** 84,88 **** }; ! // Kept for backwords compatibility: virtual string getString() { --- 117,122 ---- }; ! /// Returns the error string ! /// @deprecated Access the data directly instead virtual string getString() { *************** *** 90,93 **** --- 124,128 ---- } + /// Constructor with error data, file name, and line number epp_TrException(const string file, const int lineno, const string & data) throw() { Index: epp_TransportConn.h =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportConn.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** epp_TransportConn.h 13 Mar 2002 13:55:19 -0000 1.5 --- epp_TransportConn.h 14 Mar 2002 18:37:50 -0000 1.6 *************** *** 29,32 **** --- 29,37 ---- #define __EPP_TRANSPORTCONN_H + /** @file epp_TransportConn.h + * @brief Definition of epp_TransportConn + * @author Asbjorn Steira Mikkelsen + */ + #include <string> #include "epp_TransportBase.h" *************** *** 34,62 **** namespace epptransport { class epp_TransportConn : public epp_TransportBase { protected: ! string m_serverName; ! unsigned long m_serverPort; public: epp_TransportConn() { m_serverName = "epp.nic.name"; m_serverPort = 3121; }; virtual ~epp_TransportConn() {}; ! virtual void writeToServer(const string & xml_string) = 0; ! virtual string readFromServer() = 0; ! virtual void connect(const string & serverName, const unsigned long & serverPort) = 0; virtual void connect() = 0; virtual void disconnect() = 0; ! // Deprecated, use getServerName instead virtual string getServerIP() { --- 39,79 ---- namespace epptransport { + /// Abstract class defining common methods and attributes used in + /// connection-based transport classes + /// @see epp_TransportBase for additional information class epp_TransportConn : public epp_TransportBase { protected: ! string m_serverName; /**< The name of the server to connect to */ ! unsigned long m_serverPort; /**< The port of the server to connect to */ public: + /// Null constructor, setting epp_TransportBase#m_type epp_TransportConn() { + m_type = "epp_TransportConn"; m_serverName = "epp.nic.name"; m_serverPort = 3121; }; + /// Destructor virtual ~epp_TransportConn() {}; ! /// Abstract function, connects to server using server name and server port ! /// @param serverName Name of server ! /// @param serverPort Port of server virtual void connect(const string & serverName, const unsigned long & serverPort) = 0; + + /// Abstract function, connects to server virtual void connect() = 0; + + /// Abstract function, disconnects from server virtual void disconnect() = 0; ! /// Returning the IP address of the server ! /// @return IP address of server ! /// @deprecated Use getServerName() instead virtual string getServerIP() { *************** *** 64,68 **** }; ! // Deprecated, use setServerName instead virtual void setServerIP(const string & serverIP) { --- 81,87 ---- }; ! /// Setting the IP address of the server ! /// @param serverIP IP address of server ! /// @deprecated Use setServerName() instead virtual void setServerIP(const string & serverIP) { *************** *** 70,73 **** --- 89,94 ---- } + /// Returning the port of the server + /// @return Port for server virtual unsigned long getServerPort() { *************** *** 75,78 **** --- 96,101 ---- }; + /// Setting the port of the server + /// @param serverPort Port for server virtual void setServerPort(const unsigned long & serverPort) { *************** *** 80,83 **** --- 103,108 ---- } + /// Returning the name of the server + /// @return Name of server virtual string getServerName() { *************** *** 85,88 **** --- 110,115 ---- }; + /// Setting the name of the server + /// @param serverName Name of server virtual void setServerName(const string & serverName) { *************** *** 92,95 **** --- 119,123 ---- }; + /// Typedef for the ref to the epp_TransportConn class typedef refcnt_ptr<epp_TransportConn> epp_TransportConn_ref; }; Index: epp_TransportIOStream.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportIOStream.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** epp_TransportIOStream.cc 8 Mar 2002 11:10:15 -0000 1.5 --- epp_TransportIOStream.cc 14 Mar 2002 18:37:50 -0000 1.6 *************** *** 26,31 **** --- 26,38 ---- ************************************************************************/ + /** @file epp_TransportIOStream.cc + * @brief Definition of epp_TransportIOStream functions + * @author Asbjorn Steira Mikkelsen + * @see epp_TransportIOStream.h + */ + #include "epp_TransportIOStream.h" + using namespace epptransport; *************** *** 42,45 **** --- 49,53 ---- #endif } + string epp_TransportIOStream::readFromServer() Index: epp_TransportIOStream.h =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportIOStream.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** epp_TransportIOStream.h 13 Mar 2002 13:55:19 -0000 1.3 --- epp_TransportIOStream.h 14 Mar 2002 18:37:50 -0000 1.4 *************** *** 29,32 **** --- 29,37 ---- #define __EPP_TRANSPORTIOSTREAM_H + /** @file epp_TransportIOStream.h + * @brief Definition of epp_TransportIOStream + * @author Asbjorn Steira Mikkelsen + */ + #include <string> #include "epp_TransportBase.h" *************** *** 34,41 **** --- 39,50 ---- namespace epptransport { + /// Class defining the IOStream transport, which reads from cin + /// and writes to cout + /// @see epp_TransportBase for additional information class epp_TransportIOStream : public epp_TransportBase { public: + /// Null constructor, setting epp_TransportBase#m_type epp_TransportIOStream() { *************** *** 43,53 **** --- 52,68 ---- }; + /// Destructor virtual ~epp_TransportIOStream() {}; + /// Writing data to cout + /// @param xml_string Data to write to cout void writeToServer(const string & xml_string); + /// Reading data from cin + /// @return Data read from cin string readFromServer(); }; + /// Typedef for the ref to the epp_TransportIOStream class typedef refcnt_ptr<epp_TransportIOStream> epp_TransportIOStream_ref; }; Index: epp_TransportSSL.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportSSL.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** epp_TransportSSL.cc 13 Mar 2002 15:50:39 -0000 1.12 --- epp_TransportSSL.cc 14 Mar 2002 18:37:50 -0000 1.13 *************** *** 26,29 **** --- 26,35 ---- ************************************************************************/ + /** @file epp_TransportSSL.cc + * @brief Definition of epp_TransportSSL functions + * @author Asbjorn Steira Mikkelsen + * @see epp_TransportSSL.h + */ + #include "epp_TransportSSL.h" #include <openssl/ssl.h> *************** *** 75,78 **** --- 81,85 ---- } + string epp_TransportSSL::readFromServer() { *************** *** 123,126 **** --- 130,134 ---- } + void epp_TransportSSL::connect(const string & serverName, const unsigned long & serverPort, const string & certFile, const string & cacertFile = "", *************** *** 135,138 **** --- 143,147 ---- } + void epp_TransportSSL::connect(const string & serverName, const unsigned long & serverPort) { *************** *** 142,145 **** --- 151,155 ---- } + void epp_TransportSSL::connect() { *************** *** 181,184 **** --- 191,195 ---- } + void epp_TransportSSL::disconnect() Index: epp_TransportSSL.h =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportSSL.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** epp_TransportSSL.h 13 Mar 2002 15:50:39 -0000 1.11 --- epp_TransportSSL.h 14 Mar 2002 18:37:50 -0000 1.12 *************** *** 29,32 **** --- 29,37 ---- #define __EPP_TRANSPORTSSL_H + /** @file epp_TransportSSL.h + * @brief Definition of epp_TransportSSL + * @author Asbjorn Steira Mikkelsen + */ + #include "../ssl/npssl.h" #include <string> *************** *** 36,53 **** namespace epptransport { class epp_TransportSSL : public epp_TransportConn { private: ! string m_certFile; ! string m_cacertFile; ! string m_cacertDir; ! ! npbase::npssl *sslserver; ! int sockfd; public: ! epp_TransportSSL() : epp_TransportConn() { m_type="epp_TransportSSL"; --- 41,61 ---- namespace epptransport { + /// Class defining the SSL transport, which reads from and + /// writes to a socket through a secure socket layer + /// @see epp_TransportConn for additional information class epp_TransportSSL : public epp_TransportConn { private: + string m_certFile; /**< SSL certificate file location */ + string m_cacertFile; /**< Certificate authority filename */ + string m_cacertDir; /**< Certificate authority directory */ ! npbase::npssl *sslserver; /**< SSL server handler */ ! int sockfd; /**< Socket file descriptor */ public: ! /// Null constructor, setting epp_TransportBase#m_type ! epp_TransportSSL() { m_type="epp_TransportSSL"; *************** *** 57,64 **** }; epp_TransportSSL(const string & certFile, const string & cacertFile = "", const string & cacertDir = "") - : epp_TransportConn() { m_type="epp_TransportSSL"; --- 65,72 ---- }; + /// Constructor with certificate file locations epp_TransportSSL(const string & certFile, const string & cacertFile = "", const string & cacertDir = "") { m_type="epp_TransportSSL"; *************** *** 69,72 **** --- 77,81 ---- }; + /// Destructor virtual ~epp_TransportSSL() { *************** *** 74,82 **** --- 83,109 ---- }; + /// Writing data to server + /// @param xml_string Data to write to server + /// @throw epp_TrException If it is not connected to the server + /// @throw epp_TrException If it is unable write to server void writeToServer(const string & xml_string); + /// Reading data from server + /// @return Data read from server + /// @throw epp_TrException If it is not connected to the server + /// @throw epp_TrException If it is unable to read from server string readFromServer(); + /// Connecting to server by setting server name and server port and then calling #connect() + /// @param serverName Name of server + /// @param serverPort Port of server void connect(const string & serverName, const unsigned long & serverPort); + + /// Connecting to server by setting server name/port and certificate files and then calling #connect() + /// @param serverName Name of server + /// @param serverPort Port of server + /// @param certFile SSL certificate file location + /// @param cacertFile Certificate authority filename + /// @param cacertDir Certificate authority directory void connect(const string & serverName, const unsigned long & serverPort, *************** *** 85,91 **** --- 112,127 ---- const string & cacertDir = ""); + /// Connects to server + /// @throw epp_TrException If it is unable to connect to server + /// @throw epp_TrException If it is unable to set up a connection with the server + /// @throw epp_TrException If SSL handshake fails void connect(); + + /// Disconnects from server void disconnect(); + + /// Returning the location of the SSL certificate file + /// @return Location of the SSL certificate file string getCertFile() { *************** *** 93,96 **** --- 129,134 ---- }; + /// Setting the location of the SSL certificate file + /// @param certFile Location of the SSL certificate file void setCertFile(const string & certFile) { *************** *** 98,101 **** --- 136,141 ---- } + /// Returning the filename of the certificate authority file + /// @return Filename of the certificate authority file string getCACertFile() { *************** *** 103,106 **** --- 143,148 ---- } + /// Setting the filename of the certificate authority file + /// @param cacertFile Filename of the certificate authority file void setCACertFile(const string & cacertFile) { *************** *** 108,111 **** --- 150,155 ---- } + /// Returning the directory of the certificate authority file + /// @return Directory of the certificate authority file string getCACertDir() { *************** *** 113,116 **** --- 157,162 ---- } + /// Setting the directory of the certificate authority file + /// @param cacertDir Directory of the certificate authority file void setCACertDir(const string & cacertDir) { *************** *** 118,121 **** --- 164,169 ---- } + /// Tells whether the client is connected to the server or not + /// @return True if client is connect to server, otherwise false bool connected() { *************** *** 124,127 **** --- 172,176 ---- }; + /// Typedef for the ref to the epp_TransportSSL class typedef refcnt_ptr<epp_TransportSSL> epp_TransportSSL_ref; Index: epp_TransportTCP.cc =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportTCP.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** epp_TransportTCP.cc 13 Mar 2002 13:55:19 -0000 1.3 --- epp_TransportTCP.cc 14 Mar 2002 18:37:50 -0000 1.4 *************** *** 26,29 **** --- 26,36 ---- ************************************************************************/ + + /** @file epp_TransportTCP.cc + * @brief Definition of epp_TransportTCP functions + * @author Asbjorn Steira Mikkelsen + * @see epp_TransportTCP.h + */ + #include "epp_TransportTCP.h" *************** *** 63,67 **** ! epp_TransportTCP::epp_TransportTCP() : epp_TransportConn() { m_type="epp_TransportTCP"; --- 70,74 ---- ! epp_TransportTCP::epp_TransportTCP() { m_type="epp_TransportTCP"; *************** *** 71,75 **** timeout = 0; readbuf[0] = '\0'; - memset(rbuf, 0, sizeof(rbuf)); } --- 78,81 ---- *************** *** 183,186 **** --- 189,193 ---- } + int epp_TransportTCP::getC() { *************** *** 245,248 **** --- 252,256 ---- } + void epp_TransportTCP::connect() { *************** *** 270,273 **** --- 278,282 ---- } + void epp_TransportTCP::disconnect() Index: epp_TransportTCP.h =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/epp_TransportTCP.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** epp_TransportTCP.h 13 Mar 2002 13:55:19 -0000 1.2 --- epp_TransportTCP.h 14 Mar 2002 18:37:50 -0000 1.3 *************** *** 29,32 **** --- 29,37 ---- #define __EPP_TRANSPORTTCP_H + /** @file epp_TransportTCP.h + * @brief Definition of epp_TransportTCP + * @author Asbjorn Steira Mikkelsen + */ + #include <string> #include "epp_TransportConn.h" *************** *** 35,50 **** namespace epptransport { class epp_TransportTCP : public epp_TransportConn { private: ! char readbuf[16384]; ! int sockfd; ! unsigned int pos; ! int len; ! unsigned int timeout; bool fillBuf(void); enum { READ = 1, --- 40,61 ---- namespace epptransport { + /// Class defining the TCP transport, which reads from and + /// writes to a socket + /// @see epp_TransportConn for additional information class epp_TransportTCP : public epp_TransportConn { private: ! char readbuf[16384]; /**< Buffer used when reading from server */ ! int sockfd; /**< Socket file descriptor */ ! unsigned int pos; /**< Read position in read buffer */ ! int len; /**< Length of data in read buffer */ ! unsigned int timeout; /**< Timeout value */ + /// Reads data from the socket into #readbuf + /// @return True if successful read from socket bool fillBuf(void); + /// Read or write operation enum { READ = 1, *************** *** 52,63 **** }; - protected: - - char rbuf[4096]; - public: epp_TransportTCP(); virtual ~epp_TransportTCP() { --- 63,72 ---- }; public: + /// Null constructor, setting epp_TransportBase#m_type epp_TransportTCP(); + /// Destructor virtual ~epp_TransportTCP() { *************** *** 65,80 **** --- 74,111 ---- }; + /// Writing data to server + /// @param xml_string Data to write to server + /// @throw epp_TrException If it cannot write to server void writeToServer(const string & xml_string); + /// Reading data from server + /// @return Data read from server string readFromServer(); + /// Selects type of operation (READ/WRITE) + /// @param type Type of operation to select + /// @return True if operation successfully selected + /// @throw epp_TrException If socket timed out bool select(int type) const; + + /// Connecting to server by setting server name and server port and then calling #connect() + /// @param serverName Name of server + /// @param serverPort Port of server void connect(const string & serverName, const unsigned long & serverPort); + + /// Connects to server + /// @throw epp_TrException If it is unable to resolve hostname + /// @throw epp_TrException If it is unable to connect to server void connect(); + + /// Disconnects from server void disconnect(); + /// Reads one character from the server + /// @return ASCII value of read character, or -1 if nothing to read int getC(); }; + /// Typedef for the ref to the epp_TransportTCP class typedef refcnt_ptr<epp_TransportTCP> epp_TransportTCP_ref; Index: transports.h =================================================================== RCS file: /cvsroot/epp-rtk/epp-rtk/c++/src/transport/transports.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** transports.h 12 Mar 2002 13:30:43 -0000 1.1 --- transports.h 14 Mar 2002 18:37:50 -0000 1.2 *************** *** 29,32 **** --- 29,37 ---- #define __TRANSPORTS_H + /** @file transports.h + * @brief Files including all allowed (non-abstract) transports + * @author Asbjorn Steira Mikkelsen + */ + #include "epp_TransportIOStream.h" #include "epp_TransportSSL.h" |