# Configuration handling

## Functions

void | discover_conf_load (discover_error_t *status)
int | discover_conf_name_to_bus (char *name, discover_error_t *status)
discover_bus_map_t * | discover_conf_get_full_bus_map (discover_error_t *status)
discover_bus_map_t * | discover_conf_get_bus_map_by_name (char *name, discover_error_t *status)
discover_bus_map_t * | discover_conf_get_bus_map (discover_bus_t bus, discover_error_t *status)
void | discover_conf_insert_url (char *url, discover_error_t *status)
void | discover_conf_append_url (char *url, discover_error_t *status)
discover_xml_url_t * | discover_conf_get_urls (discover_error_t *status)
void | discover_conf_free (void)
char * | discover_conf_get_bus_name (discover_bus_t bus)
char * | discover_conf_get_filetype_name (discover_filetype_t filetype)

## Function Documentation

void discover_conf_append_url | ( | char * | url,
|  | discover_error_t * | status
| ) |

Append the URL specified in url at the tail of the list of URLs where Discover data will be retrieved.

Parameters:

  | url | URL to append
  | status | Address in which to place status report

Definition at line 579 of file conf.c.

References discover_error::code, and discover_conf_load().

void discover_conf_free | ( | void |  | ) |

| Free configuration data. This is mainly useful so that the next call to discover_conf_load will reload the configuration data. Definition at line 650 of file conf.c. References discover_xml_url_free().

discover_bus_map_t* discover_conf_get_bus_map | ( | discover_bus_t | bus,
|  | discover_error_t * | status
| ) |

Get the bus map for a single bus.

Parameters:

  | bus | Name of the bus whose map to get
  | status | Address in which to place status report

Definition at line 532 of file conf.c.

References BUS_COUNT, discover_error::code, discover_conf_load(), and DISCOVER_EBUSNOTFOUND.

Referenced by discover_get_devices().

discover_bus_map_t* discover_conf_get_bus_map_by_name | ( | char * | name,
|  | discover_error_t * | status
| ) |

Get the bus map by name for a single bus.

Parameters:

  | name | Name of the bus whose map to get
  | status | Address in which to place status report

Definition at line 509 of file conf.c.

References _real_discover_conf_get_bus_map_by_name(), discover_error::code, and discover_conf_load().

char* discover_conf_get_bus_name | ( | discover_bus_t | bus | ) |

Translate an enum bus value into a string.

Parameters:

  | bus | Bus type in enumerated form

Definition at line 666 of file conf.c.

References BUS_COUNT, and discover_bus_map::name.

Referenced by discover_xml_get_data_urls().

char* discover_conf_get_filetype_name | ( | discover_filetype_t | filetype | ) |

Translate an enum filetype value into a string.

Parameters:

  | filetype | Filetype in enumerated form

Definition at line 682 of file conf.c.

Referenced by discover_xml_get_data_urls().

discover_bus_map_t* discover_conf_get_full_bus_map | ( | discover_error_t * | status | ) |

Get the full bus map, listing all buses.

Parameters:

  | status | Address in which to place status report

Definition at line 496 of file conf.c.

References discover_conf_load().

Referenced by discover_device_find().

discover_xml_url_t* discover_conf_get_urls | ( | discover_error_t * | status | ) |

Get the list of URLs from which XML data will be retrieved.

Parameters:

  | status | Address in which to place status report

Definition at line 599 of file conf.c.

References discover_error::code, discover_conf_load(), and discover_xml_url_new().

Referenced by discover_xml_get_urls().

void discover_conf_insert_url | ( | char * | url,
|  | discover_error_t * | status
| ) |

Insert the URL specified in url at the head of the list of URLs where Discover data will be retrieved.

Parameters:

  | url | URL to insert
  | status | Address in which to place status report

Definition at line 557 of file conf.c.

References discover_error::code, and discover_conf_load().

void discover_conf_load | ( | discover_error_t * | status | ) |

Ensure that the configuration file is loaded. Repeated calls to this function will not change anything, unless you call discover_conf_free.

Technically, this function will lie to you if there is no conf file. Even though no configuration was loaded, repeated calls still will not change anything. However, if we don't do this and a config file is created between the time some long-lived caller first calls discover_conf_load and the time it calls it again, it will be loaded. This doesn't strike me as idempotent behavior. So, repeated calls even in this case will not change anything unless you call discover_conf_free.

Parameters:

  | status | Address in which to place status report

Definition at line 378 of file conf.c.

References discover_error::code, discover_error::create_message, and DISCOVER_EXML.

Referenced by discover_conf_append_url(), discover_conf_get_bus_map(), discover_conf_get_bus_map_by_name(), discover_conf_get_full_bus_map(), discover_conf_get_urls(), and discover_conf_insert_url().

int discover_conf_name_to_bus | ( | char * | name,
|  | discover_error_t * | status
| ) |

Get the bus enumeration for a bus name.

Parameters:

  | name | Name of the bus
  | status | Address in which to place status report

Definition at line 477 of file conf.c.

References discover_error::code, and DISCOVER_EBUSNOTFOUND.

Referenced by _real_discover_conf_get_bus_map_by_name().