00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: Y2RemoteComponent.h 00014 00015 Authors: Mathias Kettner <kettner@suse.de> 00016 Arvin Schnell <arvin@suse.de> 00017 Maintainer: Arvin Schnell <arvin@suse.de> 00018 00019 /-*/ 00020 // -*- c++ -*- 00021 00022 /* 00023 * Component that communicates via stdin/out/err 00024 * 00025 * Author: Mathias Kettner <kettner@suse.de> 00026 */ 00027 00028 #ifndef Y2RemoteComponent_h 00029 #define Y2RemoteComponent_h 00030 00031 00032 class RemoteProtocol; 00033 00034 #include <ycp/Parser.h> 00035 00036 #include "Y2Component.h" 00037 00041 class Y2RemoteComponent : public Y2Component 00042 { 00046 const bool is_server; 00047 00051 Y2Component *user_interface; 00052 00056 string protocol; 00057 00061 string loginname; 00062 00066 string password; 00067 00071 string hostname; 00072 00076 string componentname; 00077 00078 public: 00079 00083 Y2RemoteComponent (bool is_server, string protocol, string loginname, 00084 string hostname, string password, string componentname); 00085 00089 string name() const; 00090 00094 YCPValue evaluate (const YCPValue& command); 00095 00100 // void result(const YCPValue& result); 00101 00108 // void setServerOptions(int argc, char **argv); 00109 00120 YCPValue doActualWork(const YCPList& arglist, Y2Component *user_interface); 00121 00122 private: 00123 00127 RemoteProtocol *rp; 00128 00132 Parser parser; 00133 00137 void send (const YCPValue& v, bool eat_echo); 00138 00142 YCPValue receive (); 00143 00147 bool initTelnetSession(class ExternalProgram &); 00148 00155 string askPassword(bool& ok); 00156 00160 bool analyseURL(string); 00161 00165 bool is_up; 00166 00170 bool connect (); 00171 00172 }; 00173 00174 00175 #endif // Y2RemoteComponent_h