source: mainline/uspace/srv/net/dnsrsrv/dns_type.h@ 9f029aa

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 9f029aa was 9f029aa, checked in by Jiri Svoboda <jiri@…>, 13 years ago

Simplify slightly, comments.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 * Copyright (c) 2012 Jiri Svoboda
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup dnsres
30 * @{
31 */
32/**
33 * @file
34 */
35
36#ifndef DNS_TYPE_H
37#define DNS_TYPE_H
38
39#include <adt/list.h>
40#include <inet/inet.h>
41#include <stdbool.h>
42#include <stdint.h>
43#include "dns_std.h"
44
45/** Encoded DNS PDU */
46typedef struct {
47 /** Encoded PDU data */
48 uint8_t *data;
49 /** Encoded PDU size */
50 size_t size;
51} dns_pdu_t;
52
53/** DNS message */
54typedef struct {
55 /* Encoded PDU */
56 dns_pdu_t pdu;
57
58 /** Identifier */
59 uint16_t id;
60 /** Query or Response */
61 dns_query_response_t qr;
62 /** Opcode */
63 dns_opcode_t opcode;
64 /** Authoritative Answer */
65 bool aa;
66 /** TrunCation */
67 bool tc;
68 /** Recursion Desired */
69 bool rd;
70 /** Recursion Available */
71 bool ra;
72 /** Response Code */
73 dns_rcode_t rcode;
74
75 list_t question; /* of dns_question_t */
76 list_t answer; /* of dns_rr_t */
77 list_t authority; /* of dns_rr_t */
78 list_t additional; /* of dns_rr_t */
79} dns_message_t;
80
81/** Unencoded DNS message question section */
82typedef struct {
83 link_t msg;
84 /** Domain name in text format (dot notation) */
85 char *qname;
86 /** Query type */
87 dns_qtype_t qtype;
88 /** Query class */
89 dns_qclass_t qclass;
90} dns_question_t;
91
92/** Unencoded DNS resource record */
93typedef struct {
94 link_t msg;
95 /** Domain name */
96 char *name;
97 /** RR type */
98 dns_type_t rtype;
99 /** Class of data */
100 dns_class_t rclass;
101 /** Time to live */
102 uint32_t ttl;
103
104 /** Resource data */
105 void *rdata;
106 /** Number of bytes in @c *rdata */
107 size_t rdata_size;
108 /** Offset in the raw message */
109 size_t roff;
110} dns_rr_t;
111
112/** Host information */
113typedef struct {
114 /** Host name */
115 char *name;
116 /** Host address */
117 inet_addr_t addr;
118} dns_host_info_t;
119
120typedef struct {
121} dnsr_client_t;
122
123#endif
124
125/** @}
126 */
Note: See TracBrowser for help on using the repository browser.