summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2024-11-05 01:53:26 +0000
committerliuxueli <[email protected]>2024-11-05 02:32:07 +0000
commitb0b67d145525d842f0b3ad666797c91f7d5757a8 (patch)
treed38a431fdbcc6d120d4783e20ba27871b136e6a8 /include
parentd7f8f42327ccbdd5fcc3c7f056869448cfbafd80 (diff)
refactor dns decoderliuxueli-dev-decoder
Diffstat (limited to 'include')
-rw-r--r--include/stellar/dns.h23
1 files changed, 9 insertions, 14 deletions
diff --git a/include/stellar/dns.h b/include/stellar/dns.h
index 6b05ea6..2708978 100644
--- a/include/stellar/dns.h
+++ b/include/stellar/dns.h
@@ -7,14 +7,15 @@ extern "C"
#include <stdint.h>
#include <stddef.h>
+#include <linux/limits.h>
#include <stellar/session.h>
#include <stellar/module_manager.h>
/*.
- First call DNS_MESSAGE_TRANSACTION_BEGIN to create the transaction,
+ First call DNS_TRANSACTION_STATE_BEGIN to create the transaction,
then publish the transaction's DNS_MESSAGE_QUERY/DNS_MESSAGE_RESPONSE,
- and finally call DNS_MESSAGE_TRANSACTION_END to release the transaction.
+ and finally call DNS_TRANSACTION_STATE_END to release the transaction.
*/
#define DNS_NAME_MAX (NAME_MAX + 1)
@@ -86,23 +87,17 @@ struct dns_message
{
uint16_t transaction_id;
struct dns_flag flag;
- uint16_t n_questions;
- uint16_t n_answer_rrs;
- uint16_t n_authority_rrs;
- uint16_t n_additional_rrs;
- struct dns_query_question *questions;
+ uint16_t n_question;
+ uint16_t n_answer_rr;
+ uint16_t n_authority_rr;
+ uint16_t n_additional_rr;
+ struct dns_query_question question;
char *rr_payload;
size_t rr_payload_sz;
size_t rr_payload_offset;
struct dns_resource_record_resolver *rr_resolver;
};
-enum dns_transaction_state
-{
- DNS_TRANSACTION_STATE_BEGIN=1,
- DNS_TRANSACTION_STATE_END
-};
-
enum dns_message_type
{
DNS_MESSAGE_QUERY=1,
@@ -110,7 +105,7 @@ enum dns_message_type
DNS_MESSAGE_MAX
};
-typedef void on_dns_message_callback(struct session *sess, enum dns_transaction_state state, enum dns_message_type type, struct dns_message *msg, void *args);
+typedef void on_dns_message_callback(struct session *sess, uint16_t transaction_id, enum dns_message_type type, struct dns_message *msg, void *args);
int dns_decoder_subscribe_dns_message(struct stellar_module_manager *mod_mgr, on_dns_message_callback *cb, void *args);
int dns_decoder_resource_record_is_dnssec(struct dns_resource_record_resolver *rr_resolver, char *rr_payload, size_t rr_payload_sz, size_t rr_payload_offset);