Changeset adae30d in mainline


Ignore:
Timestamp:
2012-08-12T16:27:30Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f85ed4b
Parents:
d23d911
Message:

Work-in-progress message encoding/decoding, transport and query composition.

Location:
uspace/srv/net/dnsres
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/dnsres/Makefile

    rd23d911 radae30d  
    3131
    3232SOURCES = \
    33         dnsres.c
     33        dns_msg.c \
     34        dnsres.c \
     35        query.c \
     36        transport.c
    3437
    3538include $(USPACE_PREFIX)/Makefile.common
  • uspace/srv/net/dnsres/dns_msg.h

    rd23d911 radae30d  
    4141#include <stdint.h>
    4242#include "dns_std.h"
     43#include "dns_type.h"
    4344
    44 /** Unencoded DNS message */
    45 typedef struct {
    46         /** Identifier */
    47         uint16_t id;
    48         /** Query or Response */
    49         dns_query_response_t qr;
    50         /** Opcode */
    51         dns_opcode_t opcode;
    52         /** Authoritative Answer */
    53         bool aa;
    54         /** TrunCation */
    55         bool tc;
    56         /** Recursion Desired */
    57         bool rd;
    58         /** Recursion Available */
    59         bool ra;
    60         /** Response Code */
    61         dns_rcode_t rcode;
    62 
    63         list_t question; /* of dns_question_t */
    64         list_t answer; /* of dns_rr_t */
    65         list_t authority; /* of dns_rr_t */
    66         list_t additional; /* of dns_rr_t */
    67 } dns_message_t;
    68 
    69 /** Unencoded DNS message question section */
    70 typedef struct {
    71         /** Domain name in text format (dot notation) */
    72         char *qname;
    73         /** Query type */
    74         dns_qtype_t qtype;
    75         /** Query class */
    76         dns_qclass_t qclass;
    77 } dns_question_t;
    78 
    79 /** Unencoded DNS resource record */
    80 typedef struct {
    81         /** Domain name */
    82         char *name;
    83         /** RR type */
    84         dns_type_t rtype;
    85         /** Class of data */
    86         dns_class_t rclass;
    87         /** Time to live */
    88         uint32_t ttl;
    89 
    90         /** Resource data */
    91         void *rdata;
    92         /** Number of bytes in @c *rdata */
    93         size_t rdata_size;
    94 } dns_rr_t;
     45extern int dns_message_encode(dns_message_t *, void **, size_t *);
    9546
    9647#endif
  • uspace/srv/net/dnsres/dns_std.h

    rd23d911 radae30d  
    8585
    8686typedef struct {
     87        /** Identifier assigned by the query originator */
    8788        uint16_t id;
     89        /** QR, Opcode, AA, TC,RD, RA, Z, Rcode */
    8890        uint16_t opbits;
     91        /** Number of entries in query section */
    8992        uint16_t qd_count;
     93        /** Number of RRs in the answer section */
    9094        uint16_t an_count;
     95        /** Number of name server RRs in the authority records section */
    9196        uint16_t ns_count;
     97        /** Number of RRs in the additional records section */
    9298        uint16_t ar_count;
    9399} dns_header_t;
     
    100106enum dns_opbits {
    101107        OPB_QR          = 15,
    102         QPB_OPCODE_h    = 14,
    103         QPB_OPCODE_l    = 11,
    104         QPB_AA          = 10,
    105         QPB_TC          = 9,
    106         QPB_RD          = 8,
    107         QPB_RA          = 7,
    108         QPB_Z_h         = 6,
    109         QPB_Z_l         = 4,
    110         QPB_RCODE_h     = 3,
    111         QPB_RCODE_l     = 0
     108        OPB_OPCODE_h    = 14,
     109        OPB_OPCODE_l    = 11,
     110        OPB_AA          = 10,
     111        OPB_TC          = 9,
     112        OPB_RD          = 8,
     113        OPB_RA          = 7,
     114        OPB_Z_h         = 6,
     115        OPB_Z_l         = 4,
     116        OPB_RCODE_h     = 3,
     117        OPB_RCODE_l     = 0
    112118};
    113119
  • uspace/srv/net/dnsres/dnsres.c

    rd23d911 radae30d  
    2727 */
    2828
     29/** @addtogroup dnsres
     30 * @{
     31 */
     32/**
     33 * @file
     34 */
     35
    2936#include <stdio.h>
    3037#include <errno.h>
     
    4047        return 0;
    4148}
     49
     50/** @}
     51 */
Note: See TracChangeset for help on using the changeset viewer.