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

System.cpp File Reference

#include "smbios/compat.h"
#include <string.h>
#include "smbios/ISmbios.h"
#include "smbios/IToken.h"
#include "smbios/ISmi.h"
#include "smbios/SystemInfo.h"
#include "smbios/IMemory.h"
#include "smbios/SmbiosDefs.h"
#include "ExceptionImpl.h"
#include "TokenLowLevel.h"
#include "DellMagic.h"
#include "smbios/version.h"
#include "smbios/message.h"

Go to the source code of this file.

Classes

struct  DellGetServiceTagFunctions
struct  DellSetServiceTagFunctions
struct  DellAssetTagFunctions
struct  DellSetAssetTagFunctions
struct  DellSystemNameFunctions
struct  DellBiosVersionFunctions

Defines

#define LIBSMBIOS_SOURCE
#define DCOUT(line)   do {} while(0)
#define DCERR(line)   do {} while(0)

Functions

void stripString (char *str)
unsigned char dell_decode_digit (char tagval)
void dell_decode_service_tag (char *tag, int len)
unsigned char dell_encode_digit (char ch)
void dell_encode_service_tag (char *tag, size_t len)
const char * SMBIOSGetLibraryVersionString ()
 Return a string representing the version of the libsmbios library.
void SMBIOSFreeMemory (const char *ptr)
 Free memory allocated by libsmbios.
char * getTagFromSMI (u16 select)
void setTagUsingSMI (const char *newTag, u16 select)
char * getStringFromTable (unsigned int structure, unsigned int stringNumber)
char * getServiceTagFromSysInfo ()
char * getServiceTagFromSysEncl ()
char * getServiceTagFromCMOSToken ()
char * getServiceTagFromSMI ()
const char * SMBIOSGetServiceTag ()
 Returns the 5 or 7 character Dell Service Tag.
void setServiceTagUsingCMOSToken (const char *newTag, size_t len)
void setServiceTagUsingSMI (const char *newTag, size_t size)
int SMBIOSSetServiceTag (const char *password, const char *serviceTag, size_t len)
 Set the 5 or 7 character Dell Service Tag.
char * getAssetTagFromSysEncl ()
char * getAssetTagFromToken ()
char * getAssetTagFromSMI ()
const char * SMBIOSGetAssetTag ()
 Returns the 10 character Dell Asset Tag.
void setAssetTagUsingCMOSToken (const char *newTag, size_t len)
void setAssetTagUsingSMI (const char *newTag, size_t size)
int SMBIOSSetAssetTag (const char *password, const char *assetTag, size_t len)
 Set the Dell Asset Tag.
char * getSystemNameFromSysInfo ()
const char * SMBIOSGetSystemName ()
 Return a buffer containing the System Name.
char * getBiosVersionFromOneByteStructForDiamond ()
char * getBiosVersionFromSmbios ()
const char * SMBIOSGetBiosVersion ()
 Return a buffer containing the BIOS version string.
const char * SMBIOSGetVendorName ()
int SMBIOSHasNvramStateBytes ()
int SMBIOSGetNvramStateBytes (int user)
void SMBIOSSetNvramStateBytes (int value, int user)
bool getUpOffsetAndFlag (up_info *up)
int upBootHelper (bool set=false, bool value=false)
int SMBIOSHasBootToUp ()
int SMBIOSGetBootToUp ()
void SMBIOSSetBootToUp (int state)
int SMBIOSGetSmiPasswordCoding ()

Variables

smbios::Exception< smbios::IExceptionSysInfoException
std::string biosPassword = ""
DellGetServiceTagFunctions DellGetServiceTagFunctions []
DellSetServiceTagFunctions DellSetServiceTagFunctions []
DellAssetTagFunctions DellAssetTagFunctions []
DellSetAssetTagFunctions DellSetAssetTagFunctions []
DellSystemNameFunctions DellSystemNameFunctions []
DellBiosVersionFunctions DellBiosVersionFunctions []


Define Documentation

#define DCERR line   )     do {} while(0)
 

Definition at line 50 of file System.cpp.

#define DCOUT line   )     do {} while(0)
 

Definition at line 49 of file System.cpp.

#define LIBSMBIOS_SOURCE
 

Definition at line 19 of file System.cpp.


Function Documentation

unsigned char dell_decode_digit char  tagval  )  [static]
 

Definition at line 87 of file System.cpp.

Referenced by dell_decode_service_tag().

void dell_decode_service_tag char *  tag,
int  len
[static]
 

Definition at line 109 of file System.cpp.

