libsmbios_c library
|
00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c: 00002 /* 00003 * Copyright (C) 2005 Dell Inc. 00004 * by Michael Brown <Michael_E_Brown@dell.com> 00005 * Licensed under the Open Software License version 2.1 00006 * 00007 * Alternatively, you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published 00009 * by the Free Software Foundation; either version 2 of the License, 00010 * or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 * See the GNU General Public License for more details. 00016 */ 00017 00018 00019 #ifndef C_SMBIOS_H 00020 #define C_SMBIOS_H 00021 00022 // include smbios_c/compat.h first 00023 #include "smbios_c/compat.h" 00024 #include "smbios_c/types.h" 00025 00026 EXTERN_C_BEGIN; 00027 00028 struct smbios_struct; 00029 00037 LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct(const struct smbios_struct *cur); 00038 00039 00049 LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct_by_type(const struct smbios_struct *cur, u8 type); 00050 00060 LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct_by_handle(const struct smbios_struct *cur, u16 handle); 00061 00068 LIBSMBIOS_C_DLL_SPEC void smbios_walk(void (*fn)(const struct smbios_struct *, void *userdata), void *userdata); 00069 00073 #define smbios_for_each_struct(struct_name) \ 00074 for( \ 00075 const struct smbios_struct *struct_name = smbios_get_next_struct(0);\ 00076 struct_name;\ 00077 struct_name = smbios_get_next_struct(struct_name)\ 00078 ) 00079 00084 #define smbios_for_each_struct_type(struct_name, struct_type) \ 00085 for( \ 00086 const struct smbios_struct *struct_name = smbios_get_next_struct_by_type(0, struct_type);\ 00087 struct_name;\ 00088 struct_name = smbios_get_next_struct_by_type(struct_name, struct_type)\ 00089 ) 00090 00092 LIBSMBIOS_C_DLL_SPEC u8 smbios_struct_get_type(const struct smbios_struct *); 00093 00095 LIBSMBIOS_C_DLL_SPEC u8 smbios_struct_get_length(const struct smbios_struct *); 00096 00098 LIBSMBIOS_C_DLL_SPEC u16 smbios_struct_get_handle(const struct smbios_struct *); 00099 00108 LIBSMBIOS_C_DLL_SPEC int smbios_struct_get_data(const struct smbios_struct *s, void *dest, u8 offset, size_t len); 00109 00117 LIBSMBIOS_C_DLL_SPEC const char * smbios_struct_get_string_from_offset(const struct smbios_struct *s, u8 offset); 00118 00124 LIBSMBIOS_C_DLL_SPEC const char * smbios_struct_get_string_number(const struct smbios_struct *s, u8 which); 00125 00130 LIBSMBIOS_C_DLL_SPEC const char * smbios_strerror(); 00131 00132 EXTERN_C_END; 00133 00134 #endif /* SMBIOS_H */