LogService
libdadi: utility tools for distributed applications
|
00001 /****************************************************************************/ 00002 /* Log forwarder implementation - Forwarder executable */ 00003 /* */ 00004 /* Author(s): */ 00005 /* - Gael Le Mahec (gael.le.mahec@ens-lyon.fr) */ 00006 /* */ 00007 /* This file is part of DIET . */ 00008 /* */ 00009 /* Copyright (C) 2000-2003 ENS Lyon, LIFC, INSA, INRIA and SysFera (2000) */ 00010 /* */ 00011 /* - Frederic.Desprez@ens-lyon.fr (Project Manager) */ 00012 /* - Eddy.Caron@ens-lyon.fr (Technical Manager) */ 00013 /* - Tech@sysfera.com (Maintainer and Technical Support) */ 00014 /* */ 00015 /* This software is a computer program whose purpose is to provide an */ 00016 /* distributed logging services. */ 00017 /* */ 00018 /* */ 00019 /* This software is governed by the CeCILL license under French law and */ 00020 /* abiding by the rules of distribution of free software. You can use, */ 00021 /* modify and/ or redistribute the software under the terms of the CeCILL */ 00022 /* license as circulated by CEA, CNRS and INRIA at the following URL */ 00023 /* "http://www.cecill.info". */ 00024 /* */ 00025 /* As a counterpart to the access to the source code and rights to copy, */ 00026 /* modify and redistribute granted by the license, users are provided */ 00027 /* only with a limited warranty and the software's author, the holder */ 00028 /* of the economic rights, and the successive licensors have only */ 00029 /* limited liability. */ 00030 /* */ 00031 /* In this respect, the user's attention is drawn to the risks */ 00032 /* associated with loading, using, modifying and/or developing or */ 00033 /* reproducing the software by the user in light of its specific status */ 00034 /* of free software, that may mean that it is complicated to */ 00035 /* manipulate, and that also therefore means that it is reserved for */ 00036 /* developers and experienced professionals having in-depth computer */ 00037 /* knowledge. Users are therefore encouraged to load and test the */ 00038 /* software's suitability as regards their requirements in conditions */ 00039 /* enabling the security of their systems and/or data to be ensured and, */ 00040 /* more generally, to use and operate it in the same conditions as */ 00041 /* regards security. */ 00042 /* */ 00043 /* The fact that you are presently reading this means that you have had */ 00044 /* knowledge of the CeCILL license and that you accept its terms. */ 00045 /* */ 00046 /****************************************************************************/ 00047 00048 #ifndef _LOGFWDR_HH_ 00049 #define _LOGFWDR_HH_ 00050 00051 #include <string> 00052 #include "Options.hh" 00053 00054 class LogForwarder; 00055 class LogORBMgr; 00056 00057 00058 class FwrdConfig : public Configuration { 00059 public: 00060 explicit FwrdConfig(const std::string& pgName); 00061 00062 const std::string& 00063 getName() const; 00064 00065 const std::string& 00066 getPeerName() const; 00067 00068 const std::string& 00069 getPeerIOR() const; 00070 00071 const std::string& 00072 getSshHost() const; 00073 00074 const std::string& 00075 getRemoteHost() const; 00076 00077 const std::string& 00078 getRemotePortTo() const; 00079 00080 const std::string& 00081 getRemotePortFrom() const; 00082 00083 const std::string& 00084 getLocalPortFrom() const; 00085 00086 bool 00087 createTo() const; 00088 00089 bool 00090 createFrom() const; 00091 00092 const std::string& 00093 getSshPath() const; 00094 00095 const std::string& 00096 getSshPort() const; 00097 00098 const std::string& 00099 getSshLogin() const; 00100 00101 const std::string& 00102 getSshKeyPath() const; 00103 00104 int 00105 getNbRetry() const; 00106 00107 unsigned int 00108 getWaitingTime() const; 00109 00110 const std::string& 00111 getCfgPath() const; 00112 00113 void 00114 setName(const std::string& name); 00115 00116 void 00117 setPeerName(const std::string& name); 00118 00119 void 00120 setPeerIOR(const std::string& ior); 00121 00122 void 00123 setSshHost(const std::string& host); 00124 00125 void 00126 setRemoteHost(const std::string& host); 00127 00128 void 00129 setRemotePortTo(const std::string& port); 00130 00131 void 00132 setRemotePortFrom(const std::string& port); 00133 00134 void 00135 setLocalPortFrom(const std::string& port); 00136 00137 void 00138 createTo(bool create); 00139 00140 void 00141 createFrom(bool create); 00142 00143 void 00144 setSshPath(const std::string& path); 00145 00146 void 00147 setSshPort(const std::string& port); 00148 00149 void 00150 setSshLogin(const std::string& login); 00151 00152 void 00153 setSshKeyPath(const std::string& path); 00154 00155 void 00156 setNbRetry(const int nb); 00157 00158 void 00159 setWaitingTime(const unsigned int time); 00160 00161 void 00162 setCfgPath(const std::string& path); 00163 00164 private: 00165 std::string name; 00166 std::string peerName; 00167 std::string peerHost; 00168 std::string peerPort; 00169 std::string peerIOR; 00170 00171 std::string sshHost; 00172 std::string remoteHost; 00173 std::string localPortFrom; 00174 std::string remotePortTo; 00175 std::string remotePortFrom; 00176 bool createTunnelTo; 00177 bool createTunnelFrom; 00178 std::string sshPath; 00179 std::string sshPort; 00180 std::string sshLogin; 00181 std::string sshKeyPath; 00182 int nbRetry; 00183 std::string cfgPath; 00184 unsigned int waitingTime; 00185 }; 00186 00187 int 00188 connectPeer(const std::string &ior, const std::string &peerIOR, 00189 const std::string &newHost, const std::string &remoteHost, 00190 int localPortFrom, int remotePortFrom, 00191 LogForwarder *forwarder, LogORBMgr* mgr); 00192 00193 void 00194 name(const std::string& name, Configuration* cfg); 00195 00196 void 00197 peer_name(const std::string& name, Configuration* cfg); 00198 00199 void 00200 peer_ior(const std::string& ior, Configuration* cfg); 00201 00202 void 00203 ssh_host(const std::string& host, Configuration* cfg); 00204 00205 void 00206 remote_host(const std::string& host, Configuration* cfg); 00207 00208 void 00209 remote_port_to(const std::string& port, Configuration* cfg); 00210 00211 void 00212 remote_port_from(const std::string& port, Configuration* cfg); 00213 00214 void 00215 local_port_from(const std::string& port, Configuration* cfg); 00216 00217 void 00218 create(const std::string& create, Configuration* cfg); 00219 00220 void 00221 ssh_path(const std::string& path, Configuration* cfg); 00222 00223 void 00224 ssh_port(const std::string& port, Configuration* cfg); 00225 00226 void 00227 ssh_login(const std::string& login, Configuration* cfg); 00228 00229 void 00230 key_path(const std::string& path, Configuration* cfg); 00231 00232 void 00233 nb_retry(const std::string& nb, Configuration* cfg); 00234 00235 void 00236 tunnel_wait(const std::string& time, Configuration* cfg); 00237 00238 /* Transformation function for the host name. */ 00239 int 00240 change(int c); 00241 00242 #endif // _LOGFWDR_HH_