diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2020-09-09 11:59:36 +0200 |
---|---|---|
committer | Jordan Augé <jordan.auge+fdio@cisco.com> | 2020-09-21 14:49:29 +0200 |
commit | 7356408ca1554468c9d7b9840aaaee28b4341c8d (patch) | |
tree | f57bfcc87be4cf5b51b86e5c847b4cde24c0d5e0 /hicn-light/src/hicn/core/content_store.h | |
parent | fe310f8b7a54f31b7270107b57b5ffcc00966f45 (diff) |
[HICN-563] listener and connection tables
Change-Id: I88b85a61908d97bda1afb08d31c3bf10b4d9c5c5
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/core/content_store.h')
-rw-r--r-- | hicn-light/src/hicn/core/content_store.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/hicn-light/src/hicn/core/content_store.h b/hicn-light/src/hicn/core/content_store.h index 1a339f494..5cddeaa87 100644 --- a/hicn-light/src/hicn/core/content_store.h +++ b/hicn-light/src/hicn/core/content_store.h @@ -45,6 +45,7 @@ KHASH_INIT(cs_name, const Name *, unsigned, 0, name_hash, name_hash_eq); typedef struct { content_store_type_t type; + size_t max_size; // XXX TODO api to dynamically set max size content_store_entry_t * entries; // pool @@ -60,7 +61,25 @@ typedef struct { content_store_stats_t stats; } content_store_t; -content_store_t * content_store_create(content_store_type_t type, size_t max_elts); +/** + * @brief Create a new content store (extended parameters) + * + * @param[in] type Content store type + * @param[in] init_size Initially allocated size (hint, 0 = use default value) + * @param[in] max_size Maximum size (0 = unlimited) + * + * @return content_store_t* - The newly created content store + */ +content_store_t * _content_store_create(content_store_type_t type, size_t init_size, size_t max_size); + +/** + * @brief Create a new content store + * + * @param[in] type Content store type + * + * @return content_store_t* - The newly created content store + */ +#define content_store_create( TYPE) _content_store_create((TYPE), 0, 0) void content_store_free(content_store_t * cs); @@ -74,7 +93,7 @@ void content_store_remove_entry(content_store_t * cs, content_store_entry_t * en bool content_store_remove(content_store_t * cs, msgbuf_t * msgbuf); -#define content_store_size(content_store) (pool_elts(cs->entries)) +#define content_store_size(content_store) (pool_len(cs->entries)) void content_store_purge_entry(content_store_t * cs, content_store_entry_t * entry); |