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& value = YCPNull(),
00073 const YCPValue& arg = YCPNull()) {
00074 ycp2error( "Unimplemented Execute called for path %s", path-> toString ().c_str () );
00075 return YCPNull ();
00076 }
00077
00081 virtual YCPMap Error (const YCPPath& path) {
00082 return unspecified_error;
00083 }
00084
00088 virtual YCPBoolean RegisterAgent (const YCPPath& path, const YCPValue& value) {
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& path) {
00113 return YCPBoolean( false );
00114 }
00115
00120 virtual YCPValue otherCommand (const YCPTerm& term);
00121
00127 SCRAgent *mainscragent;
00128
00134 static YCPValue readconf (const char *filename);
00135
00136 static SCRAgent* instance();
00137
00138 void setAsCurrentSCR() {
00139 current_scr = this;
00140 }
00141
00142 private:
00143 static SCRAgent* current_scr;
00145 static YCPMap unspecified_error;
00146 };
00147
00148
00149 #endif // SCRAgent_h