00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef C_OBJ_TOKEN_H
00020 #define C_OBJ_TOKEN_H
00021
00022
00023 #include "smbios_c/compat.h"
00024 #include "smbios_c/types.h"
00025
00026
00027 #include "smbios_c/config/abi_prefix.h"
00028
00029 EXTERN_C_BEGIN;
00030
00031 #define TOKEN_DEFAULTS 0x0000
00032 #define TOKEN_GET_SINGLETON 0x0001
00033 #define TOKEN_GET_NEW 0x0002
00034 #define TOKEN_UNIT_TEST_MODE 0x0004
00035 #define TOKEN_NO_ERR_CLEAR 0x0008
00036
00037 struct token_table;
00038 struct token_obj;
00039
00040
00041 DLL_SPEC struct token_table * DLL_SPEC token_table_factory(int flags, ...);
00042
00043
00044 DLL_SPEC void DLL_SPEC token_table_free(struct token_table *);
00045
00046
00047 DLL_SPEC const char * DLL_SPEC token_table_strerror(const struct token_table *);
00048 DLL_SPEC const char * DLL_SPEC token_obj_strerror(const struct token_obj *);
00049
00050
00051 DLL_SPEC const struct token_obj * DLL_SPEC token_table_get_next(const struct token_table *, const struct token_obj *cur);
00052 DLL_SPEC const struct token_obj * DLL_SPEC token_table_get_next_by_id(const struct token_table *, const struct token_obj *cur, u16 id);
00053
00054 DLL_SPEC u16 DLL_SPEC token_obj_get_id(const struct token_obj *);
00055
00056 #define token_table_for_each(table_name, struct_name) \
00057 for( \
00058 const struct token_obj *struct_name = token_table_get_next(table_name, 0);\
00059 struct_name;\
00060 struct_name = token_table_get_next(table_name, struct_name)\
00061 )
00062
00063 #define token_table_for_each_id(table_name, struct_name, id) \
00064 for( \
00065 const struct token_obj *struct_name = token_table_get_next_id(table_name, 0, id);\
00066 struct_name;\
00067 struct_name = token_table_get_next_id(table_name, struct_name, id)\
00068 )
00069
00070 DLL_SPEC int DLL_SPEC token_obj_get_type(const struct token_obj *);
00071 DLL_SPEC bool DLL_SPEC token_obj_is_bool(const struct token_obj *);
00072 DLL_SPEC int DLL_SPEC token_obj_is_active(const struct token_obj *);
00073 DLL_SPEC int DLL_SPEC token_obj_activate(const struct token_obj *);
00074
00075 DLL_SPEC bool DLL_SPEC token_obj_is_string(const struct token_obj *);
00076 DLL_SPEC char* DLL_SPEC token_obj_get_string(const struct token_obj *, size_t *len);
00077 DLL_SPEC int DLL_SPEC token_obj_set_string(const struct token_obj *, const char *, size_t size);
00078
00079 DLL_SPEC const struct smbios_struct * DLL_SPEC token_obj_get_smbios_struct(const struct token_obj *);
00080 DLL_SPEC int DLL_SPEC token_obj_try_password(const struct token_obj *, const char *pass_ascii, const char *pass_scancode);
00081 DLL_SPEC const void * DLL_SPEC token_obj_get_ptr(const struct token_obj *t);
00082
00083 #if defined(_MSC_VER)
00084 #pragma pack(push,1)
00085 #endif
00086 struct indexed_io_token
00087 {
00088 u16 tokenId;
00089 u8 location;
00090 u8 andMask;
00091 union {
00092 u8 orValue;
00093 u8 stringLength;
00094 };
00095 }
00096 LIBSMBIOS_C_PACKED_ATTR;
00097
00098 struct indexed_io_access_structure
00099 {
00100 u8 type;
00101 u8 length;
00102 u16 handle;
00103 u16 indexPort;
00104 u16 dataPort;
00105 u8 checkType;
00106 u8 checkedRangeStartIndex;
00107 u8 checkedRangeEndIndex;
00108 u8 checkValueIndex;
00109
00110 struct indexed_io_token tokens[];
00111 }
00112 LIBSMBIOS_C_PACKED_ATTR;
00113
00114 struct dell_protected_value_1_structure
00115 {
00116 u8 type;
00117 u8 length;
00118 u16 handle;
00119 u16 tokenId;
00120 u8 valueLen;
00121 u8 valueFormat;
00122 u16 validationKey;
00123 u16 indexPort;
00124 u16 dataPort;
00125 u8 checkType;
00126 u8 valueStartIndex;
00127 u8 checkIndex;
00128 }
00129 LIBSMBIOS_C_PACKED_ATTR;
00130
00131 struct dell_protected_value_2_structure
00132 {
00133 u8 type;
00134 u8 length;
00135 u16 handle;
00136 u16 tokenId;
00137 u8 valueLen;
00138 u8 valueFormat;
00139 u16 validationKey;
00140 u16 indexPort;
00141 u16 dataPort;
00142 u8 checkType;
00143 u8 valueStartIndex;
00144 u8 checkIndex;
00145 u8 rangeCheckType;
00146 u8 rangeCheckStart;
00147 u8 rangeCheckEnd;
00148 u8 rangeCheckIndex;
00149 }
00150 LIBSMBIOS_C_PACKED_ATTR;
00151 #if defined(_MSC_VER)
00152 #pragma pack(pop)
00153 #endif
00154
00155 enum
00156 {
00157 CHECK_TYPE_WORD_CHECKSUM = 0x00,
00158 CHECK_TYPE_BYTE_CHECKSUM = 0x01,
00159 CHECK_TYPE_WORD_CRC = 0x02,
00160 CHECK_TYPE_WORD_CHECKSUM_N = 0x03,
00161 };
00162
00163 EXTERN_C_END;
00164
00165
00166 #include "smbios_c/config/abi_suffix.h"
00167
00168 #endif