aboutsummaryrefslogtreecommitdiff
path: root/src/dns.h
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-02-28 23:23:54 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-02-28 23:23:54 +0100
commit233f169f507e31472b23a64269878557d6f0f9fe (patch)
tree666e3a2920a4936097f970c89819909e69ad5db6 /src/dns.h
parent3cac8f89459317626d521904d85fcb8267671c78 (diff)
downloaddns-233f169f507e31472b23a64269878557d6f0f9fe.tar.gz
construct answer/question
Diffstat (limited to 'src/dns.h')
-rw-r--r--src/dns.h34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/dns.h b/src/dns.h
index 73cf9c3..c44fb29 100644
--- a/src/dns.h
+++ b/src/dns.h
@@ -91,8 +91,9 @@ struct dns_answer;
/**
* DNS Message struct
*
- * A initialized instance is only valid as long as
- * the buffer used to create it remains unchanged
+ * An initialized instance is only valid as long as
+ * the buffer used to create it remains unchanged as
+ * some values are referenced, not copied.
* */
struct dns_message;
@@ -116,12 +117,16 @@ struct dns_header {
struct dns_question {
const char* qname;
+ int qname_len;
+
uint16_t qtype;
uint16_t qclass;
};
struct dns_answer {
- char* name; //in qname format
+ char* qname; //in qname format
+ int qname_len;
+
uint16_t type;
uint16_t class;
uint32_t ttl;
@@ -140,9 +145,28 @@ struct dns_message {
};
int dns_construct_header (
- struct dns_header* _header,
char* _buffer,
- int _bufflen
+ int _bufflen,
+ struct dns_header* _header
+ );
+
+int dns_construct_answer (
+ char* _buffer,
+ int _bufflen,
+ struct dns_answer* _answer
+ );
+
+int dns_construct_questoin (
+ char* _buffer,
+ int _bufflen,
+ struct dns_question* _question
+ );
+
+// Question and answer count come from header
+int dns_construct_packet (
+ char* _buffer,
+ int _bufflen,
+ struct dns_message* _message
);
/**