References dell_decode_digit(), and SVC_TAG_LEN_MAX.

Referenced by getServiceTagFromCMOSToken().

unsigned char dell_encode_digit char  ch  )  [static]
 

Definition at line 131 of file System.cpp.

Referenced by dell_encode_service_tag().

void dell_encode_service_tag char *  tag,
size_t  len
[static]
 

Definition at line 155 of file System.cpp.

References dell_encode_digit(), SVC_TAG_CMOS_LEN_MAX, and SVC_TAG_LEN_MAX.

Referenced by setServiceTagUsingCMOSToken().

char* getAssetTagFromSMI  ) 
 

Definition at line 554 of file System.cpp.

References getTagFromSMI().

char* getAssetTagFromSysEncl  )  [static]
 

Definition at line 500 of file System.cpp.

References getStringFromTable(), smbios::System_Enclosure_or_Chassis, and System_Enclosure_or_Chassis_Asset_Offset.

char* getAssetTagFromToken  ) 
 

Definition at line 507 of file System.cpp.

References ASSET_TAG_CMOS_LEN_MAX, ASSET_TAG_LEN_MAX, TokenTableFactory::getFactory(), CmosRWFactory::getFactory(), TokenTableFactory::getSingleton(), CmosRWFactory::getSingleton(), ICmosRW::readByte(), u16, u32, and u8.

Referenced by testPlatform::testAssetTag().

char* getBiosVersionFromOneByteStructForDiamond  )  [static]
 

Definition at line 739 of file System.cpp.

References DELL_SYSTEM_STRING, DELL_SYSTEM_STRING_LEN, DELL_SYSTEM_STRING_LOC_DIAMOND_1, DELL_SYSTEM_STRING_LOC_DIAMOND_2, IMemory::fillBuffer(), IMemory::getByte(), MemoryFactory::getFactory(), ID_BYTE_LOC_DIAMOND_1, ID_BYTE_LOC_DIAMOND_2, SYSTEM_ID_DIAMOND, and u8.

char* getBiosVersionFromSmbios  )  [static]
 

Definition at line 772 of file System.cpp.

References smbios::BIOS_Information, BIOS_Information_Version_Offset, and getStringFromTable().

char* getServiceTagFromCMOSToken  ) 
 

Definition at line 285 of file System.cpp.

References DCOUT, dell_decode_service_tag(), TokenTableFactory::getFactory(), CmosRWFactory::getFactory(), TokenTableFactory::getSingleton(), CmosRWFactory::getSingleton(), ICmosRW::readByte(), SVC_TAG_CMOS_LEN_MAX, SVC_TAG_LEN_MAX, u16, u32, and u8.

Referenced by testPlatform::testServiceTagWriting().

char* getServiceTagFromSMI  ) 
 

Definition at line 340 of file System.cpp.

References DCOUT, and getTagFromSMI().

char* getServiceTagFromSysEncl  )  [static]
 

Definition at line 278 of file System.cpp.

References DCOUT, getStringFromTable(), smbios::System_Enclosure_or_Chassis, and System_Enclosure_or_Chassis_Service_Offset.

char* getServiceTagFromSysInfo  )  [static]
 

Definition at line 272 of file System.cpp.

References DCOUT, getStringFromTable(), smbios::System_Information, and System_Information_Serial_Number_Offset.

char* getStringFromTable unsigned int  structure,
unsigned int  stringNumber
[static]
 

Definition at line 242 of file System.cpp.

References SmbiosFactory::getFactory(), SmbiosFactory::getSingleton(), smbios::getString_FromItem(), and stripString().

Referenced by getAssetTagFromSysEncl(), getBiosVersionFromSmbios(), getServiceTagFromSysEncl(), getServiceTagFromSysInfo(), getSystemNameFromSysInfo(), and SMBIOSGetVendorName().

char* getSystemNameFromSysInfo  )  [static]
 

Definition at line 695 of file System.cpp.

References getStringFromTable(), smbios::System_Information, and System_Information_Product_Name_Offset.

char* getTagFromSMI u16  select  )  [static]
 

Definition at line 217 of file System.cpp.

References smi::doSimpleCallingInterfaceSmi(), and u32.

Referenced by getAssetTagFromSMI(), and getServiceTagFromSMI().

bool getUpOffsetAndFlag up_info up  )  [static]
 

Definition at line 966 of file System.cpp.

References IMemory::fillBuffer(), and MemoryFactory::getFactory().

Referenced by upBootHelper().

