diff options
author | Sander Vrijders <[email protected]> | 2017-01-31 19:41:35 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-01-31 19:41:35 +0000 |
commit | 5be7963e8b319b9b0c191f7ff0b31f7fbbeafb6c (patch) | |
tree | 7406c71252aef416061e255d41352b105afbeac5 /include | |
parent | 9728a845eb6896219b7653640fb2b8d39da1bc83 (diff) | |
parent | 988355d5bb62405f3bd3fbaade1f26ba4b2c274e (diff) | |
download | ouroboros-5be7963e8b319b9b0c191f7ff0b31f7fbbeafb6c.tar.gz ouroboros-5be7963e8b319b9b0c191f7ff0b31f7fbbeafb6c.zip |
Merged in dstaesse/ouroboros/be-ribmgrv2 (pull request #356)
lib: Add packing and unpacking RIB
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/rib.h | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/include/ouroboros/rib.h b/include/ouroboros/rib.h index 1d0661a7..50747498 100644 --- a/include/ouroboros/rib.h +++ b/include/ouroboros/rib.h @@ -25,40 +25,54 @@ #define OUROBOROS_LIB_RIB_H #include <sys/types.h> +#include <stdint.h> #include <stdbool.h> #define RIB_ROOT "" -int rib_init(void); +#define PACK_HASH_ROOT 0x0001 +#define PACK_HASH_ALL 0x0002 -void rib_fini(void); +#define UNPACK_CREATE 0x0001 -int rib_add(const char * parent, - const char * name); +int rib_init(void); -int rib_del(char * path); +void rib_fini(void); -ssize_t rib_read(const char * path, - void * data, - size_t len); +int rib_add(const char * parent, + const char * name); -int rib_write(const char * path, - const void * data, +int rib_del(char * path); + +ssize_t rib_read(const char * path, + void * data, + size_t len); + +int rib_write(const char * path, + const void * data, + size_t len); + +int rib_put(const char * path, + void * data, size_t len); -int rib_put(const char * path, - void * data, - size_t len); +bool rib_has(const char * path); + +ssize_t rib_children(const char * path, + char *** children); -bool rib_has(const char * path); +char * rib_path_append(char * path, + const char * name); -ssize_t rib_children(const char * path, - char *** children); +char * rib_name_gen(void * data, + size_t len); -char * rib_path_append(char * path, - const char * name); +ssize_t rib_pack(const char * path, + uint8_t ** buf, + uint32_t flags); -char * rib_name_gen(void * data, - size_t len); +int rib_unpack(uint8_t * packed, + size_t len, + uint32_t flags); #endif /* OUROBOROS_LIB_RIB_H */ |