Attr. encoding for PROXY node: * [| attr1_t(2) attr1_val(2) |]? RECURSE attr * [| attr2_t(2) attr2_val(2) |]? TIMEOUT attr * [| attr3_t(2) attr3_val(2) |]? ORDERING attr */
| 943 | * [| attr3_t(2) attr3_val(2) |]? ORDERING attr |
| 944 | */ |
| 945 | static inline int encode_proxy_attr(xmlNodePtr node, char *node_ptr, |
| 946 | char *buf_end) |
| 947 | { |
| 948 | xmlAttrPtr attr; |
| 949 | char *p, *p_orig; |
| 950 | unsigned char *nr_attr; |
| 951 | unsigned int nr; |
| 952 | str val; |
| 953 | |
| 954 | nr_attr = &(NR_OF_ATTR(node_ptr)); |
| 955 | *nr_attr = 0; |
| 956 | p = p_orig = ATTR_PTR(node_ptr); |
| 957 | |
| 958 | FOR_ALL_ATTR(node,attr) { |
| 959 | (*nr_attr)++; |
| 960 | /* get the value of the attribute */ |
| 961 | get_attr_val( attr->name , val, error); |
| 962 | switch(attr->name[0]) { |
| 963 | case 'R': case 'r': |
| 964 | set_attr_type(p, RECURSE_ATTR, buf_end, error); |
| 965 | if (val.s[0]=='y' || val.s[0]=='Y') |
| 966 | append_short_attr(p, YES_VAL, buf_end, error); |
| 967 | else if (val.s[0]=='n' || val.s[0]=='N') |
| 968 | append_short_attr(p, NO_VAL, buf_end, error); |
| 969 | else { |
| 970 | LM_ERR("unknown value " |
| 971 | "<%s> for attribute RECURSE\n",val.s); |
| 972 | goto error; |
| 973 | } |
| 974 | break; |
| 975 | case 'T': case 't': |
| 976 | set_attr_type(p, TIMEOUT_ATTR, buf_end, error); |
| 977 | if (str2int(&val,&nr)==-1) { |
| 978 | LM_ERR("bad value <%.*s>" |
| 979 | " for attribute TIMEOUT\n",val.len,val.s); |
| 980 | goto error; |
| 981 | } |
| 982 | append_short_attr(p, (unsigned short)nr, buf_end, error); |
| 983 | break; |
| 984 | case 'O': case 'o': |
| 985 | set_attr_type(p, ORDERING_ATTR, buf_end, error); |
| 986 | switch (val.s[0]) { |
| 987 | case 'p': case'P': |
| 988 | append_short_attr(p, PARALLEL_VAL, buf_end, error); |
| 989 | break; |
| 990 | case 'S': case 's': |
| 991 | append_short_attr(p, SEQUENTIAL_VAL, buf_end, error); |
| 992 | break; |
| 993 | case 'F': case 'f': |
| 994 | append_short_attr(p, FIRSTONLY_VAL, buf_end, error); |
| 995 | break; |
| 996 | default: |
| 997 | LM_ERR("unknown " |
| 998 | "value <%s> for attribute ORDERING\n",val.s); |
| 999 | goto error; |
| 1000 | } |
| 1001 | break; |
| 1002 | default: |
no test coverage detected