authd/provider: add stats handling hooking

This commit is contained in:
Elizabeth Myers 2016-03-27 17:15:08 -05:00
parent 02e141f7a3
commit ee7f92714a
2 changed files with 15 additions and 0 deletions

View file

@ -74,6 +74,9 @@ load_provider(struct auth_provider *provider)
rb_dictionary_add(authd_option_handlers, handler->option, handler);
}
if(provider->stats_handler.letter != '\0')
authd_stat_handlers[provider->stats_handler.letter] = provider->stats_handler.handler;
provider->init();
rb_dlinkAdd(provider, &provider->node, &auth_providers);
}
@ -88,6 +91,10 @@ unload_provider(struct auth_provider *provider)
for(handler = provider->opt_handlers; handler->option != NULL; handler++)
rb_dictionary_delete(authd_option_handlers, handler->option);
}
if(provider->stats_handler.letter != '\0')
authd_stat_handlers[provider->stats_handler.letter] = NULL;
provider->destroy();
rb_dlinkDelete(&provider->node, &auth_providers);
}

View file

@ -65,6 +65,12 @@ typedef bool (*provider_start_t)(struct auth_client *);
typedef void (*provider_cancel_t)(struct auth_client *);
typedef void (*provider_complete_t)(struct auth_client *, provider_t);
struct auth_stats_handler
{
const char letter;
authd_stat_handler handler;
};
struct auth_provider
{
rb_dlink_node node;
@ -78,6 +84,8 @@ struct auth_provider
provider_cancel_t cancel; /* Authentication cancelled */
provider_complete_t completed; /* Callback for when other performers complete (think dependency chains) */
struct auth_stats_handler stats_handler;
struct auth_opts_handler *opt_handlers;
};