Ignore:
File:
1 edited

Legend:

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

    r3e66428 r0aa70f4  
    296296uint32_t dns_uint32_t_decode(uint8_t *buf, size_t buf_size)
    297297{
    298         uint32_t w;
    299298        assert(buf_size >= 4);
    300 
    301         w = ((uint32_t) buf[0] << 24) +
     299       
     300        uint32_t w = ((uint32_t) buf[0] << 24) +
    302301            ((uint32_t) buf[1] << 16) +
    303302            ((uint32_t) buf[2] << 8) +
    304303            buf[3];
    305 
     304       
    306305        return w;
     306}
     307
     308/** Decode unaligned big-endian 128-bit integer */
     309void 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);
    307314}
    308315
     
    400407        int rc;
    401408
    402         rr = calloc(1, sizeof (dns_rr_t));
     409        rr = calloc(1, sizeof(dns_rr_t));
    403410        if (rr == NULL)
    404411                return ENOMEM;
     
    427434
    428435        rr->rtype = dns_uint16_t_decode(bp, bsz);
    429         bp += sizeof(uint16_t); bsz -= sizeof(uint16_t);
     436        bp += sizeof(uint16_t);
     437        bsz -= sizeof(uint16_t);
    430438
    431439        rr->rclass = dns_uint16_t_decode(bp, bsz);
    432         bp += sizeof(uint16_t); bsz -= sizeof(uint16_t);
     440        bp += sizeof(uint16_t);
     441        bsz -= sizeof(uint16_t);
    433442
    434443        rr->ttl = dns_uint32_t_decode(bp, bsz);
    435         bp += sizeof(uint32_t); bsz -= sizeof(uint32_t);
     444        bp += sizeof(uint32_t);
     445        bsz -= sizeof(uint32_t);
    436446
    437447        rdlength = dns_uint16_t_decode(bp, bsz);
    438         bp += sizeof(uint16_t); bsz -= sizeof(uint16_t);
     448        bp += sizeof(uint16_t);
     449        bsz -= sizeof(uint16_t);
    439450
    440451        if (rdlength > bsz) {
Note: See TracChangeset for help on using the changeset viewer.