1 /*
2  * Copyright (c) 2008-2020, OARC, Inc.
3  * Copyright (c) 2007-2008, Internet Systems Consortium, Inc.
4  * Copyright (c) 2003-2007, The Measurement Factory, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in
16  *    the documentation and/or other materials provided with the
17  *    distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its
20  *    contributors may be used to endorse or promote products derived
21  *    from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37 #ifndef __dsc_response_time_index_h
38 #define __dsc_response_time_index_h
39 
40 #include "dns_message.h"
41 
42 enum response_time_mode {
43     response_time_bucket,
44     response_time_log10,
45     response_time_log2
46 };
47 
48 enum response_time_max_sec_mode {
49     response_time_ceil,
50     response_time_timed_out
51 };
52 
53 enum response_time_full_mode {
54     response_time_drop_oldest,
55     response_time_drop_query
56 };
57 
58 void response_time_set_mode(enum response_time_mode m);
59 void response_time_set_max_sec(time_t s);
60 void response_time_set_max_sec_mode(enum response_time_max_sec_mode m);
61 void response_time_set_bucket_size(unsigned int s);
62 void response_time_set_max_queries(size_t q);
63 void response_time_set_full_mode(enum response_time_full_mode m);
64 
65 int                response_time_indexer(const dns_message*);
66 int                response_time_iterator(const char** label);
67 void               response_time_reset(void);
68 const dns_message* response_time_flush(enum flush_mode mode);
69 
70 #endif /* __dsc_response_time_index_h */
71