aboutsummaryrefslogtreecommitdiff
path: root/src/dns.h
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-05-02 19:15:56 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-05-02 19:15:56 +0200
commit98c68ed8cc11fa8932e480256b2544c50aaa790b (patch)
tree97e7a5b0a3af20dd3e5014cfbb3e17289cb64c88 /src/dns.h
parent009dc3ba991290de19f0a5e4e4a25a33e82689cc (diff)
downloaddns-98c68ed8cc11fa8932e480256b2544c50aaa790b.tar.gz
convert to typedef structs
Diffstat (limited to 'src/dns.h')
-rw-r--r--src/dns.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/dns.h b/src/dns.h
index 4ee1c88..009f861 100644
--- a/src/dns.h
+++ b/src/dns.h
@@ -76,17 +76,17 @@ enum dns_responsecode {
/**
* Data is COPIED
* */
-struct dns_header;
+typedef struct dns_header dns_header_t;
/**
* QNAME is REFERENCED
* */
-struct dns_question;
+typedef struct dns_question dns_question_t;
/**
* NAME is REFERENCED
* */
-struct dns_answer;
+typedef struct dns_answer dns_answer_t;
/**
* DNS Message struct
@@ -95,7 +95,7 @@ struct dns_answer;
* the buffer used to create it remains unchanged as
* some values are referenced, not copied.
* */
-struct dns_message;
+typedef struct dns_message dns_message_t;
struct dns_header {
uint16_t id;
@@ -138,41 +138,41 @@ struct dns_message {
struct dns_header header;
int question_count;
- struct dns_question* question;
+ dns_question_t* question;
int answer_count;
- struct dns_answer* answer;
+ dns_answer_t* answer;
};
int dns_construct_header (
char* _buffer,
int _bufflen,
- struct dns_header* _header
+ dns_header_t* _header
);
int dns_construct_answer (
char* _buffer,
int _bufflen,
- struct dns_answer* _answer
+ dns_answer_t* _answer
);
int dns_construct_questoin (
char* _buffer,
int _bufflen,
- struct dns_question* _question
+ dns_question_t* _question
);
// Question and answer count come from header
int dns_construct_packet (
char* _buffer,
int _bufflen,
- struct dns_message* _message
+ dns_message_t* _message
);
/**
* Frees all malloced memory
* */
-int dns_destroy_struct ( struct dns_message* _msg );
+int dns_destroy_struct ( dns_message_t* _msg );
/**
* Parse the packet in _buffer and populate the dns_message struct
@@ -182,7 +182,7 @@ int dns_destroy_struct ( struct dns_message* _msg );
* ONLY WRITES QUESTION SECTION. ALL OTHER ARE IGNORED
*
* */
-int dns_parse_packet ( char* _buffer, int _bufflen, struct dns_message* _msg );
+int dns_parse_packet ( char* _buffer, int _bufflen, dns_message_t* _msg );
/**
* Convert a null terminated string containing a