Attr. encoding for ADDRESS node: * | attr_t(2) attr_len(2) attr_val(2*x) | IS/CONTAINS/SUBDOMAIN_OF attr (NT) */
| 284 | * | attr_t(2) attr_len(2) attr_val(2*x) | IS/CONTAINS/SUBDOMAIN_OF attr (NT) |
| 285 | */ |
| 286 | static inline int encode_address_attr(xmlNodePtr node, char *node_ptr, char *buf_end) |
| 287 | { |
| 288 | xmlAttrPtr attr; |
| 289 | char *p, *p_orig; |
| 290 | unsigned char *nr_attr; |
| 291 | str val; |
| 292 | |
| 293 | nr_attr = &(NR_OF_ATTR(node_ptr)); |
| 294 | *nr_attr = 0; |
| 295 | p = p_orig = ATTR_PTR(node_ptr); |
| 296 | |
| 297 | FOR_ALL_ATTR(node,attr) { |
| 298 | (*nr_attr)++; |
| 299 | switch (attr->name[0]) { |
| 300 | case 'i': case 'I': |
| 301 | set_attr_type(p, IS_ATTR, buf_end, error); |
| 302 | break; |
| 303 | case 'c': case 'C': |
| 304 | set_attr_type(p, CONTAINS_ATTR, buf_end, error); |
| 305 | break; |
| 306 | case 's': case 'S': |
| 307 | set_attr_type(p, SUBDOMAIN_OF_ATTR, buf_end, error); |
| 308 | break; |
| 309 | default: |
| 310 | LM_ERR("unknown attribute " |
| 311 | "<%s>\n",attr->name); |
| 312 | goto error; |
| 313 | } |
| 314 | /* get the value of the attribute */ |
| 315 | get_attr_val( attr->name , val, error); |
| 316 | /* copy also the \0 from the end of string */ |
| 317 | val.len++; |
| 318 | append_str_attr(p, val, buf_end, error); |
| 319 | } |
| 320 | |
| 321 | return p-p_orig; |
| 322 | error: |