diff options
Diffstat (limited to 'src/disfluid-header-iterator.h')
-rw-r--r-- | src/disfluid-header-iterator.h | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/src/disfluid-header-iterator.h b/src/disfluid-header-iterator.h deleted file mode 100644 index db3ff75..0000000 --- a/src/disfluid-header-iterator.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef DISFLUID_HEADER_ITERATOR_INCLUDED -# define DISFLUID_HEADER_ITERATOR_INCLUDED - -struct disfluid_header_iterator; - -static inline - int header_iterator_init_request (struct disfluid_header_iterator *iterator, - const struct disfluid_cache_request - *request); - -static inline - void header_iterator_clear (struct disfluid_header_iterator *iterator); - -static inline - const char *header_iterator_get_name (const struct disfluid_header_iterator - *iterator); - -static inline - const char *header_iterator_get_value (const struct disfluid_header_iterator - *iterator); - -static inline - bool header_iterator_next (struct disfluid_header_iterator *iterator); - -# include "disfluid-cache-request.h" - -struct disfluid_header_iterator -{ - const struct disfluid_cache_request *request; - size_t i; -}; - -static inline int -header_iterator_init (struct disfluid_header_iterator *iterator, - const struct disfluid_cache_request *request) -{ - iterator->request = request; - iterator->i = 0; -} - -static inline void -header_iterator_clear (struct disfluid_header_iterator *iterator) -{ - iterator->request = NULL; -} - -/* Before iterating over the other headers, the request produces 1 - header: Host. */ - -static inline const char * -header_iterator_get_name (const struct disfluid_header_iterator *iterator) -{ - switch (iterator->i) - { - case 0: - return "Host"; - default: - return NULL; - } -} - -static inline const char * -header_iterator_get_value (const struct disfluid_header_iterator *iterator) -{ - switch (iterator->i) - { - case 0: - return iterator->request->host; - default: - return NULL; - } -} - -static inline bool -header_iterator_next (struct disfluid_header_iterator *iterator) -{ - if (iterator->i < 1) - { - iterator->i += 1; - return true; - } - return false; -} - -#endif /* DISFLUID_HEADER_ITERATOR_INCLUDED */ |