MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / encode_mail_attr

Function encode_mail_attr

modules/cpl_c/cpl_parser.c:1174–1199  ·  view source on GitHub ↗

Attr. encoding for MAIL node: * | attr1_t(2) attr1_len(2) attr1_val(2*x) | TO_ATTR attr (NNT) * [| attr2_t(2) attr2_len(2) attr2_val(2*x) |]? SUBJECT_ATTR attr (NNT) * [| attr3_t(2) attr3_len(2) attr3_val(2*x) |]? BODY_ATTR attr (NNT) */

Source from the content-addressed store, hash-verified

1172 * [| attr3_t(2) attr3_len(2) attr3_val(2*x) |]? BODY_ATTR attr (NNT)
1173 */
1174static inline int encode_mail_attr(xmlNodePtr node, char *node_ptr, char *buf_end)
1175{
1176 xmlAttrPtr attr;
1177 char *p, *p_orig;
1178 unsigned char *nr_attr;
1179
1180 nr_attr = &(NR_OF_ATTR(node_ptr));
1181 *nr_attr = 0;
1182 p = p_orig = ATTR_PTR(node_ptr);
1183
1184 FOR_ALL_ATTR(node,attr) {
1185 /* there is only one attribute -> URL */
1186 if (attr->name[0]!='u' && attr->name[0]!='U') {
1187 LM_ERR("unknown attribute <%s>\n",attr->name);
1188 goto error;
1189 }
1190 p = decode_mail_url( p, buf_end,
1191 (char*)xmlGetProp(node,attr->name), nr_attr);
1192 if (p==0)
1193 goto error;
1194 }
1195
1196 return p-p_orig;
1197error:
1198 return -1;
1199}
1200
1201
1202

Callers 1

encode_nodeFunction · 0.85

Calls 1

decode_mail_urlFunction · 0.85

Tested by

no test coverage detected