void setAssetTagUsingCMOSToken const char *  newTag,
size_t  len
 

Definition at line 601 of file System.cpp.

References ASSET_TAG_CMOS_LEN_MAX, CmosRWFactory::getFactory(), TokenTableFactory::getFactory(), CmosRWFactory::getSingleton(), TokenTableFactory::getSingleton(), ICmosRW::readByte(), u16, u32, u8, and ICmosRW::writeByte().

void setAssetTagUsingSMI const char *  newTag,
size_t  size
 

Definition at line 646 of file System.cpp.

References setTagUsingSMI().

void setServiceTagUsingCMOSToken const char *  newTag,
size_t  len
 

Definition at line 395 of file System.cpp.

References dell_encode_service_tag(), CmosRWFactory::getFactory(), TokenTableFactory::getFactory(), CmosRWFactory::getSingleton(), TokenTableFactory::getSingleton(), ICmosRW::readByte(), SVC_TAG_CMOS_LEN_MAX, SVC_TAG_LEN_MAX, u16, u32, u8, and ICmosRW::writeByte().

void setServiceTagUsingSMI const char *  newTag,
size_t  size
 

Definition at line 453 of file System.cpp.

References setTagUsingSMI().

void setTagUsingSMI const char *  newTag,
u16  select
[static]
 

Definition at line 234 of file System.cpp.

References biosPassword, smi::doSimpleCallingInterfaceSmi(), smi::getAuthenticationKey(), and u32.

Referenced by setAssetTagUsingSMI(), and setServiceTagUsingSMI().

void SMBIOSFreeMemory const char *   ) 
 

Free memory allocated by libsmbios.

This function must be called to free memory for any function that allocates memory on behalf of its caller.

Definition at line 211 of file System.cpp.

Referenced by safeConvertToString(), and testPlatform::testSystemInfo().

const char* SMBIOSGetAssetTag  ) 
 

Returns the 10 character Dell Asset Tag.

Allocates a buffer on behalf of the caller. Caller must use the freeMemory() function call to free this memory when finished.

Definition at line 572 of file System.cpp.

References _, Exception::setMessageString(), stripString(), and SysInfoException.

Referenced by testPlatform::testAssetTag(), and testPlatform::testSystemInfo().

const char* SMBIOSGetBiosVersion  ) 
 

Return a buffer containing the BIOS version string.

Allocates a buffer on behalf of the caller. Caller must use the freeMemory() function call to free this memory when finished.

Definition at line 787 of file System.cpp.

References _, Exception::setMessageString(), stripString(), and SysInfoException.

Referenced by testPlatform::testBiosVersion(), and testPlatform::testSystemInfo().

int SMBIOSGetBootToUp  ) 
 

Definition at line 1081 of file System.cpp.

References upBootHelper().

Referenced by testPlatform::testUpBoot().

const char* SMBIOSGetLibraryVersionString  ) 
 

Return a string representing the version of the libsmbios library.

Returns the current version of the SMBIOS library as a string

Definition at line 205 of file System.cpp.

Referenced by testStandalone::testLibraryVersion().

int SMBIOSGetNvramStateBytes int  user  ) 
 

Definition at line 874 of file System.cpp.

References _, TokenTableFactory::getFactory(), TokenTableFactory::getSingleton(), Exception::setMessageString(), SysInfoException, and u8.

Referenced by testPlatform::testStateBytes().

const char* SMBIOSGetServiceTag  ) 
 

Returns the 5 or 7 character Dell Service Tag.

Allocates a buffer on behalf of the caller. Caller must use the freeMemory() function call to free this memory when finished.

Definition at line 360 of file System.cpp.

References _, DCOUT, Exception::setMessageString(), stripString(), and SysInfoException.

Referenced by testPlatform::testServiceTag(), testPlatform::testServiceTagWriting(), and testPlatform::testSystemInfo().

int SMBIOSGetSmiPasswordCoding  ) 
 

returns password coding used in SMI calls 0 == unknown 1 == scan code 2 == ascii

Definition at line 1095 of file System.cpp.

References smi::getPasswordFormat().

const char* SMBIOSGetSystemName  ) 
 

Return a buffer containing the System Name.

Allocates a buffer on behalf of the caller. Caller must use the freeMemory() function call to free this memory when finished.

Definition at line 710 of file System.cpp.

References _, Exception::setMessageString(), stripString(), and SysInfoException.

Referenced by testPlatform::testSystemInfo(), and testPlatform::testSystemName().

const char* SMBIOSGetVendorName  ) 
 

