00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef SCRAgent_h
00022 #define SCRAgent_h
00023
00024
00025 #include <YCP.h>
00026 #include <ycp/y2log.h>
00027
00038 class SCRAgent
00039 {
00040 public:
00044 SCRAgent ();
00045
00049 virtual ~SCRAgent ();
00050
00056 virtual YCPValue Read (const YCPPath& path, const YCPValue& arg = YCPNull(), const YCPValue& opt = YCPNull()) = 0;
00057
00061 virtual YCPBoolean Write (const YCPPath& path, const YCPValue& value,
00062 const YCPValue& arg = YCPNull()) = 0;
00063
00067 virtual YCPList Dir (const YCPPath& path) = 0;
00068
00072 virtual YCPValue Execute (const YCPPath& path, const YCPValue& = YCPNull(),
00073 const YCPValue& = YCPNull()) {
00074 ycp2error( "Unimplemented Execute called for path %s", path-> toString ().c_str () );
00075 return YCPNull ();
00076 }
00077
00081 virtual YCPMap Error (const YCPPath& ) {
00082 return unspecified_error;
00083 }
00084
00088 virtual YCPBoolean RegisterAgent (const YCPPath& path, const YCPValue& ) {
00089 ycp2error( "Unimplemented RegisterAgent called for path %s", path-> toString ().c_str () );
00090 return YCPBoolean( false );
00091 }
00092
00096 virtual YCPBoolean UnregisterAgent (const YCPPath& path) {
00097 ycp2error( "Unimplemented UnregisterAgent called for path %s", path-> toString ().c_str () );
00098 return YCPBoolean( false );
00099 }
00100
00104 virtual YCPBoolean UnregisterAllAgents () {
00105 ycp2error( "Unimplemented UnregisterAllAgents called" );
00106 return YCPBoolean( false );
00107 }
00108
00112 virtual YCPBoolean UnmountAgent (const YCPPath& ) {
00113 return YCPBoolean( false );
00114 }
00115
00119 virtual YCPBoolean RegisterNewAgents () {
00120 ycp2error( "Unimplemented RegisterNewAgents called" );
00121 return YCPBoolean( false );
00122 }
00123
00128 virtual YCPValue otherCommand (const YCPTerm& term);
00129
00135 SCRAgent *mainscragent;
00136
00142 static YCPValue readconf (const char *filename);
00143
00144 static SCRAgent* instance();
00145
00146 void setAsCurrentSCR() {
00147 current_scr = this;
00148 }
00149
00150 private:
00151 static SCRAgent* current_scr;
00153 static YCPMap unspecified_error;
00154 };
00155
00156
00157 #endif // SCRAgent_h