yast2-core
|
#include <Y2ProgramComponent.h>
Public Member Functions | |
Y2ProgramComponent (string chroot_path, string binpath, const char *component_name, bool non_y2, int level) | |
~Y2ProgramComponent () | |
string | name () const |
YCPValue | evaluate (const YCPValue &command) |
void | result (const YCPValue &result) |
void | setServerOptions (int argc, char **argv) |
YCPValue | doActualWork (const YCPList &arglist, Y2Component *user_interface) |
void | sendToExternal (const string &) |
YCPValue | receiveFromExternal () |
bool | remote () const |
![]() | |
Y2Component () | |
virtual | ~Y2Component () |
virtual Y2Namespace * | import (const char *name_space) |
virtual SCRAgent * | getSCRAgent () |
Private Member Functions | |
void | launchExternalProgram (char **argv) |
void | terminateExternalProgram () |
void | sendToExternal (const YCPValue &) |
bool | externalProgramOK () const |
Private Attributes | |
string | chroot_path |
string | bin_file |
bool | is_non_y2 |
string | component_name |
int | argc |
char ** | argv |
int | to_external [2] |
int | from_external [2] |
pid_t | pid |
Parser | parser |
int | level |
Y2ProgramComponent::Y2ProgramComponent | ( | string | chroot_path, |
string | binpath, | ||
const char * | component_name, | ||
bool | non_y2, | ||
int | level | ||
) |
Y2ProgramComponent::~Y2ProgramComponent | ( | ) |
Frees internal data.
References pid, and terminateExternalProgram().
|
virtual |
Launches the program with the previously set parameters
Reimplemented from Y2Component.
References argc, argv, Y2Component::evaluate(), is_non_y2, YCPElement::isNull(), launchExternalProgram(), name(), pid, receiveFromExternal(), sendToExternal(), YCPList::size(), YCPList::value(), and y2debug.
Let the server evaluate a command.
This method is only valid, if the component is a server.
Reimplemented from Y2Component.
References argc, argv, is_non_y2, YCPElement::isNull(), launchExternalProgram(), name(), pid, receiveFromExternal(), sendToExternal(), and y2error.
|
private |
Determines, if the external program is running.
References pid.
Referenced by receiveFromExternal(), and sendToExternal().
|
private |
Lauches the external programm in a new process.
References argv, bin_file, chroot_path, from_external, level, parser, pid, ExternalProgram::renumber_fd(), Parser::setBuffered(), Parser::setInput(), to_external, y2debug, and y2error.
Referenced by doActualWork(), and evaluate().
|
virtual |
Returns the name of this component.
Implements Y2Component.
References component_name.
Referenced by doActualWork(), and evaluate().
YCPValue Y2ProgramComponent::receiveFromExternal | ( | ) |
Receives a YCP value from the external program.
References bin_file, externalProgramOK(), YCPElement::isNull(), Parser::parse(), parser, y2error, and y2milestone.
Referenced by doActualWork(), and evaluate().
|
virtual |
Reimplemented from Y2Component.
|
virtual |
Tells this server, that the client doesn't need it's services any longer and that the exit code of the client is result.
This method is only valid, if the component is a server.
Reimplemented from Y2Component.
References YCPTerm::add(), pid, sendToExternal(), terminateExternalProgram(), and y2milestone.
void Y2ProgramComponent::sendToExternal | ( | const string & | value | ) |
References bin_file, externalProgramOK(), is_non_y2, terminateExternalProgram(), to_external, y2debug, and y2error.
Referenced by doActualWork(), evaluate(), result(), and sendToExternal().
|
private |
Send a YCP value to the external program
References sendToExternal().
|
virtual |
Sets the commandline options of the server.
This method is only valid, if the component is a server.
Reimplemented from Y2Component.
|
private |
Kills the external program (that is process) with SIGQUIT
References from_external, pid, and to_external.
Referenced by result(), sendToExternal(), and ~Y2ProgramComponent().
|
private |
Stores options for a server program
Referenced by doActualWork(), evaluate(), and setServerOptions().
|
private |
Stores options for a server program
Referenced by doActualWork(), evaluate(), launchExternalProgram(), and setServerOptions().
|
private |
Filename of the executable binary.
Referenced by launchExternalProgram(), receiveFromExternal(), and sendToExternal().
|
private |
Chroot path for the program.
Referenced by launchExternalProgram().
|
private |
Name of the component that is implemented by the program
Referenced by name().
|
private |
Filehandles of pipe from external programm
Referenced by launchExternalProgram(), and terminateExternalProgram().
|
private |
Specifies whether this component is a ycp program or a shell and such like.
Referenced by doActualWork(), evaluate(), and sendToExternal().
|
private |
The component level this program was started in. For example programs started from floppy get the component level 0.
Referenced by launchExternalProgram().
|
private |
Used to parse the values the external program sends
Referenced by launchExternalProgram(), and receiveFromExternal().
|
private |
Process ID of external process. This is -1, if the process is not yet launched.
Referenced by doActualWork(), evaluate(), externalProgramOK(), launchExternalProgram(), result(), terminateExternalProgram(), and ~Y2ProgramComponent().
|
private |
Filehandles of pipe to external programm
Referenced by launchExternalProgram(), sendToExternal(), and terminateExternalProgram().