Allocates a buffer on behalf of the caller. Caller must use the freeMemory() function call to free this memory when finished.

Definition at line 816 of file System.cpp.

References _, getStringFromTable(), Exception::setMessageString(), stripString(), SysInfoException, smbios::System_Information, and System_Information_Manufacturer_Offset.

Referenced by testPlatform::testSystemInfo().

int SMBIOSHasBootToUp  ) 
 

Definition at line 1076 of file System.cpp.

References upBootHelper().

Referenced by testPlatform::testUpBoot().

int SMBIOSHasNvramStateBytes  ) 
 

Definition at line 838 of file System.cpp.

References _, TokenTableFactory::getFactory(), TokenTableFactory::getSingleton(), Exception::setMessageString(), SysInfoException, and u8.

Referenced by testPlatform::testStateBytes().

int SMBIOSSetAssetTag const char *  password,
const char *  newTag,
size_t  len
 

Set the Dell Asset Tag.

The Dell Asset Tag is displayed in BIOS and is also contained in SMBIOS. This tag can generally be up to 10 chars long. There are SMI and CMOS methods to set this tag. At present, only CMOS access method is implemented in libsmbios. This works across all Dell hardware that the author is aware of.

User of the system can use this field to store any user-defined data. Dell BIOS/support/etc does not utilize this value.

Definition at line 664 of file System.cpp.

References _, biosPassword, Exception::setMessageString(), and SysInfoException.

Referenced by testPlatform::testAssetTag().

void SMBIOSSetBootToUp int  state  ) 
 

Definition at line 1088 of file System.cpp.

References upBootHelper().

Referenced by testPlatform::testUpBoot().

void SMBIOSSetNvramStateBytes int  value,
int  user
 

Definition at line 927 of file System.cpp.

References _, TokenTableFactory::getFactory(), TokenTableFactory::getSingleton(), Exception::setMessageString(), SysInfoException, and u8.

Referenced by testPlatform::testStateBytes().

int SMBIOSSetServiceTag const char *  password,
const char *  newTag,
size_t  len
 

Set the 5 or 7 character Dell Service Tag.

The Dell Asset Tag is displayed in BIOS and is also contained in SMBIOS. This tag can generally be up to 7 chars long. There are SMI and CMOS methods to set this tag. At present, only CMOS access method is implemented in libsmbios. This works across all Dell hardware that the author is aware of.

WARNING! The Dell Service Tag is very closely tied into the Dell support system. This tag should not be changed except under direction from Dell support.

Definition at line 470 of file System.cpp.

References _, biosPassword, Exception::setMessageString(), and SysInfoException.

Referenced by testPlatform::testServiceTagWriting().

void stripString char *  str  )  [static]
 

Definition at line 61 of file System.cpp.

Referenced by getStringFromTable(), SMBIOSGetAssetTag(), SMBIOSGetBiosVersion(), SMBIOSGetServiceTag(), SMBIOSGetSystemName(), and SMBIOSGetVendorName().

int upBootHelper bool  set = false,
bool  value = false
[static]
 

Definition at line 1007 of file System.cpp.

References _, indexed_io_access_structure::dataPort, CmosRWFactory::getFactory(), TokenTableFactory::getFactory(), CmosRWFactory::getSingleton(), TokenTableFactory::getSingleton(), getUpOffsetAndFlag(), indexed_io_access_structure::indexPort, ICmosRW::readByte(), Exception::setMessageString(), SysInfoException, u8, and ICmosRW::writeByte().

Referenced by SMBIOSGetBootToUp(), SMBIOSHasBootToUp(), and SMBIOSSetBootToUp().


Variable Documentation

std::string biosPassword = "" [static]
 

Definition at line 59 of file System.cpp.

Referenced by setTagUsingSMI(), SMBIOSSetAssetTag(), and SMBIOSSetServiceTag().

struct DellAssetTagFunctions DellAssetTagFunctions[]
 

struct DellBiosVersionFunctions DellBiosVersionFunctions[]
 

struct DellGetServiceTagFunctions DellGetServiceTagFunctions[]
 

struct DellSetAssetTagFunctions DellSetAssetTagFunctions[]
 

struct DellSetServiceTagFunctions DellSetServiceTagFunctions[]
 

struct DellSystemNameFunctions DellSystemNameFunctions[]
 

smbios::Exception<smbios::IException> SysInfoException
 

Definition at line 23 of file SysInfoError.cpp.


Generated on Tue Feb 26 14:39:01 2008 for SMBIOS Library by  doxygen 1.3.9.1