Changeset 08a6382 in mainline for uspace/srv/net/dnsres/dns_msg.c
- Timestamp:
- 2012-08-12T20:17:31Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e5e73af
- Parents:
- f85ed4b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/dnsres/dns_msg.c
rf85ed4b r08a6382 35 35 36 36 #include <bitops.h> 37 #include <byteorder.h> 37 38 #include <errno.h> 38 39 #include <stdint.h> … … 87 88 buf[pi] = (uint8_t)lsize; 88 89 90 lsize = 0; 91 pi = di; 92 ++di; 93 89 94 if (c == '\0') 90 95 break; 91 92 pi = di; 96 } else { 97 if (buf != NULL && di < buf_size) 98 buf[di] = c; 93 99 ++di; 94 } else {95 100 ++lsize; 96 if (buf != NULL && di < buf_size)97 buf[di++] = c;98 101 } 99 102 } … … 126 129 return rc; 127 130 131 printf("name_size=%zu\n", name_size); 132 128 133 *act_size = name_size + sizeof(uint16_t) + sizeof(uint16_t); 134 printf("act_size=%zu\n", *act_size); 129 135 if (buf == NULL) 130 136 return EOK; … … 138 144 di += sizeof(uint16_t); 139 145 140 *act_size = di;141 146 return EOK; 142 147 } … … 151 156 int rc; 152 157 153 hdr.id = msg->id;154 155 hdr.opbits = 158 hdr.id = host2uint16_t_be(msg->id); 159 160 hdr.opbits = host2uint16_t_be( 156 161 (msg->qr << OPB_QR) | 157 162 (msg->opcode << OPB_OPCODE_l) | … … 160 165 (msg->rd ? BIT_V(uint16_t, OPB_RD) : 0) | 161 166 (msg->ra ? BIT_V(uint16_t, OPB_RA) : 0) | 162 msg->rcode; 163 164 hdr.qd_count = list_count(&msg->question); 167 msg->rcode 168 ); 169 170 hdr.qd_count = host2uint16_t_be(list_count(&msg->question)); 165 171 hdr.an_count = 0; 166 172 hdr.ns_count = 0; … … 168 174 169 175 size = sizeof(dns_header_t); 176 printf("dns header size=%zu\n", size); 170 177 171 178 list_foreach(msg->question, link) { … … 175 182 return rc; 176 183 184 printf("q_size=%zu\n", q_size); 177 185 size += q_size; 178 186 } … … 193 201 } 194 202 203 printf("-> size=%zu, di=%zu\n", size, di); 195 204 *rdata = data; 196 205 *rsize = size;
Note:
See TracChangeset
for help on using the changeset viewer.