# Device list XML parsing

## Functions

void | discover_xml_merge_device_url (discover_device_t **dlist, char *url, discover_xml_busclass_t *busclasses, discover_xml_vendor_t *vendors, discover_error_t *status)
discover_device_t * | discover_xml_get_devices (discover_bus_t bus, discover_error_t *status)
void | discover_xml_free_devices (void)
discover_device_t * | discover_xml_find_device (discover_device_t *xml_devices, char *target_vendor, char *target_model, discover_error_t *status)
discover_device_t * | discover_xml_find_next_device (discover_device_t *xml_devices, char *target_vendor, char *target_model, discover_error_t *status)
discover_device_t * | discover_xml_get_matching_devices (discover_device_t *xml_devices, char *target_vendor, char *target_model, discover_error_t *status)

## Function Documentation

discover_device_t* discover_xml_find_device | ( | discover_device_t * | xml_devices,
|  | char * | target_vendor,
|  | char * | target_model,
|  | discover_error_t * | status
| ) |

Find the first device in xml_devices matching target_vendor and/or target_model. (One or both can be specified, but not zero.)

Parameters:

  | xml_devices | List of devices to search
  | target_vendor | Vendor for which to search
  | target_model | Model for which to search
  | status | Address in which to place status report

Definition at line 550 of file device-xml.c.

Referenced by discover_xml_find_next_device(), and discover_xml_get_matching_devices().

discover_device_t* discover_xml_find_next_device | ( | discover_device_t * | xml_devices,
|  | char * | target_vendor,
|  | char * | target_model,
|  | discover_error_t * | status
| ) |

Find the next device in xml_devices matching target_vendor and/or target_model. (One or both can be specified, but not zero.)

The first device in the list is assumed to have been processed, so we simply call discover_xml_find_device() on the next pointer.

Parameters:

  | xml_devices | List of devices to search
  | target_vendor | Vendor for which to search
  | target_model | Model for which to search
  | status | Address in which to place status report

Definition at line 594 of file device-xml.c.

References discover_xml_find_device().

Referenced by discover_xml_get_matching_devices().

void discover_xml_free_devices | ( | void |  | ) |

| Free the list of XML devices. Definition at line 531 of file device-xml.c. References BUS_COUNT, and discover_device_free().

discover_device_t* discover_xml_get_devices | ( | discover_bus_t | bus,
|  | discover_error_t * | status
| ) |

Get the list of devices for the required bus.

Parameters:

  | bus | Bus for which the devices are requested
  | status | Address in which to place status report

Definition at line 484 of file device-xml.c.

References discover_error::code, discover_xml_get_busclasses(), discover_xml_get_data_urls(), discover_xml_get_vendors(), discover_xml_merge_device_url(), discover_xml_url_get_next(), and discover_xml_url_get_url().

Referenced by discover_get_devices().

discover_device_t* discover_xml_get_matching_devices | ( | discover_device_t * | xml_devices,
|  | char * | target_vendor,
|  | char * | target_model,
|  | discover_error_t * | status
| ) |

Find and duplicate all devices in xml_devices matching target_vendor and/or target_model. (One or both can be specified, but not zero.)

Parameters:

  | xml_devices | List of devices to search
  | target_vendor | Vendor for which to search
  | target_model | Model for which to search
  | status | Address in which to place status report

Definition at line 614 of file device-xml.c.

References discover_device_copy(), discover_device_new(), discover_xml_find_device(), and discover_xml_find_next_device().

Referenced by discover_get_devices().

void discover_xml_merge_device_url | ( | discover_device_t ** | dlist,
|  | char * | url,
|  | discover_xml_busclass_t * | busclasses,
|  | discover_xml_vendor_t * | vendors,
|  | discover_error_t * | status
| ) |

Merge new busclasses into a list.

Parameters:

  | dlist | Address of the list to merge busclasses into
  | url | URL of the document defining the busclasses
  | busclasses | List of busclasses for this bus
  | vendors | List of vendors for this bus
  | status | Address in which to place status report

Definition at line 425 of file device-xml.c.

References discover_error::code, DISCOVER_EIO, and DISCOVER_EXML.

Referenced by discover_xml_get_devices().