# Busclass list XML parsing

## Functions

void | discover_xml_merge_busclass_url (discover_xml_busclass_t **blist, char *url, discover_error_t *status)
discover_xml_busclass_t * | discover_xml_get_busclasses (discover_bus_t bus, discover_error_t *status)
void | discover_xml_free_busclasses (void)
char * | discover_xml_busclass_to_class (char *busclass, discover_xml_busclass_t *busclasses)
int | discover_xml_busclass_cmp (char *busclass, char *discover_class, discover_xml_busclass_t *busclasses)
char * | discover_xml_busclass_get_id (discover_xml_busclass_t *busclass)
char * | discover_xml_busclass_get_name (discover_xml_busclass_t *busclass)
discover_xml_busclass_t * | discover_xml_busclass_get_next (discover_xml_busclass_t *busclass)
discover_xml_busclass_t * | discover_xml_busclass_new (void)
void | discover_xml_busclass_free (discover_xml_busclass_t *busclasses)

## Function Documentation

int discover_xml_busclass_cmp | ( | char * | busclass,
|  | char * | discover_class,
|  | discover_xml_busclass_t * | busclasses
| ) |

Compare a busclass to a device class, returning the same kind of value returned by strcmp(3). Note that this function has a special case for the class 'all'; it is considered equal to all busclasses.

Parameters:

  | busclass | Busclass to compare
  | discover_class | Device class to compare
  | busclasses | List of busclasses to search

Definition at line 295 of file busclass-xml.c.

References discover_xml_busclass_to_class().

Referenced by discover_device_find().

void discover_xml_busclass_free | ( | discover_xml_busclass_t * | busclasses | ) |

Free the busclass or list of busclasses.

Parameters:

  | busclasses | Busclass or list of busclasses to free

Definition at line 382 of file busclass-xml.c.

Referenced by discover_xml_free_busclasses().

char* discover_xml_busclass_get_id | ( | discover_xml_busclass_t * | busclass | ) |

Get the id member of busclass.

Parameters:

  | busclass |

Definition at line 327 of file busclass-xml.c.

char* discover_xml_busclass_get_name | ( | discover_xml_busclass_t * | busclass | ) |

Get the name member of busclass.

Parameters:

  | busclass |

Definition at line 340 of file busclass-xml.c.

discover_xml_busclass_t* discover_xml_busclass_get_next | ( | discover_xml_busclass_t * | busclass | ) |

| Get the next member of busclass (used for traversing lists of busclasses). Definition at line 352 of file busclass-xml.c.

discover_xml_busclass_t* discover_xml_busclass_new | ( | void |  | ) |

| Create and initialize a new discover_xml_busclass_t object. Definition at line 363 of file busclass-xml.c.

char* discover_xml_busclass_to_class | ( | char * | busclass,
|  | discover_xml_busclass_t * | busclasses
| ) |

Return the device class corresponding to a busclass.

Parameters:

  | busclass | Busclass to look up
  | busclasses | List of busclasses to search

Definition at line 263 of file busclass-xml.c.

Referenced by discover_xml_busclass_cmp().

void discover_xml_free_busclasses | ( | void |  | ) |

| Free the list of busclasses. Definition at line 247 of file busclass-xml.c. References BUS_COUNT, and discover_xml_busclass_free().

discover_xml_busclass_t* discover_xml_get_busclasses | ( | discover_bus_t | bus,
|  | discover_error_t * | status
| ) |

Get the list of busclasses by bus type.

Parameters:

  | bus | Type of bus for which busclasses are required
  | status | Address in which to place status report

Definition at line 213 of file busclass-xml.c.

References discover_error::code, discover_xml_get_data_urls(), discover_xml_merge_busclass_url(), discover_xml_url_get_next(), and discover_xml_url_get_url().

Referenced by discover_device_find(), and discover_xml_get_devices().

void discover_xml_merge_busclass_url | ( | discover_xml_busclass_t ** | blist,
|  | char * | url,
|  | discover_error_t * | status
| ) |

Merge new busclasses into a list.

Parameters:

  | blist | Address of the list to merge busclasses into
  | url | URL of the document defining the busclasses
  | status | Address in which to place status report

Definition at line 171 of file busclass-xml.c.

References discover_error::code, DISCOVER_EIO, and DISCOVER_EXML.

Referenced by discover_xml_get_busclasses().