-void iterate_parsers(struct discover_context *ctx, enum conf_method method)
-{
- int rc, i, len;
- char *buf;
-
- pb_log("trying parsers for %s\n", ctx->device->device->id);
-
- switch (method) {
- case CONF_METHOD_LOCAL_FILE:
- for (i = 0; i < n_parsers; i++) {
- if (parsers[i]->method != CONF_METHOD_LOCAL_FILE)
- continue;
-
- pb_log("\ttrying parser '%s'\n", parsers[i]->name);
- ctx->parser = parsers[i];
- iterate_parser_files(ctx, ctx->parser);
- }
- ctx->parser = NULL;
- break;
-
- case CONF_METHOD_DHCP:
- rc = download_config(ctx, &buf, &len);
- if (rc)
- return;
-
- for (i = 0; i < n_parsers; i++) {
- if (parsers[i]->method != method)
- continue;
-
- pb_log("\ttrying parser '%s'\n", parsers[i]->name);
- ctx->parser = parsers[i];
- parsers[i]->parse(ctx, buf, len);
- }