~ubuntu-branches/ubuntu/maverick/strongswan/maverick

« back to all changes in this revision

Viewing changes to src/libstrongswan/utils/iterator.h

  • Committer: Bazaar Package Importer
  • Author(s): Rene Mayrhofer
  • Date: 2008-12-05 17:21:42 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20081205172142-9g77wgyzcj0blq7p
* New upstream release, fixes a MOBIKE issue.
  Closes: #507542: strongswan: endless loop
* Explicitly enable compilation with libcurl for CRL fetching
  Closes: #497756: strongswan: not compiled with curl support; crl 
                   fetching not available
* Enable compilation with SSH agent support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
14
 * for more details.
15
15
 *
16
 
 * $Id: iterator.h 3589 2008-03-13 14:14:44Z martin $
 
16
 * $Id: iterator.h 4577 2008-11-05 08:37:09Z martin $
17
17
 */
18
18
 
19
19
/**
26
26
 
27
27
#include <library.h>
28
28
 
29
 
typedef enum hook_result_t hook_result_t;
30
 
 
31
 
/**
32
 
 * Return value of an iterator hook.
33
 
 *
34
 
 * Returning HOOK_AGAIN is useful to "inject" additional elements in an
35
 
 * iteration, HOOK_NEXT is the normal iterator behavior, and HOOK_SKIP may
36
 
 * be used to filter elements out.
37
 
 */
38
 
enum hook_result_t {
39
 
 
40
 
        /**
41
 
         * A value was placed in out, hook is called again with the same "in"
42
 
         */
43
 
        HOOK_AGAIN,
44
 
        
45
 
        /**
46
 
         * A value was placed in out, hook is called again with next "in" (if any)
47
 
         */
48
 
        HOOK_NEXT,
49
 
        
50
 
        /**
51
 
         * No value in out, call again with next "in" (if any)
52
 
         */
53
 
        HOOK_SKIP,
54
 
};
55
 
 
56
 
/**
57
 
 * Iterator hook function prototype.
58
 
 *
59
 
 * @param param         user supplied parameter
60
 
 * @param in            the value the hook receives from the iterator
61
 
 * @param out           the value supplied as a result to the iterator
62
 
 * @return                      a hook_result_t
63
 
 */
64
 
typedef hook_result_t (iterator_hook_t)(void *param, void *in, void **out);
65
 
 
66
29
 
67
30
typedef struct iterator_t iterator_t;
68
31
 
94
57
        bool (*iterate) (iterator_t *this, void** value);
95
58
        
96
59
        /**
97
 
         * Hook a function into the iterator.
98
 
         *
99
 
         * Sometimes it is useful to hook in an iterator. The hook function is
100
 
         * called before any successful return of iterate(). It takes the
101
 
         * iterator value, may manipulate it (or the references object), and returns
102
 
         * the value that the iterate() function returns. Depending on the hook
103
 
         * return value, the hook is called again, called with next, or skipped.
104
 
         * A value of NULL deactivates the iterator hook.
105
 
         * If an iterator is hooked, only the iterate() method is valid,
106
 
         * all other methods behave undefined.
107
 
         * 
108
 
         * @param hook          iterator hook which manipulates the iterated value
109
 
         * @param param         user supplied parameter to pass back to the hook
110
 
         */
111
 
        void (*set_iterator_hook) (iterator_t *this, iterator_hook_t *hook,
112
 
                                                           void *param);
113
 
        
114
 
        /**
115
60
         * Inserts a new item before the given iterator position.
116
61
         * 
117
62
         * The iterator position is not changed after inserting