libsmbios_c library
DellRbu.h
Go to the documentation of this file.
1 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:
2 /*
3  * Copyright (C) 2005 Dell Inc.
4  * by Michael Brown <Michael_E_Brown@dell.com>
5  * Licensed under the Open Software License version 2.1
6  *
7  * Alternatively, you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published
9  * by the Free Software Foundation; either version 2 of the License,
10  * or (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  * See the GNU General Public License for more details.
16  */
17 
18 
19 #ifndef RBU_H
20 #define RBU_H
21 
22 // compat header should always be first header, if system headers included
23 #include "smbios/compat.h"
24 
25 #include <string>
26 
27 // types.h should be first user-defined header.
28 #include "smbios/types.h"
29 #include "smbios/IFactory.h"
30 #include "smbios/IException.h"
31 
32 // abi_prefix should be last header included before declarations
34 
35 
36 namespace rbu
37 {
38  DECLARE_EXCEPTION( RbuException );
39  DECLARE_EXCEPTION_EX( RbuNotSupported, rbu, RbuException );
40  DECLARE_EXCEPTION_EX( InvalidHdrFile, rbu, RbuException );
41  DECLARE_EXCEPTION_EX( UnsupportedSystemForHdrFile, rbu, RbuException );
42  DECLARE_EXCEPTION_EX( HdrFileIOError, rbu, RbuException );
43  DECLARE_EXCEPTION_EX( RbuDriverIOError, rbu, RbuException );
44 
46  // rbu_linux_v0: Linux 2.4
47  // rbu_linux_v1: 2.6 dkms
48  // rbu_linux_v2: 2.6.14+
50 
51  const int SYSID_OVERRIDE = 1;
52  const int BIOSVER_OVERRIDE = 2;
53 
54  // forward decls
55  class IRbuHdr;
56 
58 
72  class RbuFactory : public virtual factory::IFactory
73  {
74  public:
76 
86  static RbuFactory *getFactory();
87  virtual ~RbuFactory() throw();
88 
90 
99  virtual IRbuHdr *makeNew(std::string filename) = 0;
100  protected:
102  RbuFactory();
103  };
104 
105 
107  class IRbuHdr
108  {
109  public:
110  // CONSTRUCTORS, DESTRUCTOR, and ASSIGNMENT
111  IRbuHdr();
112  // Interface class: no default or copy constructor
113  virtual ~IRbuHdr ();
114 
116  //output table information.
120  virtual std::ostream & streamify(std::ostream & cout ) const = 0;
121 
122  virtual std::string getBiosVersion() const = 0;
123  virtual void getHdrVersion(unsigned int &major, unsigned int &minor) const = 0;
124  virtual const u32 *getSystemIdList() const = 0;
125  virtual void doUpdate() const = 0;
126  virtual FILE *getFh() const = 0;
127 
128  private:
129  explicit IRbuHdr(const IRbuHdr &);
130  void operator =( const IRbuHdr & );
131  };
132 
133  std::ostream & operator << (std::ostream & cout, const IRbuHdr & item);
134 
136 
138  void cancelDellBiosUpdate();
139 
141 
143  bool checkSystemId(const IRbuHdr &hdr, u16 sysId );
144 
146 
148  void dellBiosUpdate(const IRbuHdr &hdr, packet_type force_type);
149 
151 
153  int compareBiosVersion(std::string ver1, std::string ver2);
154 
155 }
156 
157 // always should be last thing in header file
159 
160 #endif /* RBU_H */
DECLARE_EXCEPTION(RbuException)
const int SYSID_OVERRIDE
Definition: DellRbu.h:51
Definition: DellRbu.h:45
AbstractFactory that produces IRbuHdr objects.
Definition: DellRbu.h:72
virtual void getHdrVersion(unsigned int &major, unsigned int &minor) const =0
void dellBiosUpdate(const IRbuHdr &hdr, packet_type force_type)
Update BIOS on Dell systems.
Interface definition for RBU HDR operations.
Definition: DellRbu.h:107
DECLARE_EXCEPTION_EX(RbuNotSupported, rbu, RbuException)
virtual ~RbuFactory()
bool checkSystemId(const IRbuHdr &hdr, u16 sysId)
Check to see if a HDR file supports a specific System ID.
virtual void doUpdate() const =0
packet_type
Definition: DellRbu.h:45
virtual std::string getBiosVersion() const =0
Definition: DellRbu.h:49
Definition: DellRbu.h:49
driver_type
Definition: DellRbu.h:49
const int BIOSVER_OVERRIDE
Definition: DellRbu.h:52
Definition: DellRbu.h:49
Definition: DellRbu.h:45
Definition: DellRbu.h:45
virtual FILE * getFh() const =0
virtual IRbuHdr * makeNew(std::string filename)=0
Create a new IRbuHdr object that the caller must delete. (NOT RECOMMENDED)
std::ostream & operator<<(std::ostream &cout, const IRbuHdr &item)
int compareBiosVersion(std::string ver1, std::string ver2)
Compare BIOS Versions.
virtual const u32 * getSystemIdList() const =0
virtual std::ostream & streamify(std::ostream &cout) const =0
Used by operator &lt;&lt; (std::ostream &amp; cout, const IRbuHdr &amp; ) to.
static RbuFactory * getFactory()
Create a factory object that you can use to create IRbuHdr objects.
unsigned int u32
Definition: types.h:35
void cancelDellBiosUpdate()
Cancel BIOS Update on Dell systems.
Definition: DellRbu.h:49
unsigned short u16
Definition: types.h:31
Definition: DellRbu.h:45
Definition: DellRbu.h:49
Base class for all Abstract Factories.
Definition: IFactory.h:39
virtual ~IRbuHdr()
RbuFactory()
Use getFactory() to get a factory.