1 /* SIE DNS NXDOMAIN nmsg message module */
2 
3 /*
4  * Copyright (c) 2010-2012, 2015 by Farsight Security, Inc.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *    http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 /* Import. */
20 
21 #include <string.h>
22 #include <time.h>
23 
24 #include "defs.h"
25 #include "dnsnx.pb-c.h"
26 
27 /* Data. */
28 
29 struct nmsg_msgmod_field dnsnx_fields[] = {
30 	{
31 		.type = nmsg_msgmod_ft_bytes,
32 		.name = "qname",
33 		.print = dns_name_print,
34 		.format = dns_name_format,
35 		.parse = dns_name_parse
36 	},
37 	{
38 		.type = nmsg_msgmod_ft_uint16,
39 		.name = "qclass",
40 		.print = dns_class_print,
41 		.format = dns_class_format,
42 		.parse = dns_class_parse
43 	},
44 	{
45 		.type = nmsg_msgmod_ft_uint16,
46 		.name = "qtype",
47 		.print = dns_type_print,
48 		.format = dns_type_format,
49 		.parse = dns_type_parse
50 	},
51 	{
52 		.type = nmsg_msgmod_ft_ip,
53 		.name = "response_ip",
54 	},
55 	{
56 		.type = nmsg_msgmod_ft_bytes,
57 		.name = "soa_rrname",
58 		.print = dns_name_print,
59 		.format = dns_name_format,
60 		.parse = dns_name_parse
61 	},
62 	{
63 		.type = nmsg_msgmod_ft_int64,
64 		.name = "response_time_sec",
65 		.flags = NMSG_MSGMOD_FIELD_NOPRINT
66 	},
67 	{
68 		.type = nmsg_msgmod_ft_int32,
69 		.name = "response_time_nsec",
70 		.flags = NMSG_MSGMOD_FIELD_NOPRINT
71 	},
72 	NMSG_MSGMOD_FIELD_END
73 };
74 
75 /* Export. */
76 
77 struct nmsg_msgmod_plugin nmsg_msgmod_ctx = {
78 	NMSG_MSGMOD_REQUIRED_INIT,
79 	.vendor		= NMSG_VENDOR_SIE,
80 	.msgtype	= { NMSG_VENDOR_SIE_DNSNX_ID, NMSG_VENDOR_SIE_DNSNX_NAME },
81 
82 	.pbdescr	= &nmsg__sie__dns_nx__descriptor,
83 	.fields		= dnsnx_fields
84 };
85