Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

# discover.h

Go to the documentation of this file.

    00001
    00006 /* $Progeny$
    00007  *
    00008  * Copyright 2001, 2002 Progeny Linux Systems, Inc.
    00009  * Copyright 2002 Hewlett-Packard Company
    00010  *
    00011  * Permission is hereby granted, free of charge, to any person obtaining a
    00012  * copy of this software and associated documentation files (the "Software"),
    00013  * to deal in the Software without restriction, including without limitation
    00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00015  * and/or sell copies of the Software, and to permit persons to whom the
    00016  * Software is furnished to do so, subject to the following conditions:
    00017  *
    00018  * The above copyright notice and this permission notice shall be included in
    00019  * all copies or substantial portions of the Software.
    00020  *
    00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00022  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
    00024  * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00027  * DEALINGS IN THE SOFTWARE.
    00028  */
    00029
    00030 #ifndef DISCOVER_H
    00031 #define DISCOVER_H
    00032
    00033 #include <stdbool.h>
    00034
    00035 #ifdef __cplusplus
    00036     extern "C" {
    00037 #endif
    00038
    00073 typedef enum {
    00075     DISCOVER_SUCCESS,
    00077     DISCOVER_EIO,
    00079     DISCOVER_EXML,
    00081     DISCOVER_ESYS,
    00083     DISCOVER_EBUSDISABLED,
    00085     DISCOVER_EBUSNOTFOUND,
    00087     DISCOVER_EDATANOTFOUND,
    00089     DISCOVER_EDEVICENOTFOUND,
    00091     DISCOVER_EBADVERSION,
    00093     DISCOVER_ENOIMPL
    00094 } discover_error_code_t;
    00095
    00096 struct discover_error;
    00097
    00099 typedef void *(discover_create_message_t)(struct discover_error **, char *);
    00100
    00106 typedef struct discover_error {
    00108     discover_error_code_t code;
    00110     char *message;
    00112     discover_create_message_t *create_message;
    00113 } discover_error_t;
    00114
    00116 typedef struct discover_bus_map         discover_bus_map_t;
    00118 typedef struct discover_device          discover_device_t;
    00120 typedef struct discover_data            discover_data_t;
    00122 typedef struct discover_xml_busclass    discover_xml_busclass_t;
    00124 typedef struct discover_xml_vendor      discover_xml_vendor_t;
    00126 typedef struct discover_xml_url         discover_xml_url_t;
    00127
    00129 typedef discover_device_t *(discover_device_func_t)(discover_error_t *);
    00131 typedef discover_xml_busclass_t *(discover_xml_busclass_func_t)(discover_error_t *);
    00133 typedef discover_xml_vendor_t *(discover_xml_vendor_func_t)(discover_error_t *);
    00135 typedef discover_xml_url_t *(discover_xml_url_func_t)(discover_error_t *);
    00137 typedef void (discover_free_func_t)(void);
    00138
    00139 #include <discover/sysdep.h>
    00141 typedef discover_sysdep_data_t *(discover_sysdep_raw_func_t)(void);
    00142
    00146 typedef enum {
    00147     ATA,
    00148     PCI,
    00149     PCMCIA,
    00150     SCSI,
    00151     USB
    00152 } discover_bus_t;
    00153
    00157 #define BUS_COUNT 5
    00158
    00162 typedef enum {
    00163     VENDOR_TYPE,
    00164     BUSCLASS_TYPE,
    00165     DEVICE_TYPE
    00166 } discover_filetype_t;
    00167
    00168
    00178 struct discover_bus_map {
    00180     char *name;
    00182     int scan_default;
    00184     int scan_never;
    00186     discover_sysdep_raw_func_t *get_raw;
    00187 };
    00188
    00192 discover_device_t *discover_get_devices(discover_bus_t bus, discover_error_t *status);
    00193
    00195 void discover_free_devices(void);
    00196
    00197 discover_error_t *discover_error_new(void);
    00198 void discover_error_free(discover_error_t *status);
    00199 char *discover_strerror(discover_error_t *err);
    00200 int discover_major_version(void);
    00201 int discover_minor_version(void);
    00202 int discover_micro_version(void);
    00203
    00204 /******************************************************************************
    00205  * discover_device
    00206  */
    00207
    00208 discover_device_t *discover_device_new(void);
    00209
    00210 /* Class is "video", "sound", etc. */
    00211 discover_device_t *discover_device_find(char *discover_class,
    00212                                              discover_error_t *status);
    00213
    00214 char *discover_device_get_data(discover_device_t *device,
    00215                                char *path, char *version,
    00216                                discover_error_t *status);
    00217
    00218 void
    00219 discover_device_copy(discover_device_t *src, discover_device_t *dst);
    00220
    00221 char *discover_device_get_busclass(discover_device_t *device);
    00222 char *discover_device_get_model_id(discover_device_t *device);
    00223 char *discover_device_get_model_name(discover_device_t *device);
    00224 char *discover_device_get_vendor_id(discover_device_t *device);
    00225 char *discover_device_get_vendor_name(discover_device_t *device);
    00226
    00227 discover_data_t *
    00228 discover_device_get_data_struct(discover_device_t *device);
    00229
    00230 discover_device_t *
    00231 discover_device_get_next(discover_device_t *device);
    00232
    00233 void discover_device_free(discover_device_t *devices, int free_data);
    00234
    00235 /******************************************************************************
    00236  * discover_data
    00237  */
    00238
    00239 discover_data_t *discover_data_new(void);
    00240
    00241 char *discover_data_get_class(discover_data_t *data);
    00242 char *discover_data_get_text(discover_data_t *data);
    00243 discover_data_t *discover_data_get_parent(discover_data_t *data);
    00244 discover_data_t *discover_data_get_child(discover_data_t *data);
    00245 discover_data_t *discover_data_get_next(discover_data_t *data);
    00246 discover_data_t *discover_data_get_prev(discover_data_t *prev);
    00247 discover_data_t *discover_data_get_first(discover_data_t *data);
    00248 void discover_data_free(discover_data_t *data_tree);
    00249
    00250 #ifdef __cplusplus
    00251     }
    00252 #endif
    00253
    00254 #endif
    00255
    00256 /*
    00257  * Local variables:
    00258  * c-file-style: "progeny"
    00259  * indent-tabs-mode: nil
    00260  * End:
    00261  */
    00262 /* vim: set cin fo=tcroq sw=4 et sts=4 tw=75: */