Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/dnsrsrv/dns_msg.c

    rfeeac0d r9f029aa  
    296296uint32_t dns_uint32_t_decode(uint8_t *buf, size_t buf_size)
    297297{
     298        uint32_t w;
    298299        assert(buf_size >= 4);
    299        
    300         uint32_t w = ((uint32_t) buf[0] << 24) +
    301             ((uint32_t) buf[1] << 16) +
    302             ((uint32_t) buf[2] << 8) +
     300
     301        w = ((uint32_t)buf[0] << 24) +
     302            ((uint32_t)buf[1] << 16) +
     303            ((uint32_t)buf[2] << 8) +
    303304            buf[3];
    304        
     305
    305306        return w;
    306 }
    307 
    308 /** Decode unaligned big-endian 128-bit integer */
    309 void dns_addr128_t_decode(uint8_t *buf, size_t buf_size, addr128_t addr)
    310 {
    311         assert(buf_size >= 16);
    312        
    313         addr128_t_be2host(buf, addr);
    314307}
    315308
     
    407400        int rc;
    408401
    409         rr = calloc(1, sizeof(dns_rr_t));
     402        rr = calloc(1, sizeof (dns_rr_t));
    410403        if (rr == NULL)
    411404                return ENOMEM;
     
    434427
    435428        rr->rtype = dns_uint16_t_decode(bp, bsz);
    436         bp += sizeof(uint16_t);
    437         bsz -= sizeof(uint16_t);
     429        bp += sizeof(uint16_t); bsz -= sizeof(uint16_t);
    438430
    439431        rr->rclass = dns_uint16_t_decode(bp, bsz);
    440         bp += sizeof(uint16_t);
    441         bsz -= sizeof(uint16_t);
     432        bp += sizeof(uint16_t); bsz -= sizeof(uint16_t);
    442433
    443434        rr->ttl = dns_uint32_t_decode(bp, bsz);
    444         bp += sizeof(uint32_t);
    445         bsz -= sizeof(uint32_t);
     435        bp += sizeof(uint32_t); bsz -= sizeof(uint32_t);
    446436
    447437        rdlength = dns_uint16_t_decode(bp, bsz);
    448         bp += sizeof(uint16_t);
    449         bsz -= sizeof(uint16_t);
     438        bp += sizeof(uint16_t); bsz -= sizeof(uint16_t);
    450439
    451440        if (rdlength > bsz) {
     
    510499        size = sizeof(dns_header_t);
    511500
    512         list_foreach(msg->question, msg, dns_question_t, q) {
     501        list_foreach(msg->question, link) {
     502                dns_question_t *q = list_get_instance(link, dns_question_t, msg);
    513503                rc = dns_question_encode(q, NULL, 0, &q_size);
    514504                if (rc != EOK)
     
    525515        di = sizeof(dns_header_t);
    526516
    527         list_foreach(msg->question, msg, dns_question_t, q) {
     517        list_foreach(msg->question, link) {
     518                dns_question_t *q = list_get_instance(link, dns_question_t, msg);
    528519                rc = dns_question_encode(q, data + di, size - di, &q_size);
    529520                if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.