#include <SmbiosXmlImpl_xerces.h>
Inheritance diagram for SmbiosItemXml:
Public Types | |
FIELD_LEN_BYTE = 1 | |
FIELD_LEN_WORD = 2 | |
FIELD_LEN_DWORD = 4 | |
FIELD_LEN_QWORD = 8 | |
enum | { FIELD_LEN_BYTE = 1, FIELD_LEN_WORD = 2, FIELD_LEN_DWORD = 4, FIELD_LEN_QWORD = 8 } |
Public Member Functions | |
SmbiosItemXml (const SmbiosItem &source) | |
SmbiosItemXml (const smbiosLowlevel::smbios_structure_header *header=0) | |
virtual std::ostream & | streamify (std::ostream &cout) const |
void | setXmlFilePath (const std::string newFile, XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *newDoc) |
virtual u8 | getU8 (const std::string field) const |
virtual u16 | getU16 (const std::string field) const |
virtual u32 | getU32 (const std::string field) const |
virtual u64 | getU64 (const std::string field) const |
virtual u32 | getBitfield (const std::string field, const std::string bitField) const |
virtual const char * | getString (const std::string field) const |
virtual std::auto_ptr< const ISmbiosItem > | clone () const |
virtual std::auto_ptr< ISmbiosItem > | clone () |
u8 | getType () const |
u8 | getLength () const |
u16 | getHandle () const |
virtual u8 | getU8 (unsigned int offset) const |
virtual u16 | getU16 (unsigned int offset) const |
virtual u32 | getU32 (unsigned int offset) const |
virtual u64 | getU64 (unsigned int offset) const |
virtual u32 | getBitfield (unsigned int offset, unsigned int fieldLen, unsigned int lsb, unsigned int msb) const |
virtual const char * | getString (unsigned int header_offset) const |
virtual const u8 * | getBufferCopy (size_t &length) const |
virtual const size_t | getBufferSize () const |
Returns the buffer size of the item. | |
virtual void | fixup (const SmbiosWorkaroundTable *workaround) const |
virtual const char * | getStringByStringNumber (u8) const |
Protected Member Functions | |
std::string | getTypeAsString () const |
Protected Attributes | |
std::string | xmlFile |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | doc |
const smbiosLowlevel::smbios_structure_header * | header |
size_t | header_size |
Definition at line 34 of file SmbiosXmlImpl_xerces.h.
anonymous enum [inherited] |
SmbiosItemXml | ( | const SmbiosItem & | source | ) | [inline] |
Definition at line 37 of file SmbiosXmlImpl_xerces.h.
SmbiosItemXml | ( | const smbiosLowlevel::smbios_structure_header * | header = 0 |
) | [inline, explicit] |
Definition at line 41 of file SmbiosXmlImpl_xerces.h.
std::auto_ptr< ISmbiosItem > clone | ( | ) | [virtual, inherited] |
Implements ISmbiosItem.
Definition at line 201 of file SmbiosItem.cpp.
References SmbiosItem::SmbiosItem().
std::auto_ptr< const ISmbiosItem > clone | ( | ) | const [virtual, inherited] |
Implements ISmbiosItem.
Definition at line 196 of file SmbiosItem.cpp.
References SmbiosItem::SmbiosItem().
void fixup | ( | const SmbiosWorkaroundTable * | workaround | ) | const [virtual, inherited] |
Definition at line 385 of file SmbiosItem.cpp.
References SmbiosWorkaroundTable::fixupItem(), SmbiosItem::header, and SmbiosItem::header_size.
u32 getBitfield | ( | unsigned int | offset, | |
unsigned int | fieldLen, | |||
unsigned int | lsb, | |||
unsigned int | msb | |||
) | const [virtual, inherited] |
Returns the bitfield specified by the offset into the item.
offset | The offset of the field within the item. | |
fieldLen | The total length of the bitfield. | |
lsb | The least significant bit of the bitfield. | |
msb | The most significant bit of the bitfield. Optional. Default is the same as lsb if not supplied. |
<FIELD offset="12h" name="BIOS Characteristics Extension Byte 1" length="BYTE" usage="BITFIELD"> <MAPPING> <BITS lsb="0" name="ACPI supported"/> <BITS lsb="1" name="USB Legacy is supported"/> <BITS lsb="2" name="AGP is supported"/> <BITS lsb="3" name="I20 boot is supported"/> <BITS lsb="4" name="LS-120 boot is supported"/> <BITS lsb="5" name="ATAPI ZIP Drive boot is supported"/> <BITS lsb="6" name="1394 boot is supported"/> <BITS lsb="7" name="Smart Battery is supported"/> </MAPPING> </FIELD>
In this example, a call to getBitfield with an lsb of 2 and no msb would return the value of the "AGP is supported" bit as the lowest bit of the u32 return value.
Implements ISmbiosItem.
Definition at line 318 of file SmbiosItem.cpp.
References _, smbios::checkBitfieldBounds(), smbios::checkItemBounds(), ISmbiosItem::FIELD_LEN_BYTE, ISmbiosItem::FIELD_LEN_DWORD, ISmbiosItem::FIELD_LEN_QWORD, ISmbiosItem::FIELD_LEN_WORD, SmbiosItem::getU16(), SmbiosItem::getU32(), SmbiosItem::getU64(), SmbiosItem::getU8(), SmbiosItem::header, SmbiosItem::header_size, and smbios_structure_header::length.
virtual u32 getBitfield | ( | const std::string | field, | |
const std::string | bitField | |||
) | const [virtual] |
Returns the bitfield denoted by bitField. Caller must be aware of the size of the bitfield. Bitfield will be returned in the lowest bits of the u32 return value.
field | The name of the field within the item. | |
bitField | The name of the bitfield to retrieve. |
Reimplemented from SmbiosItem.
const u8 * getBufferCopy | ( | size_t & | length | ) | const [virtual, inherited] |
Implements ISmbiosItem.
Definition at line 371 of file SmbiosItem.cpp.
References SmbiosItem::header, and SmbiosItem::header_size.
const size_t getBufferSize | ( | ) | const [virtual, inherited] |
Returns the buffer size of the item.
Implements ISmbiosItem.
Definition at line 380 of file SmbiosItem.cpp.
References SmbiosItem::header_size.
u16 getHandle | ( | ) | const [virtual, inherited] |
Returns the Handle field of the SMBIOS Item. This field is standard for all SMBIOS tables and is defined in the SMBIOS standard.
Implements ISmbiosItem.
Definition at line 216 of file SmbiosItem.cpp.
References smbios_structure_header::handle, and SmbiosItem::header.
u8 getLength | ( | ) | const [virtual, inherited] |
Returns the Length field of the SMBIOS Item. This field is standard for all SMBIOS tables and is defined in the SMBIOS standard.
Implements ISmbiosItem.
Definition at line 211 of file SmbiosItem.cpp.
References SmbiosItem::header, and smbios_structure_header::length.
Referenced by SmbiosItem::getString().
const char * getString | ( | unsigned int | header_offset | ) | const [virtual, inherited] |
Returns the string at header_offset. Offset is given as the field value for that particular string. The string should almost always be retrieved with the getString(const std::string field) method instead.
header_offset | The offset into the list of strings found at the end of the item. |
Implements ISmbiosItem.
Definition at line 174 of file SmbiosItem.cpp.
References _, SmbiosItem::getLength(), SmbiosItem::getStringByStringNumber(), and SmbiosItem::header.
virtual const char* getString | ( | const std::string | field | ) | const [virtual] |
XML Enhanced access to string fields. Returns the string for the field field. Field must be of length "BYTE" and of usage "STRING". Type is checked against XML file. Other than that, this method is identical to getString(unsigned int):
field | A string representing the FIELD to look up. This is converted to the integer field offset by looking up in the XML file. |
Reimplemented from SmbiosItem.
const char * getStringByStringNumber | ( | u8 | ) | const [virtual, inherited] |
Not likely to be useful to regular client code. It is public mainly to help in writing Unit Tests. Clients should normally use getString().
Implements ISmbiosItem.
Definition at line 116 of file SmbiosItem.cpp.
References _, smbios::force_u64_to_u32(), SmbiosItem::header, SmbiosItem::header_size, and smbios_structure_header::length.
Referenced by SmbiosItem::getString().
u8 getType | ( | ) | const [virtual, inherited] |
Returns the Type field of the SMBIOS Item. This field is standard for all SMBIOS tables and is defined in the SMBIOS standard.
Implements ISmbiosItem.
Definition at line 206 of file SmbiosItem.cpp.
References SmbiosItem::header, and smbios_structure_header::type.
Referenced by SmbiosItemXml::streamify().
std::string getTypeAsString | ( | ) | const [protected] |
u16 getU16 | ( | unsigned int | offset | ) | const [virtual, inherited] |
Set of accessor functions: getU8(), getU16(), getU32(), and getU64() Returns a (byte|word|dword|qword) field from the Item.
The offset specified is an int representing the a valid offset within the table. Method will return a u8/u16/u32/u64 (depending on function called).
These methods all check the offset parameter for out of bounds conditions. They will throw exceptions on attempts to access data outside the length of the present item.
offset | The offset to the field within the Item. |
Implements ISmbiosItem.
Definition at line 282 of file SmbiosItem.cpp.
References smbios::checkItemBounds(), smbios::getData(), SmbiosItem::header, SmbiosItem::header_size, and smbios_structure_header::length.
Referenced by SmbiosItem::getBitfield().
virtual u16 getU16 | ( | const std::string | field | ) | const [virtual] |
Returns a byte field from the Item.
This function takes a string that represents a FIELD element from the smbios XML definition. The implementation will look up the offset in XML and call getU8( int ) with the correct offset.
The implementation will also validate in the XML that the FIELD is actually of length U8, and will throw an exception if the data field is the wrong length
Sample XML:
<STRUCTURE type="2" description="Base Board Information"> <FIELD offset="0h" name="Type" length="BYTE" usage="STRUCTURE_TYPE"/> <FIELD offset="1h" name="Length" length="BYTE" usage="SIZE"/> <FIELD offset="2h" name="Handle" length="WORD" usage="HANDLE"/> <FIELD offset="4h" name="Manufacturer" length="BYTE" usage="STRING"/> <FIELD offset="5h" name="Product" length="BYTE" usage="STRING"/> <FIELD offset="6h" name="Version" length="BYTE" usage="STRING"/> <FIELD offset="7h" name="Serial Number" length="BYTE" usage="STRING"/> </STRUCTURE>
field | String corresponding to the FIELD element in the XML |
Reimplemented from SmbiosItem.
u32 getU32 | ( | unsigned int | offset | ) | const [virtual, inherited] |
Set of accessor functions: getU8(), getU16(), getU32(), and getU64() Returns a (byte|word|dword|qword) field from the Item.
The offset specified is an int representing the a valid offset within the table. Method will return a u8/u16/u32/u64 (depending on function called).
These methods all check the offset parameter for out of bounds conditions. They will throw exceptions on attempts to access data outside the length of the present item.
offset | The offset to the field within the Item. |
Implements ISmbiosItem.
Definition at line 291 of file SmbiosItem.cpp.
References smbios::checkItemBounds(), smbios::getData(), SmbiosItem::header, SmbiosItem::header_size, and smbios_structure_header::length.
Referenced by SmbiosItem::getBitfield().
virtual u32 getU32 | ( | const std::string | field | ) | const [virtual] |
Returns a byte field from the Item.
This function takes a string that represents a FIELD element from the smbios XML definition. The implementation will look up the offset in XML and call getU8( int ) with the correct offset.
The implementation will also validate in the XML that the FIELD is actually of length U8, and will throw an exception if the data field is the wrong length
Sample XML:
<STRUCTURE type="2" description="Base Board Information"> <FIELD offset="0h" name="Type" length="BYTE" usage="STRUCTURE_TYPE"/> <FIELD offset="1h" name="Length" length="BYTE" usage="SIZE"/> <FIELD offset="2h" name="Handle" length="WORD" usage="HANDLE"/> <FIELD offset="4h" name="Manufacturer" length="BYTE" usage="STRING"/> <FIELD offset="5h" name="Product" length="BYTE" usage="STRING"/> <FIELD offset="6h" name="Version" length="BYTE" usage="STRING"/> <FIELD offset="7h" name="Serial Number" length="BYTE" usage="STRING"/> </STRUCTURE>
field | String corresponding to the FIELD element in the XML |
Reimplemented from SmbiosItem.
u64 getU64 | ( | unsigned int | offset | ) | const [virtual, inherited] |
Set of accessor functions: getU8(), getU16(), getU32(), and getU64() Returns a (byte|word|dword|qword) field from the Item.
The offset specified is an int representing the a valid offset within the table. Method will return a u8/u16/u32/u64 (depending on function called).
These methods all check the offset parameter for out of bounds conditions. They will throw exceptions on attempts to access data outside the length of the present item.
offset | The offset to the field within the Item. |
Implements ISmbiosItem.
Definition at line 299 of file SmbiosItem.cpp.
References smbios::checkItemBounds(), smbios::getData(), SmbiosItem::header, SmbiosItem::header_size, and smbios_structure_header::length.
Referenced by SmbiosItem::getBitfield().
virtual u64 getU64 | ( | const std::string | field | ) | const [virtual] |
Returns a byte field from the Item.
This function takes a string that represents a FIELD element from the smbios XML definition. The implementation will look up the offset in XML and call getU8( int ) with the correct offset.
The implementation will also validate in the XML that the FIELD is actually of length U8, and will throw an exception if the data field is the wrong length
Sample XML:
<STRUCTURE type="2" description="Base Board Information"> <FIELD offset="0h" name="Type" length="BYTE" usage="STRUCTURE_TYPE"/> <FIELD offset="1h" name="Length" length="BYTE" usage="SIZE"/> <FIELD offset="2h" name="Handle" length="WORD" usage="HANDLE"/> <FIELD offset="4h" name="Manufacturer" length="BYTE" usage="STRING"/> <FIELD offset="5h" name="Product" length="BYTE" usage="STRING"/> <FIELD offset="6h" name="Version" length="BYTE" usage="STRING"/> <FIELD offset="7h" name="Serial Number" length="BYTE" usage="STRING"/> </STRUCTURE>
field | String corresponding to the FIELD element in the XML |
Reimplemented from SmbiosItem.
u8 getU8 | ( | unsigned int | offset | ) | const [virtual, inherited] |
Set of accessor functions: getU8(), getU16(), getU32(), and getU64() Returns a (byte|word|dword|qword) field from the Item.
The offset specified is an int representing the a valid offset within the table. Method will return a u8/u16/u32/u64 (depending on function called).
These methods all check the offset parameter for out of bounds conditions. They will throw exceptions on attempts to access data outside the length of the present item.
offset | The offset to the field within the Item. |
Implements ISmbiosItem.
Definition at line 275 of file SmbiosItem.cpp.
References smbios::checkItemBounds(), SmbiosItem::header, SmbiosItem::header_size, and smbios_structure_header::length.
Referenced by SmbiosItem::getBitfield().
virtual u8 getU8 | ( | const std::string | field | ) | const [virtual] |
Returns a byte field from the Item.
This function takes a string that represents a FIELD element from the smbios XML definition. The implementation will look up the offset in XML and call getU8( int ) with the correct offset.
The implementation will also validate in the XML that the FIELD is actually of length U8, and will throw an exception if the data field is the wrong length
Sample XML:
<STRUCTURE type="2" description="Base Board Information"> <FIELD offset="0h" name="Type" length="BYTE" usage="STRUCTURE_TYPE"/> <FIELD offset="1h" name="Length" length="BYTE" usage="SIZE"/> <FIELD offset="2h" name="Handle" length="WORD" usage="HANDLE"/> <FIELD offset="4h" name="Manufacturer" length="BYTE" usage="STRING"/> <FIELD offset="5h" name="Product" length="BYTE" usage="STRING"/> <FIELD offset="6h" name="Version" length="BYTE" usage="STRING"/> <FIELD offset="7h" name="Serial Number" length="BYTE" usage="STRING"/> </STRUCTURE>
field | String corresponding to the FIELD element in the XML |
Reimplemented from SmbiosItem.
void setXmlFilePath | ( | const std::string | newFile, | |
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * | newDoc | |||
) |
Definition at line 357 of file SmbiosXml_xerces.cpp.
References SmbiosItemXml::doc, and SmbiosItemXml::xmlFile.
std::ostream & streamify | ( | std::ostream & | cout | ) | const [virtual] |
Used by 'stdostream &smbios::operator <<( std::ostream &, ISmbiosItem&)' to print out the item info.
Not particularly useful for clients. Use operator<< instead.
Reimplemented from SmbiosItem.
Definition at line 522 of file SmbiosXml_xerces.cpp.
References SmbiosItemXml::doc, xmlutils::findElement(), xmlutils::findElementWithNumericAttr(), smbios::getStringForType(), SmbiosItem::getType(), SmbiosItem::header, smbios::printStructureField(), xmlutils::safeGetAttribute(), SmbiosItem::streamify(), and X.
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc [protected] |
Definition at line 66 of file SmbiosXmlImpl_xerces.h.
Referenced by SmbiosItemXml::setXmlFilePath(), and SmbiosItemXml::streamify().
const smbiosLowlevel::smbios_structure_header* header [protected, inherited] |
Definition at line 211 of file SmbiosImpl.h.
Referenced by SmbiosItem::fixup(), SmbiosItem::getBitfield(), SmbiosItem::getBufferCopy(), SmbiosItem::getHandle(), SmbiosItem::getLength(), SmbiosItem::getString(), SmbiosItem::getStringByStringNumber(), SmbiosItem::getType(), SmbiosItem::getU16(), SmbiosItem::getU32(), SmbiosItem::getU64(), SmbiosItem::getU8(), SmbiosItem::SmbiosItem(), SmbiosItemXml::streamify(), and SmbiosItem::~SmbiosItem().
size_t header_size [protected, inherited] |
Definition at line 212 of file SmbiosImpl.h.
Referenced by SmbiosItem::fixup(), SmbiosItem::getBitfield(), SmbiosItem::getBufferCopy(), SmbiosItem::getBufferSize(), SmbiosItem::getStringByStringNumber(), SmbiosItem::getU16(), SmbiosItem::getU32(), SmbiosItem::getU64(), SmbiosItem::getU8(), and SmbiosItem::SmbiosItem().
std::string xmlFile [protected] |
Definition at line 65 of file SmbiosXmlImpl_xerces.h.
Referenced by SmbiosItemXml::setXmlFilePath().