diff options
author | Matt Jordan <mjordan@digium.com> | 2015-07-14 09:31:11 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-07-14 09:31:12 -0500 |
commit | f35998e0ef2f3fb5b7511d01f57aac62f797a48e (patch) | |
tree | f8b739d7394ef51292b39b32bd73e13b7042d545 | |
parent | aa5707b8891119741baae98cf7b51a00c0f99438 (diff) | |
parent | 887945d410399f299bfc98eb226232ae42105112 (diff) |
Merge "main/bucket: Add a callback function for ast_bucket_file objects"
-rw-r--r-- | include/asterisk/bucket.h | 11 | ||||
-rw-r--r-- | main/bucket.c | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/asterisk/bucket.h b/include/asterisk/bucket.h index c335fd351..4a27c3c18 100644 --- a/include/asterisk/bucket.h +++ b/include/asterisk/bucket.h @@ -195,6 +195,17 @@ int ast_bucket_file_metadata_unset(struct ast_bucket_file *file, const char *nam struct ast_bucket_metadata *ast_bucket_file_metadata_get(struct ast_bucket_file *file, const char *name); /*! + * \brief Execute a callback function on the metadata associated with a file + * \since 14.0.0 + * + * \param file The bucket file + * \param cb An ao2 callback function that will be called with each \c ast_bucket_metadata + * associated with \c file + * \param arg An optional argument to pass to \c cb + */ +void ast_bucket_file_metadata_callback(struct ast_bucket_file *file, ao2_callback_fn cb, void *arg); + +/*! * \brief Allocate a new bucket * * \param uri Complete URI for the bucket diff --git a/main/bucket.c b/main/bucket.c index afb017574..f7845c8c0 100644 --- a/main/bucket.c +++ b/main/bucket.c @@ -362,6 +362,12 @@ struct ast_bucket_metadata *ast_bucket_file_metadata_get(struct ast_bucket_file return ao2_find(file->metadata, name, OBJ_KEY); } +void ast_bucket_file_metadata_callback(struct ast_bucket_file *file, ao2_callback_fn cb, void *arg) +{ + ao2_callback(file->metadata, 0, cb, arg); +} + + /*! \brief Destructor for buckets */ static void bucket_destroy(void *obj) { |