HTTP Parser and message builder / objects in plain C Snapshot
|
00001 #ifndef _QUERY_STRING_H_ 00002 #define _QUERY_STRING_H 00003 00004 #include <cutils/bhash.h> 00005 #include <hutils/uri.h> 00006 00007 typedef struct tagHASHNAMEVALUE { 00008 HASH_Entry entry; 00009 char *name; 00010 char *value; 00011 } HASHNAMEVALUE; 00012 00013 typedef struct tagQUERYSTRING { 00014 HASH name_to_value; 00015 } QUERYSTRING; 00016 00017 int QUERYSTRING_init(QUERYSTRING *query, URI *uri); 00018 int QUERYSTRING_free(QUERYSTRING *query ); 00019 00020 M_INLINE const char *QUERYSTRING_find(QUERYSTRING *query, const char *name ) 00021 { 00022 HASHNAMEVALUE *value; 00023 00024 value = (HASHNAMEVALUE *) HASH_find( &query->name_to_value, (void *) name, -1 ); 00025 if (value) { 00026 return value->value; 00027 } 00028 return 0; 00029 } 00030 00031 00032 #endif 00033 00034