00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: Y2ProgramComponent.h 00014 00015 Author: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Arvin Schnell <arvin@suse.de> 00017 00018 /-*/ 00019 // -*- c++ -*- 00020 00021 /* 00022 * Component that starts an external Y2 program 00023 */ 00024 00025 #ifndef Y2ProgramComponent_h 00026 #define Y2ProgramComponent_h 00027 00028 #include "Y2.h" 00029 #include <ycp/Parser.h> 00030 00031 class Y2ProgramComponent : public Y2Component 00032 { 00036 string chroot_path; 00037 00041 string bin_file; 00042 00046 bool is_non_y2; 00047 00051 string component_name; 00052 00056 int argc; 00057 00061 char **argv; 00062 00066 int to_external[2]; 00067 00071 int from_external[2]; 00072 00077 pid_t pid; 00078 00082 Parser parser; 00083 00088 int level; 00089 00090 public: 00091 00092 Y2ProgramComponent (string chroot_path, string binpath, 00093 const char *component_name, bool non_y2, int level); 00094 00098 ~Y2ProgramComponent(); 00099 00103 string name() const; 00104 00110 YCPValue evaluate(const YCPValue& command); 00111 00118 void result(const YCPValue& result); 00119 00125 void setServerOptions(int argc, char **argv); 00126 00130 YCPValue doActualWork(const YCPList& arglist, Y2Component *user_interface); 00131 00132 void sendToExternal(const string&); 00133 00137 YCPValue receiveFromExternal(); 00138 00139 00140 bool remote () const; 00141 00142 00143 private: 00148 void launchExternalProgram(char** argv); 00149 00153 void terminateExternalProgram(); 00154 00158 void sendToExternal(const YCPValue&); 00159 00163 bool externalProgramOK() const; 00164 }; 00165 00166 00167 #endif // Y2ProgramComponent_h