Changeset 5848 for pjproject/trunk/pjsip/src/test/dns_test.c
- Timestamp:
- Jul 30, 2018 2:32:25 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/test/dns_test.c
r5170 r5848 51 51 pj_dns_parsed_query q; 52 52 pj_dns_parsed_rr ans[4]; 53 pj_dns_parsed_rr ar[ 5];53 pj_dns_parsed_rr ar[10]; 54 54 pj_str_t tmp; 55 55 unsigned i; … … 73 73 example.com. 3600 IN A 5.5.5.5 74 74 75 ; Additionally, add corresponding empty AAAA records for all A records 75 76 */ 76 77 pj_bzero(&pkt, sizeof(pkt)); … … 152 153 ar[4].rdata.a.ip_addr = pj_inet_addr(pj_cstr(&tmp, "5.5.5.5")); 153 154 155 /* Add corresponding AAAA records for A records above */ 156 for (i = 0; i < 5; ++i) { 157 ar[5+i].name = ar[i].name; 158 ar[5+i].type = PJ_DNS_TYPE_AAAA; 159 ar[5+i].dnsclass = PJ_DNS_CLASS_IN; 160 ar[5+i].ttl = 3600; 161 } 162 154 163 /* 155 164 * Create individual A records for all hosts in "example.com" domain. … … 163 172 q.type = ar[i].type; 164 173 q.dnsclass = PJ_DNS_CLASS_IN; 165 pkt.hdr.anscount = 1; 166 pkt.ans = &ar[i]; 174 /* For now, AAAA always contains empty record */ 175 if (ar[i].type != PJ_DNS_TYPE_AAAA) { 176 pkt.hdr.anscount = 1; 177 pkt.ans = &ar[i]; 178 } 167 179 168 180 pj_dns_resolver_add_entry( resv, &pkt, PJ_FALSE); … … 213 225 sip06.domain.com. 3600 IN A 6.6.6.6 214 226 sip07.domain.com. 3600 IN A 7.7.7.7 227 228 ; Additionally, add corresponding empty AAAA records for all A records 215 229 */ 216 230 … … 268 282 269 283 pkt.hdr.qdcount = 1; 284 pkt.hdr.anscount = 1; 270 285 pkt.q = &q; 271 286 q.name = ans[0].name; … … 274 289 275 290 pj_dns_resolver_add_entry( resv, &pkt, PJ_FALSE); 291 292 /* Add corresponding AAAA record */ 293 q.type = PJ_DNS_TYPE_AAAA; 294 pkt.hdr.anscount = 0; 295 pj_dns_resolver_add_entry( resv, &pkt, PJ_FALSE); 296 276 297 277 298 /* Add the A record for sip07.domain.com */ … … 283 304 284 305 pkt.hdr.qdcount = 1; 306 pkt.hdr.anscount = 1; 285 307 pkt.q = &q; 286 308 q.name = ans[0].name; … … 289 311 290 312 pj_dns_resolver_add_entry( resv, &pkt, PJ_FALSE); 313 314 /* Add corresponding AAAA record */ 315 q.type = PJ_DNS_TYPE_AAAA; 316 pkt.hdr.anscount = 0; 317 pj_dns_resolver_add_entry( resv, &pkt, PJ_FALSE); 318 291 319 292 320 pkt.hdr.qdcount = 0;
Note: See TracChangeset
for help on using the changeset viewer.