/* * read a struct and add it to tree */ static void read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree, int add_type_field) { proto_item *ti; proto_tree *new_tree; int length; int i; ti = proto_tree_add_item(etch_tree, hf_etch_struct, tvb, *offset, tvb_captured_length(tvb) - *offset, ENC_NA); new_tree = proto_item_add_subtree(ti, ett_etch_struct); if (add_type_field) { read_type(offset, tvb, new_tree); } /* struct type as hash */ read_value(offset, tvb, new_tree, hf_etch_value); /* struct length */ length = read_value(offset, tvb, new_tree, hf_etch_length); for (i = 0; i < length; i++) { read_key_value(offset, tvb, new_tree); } /* termination */ read_type(offset, tvb, new_tree); }
bool request::parse_cookies() { std::string const cookie_str=http_cookie(); std::string::const_iterator p=cookie_str.begin(),e=cookie_str.end(); p=http::protocol::skip_ws(p,e); http::cookie cookie; while(p<e) { std::string key,value; if(!read_key_value(p,e,key,value)) { cookie = http::cookie(); continue; } if(key[0]=='$') { if(cookie.name().empty()) { if(http::protocol::compare(key,"$Path")==0) cookie.name(value); else if(http::protocol::compare(key,"$Domain")==0) cookie.domain(value); } } else { if(!cookie.name().empty()) cookies_.insert(std::make_pair(cookie.name(),cookie)); cookie=http::cookie(key,value); } } if(!cookie.name().empty()) cookies_.insert(std::make_pair(cookie.name(),cookie)); return true; }