]> git.ipfire.org Git - thirdparty/asterisk.git/commit
sorcery.c: Sorcery enhancements for wizard management
authorGeorge Joseph <gjoseph@digium.com>
Thu, 14 Mar 2019 16:46:53 +0000 (10:46 -0600)
committerGeorge Joseph <gjoseph@digium.com>
Mon, 18 Mar 2019 17:39:31 +0000 (11:39 -0600)
commit7bdde83f2c647e6b4c37ba6c252d09a3290540a3
tree649a54daf6d063e6336e8bff95e07181ea2f7659
parent0426e0fedee34eb65e87d75a50dd8dd0b319a088
sorcery.c: Sorcery enhancements for wizard management

Added ability to specifiy a wizard is read-only when applying
it to a specific object type.  This allows you to specify
create, update and delete callbacks for the wizard but limit
which object types can use them.

Added the ability to allow an object type to have multiple
wizards of the same type.  This is indicated when a wizard
is added to a specific object type.

Added 3 new sorcery wizard functions:

* ast_sorcery_object_type_insert_wizard which does the same thing
  as the existing ast_sorcery_insert_wizard_mapping function but
  accepts the new read-only and allot-duplicates flags and also
  returns the ast_sorcery_wizard structure used and it's internal
  data structure. This allows immediate use of the wizard's
  callbacks without having to register a "wizard mapped" observer.

* ast_sorcery_object_type_apply_wizard which does the same
  thing as the existing ast_sorcery_apply_wizard_mapping function
  but has the added capabilities of
  ast_sorcery_object_type_insert_wizard.

* ast_sorcery_object_type_remove_wizard which removes a wizard
  matching both its name and its original argument string.

* The original logic in __ast_sorcery_insert_wizard_mapping was moved
  to __ast_sorcery_object_type_insert_wizard and enhanced for the
  new capabilities, then __ast_sorcery_insert_wizard_mapping was
  refactored to just call __ast_sorcery_insert_wizard_mapping.

* Added a unit test to test_sorcery.c to test the read-only
  capability.

Change-Id: I40f35840252e4313d99e11dbd80e270a3aa10605
include/asterisk/sorcery.h
main/sorcery.c
tests/test_sorcery.c