summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/decoders/dns/gtest_dns_decoder_plugin.c33
2 files changed, 11 insertions, 24 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4721632..0a89d0a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -7,4 +7,4 @@ add_subdirectory(lpi_plus)
#add_subdirectory(decoders/stratum)
#add_subdirectory(decoders/session_flags)
add_subdirectory(decoders/tls)
-# add_subdirectory(decoders/dns)
+add_subdirectory(decoders/dns)
diff --git a/test/decoders/dns/gtest_dns_decoder_plugin.c b/test/decoders/dns/gtest_dns_decoder_plugin.c
index 5956740..c467a1e 100644
--- a/test/decoders/dns/gtest_dns_decoder_plugin.c
+++ b/test/decoders/dns/gtest_dns_decoder_plugin.c
@@ -10,7 +10,6 @@
#include "stellar/dns.h"
#include "stellar/session.h"
-#include "stellar/session_manager.h"
#include "stellar/mq.h"
struct gtest_dns_decoder_plugin_env
@@ -63,38 +62,26 @@ void gtest_dns_decoder_real_result_write_file(char *result_str)
}
}
-void gtest_dns_decoder_message_cb(struct session *ss, enum dns_message_type type, struct dns_message *dns_msg, void *args)
+void gtest_dns_decoder_message_cb(struct session *sess, uint16_t transaction_id __attribute__((unused)), enum dns_message_type type __attribute__((unused)), struct dns_message *dns_msg, void *args)
{
- if(type==DNS_MESSAGE_TRANSACTION_BEGIN || type==DNS_MESSAGE_TRANSACTION_END)
- {
- return;
- }
-
//uint16_t id=dns_message_header_id_get(dns_msg);
struct gtest_dns_decoder_plugin_env *plugin_env=(struct gtest_dns_decoder_plugin_env *)args;
yyjson_mut_val *dns_object=yyjson_mut_obj(dns_doc);
- yyjson_mut_obj_add_strcpy(dns_doc, dns_object, "Tuple4", session_get_readable_addr(ss));
+ yyjson_mut_obj_add_strcpy(dns_doc, dns_object, "Tuple4", session_get_readable_addr(sess));
- uint16_t n_question=0;
- struct dns_query_question *question=NULL;
- dns_message_query_question_get0(dns_msg, &question, &n_question);
- if(n_question>0 && question!=NULL)
+ if(dns_msg->n_question>0)
{
- yyjson_mut_obj_add_strcpy(dns_doc, dns_object, "dns_qname", dns_query_question_qname_get0(question));
- yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_qtype", dns_query_question_qtype_get0(question));
- yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_qclass", dns_query_question_qclass_get0(question));
+ yyjson_mut_obj_add_strcpy(dns_doc, dns_object, "dns_qname", (char *)(dns_msg->question.qname));
+ yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_qtype", dns_msg->question.qtype);
+ yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_qclass", dns_msg->question.qclass);
}
- struct dns_flag *flag=dns_message_header_flag_get0(dns_msg);
- if(flag!=NULL)
- {
- yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_qr", flag->qr);
- yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_opcode", flag->opcode);
- yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_rd", flag->rd);
- }
+ yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_qr", dns_msg->flag.qr);
+ yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_opcode", dns_msg->flag.opcode);
+ yyjson_mut_obj_add_int(dns_doc, dns_object, "dns_rd", dns_msg->flag.rd);
- const char *resource_record_str=dns_message_resource_record_json_exporter(dns_msg);
+ const char *resource_record_str=dns_decoder_resource_record_json_exporter(dns_msg->rr_resolver, dns_msg->rr_payload, dns_msg->rr_payload_sz, dns_msg->rr_payload_offset);
if(resource_record_str!=NULL)
{
yyjson_doc *rr_doc=yyjson_read(resource_record_str, strlen(resource_record_str), 0);