00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _SCPMAgent_h
00011 #define _SCPMAgent_h
00012
00013 #include <Y2.h>
00014 #include <scr/SCRAgent.h>
00015
00016 using namespace std;
00017
00018 #include <iostream>
00019 #include <scpm.h>
00020
00021 #include <string>
00022 #include <vector>
00023
00024 #include <unistd.h>
00025 #include <sys/types.h>
00026 #include <sys/wait.h>
00027 #include <libintl.h>
00028 #include <fstream>
00029 #include <pthread.h>
00030
00031
00035 class SCPMAgent : public SCRAgent
00036 {
00037 private:
00038 SCPM *scpm;
00039
00040 int options;
00041 bool auto_switch;
00042 bool use_rg;
00043 ofstream output, hash;
00044 string changesfile, tmpfile, hashfile;
00045
00046 pthread_t pt;
00047 switch_info_t switch_info;
00048 string profile, dest_profile;
00049
00050
00051 bool initialized;
00052
00056 static void *call_prepare( SCPMAgent *);
00057 static void *call_switch( SCPMAgent *);
00058 static void *call_save( SCPMAgent *);
00059 static void *call_add( SCPMAgent *);
00060 static void *call_copy( SCPMAgent *);
00061 static void *call_enable( SCPMAgent *);
00062
00063
00067 YCPMap tomap_ri (resource_info_t ri);
00068
00072 resource_info_t frommap_ri(YCPMap map);
00073
00077 YCPList tolist_modified_resources (vector<resource_info_t> l);
00078
00082 vector<resource_info_t> fromlist_modified_resources(YCPList list);
00083
00087 YCPMap tomap_sw(switch_info_t sw);
00091 switch_info_t frommap_sw(YCPMap map);
00092
00096 vector<resource_group_t> fromlist_groups(YCPList list);
00097
00101 YCPList tolist_groups(vector<resource_group_t> l);
00102
00106 resource_group_t frommap_rg(YCPMap map);
00107
00111 YCPMap tomap_rg(resource_group_t rgroup);
00112
00116 vector<resource_entry_t> fromlist_re(YCPList list);
00117
00121 resource_entry_t frommap_re(YCPMap map);
00122
00126 YCPMap tomap_re(resource_entry_t rentry);
00127
00128 public:
00132 SCPMAgent();
00133
00137 virtual ~SCPMAgent();
00138
00144 virtual YCPValue Read(const YCPPath &path,
00145 const YCPValue& arg = YCPNull(),
00146 const YCPValue& opt = YCPNull());
00147
00151 virtual YCPBoolean Write(const YCPPath &path,
00152 const YCPValue& value,
00153 const YCPValue& arg = YCPNull());
00154
00158 virtual YCPValue Execute(const YCPPath &path,
00159 const YCPValue& value = YCPNull(),
00160 const YCPValue& arg = YCPNull());
00161
00162
00166 virtual YCPList Dir(const YCPPath& path);
00167
00171 virtual YCPValue otherCommand(const YCPTerm& term);
00172 };
00173
00174 #endif