Changeset a0d97f83 in mainline
- Timestamp:
- 2013-05-03T08:44:14Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ef904895
- Parents:
- 48171fc4
- Location:
- uspace/srv/net/dnsrsrv
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsrsrv/dns_msg.c
r48171fc4 ra0d97f83 517 517 int rc; 518 518 519 msg = calloc(1, sizeof(dns_message_t));519 msg = dns_message_new(); 520 520 if (msg == NULL) 521 521 return ENOMEM; … … 537 537 hdr->opbits); 538 538 539 list_initialize(&msg->question);540 list_initialize(&msg->answer);541 list_initialize(&msg->authority);542 list_initialize(&msg->additional);543 544 539 doff = sizeof(dns_header_t); 545 540 … … 599 594 } 600 595 596 dns_message_t *dns_message_new(void) 597 { 598 dns_message_t *msg; 599 600 msg = calloc(1, sizeof(dns_message_t)); 601 if (msg == NULL) 602 return NULL; 603 604 list_initialize(&msg->question); 605 list_initialize(&msg->answer); 606 list_initialize(&msg->authority); 607 list_initialize(&msg->additional); 608 609 return msg; 610 } 611 601 612 void dns_message_destroy(dns_message_t *msg) 602 613 { -
uspace/srv/net/dnsrsrv/dns_msg.h
r48171fc4 ra0d97f83 45 45 extern int dns_message_encode(dns_message_t *, void **, size_t *); 46 46 extern int dns_message_decode(void *, size_t, dns_message_t **); 47 extern dns_message_t *dns_message_new(void); 47 48 extern void dns_message_destroy(dns_message_t *); 48 49 extern uint32_t dns_uint32_t_decode(uint8_t *, size_t); -
uspace/srv/net/dnsrsrv/query.c
r48171fc4 ra0d97f83 52 52 dns_message_t *msg; 53 53 dns_message_t *amsg; 54 dns_question_t question;54 dns_question_t *question; 55 55 dns_host_info_t *info; 56 56 int rc; 57 57 58 question .qname = (char *)name;59 question.qtype = DTYPE_A;60 question.qclass = DC_IN;58 question = calloc(1, sizeof(dns_question_t)); 59 if (question == NULL) 60 return ENOMEM; 61 61 62 msg = calloc(1, sizeof(dns_message_t)); 62 question->qname = (char *)name; 63 question->qtype = DTYPE_A; 64 question->qclass = DC_IN; 65 66 msg = dns_message_new(); 63 67 if (msg == NULL) 64 68 return ENOMEM; 65 69 66 list_initialize(&msg->question); 67 list_append(&question.msg, &msg->question); 70 list_append(&question->msg, &msg->question); 68 71 69 72 msg->id = msg_id++; … … 100 103 info->addr.ipv4); 101 104 105 dns_message_destroy(msg); 102 106 dns_message_destroy(amsg); 103 107 *rinfo = info;
Note:
See TracChangeset
for help on using the changeset viewer.