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_OBJ_SMBIOS_H 00020 #define C_OBJ_SMBIOS_H 00021 00022 // include smbios_c/compat.h first 00023 #include "smbios_c/compat.h" 00024 #include "smbios_c/types.h" 00025 00026 // abi_prefix should be last header included before declarations 00027 #include "smbios_c/config/abi_prefix.h" 00028 00029 EXTERN_C_BEGIN; 00030 00031 #define SMBIOS_DEFAULTS 0x0000 00032 #define SMBIOS_GET_SINGLETON 0x0001 00033 #define SMBIOS_GET_NEW 0x0002 00034 #define SMBIOS_UNIT_TEST_MODE 0x0004 00035 #define SMBIOS_NO_FIXUPS 0x0008 00036 #define SMBIOS_NO_ERR_CLEAR 0x0010 00037 00038 struct smbios_table; 00039 struct smbios_struct; 00040 00041 // construct 00042 LIBSMBIOS_C_DLL_SPEC struct smbios_table *smbios_table_factory(int flags, ...); 00043 00044 // destruct 00045 LIBSMBIOS_C_DLL_SPEC void smbios_table_free(struct smbios_table *); 00046 00048 LIBSMBIOS_C_DLL_SPEC const char *smbios_table_strerror(const struct smbios_table *); 00049 00050 // visitor pattern 00051 LIBSMBIOS_C_DLL_SPEC void smbios_table_walk(struct smbios_table *, void (*smbios_table_walk_fn)(const struct smbios_struct *, void *userdata), void *userdata); 00052 00053 // for looping/searching 00054 LIBSMBIOS_C_DLL_SPEC struct smbios_struct *smbios_table_get_next_struct(const struct smbios_table *, const struct smbios_struct *cur); 00055 LIBSMBIOS_C_DLL_SPEC struct smbios_struct *smbios_table_get_next_struct_by_type(const struct smbios_table *, const struct smbios_struct *cur, u8 type); 00056 LIBSMBIOS_C_DLL_SPEC struct smbios_struct *smbios_table_get_next_struct_by_handle(const struct smbios_table *, const struct smbios_struct *cur, u16 handle); 00057 00058 #define smbios_table_for_each_struct(table_name, struct_name) \ 00059 for( \ 00060 const struct smbios_struct *struct_name = smbios_table_get_next_struct(table_name, 0);\ 00061 struct_name;\ 00062 struct_name = smbios_table_get_next_struct(table_name, struct_name)\ 00063 ) 00064 00065 #define smbios_table_for_each_struct_type(table_name, struct_name, struct_type) \ 00066 for( \ 00067 const struct smbios_struct *struct_name = smbios_table_get_next_struct_by_type(table_name, 0, struct_type);\ 00068 struct_name;\ 00069 struct_name = smbios_table_get_next_struct_by_type(table_name, struct_name, struct_type)\ 00070 ) 00071 00072 EXTERN_C_END; 00073 00074 // always should be last thing in header file 00075 #include "smbios_c/config/abi_suffix.h" 00076 00077 #endif /* SMBIOS_H */