GNUnet  0.10.x
gnunet_fragmentation_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2009, 2011, 2015 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your 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  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19 */
34 #ifndef GNUNET_FRAGMENTATION_LIB_H
35 #define GNUNET_FRAGMENTATION_LIB_H
36 
37 #include "gnunet_util_lib.h"
38 #include "gnunet_bandwidth_lib.h"
40 
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #if 0 /* keep Emacsens' auto-indent happy */
45 }
46 #endif
47 #endif
48 
49 
54 
55 
65 typedef void
67  const struct GNUNET_MessageHeader *msg);
68 
69 
92  uint16_t mtu,
96  const struct GNUNET_MessageHeader *msg,
98  void *proc_cls);
99 
100 
108 void
110 
111 
123 int
125  const struct GNUNET_MessageHeader *msg);
126 
127 
138 void
142 
143 
150 const char *
152 
153 
158 
159 
170 typedef void
172  uint32_t id,
173  const struct GNUNET_MessageHeader *msg);
174 
175 
191  uint16_t mtu,
192  unsigned int num_msgs,
193  void *cls,
196 
197 
203 void
205 
206 
216 int
218  const struct GNUNET_MessageHeader *msg);
219 
220 
221 
222 #if 0 /* keep Emacsens' auto-indent happy */
223 {
224 #endif
225 #ifdef __cplusplus
226 }
227 #endif
228 
229 #endif
230  /* end of group */
static struct GNUNET_STATISTICS_Handle * stats
Handle for statistics.
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
struct GNUNET_DEFRAGMENT_Context * GNUNET_DEFRAGMENT_context_create(struct GNUNET_STATISTICS_Handle *stats, uint16_t mtu, unsigned int num_msgs, void *cls, GNUNET_FRAGMENT_MessageProcessor proc, GNUNET_DEFRAGMENT_AckProcessor ackp)
Create a defragmentation context.
struct GNUNET_TIME_Relative msg_delay
Current expected delay between messages.
Definition: fragmentation.c:60
void(* GNUNET_FRAGMENT_MessageProcessor)(void *cls, const struct GNUNET_MessageHeader *msg)
Function that is called with messages created by the fragmentation module.
GNUNET_FRAGMENT_MessageProcessor proc
Function to call for transmissions.
Definition: fragmentation.c:80
struct GNUNET_FRAGMENT_Context * GNUNET_FRAGMENT_context_create(struct GNUNET_STATISTICS_Handle *stats, uint16_t mtu, struct GNUNET_BANDWIDTH_Tracker *tracker, struct GNUNET_TIME_Relative msg_delay, struct GNUNET_TIME_Relative ack_delay, const struct GNUNET_MessageHeader *msg, GNUNET_FRAGMENT_MessageProcessor proc, void *proc_cls)
Create a fragmentation context for the given message.
Struct to track available bandwidth.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
void * cls
Closure for proc and ackp.
Handle for the service.
const char * GNUNET_FRAGMENT_print_ack(const struct GNUNET_MessageHeader *ack)
Convert an ACK message to a printable format suitable for logging.
struct GNUNET_BANDWIDTH_Tracker * tracker
Tracker for flow control.
Definition: fragmentation.c:50
void * proc_cls
Closure for proc.
Definition: fragmentation.c:85
GNUNET_DEFRAGMENT_AckProcessor ackp
Function to call with acknowledgements.
void GNUNET_FRAGMENT_context_transmission_done(struct GNUNET_FRAGMENT_Context *fc)
Continuation to call from the &#39;proc&#39; function after the fragment has been transmitted (and hence the ...
uint16_t mtu
Target fragment size.
unsigned int num_msgs
num_msgs how many fragmented messages to we defragment at most at the same time?
Fragmentation context.
Definition: fragmentation.c:40
void GNUNET_DEFRAGMENT_context_destroy(struct GNUNET_DEFRAGMENT_Context *dc)
Destroy the given defragmentation context.
int GNUNET_FRAGMENT_process_ack(struct GNUNET_FRAGMENT_Context *fc, const struct GNUNET_MessageHeader *msg)
Process an acknowledgement message we got from the other side (to control re-transmits).
Defragmentation context (one per connection).
GNUNET_FRAGMENT_MessageProcessor proc
Function to call with defragmented messages.
Header for all communications.
int GNUNET_DEFRAGMENT_process_fragment(struct GNUNET_DEFRAGMENT_Context *dc, const struct GNUNET_MessageHeader *msg)
We have received a fragment.
struct GNUNET_TIME_Relative ack_delay
Current expected delay for ACKs.
Definition: fragmentation.c:55
uint16_t mtu
Maximum message size for each fragment.
void GNUNET_FRAGMENT_context_destroy(struct GNUNET_FRAGMENT_Context *fc, struct GNUNET_TIME_Relative *msg_delay, struct GNUNET_TIME_Relative *ack_delay)
Destroy the given fragmentation context (stop calling &#39;proc&#39;, free resources).
void(* GNUNET_DEFRAGMENT_AckProcessor)(void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg)
Function that is called with acknowledgement messages created by the fragmentation module...
static struct GNUNET_FS_DownloadContext * dc
Time for relative time used by GNUnet, in microseconds.