xref: /netbsd-src/external/bsd/ntp/dist/sntp/tests/sntptest.h (revision 413d532bcc3f62d122e56d92e13ac64825a40baf)
1 /*	$NetBSD: sntptest.h,v 1.1.1.1 2013/12/27 23:31:33 christos Exp $	*/
2 
3 #ifndef SNTPTEST_H
4 #define SNTPTEST_H
5 
6 #include "tests_main.h"
7 
8 extern "C" {
9 #include "ntp_stdlib.h"
10 #include "sntp-opts.h"
11 };
12 
13 class sntptest : public ntptest {
14 protected:
15 	sntptest() {
16 		optionSaveState(&sntpOptions);
17 	}
18 
19 	~sntptest() {
20 		optionRestore(&sntpOptions);
21 	}
22 
23 	void ActivateOption(const char* option, const char* argument) {
24 		const int ARGV_SIZE = 4;
25 
26 		char* opts[ARGV_SIZE];
27 
28 		opts[0] = estrdup("sntpopts");
29 		opts[1] = estrdup(option);
30 		opts[2] = estrdup(argument);
31 		opts[3] = estrdup("127.0.0.1");
32 
33 		optionProcess(&sntpOptions, ARGV_SIZE, opts);
34 	}
35 };
36 
37 #endif // SNTPTEST_H
38