#ifndef	ACL_ITERATOR_INCLUDE_H
#define	ACL_ITERATOR_INCLUDE_H

typedef struct ACL_ITER ACL_ITER;

/**
 * ACL ݽṹõͨõṹ
 */
struct ACL_ITER {
	void *ptr;		/**< ָ,  */
	void *data;		/**< ûָ */
	int   dlen;		/**< ûݳ, ʵ߿ôֵҲɲ */
	const char *key;	/**< Ϊϣĵ, Ϊϣֵַ */
	int   klen;		/**< ΪACL_BINHASH, Ϊ */
	int   i;		/**< ǰеλ */
	int   size;		/**< ǰԪܸ */
};

/**
 * Ԫ
 * @param iter {ACL_ITER}
 * @param container {void*} ַ
 * @examples: samples/iterator/
 */
#define	ACL_FOREACH(iter, container)  \
        for ((container)->iter_head(&(iter), (container));  \
             (iter).ptr;  \
             (container)->iter_next(&(iter), (container)))

/**
 * Ԫ
 * @param iter {ACL_ITER}
 * @param container {void*} ַ
 * @examples: samples/iterator/
 */
#define	ACL_FOREACH_REVERSE(iter, container)  \
        for ((container)->iter_tail(&(iter), (container));  \
             (iter).ptr;  \
             (container)->iter_prev(&(iter), (container)))

/**
 * õǰָĳĳԱṹͶ
 * @param iter {ACL_ITER}
 * @param container {void*} ַ
 */
#define	ACL_ITER_INFO(iter, container)  \
	(container)->iter_info(&(iter), (container))

#define	acl_foreach_reverse	ACL_FOREACH_REVERSE
#define	acl_foreach		ACL_FOREACH
#define	acl_iter_info		ACL_ITER_INFO

#endif
