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_OBJ_SMBIOS_H
20#define C_OBJ_SMBIOS_H
21
22// include smbios_c/compat.h first
23#include "smbios_c/compat.h"
24#include "smbios_c/types.h"
25
26// abi_prefix should be last header included before declarations
28
30
31#define SMBIOS_DEFAULTS 0x0000
32#define SMBIOS_GET_SINGLETON 0x0001
33#define SMBIOS_GET_NEW 0x0002
34#define SMBIOS_UNIT_TEST_MODE 0x0004
35#define SMBIOS_NO_FIXUPS 0x0008
36#define SMBIOS_NO_ERR_CLEAR 0x0010
37
38struct smbios_table;
39struct smbios_struct;
40
41// construct
42LIBSMBIOS_C_DLL_SPEC struct smbios_table *smbios_table_factory(int flags, ...);
43
44// destruct
45LIBSMBIOS_C_DLL_SPEC void smbios_table_free(struct smbios_table *);
46
48LIBSMBIOS_C_DLL_SPEC const char *smbios_table_strerror(const struct smbios_table *);
49
50// visitor pattern
51LIBSMBIOS_C_DLL_SPEC void smbios_table_walk(struct smbios_table *, void (*smbios_table_walk_fn)(const struct smbios_struct *, void *userdata), void *userdata);
52
53// for looping/searching
54LIBSMBIOS_C_DLL_SPEC struct smbios_struct *smbios_table_get_next_struct(const struct smbios_table *, const struct smbios_struct *cur);
55LIBSMBIOS_C_DLL_SPEC struct smbios_struct *smbios_table_get_next_struct_by_type(const struct smbios_table *, const struct smbios_struct *cur, u8 type);
56LIBSMBIOS_C_DLL_SPEC struct smbios_struct *smbios_table_get_next_struct_by_handle(const struct smbios_table *, const struct smbios_struct *cur, u16 handle);
57
58#define smbios_table_for_each_struct(table_name, struct_name) \
59 for( \
60 const struct smbios_struct *struct_name = smbios_table_get_next_struct(table_name, 0);\
61 struct_name;\
62 struct_name = smbios_table_get_next_struct(table_name, struct_name)\
63 )
64
65#define smbios_table_for_each_struct_type(table_name, struct_name, struct_type) \
66 for( \
67 const struct smbios_struct *struct_name = smbios_table_get_next_struct_by_type(table_name, 0, struct_type);\
68 struct_name;\
69 struct_name = smbios_table_get_next_struct_by_type(table_name, struct_name, struct_type)\
70 )
71
73
74// always should be last thing in header file
76
77#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_table_get_next_struct_by_type(const struct smbios_table *, const struct smbios_struct *cur, u8 type)
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)
LIBSMBIOS_C_DLL_SPEC void smbios_table_walk(struct smbios_table *, void(*smbios_table_walk_fn)(const struct smbios_struct *, void *userdata), void *userdata)
LIBSMBIOS_C_DLL_SPEC const char * smbios_table_strerror(const struct smbios_table *)
LIBSMBIOS_C_DLL_SPEC struct smbios_table * smbios_table_factory(int flags,...)
LIBSMBIOS_C_DLL_SPEC void smbios_table_free(struct smbios_table *)
LIBSMBIOS_C_DLL_SPEC struct smbios_struct * smbios_table_get_next_struct(const struct smbios_table *, const struct smbios_struct *cur)
unsigned short u16
Definition types.h:33
unsigned char u8
Definition types.h:29