00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef RBU_H
00020 #define RBU_H
00021
00022
00023 #include "smbios/compat.h"
00024
00025 #include <string>
00026
00027
00028 #include "smbios/types.h"
00029 #include "smbios/IFactory.h"
00030 #include "smbios/IException.h"
00031
00032
00033 #include "smbios/config/abi_prefix.hpp"
00034
00035
00036 namespace rbu
00037 {
00038 DECLARE_EXCEPTION( RbuException );
00039 DECLARE_EXCEPTION_EX( RbuNotSupported, rbu, RbuException );
00040 DECLARE_EXCEPTION_EX( InvalidHdrFile, rbu, RbuException );
00041 DECLARE_EXCEPTION_EX( UnsupportedSystemForHdrFile, rbu, RbuException );
00042 DECLARE_EXCEPTION_EX( HdrFileIOError, rbu, RbuException );
00043 DECLARE_EXCEPTION_EX( RbuDriverIOError, rbu, RbuException );
00044
00045 typedef enum { pt_any, pt_mono, pt_packet, pt_init } packet_type;
00046
00047
00048
00049 typedef enum { rbu_unsupported, rbu_linux_v0, rbu_linux_v1, rbu_linux_v2 } driver_type;
00050
00051 const int SYSID_OVERRIDE = 1;
00052 const int BIOSVER_OVERRIDE = 2;
00053
00054
00055 class IRbuHdr;
00056
00058
00072 class RbuFactory : public virtual factory::IFactory
00073 {
00074 public:
00076
00086 static RbuFactory *getFactory();
00087 virtual ~RbuFactory() throw();
00088
00090
00099 virtual IRbuHdr *makeNew(std::string filename) = 0;
00100 protected:
00102 RbuFactory();
00103 };
00104
00105
00107 class IRbuHdr
00108 {
00109 public:
00110
00111 IRbuHdr();
00112
00113 virtual ~IRbuHdr ();
00114
00116
00120 virtual std::ostream & streamify(std::ostream & cout ) const = 0;
00121
00122 virtual std::string getBiosVersion() const = 0;
00123 virtual void getHdrVersion(unsigned int &major, unsigned int &minor) const = 0;
00124 virtual const u32 *getSystemIdList() const = 0;
00125 virtual void doUpdate() const = 0;
00126 virtual FILE *getFh() const = 0;
00127
00128 private:
00129 explicit IRbuHdr(const IRbuHdr &);
00130 void operator =( const IRbuHdr & );
00131 };
00132
00133 std::ostream & operator << (std::ostream & cout, const IRbuHdr & item);
00134
00136
00138 void cancelDellBiosUpdate();
00139
00141
00143 bool checkSystemId(const IRbuHdr &hdr, u16 sysId );
00144
00146
00148 void dellBiosUpdate(const IRbuHdr &hdr, packet_type force_type);
00149
00151
00153 int compareBiosVersion(std::string ver1, std::string ver2);
00154
00155 }
00156
00157
00158 #include "smbios/config/abi_suffix.hpp"
00159
00160 #endif