aboutsummaryrefslogtreecommitdiff
path: root/src/util/server_tc.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-01-22 15:52:40 +0000
committerChristian Grothoff <christian@grothoff.org>2010-01-22 15:52:40 +0000
commit48436941449d867ef9a32ddf29439c5017d37775 (patch)
treea34b1230ba7e4d2e9deea743dcfdb283f7f7b605 /src/util/server_tc.c
parent87487477c67697355c79d2fe079d23a5b31c7ab6 (diff)
downloadgnunet-48436941449d867ef9a32ddf29439c5017d37775.tar.gz
gnunet-48436941449d867ef9a32ddf29439c5017d37775.zip
stuff
Diffstat (limited to 'src/util/server_tc.c')
-rw-r--r--src/util/server_tc.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/util/server_tc.c b/src/util/server_tc.c
index bffb892b1..7514b0cd3 100644
--- a/src/util/server_tc.c
+++ b/src/util/server_tc.c
@@ -149,9 +149,9 @@ GNUNET_SERVER_transmit_context_create (struct GNUNET_SERVER_Client *client)
149 * @param type type of the message 149 * @param type type of the message
150 */ 150 */
151void 151void
152GNUNET_SERVER_transmit_context_append (struct GNUNET_SERVER_TransmitContext 152GNUNET_SERVER_transmit_context_append_data (struct GNUNET_SERVER_TransmitContext
153 *tc, const void *data, size_t length, 153 *tc, const void *data, size_t length,
154 uint16_t type) 154 uint16_t type)
155{ 155{
156 struct GNUNET_MessageHeader *msg; 156 struct GNUNET_MessageHeader *msg;
157 size_t size; 157 size_t size;
@@ -169,6 +169,29 @@ GNUNET_SERVER_transmit_context_append (struct GNUNET_SERVER_TransmitContext
169 169
170 170
171/** 171/**
172 * Append a message to the transmission context.
173 * All messages in the context will be sent by
174 * the transmit_context_run method.
175 *
176 * @param tc context to use
177 * @param msg message to append
178 */
179void
180GNUNET_SERVER_transmit_context_append_message(struct GNUNET_SERVER_TransmitContext
181 *tc, const struct GNUNET_MessageHeader *msg)
182{
183 struct GNUNET_MessageHeader *m;
184 uint16_t size;
185
186 size = ntohs (msg->size);
187 tc->buf = GNUNET_realloc (tc->buf, tc->total + size);
188 m = (struct GNUNET_MessageHeader *) &tc->buf[tc->total];
189 tc->total += size;
190 memcpy (m, msg, size);
191}
192
193
194/**
172 * Execute a transmission context. If there is 195 * Execute a transmission context. If there is
173 * an error in the transmission, the receive_done 196 * an error in the transmission, the receive_done
174 * method will be called with an error code (GNUNET_SYSERR), 197 * method will be called with an error code (GNUNET_SYSERR),