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
28struct smbios_struct;
29
37LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct(const struct smbios_struct *cur);
38
39
49LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct_by_type(const struct smbios_struct *cur, u8 type);
50
60LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct_by_handle(const struct smbios_struct *cur, u16 handle);
61
68LIBSMBIOS_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
92LIBSMBIOS_C_DLL_SPEC u8 smbios_struct_get_type(const struct smbios_struct *);
93
95LIBSMBIOS_C_DLL_SPEC u8 smbios_struct_get_length(const struct smbios_struct *);
96
99
108LIBSMBIOS_C_DLL_SPEC int smbios_struct_get_data(const struct smbios_struct *s, void *dest, u8 offset, size_t len);
109
117LIBSMBIOS_C_DLL_SPEC const char * smbios_struct_get_string_from_offset(const struct smbios_struct *s, u8 offset);
118
124LIBSMBIOS_C_DLL_SPEC const char * smbios_struct_get_string_number(const struct smbios_struct *s, u8 which);
125
130
132
133#endif /* SMBIOS_H */
#define LIBSMBIOS_C_DLL_SPEC
Definition compat.h:48
#define EXTERN_C_BEGIN
Definition compat.h:55
#define EXTERN_C_END
Definition compat.h:56
LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct_by_type(const struct smbios_struct *cur, u8 type)
Function for looping over smbios table structures by type.
LIBSMBIOS_C_DLL_SPEC int smbios_struct_get_data(const struct smbios_struct *s, void *dest, u8 offset, size_t len)
Copy data out of the smbios structure.
LIBSMBIOS_C_DLL_SPEC const char * smbios_struct_get_string_from_offset(const struct smbios_struct *s, u8 offset)
get string from smbios structure.
LIBSMBIOS_C_DLL_SPEC u8 smbios_struct_get_length(const struct smbios_struct *)
Returns the structure length of a given smbios structure.
LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct_by_handle(const struct smbios_struct *cur, u16 handle)
Function for looping over smbios table structures by handle.
LIBSMBIOS_C_DLL_SPEC u16 smbios_struct_get_handle(const struct smbios_struct *)
Returns the structure handle of a given smbios structure.
LIBSMBIOS_C_DLL_SPEC void smbios_walk(void(*fn)(const struct smbios_struct *, void *userdata), void *userdata)
Call a named function for each smbios structure.
LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_get_next_struct(const struct smbios_struct *cur)
Function for looping over smbios table structures.
LIBSMBIOS_C_DLL_SPEC const char * smbios_struct_get_string_number(const struct smbios_struct *s, u8 which)
get string from smbios structure.
LIBSMBIOS_C_DLL_SPEC u8 smbios_struct_get_type(const struct smbios_struct *)
Returns the structure type of a given smbios structure.
LIBSMBIOS_C_DLL_SPEC char * smbios_strerror()
Returns string describing the last error condition.
unsigned short u16
Definition types.h:33
unsigned char u8
Definition types.h:29