diff options
author | Dmitri Pal <dpal@redhat.com> | 2009-07-01 18:22:19 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-07-02 08:16:35 -0400 |
commit | 9a28c36d323c14e31a3895ffe7dc905b815291f8 (patch) | |
tree | 9f43b63b340092f9e63d7e403a36a22f51643124 /common/collection/collection_stack.h | |
parent | 203d8d4ffb03897ab995bc2a6311f2a603245269 (diff) | |
download | sssd-9a28c36d323c14e31a3895ffe7dc905b815291f8.tar.gz sssd-9a28c36d323c14e31a3895ffe7dc905b815291f8.tar.xz sssd-9a28c36d323c14e31a3895ffe7dc905b815291f8.zip |
Queue and stack APIs using collection.
Patch adds two interfaces for stack and queue using
collection as underlaying implementation.
It also fixes a bug in the insterion code -
the unsigned properties were created as long.
Diffstat (limited to 'common/collection/collection_stack.h')
-rw-r--r-- | common/collection/collection_stack.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/common/collection/collection_stack.h b/common/collection/collection_stack.h new file mode 100644 index 000000000..447b3df50 --- /dev/null +++ b/common/collection/collection_stack.h @@ -0,0 +1,81 @@ +/* + STACK + + Header file for stack implemented using collection interface. + + Copyright (C) Dmitri Pal <dpal@redhat.com> 2009 + + Collection Library is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Collection Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with Collection Library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef COLLECTION_STACK_H +#define COLLECTION_STACK_H + +#include <collection.h> + + +#define COL_CLASS_STACK 30000 +#define COL_NAME_STACK "stack" + +/* Function that creates a stack object */ +int create_stack(struct collection_item **stack); + +/* Function that destroys a stack object */ +void destroy_stack(struct collection_item *stack); + +/* Family of functions that push property to stack */ +/* Push a string property to stack. */ +int push_str_property(struct collection_item *stack, + const char *property, char *string, int length); +/* Push a binary property to stack. */ +int push_binary_property(struct collection_item *stack, + const char *property, void *binary_data, int length); +/* Push an int property to stack. */ +int push_int_property(struct collection_item *stack, + const char *property, int number); +/* Push an unsigned int property to stack. */ +int push_unsigned_property(struct collection_item *stack, + const char *property, unsigned int number); +/* Push a long property. */ +int push_long_property(struct collection_item *stack, + const char *property, long number); +/* Push an unsigned long property. */ +int push_ulong_property(struct collection_item *stack, + const char *property, unsigned long number); +/* Push a double property. */ +int push_double_property(struct collection_item *stack, + const char *property, double number); +/* Push a bool property. */ +int push_bool_property(struct collection_item *stack, + const char *property, unsigned char logical); + +/* Push any property */ +int push_any_property(struct collection_item *stack, /* Stack */ + const char *property, /* Name */ + int type, /* Data type */ + void *data, /* Pointer to the data */ + int length); /* Length of the data. For + strings it includes the + trailing 0 */ +/* Push item */ +int push_item(struct collection_item *stack, + struct collection_item *item); + + +/* Pop item */ +int pop_item(struct collection_item *stack, + struct collection_item **item); + + +#endif |