diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-29 15:34:48 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-29 15:42:12 +0100 |
commit | 74c838a87000ca800e8b3f265340c1317989a04a (patch) | |
tree | 28070bc0efd51ff30b664b52dd10c7b06b57e4ff /lib/idm.h | |
parent | 9a70c8d6c38155d8abb6d814563b9eefc134e901 (diff) |
Move ID allocator to a separate file and use it also in OSPF
Diffstat (limited to 'lib/idm.h')
-rw-r--r-- | lib/idm.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/idm.h b/lib/idm.h new file mode 100644 index 00000000..e3380cce --- /dev/null +++ b/lib/idm.h @@ -0,0 +1,25 @@ +/* + * BIRD Library -- ID Map + * + * (c) 2013--2015 Ondrej Zajicek <santiago@crfreenet.org> + * (c) 2013--2015 CZ.NIC z.s.p.o. + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ + +#ifndef _BIRD_IDM_H_ +#define _BIRD_IDM_H_ + +struct idm +{ + u32 *data; + u32 pos; + u32 used; + u32 size; +}; + +void idm_init(struct idm *m, pool *p, uint size); +u32 idm_alloc(struct idm *m); +void idm_free(struct idm *m, u32 id); + +#endif |