nmsg  0.15.1
dnstap.pb-c.h
1 /* Generated by the protocol buffer compiler. DO NOT EDIT! */
2 /* Generated from: nmsg/base/dnstap.proto */
3 
4 #ifndef PROTOBUF_C_nmsg_2fbase_2fdnstap_2eproto__INCLUDED
5 #define PROTOBUF_C_nmsg_2fbase_2fdnstap_2eproto__INCLUDED
6 
7 #include <protobuf-c/protobuf-c.h>
8 
9 PROTOBUF_C__BEGIN_DECLS
10 
11 #if PROTOBUF_C_VERSION_NUMBER < 1000000
12 # error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
13 #elif 1003001 < PROTOBUF_C_MIN_COMPILER_VERSION
14 # error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
15 #endif
16 
17 
18 typedef struct _Dnstap__Dnstap Dnstap__Dnstap;
19 typedef struct _Dnstap__Message Dnstap__Message;
20 
21 
22 /* --- enums --- */
23 
24 /*
25  * Identifies which field below is filled in.
26  */
27 typedef enum _Dnstap__Dnstap__Type {
28  DNSTAP__DNSTAP__TYPE__MESSAGE = 1
29  PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(DNSTAP__DNSTAP__TYPE)
30 } Dnstap__Dnstap__Type;
31 typedef enum _Dnstap__Message__Type {
32  /*
33  * AUTH_QUERY is a DNS query message received from a resolver by an
34  * authoritative name server, from the perspective of the authoritative
35  * name server.
36  */
37  DNSTAP__MESSAGE__TYPE__AUTH_QUERY = 1,
38  /*
39  * AUTH_RESPONSE is a DNS response message sent from an authoritative
40  * name server to a resolver, from the perspective of the authoritative
41  * name server.
42  */
43  DNSTAP__MESSAGE__TYPE__AUTH_RESPONSE = 2,
44  /*
45  * RESOLVER_QUERY is a DNS query message sent from a resolver to an
46  * authoritative name server, from the perspective of the resolver.
47  * Resolvers typically clear the RD (recursion desired) bit when
48  * sending queries.
49  */
50  DNSTAP__MESSAGE__TYPE__RESOLVER_QUERY = 3,
51  /*
52  * RESOLVER_RESPONSE is a DNS response message received from an
53  * authoritative name server by a resolver, from the perspective of
54  * the resolver.
55  */
56  DNSTAP__MESSAGE__TYPE__RESOLVER_RESPONSE = 4,
57  /*
58  * CLIENT_QUERY is a DNS query message sent from a client to a DNS
59  * server which is expected to perform further recursion, from the
60  * perspective of the DNS server. The client may be a stub resolver or
61  * forwarder or some other type of software which typically sets the RD
62  * (recursion desired) bit when querying the DNS server. The DNS server
63  * may be a simple forwarding proxy or it may be a full recursive
64  * resolver.
65  */
66  DNSTAP__MESSAGE__TYPE__CLIENT_QUERY = 5,
67  /*
68  * CLIENT_RESPONSE is a DNS response message sent from a DNS server to
69  * a client, from the perspective of the DNS server. The DNS server
70  * typically sets the RA (recursion available) bit when responding.
71  */
72  DNSTAP__MESSAGE__TYPE__CLIENT_RESPONSE = 6,
73  /*
74  * FORWARDER_QUERY is a DNS query message sent from a downstream DNS
75  * server to an upstream DNS server which is expected to perform
76  * further recursion, from the perspective of the downstream DNS
77  * server.
78  */
79  DNSTAP__MESSAGE__TYPE__FORWARDER_QUERY = 7,
80  /*
81  * FORWARDER_RESPONSE is a DNS response message sent from an upstream
82  * DNS server performing recursion to a downstream DNS server, from the
83  * perspective of the downstream DNS server.
84  */
85  DNSTAP__MESSAGE__TYPE__FORWARDER_RESPONSE = 8,
86  /*
87  * STUB_QUERY is a DNS query message sent from a stub resolver to a DNS
88  * server, from the perspective of the stub resolver.
89  */
90  DNSTAP__MESSAGE__TYPE__STUB_QUERY = 9,
91  /*
92  * STUB_RESPONSE is a DNS response message sent from a DNS server to a
93  * stub resolver, from the perspective of the stub resolver.
94  */
95  DNSTAP__MESSAGE__TYPE__STUB_RESPONSE = 10,
96  /*
97  * TOOL_QUERY is a DNS query message sent from a DNS software tool to a
98  * DNS server, from the perspective of the tool.
99  */
100  DNSTAP__MESSAGE__TYPE__TOOL_QUERY = 11,
101  /*
102  * TOOL_RESPONSE is a DNS response message received by a DNS software
103  * tool from a DNS server, from the perspective of the tool.
104  */
105  DNSTAP__MESSAGE__TYPE__TOOL_RESPONSE = 12
106  PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(DNSTAP__MESSAGE__TYPE)
107 } Dnstap__Message__Type;
108 /*
109  * SocketFamily: the network protocol family of a socket. This specifies how
110  * to interpret "network address" fields.
111  */
112 typedef enum _Dnstap__SocketFamily {
113  /*
114  * IPv4 (RFC 791)
115  */
116  DNSTAP__SOCKET_FAMILY__INET = 1,
117  /*
118  * IPv6 (RFC 2460)
119  */
120  DNSTAP__SOCKET_FAMILY__INET6 = 2
121  PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(DNSTAP__SOCKET_FAMILY)
122 } Dnstap__SocketFamily;
123 /*
124  * SocketProtocol: the transport protocol of a socket. This specifies how to
125  * interpret "transport port" fields.
126  */
127 typedef enum _Dnstap__SocketProtocol {
128  /*
129  * User Datagram Protocol (RFC 768)
130  */
131  DNSTAP__SOCKET_PROTOCOL__UDP = 1,
132  /*
133  * Transmission Control Protocol (RFC 793)
134  */
135  DNSTAP__SOCKET_PROTOCOL__TCP = 2
136  PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(DNSTAP__SOCKET_PROTOCOL)
137 } Dnstap__SocketProtocol;
138 
139 /* --- messages --- */
140 
141 /*
142  * "Dnstap": this is the top-level dnstap type, which is a "union" type that
143  * contains other kinds of dnstap payloads, although currently only one type
144  * of dnstap payload is defined.
145  * See: https://developers.google.com/protocol-buffers/docs/techniques#union
146  */
147 struct _Dnstap__Dnstap
148 {
149  ProtobufCMessage base;
150  /*
151  * DNS server identity.
152  * If enabled, this is the identity string of the DNS server which generated
153  * this message. Typically this would be the same string as returned by an
154  * "NSID" (RFC 5001) query.
155  */
156  protobuf_c_boolean has_identity;
157  ProtobufCBinaryData identity;
158  /*
159  * DNS server version.
160  * If enabled, this is the version string of the DNS server which generated
161  * this message. Typically this would be the same string as returned by a
162  * "version.bind" query.
163  */
164  protobuf_c_boolean has_version;
165  ProtobufCBinaryData version;
166  /*
167  * Extra data for this payload.
168  * This field can be used for adding an arbitrary byte-string annotation to
169  * the payload. No encoding or interpretation is applied or enforced.
170  */
171  protobuf_c_boolean has_extra;
172  ProtobufCBinaryData extra;
173  Dnstap__Dnstap__Type type;
174  /*
175  * One of the following will be filled in.
176  */
177  Dnstap__Message *message;
178 };
179 #define DNSTAP__DNSTAP__INIT \
180  { PROTOBUF_C_MESSAGE_INIT (&dnstap__dnstap__descriptor) \
181  , 0, {0,NULL}, 0, {0,NULL}, 0, {0,NULL}, DNSTAP__DNSTAP__TYPE__MESSAGE, NULL }
182 
183 
184 /*
185  * Message: a wire-format (RFC 1035 section 4) DNS message and associated
186  * metadata. Applications generating "Message" payloads should follow
187  * certain requirements based on the MessageType, see below.
188  */
189 struct _Dnstap__Message
190 {
191  ProtobufCMessage base;
192  /*
193  * One of the Type values described above.
194  */
195  Dnstap__Message__Type type;
196  /*
197  * One of the SocketFamily values described above.
198  */
199  protobuf_c_boolean has_socket_family;
200  Dnstap__SocketFamily socket_family;
201  /*
202  * One of the SocketProtocol values described above.
203  */
204  protobuf_c_boolean has_socket_protocol;
205  Dnstap__SocketProtocol socket_protocol;
206  /*
207  * The network address of the message initiator.
208  * For SocketFamily INET, this field is 4 octets (IPv4 address).
209  * For SocketFamily INET6, this field is 16 octets (IPv6 address).
210  */
211  protobuf_c_boolean has_query_address;
212  ProtobufCBinaryData query_address;
213  /*
214  * The network address of the message responder.
215  * For SocketFamily INET, this field is 4 octets (IPv4 address).
216  * For SocketFamily INET6, this field is 16 octets (IPv6 address).
217  */
218  protobuf_c_boolean has_response_address;
219  ProtobufCBinaryData response_address;
220  /*
221  * The transport port of the message initiator.
222  * This is a 16-bit UDP or TCP port number, depending on SocketProtocol.
223  */
224  protobuf_c_boolean has_query_port;
225  uint32_t query_port;
226  /*
227  * The transport port of the message responder.
228  * This is a 16-bit UDP or TCP port number, depending on SocketProtocol.
229  */
230  protobuf_c_boolean has_response_port;
231  uint32_t response_port;
232  /*
233  * The time at which the DNS query message was sent or received, depending
234  * on whether this is an AUTH_QUERY, RESOLVER_QUERY, or CLIENT_QUERY.
235  * This is the number of seconds since the UNIX epoch.
236  */
237  protobuf_c_boolean has_query_time_sec;
238  uint64_t query_time_sec;
239  /*
240  * The time at which the DNS query message was sent or received.
241  * This is the seconds fraction, expressed as a count of nanoseconds.
242  */
243  protobuf_c_boolean has_query_time_nsec;
244  uint32_t query_time_nsec;
245  /*
246  * The initiator's original wire-format DNS query message, verbatim.
247  */
248  protobuf_c_boolean has_query_message;
249  ProtobufCBinaryData query_message;
250  /*
251  * The "zone" or "bailiwick" pertaining to the DNS query message.
252  * This is a wire-format DNS domain name.
253  */
254  protobuf_c_boolean has_query_zone;
255  ProtobufCBinaryData query_zone;
256  /*
257  * The time at which the DNS response message was sent or received,
258  * depending on whether this is an AUTH_RESPONSE, RESOLVER_RESPONSE, or
259  * CLIENT_RESPONSE.
260  * This is the number of seconds since the UNIX epoch.
261  */
262  protobuf_c_boolean has_response_time_sec;
263  uint64_t response_time_sec;
264  /*
265  * The time at which the DNS response message was sent or received.
266  * This is the seconds fraction, expressed as a count of nanoseconds.
267  */
268  protobuf_c_boolean has_response_time_nsec;
269  uint32_t response_time_nsec;
270  /*
271  * The responder's original wire-format DNS response message, verbatim.
272  */
273  protobuf_c_boolean has_response_message;
274  ProtobufCBinaryData response_message;
275 };
276 #define DNSTAP__MESSAGE__INIT \
277  { PROTOBUF_C_MESSAGE_INIT (&dnstap__message__descriptor) \
278  , DNSTAP__MESSAGE__TYPE__AUTH_QUERY, 0, DNSTAP__SOCKET_FAMILY__INET, 0, DNSTAP__SOCKET_PROTOCOL__UDP, 0, {0,NULL}, 0, {0,NULL}, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0,NULL}, 0, {0,NULL}, 0, 0, 0, 0, 0, {0,NULL} }
279 
280 
281 /* Dnstap__Dnstap methods */
282 void dnstap__dnstap__init
283  (Dnstap__Dnstap *message);
284 size_t dnstap__dnstap__get_packed_size
285  (const Dnstap__Dnstap *message);
286 size_t dnstap__dnstap__pack
287  (const Dnstap__Dnstap *message,
288  uint8_t *out);
289 size_t dnstap__dnstap__pack_to_buffer
290  (const Dnstap__Dnstap *message,
291  ProtobufCBuffer *buffer);
292 Dnstap__Dnstap *
293  dnstap__dnstap__unpack
294  (ProtobufCAllocator *allocator,
295  size_t len,
296  const uint8_t *data);
297 void dnstap__dnstap__free_unpacked
298  (Dnstap__Dnstap *message,
299  ProtobufCAllocator *allocator);
300 /* Dnstap__Message methods */
301 void dnstap__message__init
302  (Dnstap__Message *message);
303 size_t dnstap__message__get_packed_size
304  (const Dnstap__Message *message);
305 size_t dnstap__message__pack
306  (const Dnstap__Message *message,
307  uint8_t *out);
308 size_t dnstap__message__pack_to_buffer
309  (const Dnstap__Message *message,
310  ProtobufCBuffer *buffer);
311 Dnstap__Message *
312  dnstap__message__unpack
313  (ProtobufCAllocator *allocator,
314  size_t len,
315  const uint8_t *data);
316 void dnstap__message__free_unpacked
317  (Dnstap__Message *message,
318  ProtobufCAllocator *allocator);
319 /* --- per-message closures --- */
320 
321 typedef void (*Dnstap__Dnstap_Closure)
322  (const Dnstap__Dnstap *message,
323  void *closure_data);
324 typedef void (*Dnstap__Message_Closure)
325  (const Dnstap__Message *message,
326  void *closure_data);
327 
328 /* --- services --- */
329 
330 
331 /* --- descriptors --- */
332 
333 extern const ProtobufCEnumDescriptor dnstap__socket_family__descriptor;
334 extern const ProtobufCEnumDescriptor dnstap__socket_protocol__descriptor;
335 extern const ProtobufCMessageDescriptor dnstap__dnstap__descriptor;
336 extern const ProtobufCEnumDescriptor dnstap__dnstap__type__descriptor;
337 extern const ProtobufCMessageDescriptor dnstap__message__descriptor;
338 extern const ProtobufCEnumDescriptor dnstap__message__type__descriptor;
339 
340 PROTOBUF_C__END_DECLS
341 
342 
343 #endif /* PROTOBUF_C_nmsg_2fbase_2fdnstap_2eproto__INCLUDED */