[asterisk-dev] [Code Review] 4215: sorcery: Add additional observer capabilities.
George Joseph
reviewboard at asterisk.org
Thu Nov 27 17:51:52 CST 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4215/
-----------------------------------------------------------
(Updated Nov. 27, 2014, 4:51 p.m.)
Review request for Asterisk Developers and Joshua Colp.
Changes
-------
Added instance_loading and object_type_loading observation points that trigger before the loads.
Also made ast_variable_find more useful.
Repository: Asterisk
Description
-------
Add the following observation points to sorcery...
/*! \brief Interface for the global sorcery observer */
struct ast_sorcery_global_observer {
/*! \brief Callback after an instance is created */
void (*instance_created)(const char *name, const struct ast_sorcery *sorcery);
/*! \brief Callback after an wizard is registered */
void (*wizard_registered)(const char *name, const struct ast_sorcery_wizard *wizard);
};
/*! \brief Interface for the instance sorcery observer */
struct ast_sorcery_instance_observer {
/*! \brief Callback before an instance is destroyed */
void (*instance_destroyed)(const char *name, const struct ast_sorcery *sorcery);
/*! \brief Callback after an instance is loaded/reloaded */
void (*instance_loaded)(const char *name, const struct ast_sorcery *sorcery,
int reloaded);
/*! \brief Callback after any obect_type is registered */
void (*object_type_registered)(const char *name, const struct ast_sorcery *sorcery,
const char *object_type);
/*! \brief Callback after any obect_type is loaded/reloaded */
void (*object_type_loaded)(const char *name, const struct ast_sorcery *sorcery,
const char *object_type, int reloaded);
};
/*! \brief Interface for the instance sorcery observer */
struct ast_sorcery_wizard_observer {
/*! \brief Callback before a wizard is unregistered */
void (*wizard_unregistered)(const char *name, const struct ast_sorcery_wizard *wizard);
/*! \brief Callback after a wizard is loaded/reloaded for any type */
void (*wizard_loaded)(const char *name, const struct ast_sorcery_wizard *wizard,
const char *object_type, int reloaded);
};
Add the following observer add/remove APIs
int ast_sorcery_global_observer_add(const struct ast_sorcery_global_observer *callbacks);
void ast_sorcery_global_observer_remove(const struct ast_sorcery_global_observer *callbacks);
int ast_sorcery_instance_observer_add(struct ast_sorcery *sorcery,
const struct ast_sorcery_instance_observer *callbacks);
void ast_sorcery_instance_observer_remove(struct ast_sorcery *sorcery,
const struct ast_sorcery_instance_observer *callbacks);
int ast_sorcery_wizard_observer_add(struct ast_sorcery_wizard *wizard,
const struct ast_sorcery_wizard_observer *callbacks);
void ast_sorcery_wizard_observer_remove(struct ast_sorcery_wizard *wizard,
const struct ast_sorcery_wizard_observer *callbacks);
Expose the following apply mapping APIs for future use...
enum ast_sorcery_apply_result __ast_sorcery_apply_wizard_mapping(struct ast_sorcery *sorcery,
const char *type, const char *module, const char *name, const char *data, unsigned int caching);
#define ast_sorcery_apply_wizard_mapping(sorcery, type, name, data, caching) \
__ast_sorcery_apply_wizard_mapping((sorcery), (type), AST_MODULE, (name), (data), (caching));
Diffs (updated)
-----
branches/12/tests/test_sorcery.c 428631
branches/12/tests/test_config.c 428631
branches/12/main/sorcery.c 428631
branches/12/main/config.c 428631
branches/12/include/asterisk/test.h 428631
branches/12/include/asterisk/sorcery.h 428631
branches/12/include/asterisk/config.h 428631
Diff: https://reviewboard.asterisk.org/r/4215/diff/
Testing
-------
All existing unit tests pass.
Additional sorcery units tests were added for the new observers.
Testsuite testing in progress.
Thanks,
George Joseph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20141127/07a2d4cd/attachment.html>
More information about the asterisk-dev
mailing list