migrated rps to new cadet api
[oweals/gnunet.git] / src / rps / rps-test_util.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18      Boston, MA 02110-1301, USA.
19 */
20
21 /**
22  * @file rps/rps-test_util.h
23  * @brief Some utils faciliating the view into the internals for the sampler
24  *        needed for evaluation
25  * @author Julius Bünger
26  */
27
28 #ifndef RPS_TEST_UTIL_H
29 #define RPS_TEST_UTIL_H
30
31 #ifndef TO_FILE
32 #define TO_FILE
33 #endif /* TO_FILE */
34
35
36 void
37 to_file_ (char *file_name, char *line);
38
39 char * 
40 auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key);
41
42 struct GNUNET_CRYPTO_AuthKey
43 string_to_auth_key (const char *str);
44
45 char * 
46 create_file (const char *name);
47
48 /**
49  * This function is used to facilitate writing important information to disk
50  */
51 #ifdef TO_FILE
52 #  define to_file(file_name, ...) do {char tmp_buf[512];\
53     int size;\
54     size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\
55     if (0 > size)\
56       LOG (GNUNET_ERROR_TYPE_WARNING,\
57            "Failed to create tmp_buf\n");\
58     else\
59       to_file_(file_name,tmp_buf);\
60   } while (0);
61 #else /* TO_FILE */
62 #  define to_file(file_name, ...)
63 #endif /* TO_FILE */
64
65 #endif /* RPS_TEST_UTIL_H */
66 /* end of gnunet-service-rps.c */