aboutsummaryrefslogtreecommitdiff
path: root/src/rps/rps-test_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/rps-test_util.c')
-rw-r--r--src/rps/rps-test_util.c65
1 files changed, 55 insertions, 10 deletions
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index 869170a8a..ea55deac5 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 3 Copyright (C)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
@@ -109,6 +107,53 @@ to_file_ (const char *file_name, char *line)
109 "Unable to close file\n"); 107 "Unable to close file\n");
110} 108}
111 109
110void
111to_file_raw (const char *file_name, void *buf, size_t size_buf)
112{
113 struct GNUNET_DISK_FileHandle *f;
114 size_t size2;
115
116
117 if (NULL == (f = GNUNET_DISK_file_open (file_name,
118 GNUNET_DISK_OPEN_APPEND |
119 GNUNET_DISK_OPEN_WRITE |
120 GNUNET_DISK_OPEN_CREATE,
121 GNUNET_DISK_PERM_USER_READ |
122 GNUNET_DISK_PERM_USER_WRITE |
123 GNUNET_DISK_PERM_GROUP_READ |
124 GNUNET_DISK_PERM_OTHER_READ)))
125 {
126 LOG (GNUNET_ERROR_TYPE_WARNING,
127 "Not able to open file %s\n",
128 file_name);
129 return;
130 }
131
132 size2 = GNUNET_DISK_file_write (f, buf, size_buf);
133 if (size_buf != size2)
134 {
135 LOG (GNUNET_ERROR_TYPE_WARNING,
136 "Unable to write to file! (Size: %u, size2: %u)\n",
137 size_buf,
138 size2);
139
140 if (GNUNET_YES != GNUNET_DISK_file_close (f))
141 LOG (GNUNET_ERROR_TYPE_WARNING,
142 "Unable to close file\n");
143
144 return;
145 }
146
147 //if (512 < size_buf)
148 //{
149 // GNUNET_free (output_buffer_p);
150 //}
151
152 //if (GNUNET_YES != GNUNET_DISK_file_close (f))
153 // LOG (GNUNET_ERROR_TYPE_WARNING,
154 // "Unable to close file\n");
155}
156
112char * 157char *
113auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key) 158auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key)
114{ 159{