1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
7 */
8
9#ifndef _SEEN_UTILS_H
10#define _SEEN_UTILS_H 1
11
12#include <time.h> /* time_t */
13
14#define PROPLENGTH 64 /* Max number of properties */
15
16enum valtype {
17 INVALID = 0,
18 INT,
19 BOOLEAN,
20 STR,
21 MURI,
22 OTHER
23};
24
25typedef struct _confkeyval {
26 char *key;
27 char *val;
28 int ival;
29 enum valtype type;
30} confkeyval;
31
32void readConfFile(confkeyval *list, FILE *cnf);
33void readConfFileFull(confkeyval *list, FILE *cnf);
34void freeConfFile(confkeyval *list);
35int defaultProperty(const char *key);
36confkeyval *findConfKey(confkeyval *list, const char *key);
37char *getConfVal(confkeyval *list, const char *key);
38int getConfNum(confkeyval *list, const char *key);
39char *setConfVal(confkeyval *ckv, const char *val);
40char *setConfValForKey(confkeyval *list, const char *key, const char *val);
41void secondsToString(char *buf, time_t t, int longness);
42void abbreviateString(char *ret, const char *in, size_t width);
43void generateSalt(char *buf, unsigned int len);
44char *generatePassphraseFile(const char *path);
45void sleep_ms(size_t ms);
46
47#endif
48
49/* vim:set ts=4 sw=4 noexpandtab: */
50