src/include/smbios_c/smbios.h File Reference

#include "smbios_c/compat.h"
#include "smbios_c/types.h"
Include dependency graph for smbios.h:

Go to the source code of this file.

Defines

#define smbios_for_each_struct(struct_name)
 looping helper macro.
#define smbios_for_each_struct_type(struct_name, struct_type)
 looping helper macro.

Functions

struct smbios_struct *DLL_SPEC smbios_get_next_struct (const struct smbios_struct *cur)
 Function for looping over smbios table structures.
struct smbios_struct *DLL_SPEC smbios_get_next_struct_by_type (const struct smbios_struct *cur, u8 type)
 Function for looping over smbios table structures by type.
struct smbios_struct *DLL_SPEC smbios_get_next_struct_by_handle (const struct smbios_struct *cur, u16 handle)
 Function for looping over smbios table structures by handle.
void DLL_SPEC smbios_walk (void(*fn)(const struct smbios_struct *, void *userdata), void *userdata)
 Call a named function for each smbios structure.
u8 DLL_SPEC smbios_struct_get_type (const struct smbios_struct *)
 Returns the structure type of a given smbios structure.
u8 DLL_SPEC smbios_struct_get_length (const struct smbios_struct *)
 Returns the structure length of a given smbios structure.
u16 DLL_SPEC smbios_struct_get_handle (const struct smbios_struct *)
 Returns the structure handle of a given smbios structure.
int DLL_SPEC smbios_struct_get_data (const struct smbios_struct *s, void *dest, u8 offset, size_t len)
 Copy data out of the smbios structure.
const char *DLL_SPEC smbios_struct_get_string_from_offset (const struct smbios_struct *s, u8 offset)
 get string from smbios structure.
const char *DLL_SPEC smbios_struct_get_string_number (const struct smbios_struct *s, u8 which)
 get string from smbios structure.
const char *DLL_SPEC smbios_strerror ()
 Returns string describing the last error condition.

Define Documentation

#define smbios_for_each_struct ( struct_name   ) 
Value:
for(    \
            const struct smbios_struct *struct_name = smbios_get_next_struct(0);\
            struct_name;\
            struct_name = smbios_get_next_struct(struct_name)\
           )

looping helper macro.

This macro makes it easy to loop over each structure in the smbios table

#define smbios_for_each_struct_type ( struct_name,
struct_type   ) 
Value:
for(    \
            const struct smbios_struct *struct_name = smbios_get_next_struct_by_type(0, struct_type);\
            struct_name;\
            struct_name = smbios_get_next_struct_by_type(struct_name, struct_type)\
           )

looping helper macro.

This macro makes it easy to loop over specific structure types in the smbios table


Function Documentation

struct smbios_struct* DLL_SPEC smbios_get_next_struct ( const struct smbios_struct *  cur  )  [read]

Function for looping over smbios table structures.

Returns a pointer to the next smbios structure. You can cast this structure to a specific smbios structure, or you can use the generic access methods to pull data out of the structure. Returns 0 on end of table.

Parameters:
cur pointer to current structure, or 0 to begin at the start of the table.
Returns:
Pointer to next smbios structure. returns 0 on end of table.
struct smbios_struct* DLL_SPEC smbios_get_next_struct_by_handle ( const struct smbios_struct *  cur,
u16  handle 
) [read]

Function for looping over smbios table structures by handle.

Returns a pointer to the next smbios structure with a given handle. You can cast this structure to a specific smbios structure, or you can use the generic access methods to pull data out of the structure. Returns 0 on end of table.

Parameters:
cur pointer to current structure, or 0 to begin at the start of the table.
handle only return smbios structures matching handle
Returns:
Pointer to next smbios structure. returns 0 on end of table.
struct smbios_struct* DLL_SPEC smbios_get_next_struct_by_type ( const struct smbios_struct *  cur,
u8  type 
) [read]

Function for looping over smbios table structures by type.

Returns a pointer to the next smbios structure with a given type. You can cast this structure to a specific smbios structure, or you can use the generic access methods to pull data out of the structure. Returns 0 on end of table.

Parameters:
cur pointer to current structure, or 0 to begin at the start of the table.
type only return smbios structures matching type
Returns:
Pointer to next smbios structure. returns 0 on end of table.
const char* DLL_SPEC smbios_strerror (  ) 

Returns string describing the last error condition.

Can return 0. The buffer used is guaranteed to be valid until the next call to any smbios_* function. Copy the contents if you need it longer.

int DLL_SPEC smbios_struct_get_data ( const struct smbios_struct *  s,
void *  dest,
u8  offset,
size_t  len 
)

Copy data out of the smbios structure.

Does bounds-checking to ensure that structure overflows do not happen.

Parameters:
s pointer to structure to access
dest pointer to user-allocated buffer to fill
offset offset in structure
len length of data to copy into buffer
Returns:
returns 0 on success, <0 on failure.
u16 DLL_SPEC smbios_struct_get_handle ( const struct smbios_struct *   ) 

Returns the structure handle of a given smbios structure.

u8 DLL_SPEC smbios_struct_get_length ( const struct smbios_struct *   ) 

Returns the structure length of a given smbios structure.

const char* DLL_SPEC smbios_struct_get_string_from_offset ( const struct smbios_struct *  s,
u8  offset 
)

get string from smbios structure.

Most smbios structures have specific offsets that contain a string number. This function will look up the offset and retrieve the pointed-to string.

Parameters:
s pointer to smbios structure
offset offset containing string pointer
Returns:
returns a pointer to the string, or 0 on failure.
const char* DLL_SPEC smbios_struct_get_string_number ( const struct smbios_struct *  s,
u8  which 
)

get string from smbios structure.

Retrieves string N from the end of a smbios structure.

Parameters:
s pointer to smbios structure
which string number to return
u8 DLL_SPEC smbios_struct_get_type ( const struct smbios_struct *   ) 

Returns the structure type of a given smbios structure.

void DLL_SPEC smbios_walk ( void(*)(const struct smbios_struct *, void *userdata)  fn,
void *  userdata 
)

Call a named function for each smbios structure.

Calls the given function for each smbios table structure. Passes a pointer to the structure as well as the userdata pointer given.

Parameters:
fn pointer to the function to call
userdata opaque pointer that will be passed to the funciton
Generated on Wed Jul 28 08:16:01 2010 for libsmbios_c library by  doxygen 1.6.3