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
00053 bool initialized;
00054
00059 static void *call_prepare( SCPMAgent *);
00060
00064 static void *call_switch( SCPMAgent *);
00065
00069 static void *call_save( SCPMAgent *);
00070
00074 static void *call_add( SCPMAgent *);
00075
00079 static void *call_copy( SCPMAgent *);
00080
00084 static void *call_enable( SCPMAgent *);
00085
00089 static void *call_recover (SCPMAgent *);
00090
00094 static void *call_rollback (SCPMAgent *);
00095
00096
00100 YCPMap tomap_ri (resource_info_t ri);
00101
00105 resource_info_t frommap_ri(YCPMap map);
00106
00110 YCPList tolist_modified_resources (vector<resource_info_t> l);
00111
00115 vector<resource_info_t> fromlist_modified_resources(YCPList list);
00116
00120 YCPMap tomap_sw(switch_info_t sw);
00124 switch_info_t frommap_sw(YCPMap map);
00125
00129 vector<resource_group_t> fromlist_groups(YCPList list);
00130
00134 YCPList tolist_groups(vector<resource_group_t> l);
00135
00139 resource_group_t frommap_rg(YCPMap map);
00140
00144 YCPMap tomap_rg(resource_group_t rgroup);
00145
00149 vector<resource_entry_t> fromlist_re(YCPList list);
00150
00154 resource_entry_t frommap_re(YCPMap map);
00155
00159 YCPMap tomap_re(resource_entry_t rentry);
00160
00161 public:
00165 SCPMAgent();
00166
00170 virtual ~SCPMAgent();
00171
00177 virtual YCPValue Read(const YCPPath &path,
00178 const YCPValue& arg = YCPNull(),
00179 const YCPValue& opt = YCPNull());
00180
00184 virtual YCPBoolean Write(const YCPPath &path,
00185 const YCPValue& value,
00186 const YCPValue& arg = YCPNull());
00187
00191 virtual YCPValue Execute(const YCPPath &path,
00192 const YCPValue& value = YCPNull(),
00193 const YCPValue& arg = YCPNull());
00194
00198 virtual YCPList Dir(const YCPPath& path);
00199
00203 virtual YCPValue otherCommand(const YCPTerm& term);
00204 };
00205
00206 #endif