libsmbios_c library
smbios.h
Go to the documentation of this file.
1 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:
2 /*
3  * Copyright (C) 2005 Dell Inc.
4  * by Michael Brown <Michael_E_Brown@dell.com>
5  * Licensed under the Open Software License version 2.1
6  *
7  * Alternatively, you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published
9  * by the Free Software Foundation; either version 2 of the License,
10  * or (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  * See the GNU General Public License for more details.
16  */
17 
18 
19 #ifndef C_SMBIOS_H
20 #define C_SMBIOS_H
21 
22 // include smbios_c/compat.h first
23 #include "smbios_c/compat.h"
24 #include "smbios_c/types.h"
25 
27 
28 struct smbios_struct;
29 
37 LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct(const struct smbios_struct *cur);
38 
39 
49 LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct_by_type(const struct smbios_struct *cur, u8 type);
50 
60 LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct_by_handle(const struct smbios_struct *cur, u16 handle);
61 
68 LIBSMBIOS_C_DLL_SPEC void smbios_walk(void (*fn)(const struct smbios_struct *, void *userdata), void *userdata);
69 
73 #define smbios_for_each_struct(struct_name) \
74  for( \
75  const struct smbios_struct *struct_name = smbios_get_next_struct(0);\
76  struct_name;\
77  struct_name = smbios_get_next_struct(struct_name)\
78  )
79 
84 #define smbios_for_each_struct_type(struct_name, struct_type) \
85  for( \
86  const struct smbios_struct *struct_name = smbios_get_next_struct_by_type(0, struct_type);\
87  struct_name;\
88  struct_name = smbios_get_next_struct_by_type(struct_name, struct_type)\
89  )
90 
92 LIBSMBIOS_C_DLL_SPEC u8 smbios_struct_get_type(const struct smbios_struct *);
93 
95 LIBSMBIOS_C_DLL_SPEC u8 smbios_struct_get_length(const struct smbios_struct *);
96 
98 LIBSMBIOS_C_DLL_SPEC u16 smbios_struct_get_handle(const struct smbios_struct *);
99 
108 LIBSMBIOS_C_DLL_SPEC int smbios_struct_get_data(const struct smbios_struct *s, void *dest, u8 offset, size_t len);
109 
117 LIBSMBIOS_C_DLL_SPEC const char * smbios_struct_get_string_from_offset(const struct smbios_struct *s, u8 offset);
118 
124 LIBSMBIOS_C_DLL_SPEC const char * smbios_struct_get_string_number(const struct smbios_struct *s, u8 which);
125 
131 
133 
134 #endif /* SMBIOS_H */