Changeset 65 for pjproject/trunk/pjsip/src/pjsip/sip_msg.c
- Timestamp:
- Nov 21, 2005 1:55:47 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_msg.c
- Property svn:eol-style set to native
r51 r65 869 869 init_hdr(hdr, PJSIP_H_CONTACT, &contact_hdr_vptr); 870 870 hdr->expires = -1; 871 pj_list_init(&hdr->other_param); 871 872 return hdr; 872 873 } … … 884 885 *p++ = ' '; 885 886 *p++ = '*'; 886 *p = '\0';887 887 return p - buf; 888 888 … … 928 928 } 929 929 930 if (hdr->other_param.slen) {931 copy_advance(buf, hdr->other_param);932 }933 934 *buf = '\0'; 930 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf,';'); 931 if (printed < 0) 932 return printed; 933 buf += printed; 934 935 935 return buf-startbuf; 936 936 } 937 937 } 938 938 939 static pjsip_contact_hdr* pjsip_contact_hdr_clone( 940 939 static pjsip_contact_hdr* pjsip_contact_hdr_clone(pj_pool_t *pool, 940 const pjsip_contact_hdr *rhs) 941 941 { 942 942 pjsip_contact_hdr *hdr = pjsip_contact_hdr_create(pool); … … 949 949 hdr->q1000 = rhs->q1000; 950 950 hdr->expires = rhs->expires; 951 pj_strdup(pool, &hdr->other_param, &rhs->other_param); 952 return hdr; 953 } 954 955 static pjsip_contact_hdr* pjsip_contact_hdr_shallow_clone( pj_pool_t *pool, 956 const pjsip_contact_hdr *rhs) 951 pjsip_param_clone(pool, &hdr->other_param, &rhs->other_param); 952 return hdr; 953 } 954 955 static pjsip_contact_hdr* 956 pjsip_contact_hdr_shallow_clone( pj_pool_t *pool, 957 const pjsip_contact_hdr *rhs) 957 958 { 958 959 pjsip_contact_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 959 960 pj_memcpy(hdr, rhs, sizeof(*hdr)); 961 pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); 960 962 return hdr; 961 963 } … … 965 967 * Content-Type header.. 966 968 */ 967 static int pjsip_ctype_hdr_print( pjsip_ctype_hdr *hdr, char *buf, pj_size_t size); 968 static pjsip_ctype_hdr* pjsip_ctype_hdr_clone( pj_pool_t *pool, const pjsip_ctype_hdr *hdr); 969 static int pjsip_ctype_hdr_print( pjsip_ctype_hdr *hdr, char *buf, 970 pj_size_t size); 971 static pjsip_ctype_hdr* pjsip_ctype_hdr_clone(pj_pool_t *pool, 972 const pjsip_ctype_hdr *hdr); 969 973 #define pjsip_ctype_hdr_shallow_clone pjsip_ctype_hdr_clone 970 974 … … 1071 1075 pjsip_from_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 1072 1076 init_hdr(hdr, PJSIP_H_FROM, &fromto_hdr_vptr); 1077 pj_list_init(&hdr->other_param); 1073 1078 return hdr; 1074 1079 } … … 1078 1083 pjsip_to_hdr *hdr = pj_pool_calloc(pool, 1, sizeof(*hdr)); 1079 1084 init_hdr(hdr, PJSIP_H_TO, &fromto_hdr_vptr); 1085 pj_list_init(&hdr->other_param); 1080 1086 return hdr; 1081 1087 } … … 1106 1112 *buf++ = ' '; 1107 1113 1108 printed = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, hdr->uri, buf, endbuf-buf); 1114 printed = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, hdr->uri, 1115 buf, endbuf-buf); 1109 1116 if (printed < 1) 1110 1117 return -1; … … 1113 1120 1114 1121 copy_advance_pair(buf, ";tag=", 5, hdr->tag); 1115 if (hdr->other_param.slen) 1116 copy_advance(buf, hdr->other_param); 1122 1123 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 1124 if (printed < 0) 1125 return -1; 1126 buf += printed; 1117 1127 1118 1128 return buf-startbuf; … … 1129 1139 hdr->uri = pjsip_uri_clone(pool, rhs->uri); 1130 1140 pj_strdup( pool, &hdr->tag, &rhs->tag); 1131 pj_strdup( pool, &hdr->other_param, &rhs->other_param); 1132 1133 return hdr; 1134 } 1135 1136 static pjsip_fromto_hdr* pjsip_fromto_hdr_shallow_clone( pj_pool_t *pool, 1137 const pjsip_fromto_hdr *rhs) 1141 pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param); 1142 1143 return hdr; 1144 } 1145 1146 static pjsip_fromto_hdr* 1147 pjsip_fromto_hdr_shallow_clone( pj_pool_t *pool, 1148 const pjsip_fromto_hdr *rhs) 1138 1149 { 1139 1150 pjsip_fromto_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1140 1151 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1152 pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); 1141 1153 return hdr; 1142 1154 } … … 1188 1200 init_hdr(hdr, PJSIP_H_RECORD_ROUTE, &routing_hdr_vptr); 1189 1201 pjsip_name_addr_init(&hdr->name_addr); 1190 pj_ memset(&hdr->other_param, 0, sizeof(hdr->other_param));1202 pj_list_init(&hdr->other_param); 1191 1203 return hdr; 1192 1204 } … … 1197 1209 init_hdr(hdr, PJSIP_H_ROUTE, &routing_hdr_vptr); 1198 1210 pjsip_name_addr_init(&hdr->name_addr); 1199 pj_ memset(&hdr->other_param, 0, sizeof(hdr->other_param));1211 pj_list_init(&hdr->other_param); 1200 1212 return hdr; 1201 1213 } … … 1226 1238 *buf++ = ' '; 1227 1239 1228 printed = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR, &hdr->name_addr, buf, endbuf-buf); 1240 printed = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR, &hdr->name_addr, buf, 1241 endbuf-buf); 1229 1242 if (printed < 1) 1230 1243 return -1; 1231 1244 buf += printed; 1232 1245 1233 if (hdr->other_param.slen) { 1234 copy_advance(buf, hdr->other_param); 1235 } 1246 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 1247 if (printed < 0) 1248 return -1; 1249 buf += printed; 1236 1250 1237 1251 return buf-startbuf; … … 1246 1260 pjsip_name_addr_init(&hdr->name_addr); 1247 1261 pjsip_name_addr_assign(pool, &hdr->name_addr, &rhs->name_addr); 1248 pj _strdup( pool, &hdr->other_param, &rhs->other_param);1262 pjsip_param_clone( pool, &hdr->other_param, &rhs->other_param); 1249 1263 return hdr; 1250 1264 } … … 1255 1269 pjsip_routing_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1256 1270 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1271 pjsip_param_shallow_clone( pool, &hdr->other_param, &rhs->other_param); 1257 1272 return hdr; 1258 1273 } … … 1331 1346 hdr->ttl_param = -1; 1332 1347 hdr->rport_param = -1; 1348 pj_list_init(&hdr->other_param); 1333 1349 return hdr; 1334 1350 } … … 1390 1406 copy_advance_pair(buf, ";received=", 10, hdr->recvd_param); 1391 1407 copy_advance_pair(buf, ";branch=", 8, hdr->branch_param); 1392 copy_advance(buf, hdr->other_param);1393 1408 1394 *buf = '\0'; 1409 printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, ';'); 1410 if (printed < 0) 1411 return -1; 1412 buf += printed; 1413 1395 1414 return buf-startbuf; 1396 1415 } … … 1408 1427 pj_strdup(pool, &hdr->recvd_param, &rhs->recvd_param); 1409 1428 pj_strdup(pool, &hdr->branch_param, &rhs->branch_param); 1410 pj _strdup(pool, &hdr->other_param, &rhs->other_param);1429 pjsip_param_clone(pool, &hdr->other_param, &rhs->other_param); 1411 1430 return hdr; 1412 1431 } … … 1417 1436 pjsip_via_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr)); 1418 1437 pj_memcpy(hdr, rhs, sizeof(*hdr)); 1438 pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param); 1419 1439 return hdr; 1420 1440 }
Note: See TracChangeset
for help on using the changeset viewer.