Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

RbuImpl.h

Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  * vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent:textwidth=0:
00003  *
00004  * Copyright (C) 2005 Dell Inc.
00005  *  by Michael Brown <Michael_E_Brown@dell.com>
00006  * Licensed under the Open Software License version 2.1
00007  *
00008  * Alternatively, you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published
00010  * by the Free Software Foundation; either version 2 of the License,
00011  * or (at your option) any later version.
00012  
00013  * This program is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  */
00018 
00019 #ifndef RBUIMPL_H
00020 #define RBUIMPL_H
00021 
00022 // compat header should always be first header if including system headers
00023 #include "smbios/compat.h"
00024 
00025 #include "smbios/DellRbu.h"
00026 #include "FactoryImpl2.h"
00027 #include "ExceptionImpl.h"
00028 #include "RbuLowLevel.h"
00029 
00030 #   if defined(DEBUG_RBU)
00031 #       define DCOUT(line) do { cout << line; } while(0)
00032 #       define DCERR(line) do { cerr << line; } while(0)
00033 #   else
00034 #       define DCOUT(line) do {} while(0)
00035 #       define DCERR(line) do {} while(0)
00036 #   endif
00037 
00038 namespace rbu 
00039 {
00040     DEFINE_EXCEPTION_EX( RbuNotSupportedImpl, rbu, RbuNotSupported );
00041     DEFINE_EXCEPTION_EX( InvalidHdrFileImpl, rbu, InvalidHdrFile );
00042     DEFINE_EXCEPTION_EX( UnsupportedSystemForHdrFileImpl, rbu, UnsupportedSystemForHdrFile );
00043     DEFINE_EXCEPTION_EX( HdrFileIOErrorImpl, rbu, HdrFileIOError );
00044     DEFINE_EXCEPTION_EX( RbuDriverIOErrorImpl, rbu, RbuDriverIOError );
00045 
00046     class RbuFactoryImpl : public factory::TFactory<RbuFactory>
00047     {
00048     public:
00049         RbuFactoryImpl();
00050         virtual ~RbuFactoryImpl() throw();
00051         virtual IRbuHdr *makeNew( std::string filename ); 
00052     };
00053 
00054 
00055     class RbuHdr : public virtual IRbuHdr
00056     {
00057     public:
00058         // CONSTRUCTORS, DESTRUCTOR, and ASSIGNMENT
00059         explicit RbuHdr(std::string filename);
00060 
00061         // CONSTRUCTORS, DESTRUCTOR, and ASSIGNMENT
00062         virtual ~RbuHdr ();
00063 
00064         virtual std::ostream & streamify(std::ostream & cout ) const;
00065 
00066         virtual std::string getBiosVersion() const;
00067         virtual void getHdrVersion(unsigned int &major, unsigned int &minor) const;
00068         virtual const u32 *getSystemIdList() const;
00069         virtual void doUpdate() const;
00070         virtual FILE *getFh() const;
00071 
00072     protected:
00073         // No-arg constructor not legal for this class for regular users
00074         RbuHdr ();
00075 
00076     private:
00077         RbuHdr (const RbuHdr &source);
00078         FILE *hdrFh;
00079         struct rbu_hdr_file_header header;
00080         u32 sysIdList[NUM_SYS_ID_IN_HDR + 1]; // zero terminated array of system ids.
00081     };
00082 
00083     packet_type getSupportedPacketType(void);
00084     void activateRbuToken();
00085     void cancelRbuToken();
00086     void checksumPacket(rbu_packet *pkt, size_t size);
00087     void createPacket(char *buffer, size_t bufSize, size_t imageSize);
00088 }
00089 
00090 #endif /* RBUIMPL_H */

Generated on Wed Apr 11 16:25:10 2007 for SMBIOS Library by doxygen 1.3.5