GNUnet  0.20.0
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  */
37 #ifndef GNUNET_FRAGMENTATION_LIB_H
38 #define GNUNET_FRAGMENTATION_LIB_H
39 
40 
41 #include "gnunet_util_lib.h"
43 
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #if 0 /* keep Emacsens' auto-indent happy */
48 }
49 #endif
50 #endif
51 
52 
57 
58 
68 typedef void
70  const struct GNUNET_MessageHeader *msg);
71 
72 
95  uint16_t mtu,
99  const struct GNUNET_MessageHeader *msg,
101  void *proc_cls);
102 
103 
111 void
113 
114 
126 int
128  const struct GNUNET_MessageHeader *msg);
129 
130 
141 void
145 
146 
153 const char *
155 
156 
161 
162 
173 typedef void
175  uint32_t id,
176  const struct GNUNET_MessageHeader *msg);
177 
178 
194  uint16_t mtu,
195  unsigned int num_msgs,
196  void *cls,
199 
200 
206 void
208 
209 
219 int
221  const struct GNUNET_MessageHeader *msg);
222 
223 
224 #if 0 /* keep Emacsens' auto-indent happy */
225 {
226 #endif
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif
232  /* end of group */
234  /* end of group addition */
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
static struct GNUNET_FS_DownloadContext * dc
struct GNUNET_STATISTICS_Handle * stats
Handle to the statistics service.
API to create, modify and access statistics.
const char * GNUNET_FRAGMENT_print_ack(const struct GNUNET_MessageHeader *ack)
Convert an ACK message to a printable format suitable for logging.
int GNUNET_DEFRAGMENT_process_fragment(struct GNUNET_DEFRAGMENT_Context *dc, const struct GNUNET_MessageHeader *msg)
We have received a fragment.
void GNUNET_FRAGMENT_context_transmission_done(struct GNUNET_FRAGMENT_Context *fc)
Continuation to call from the 'proc' function after the fragment has been transmitted (and hence the ...
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).
void GNUNET_DEFRAGMENT_context_destroy(struct GNUNET_DEFRAGMENT_Context *dc)
Destroy the given defragmentation context.
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.
void(* GNUNET_FRAGMENT_MessageProcessor)(void *cls, const struct GNUNET_MessageHeader *msg)
Function that is called with messages created by the fragmentation module.
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.
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 'proc', free resources).
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.
Defragmentation context (one per connection).
uint16_t mtu
Maximum message size for each fragment.
GNUNET_DEFRAGMENT_AckProcessor ackp
Function to call with acknowledgements.
GNUNET_FRAGMENT_MessageProcessor proc
Function to call with defragmented messages.
unsigned int num_msgs
num_msgs how many fragmented messages to we defragment at most at the same time?
void * cls
Closure for proc and ackp.
Fragmentation context.
Definition: fragmentation.c:41
struct GNUNET_TIME_Relative ack_delay
Current expected delay for ACKs.
Definition: fragmentation.c:55
GNUNET_FRAGMENT_MessageProcessor proc
Function to call for transmissions.
Definition: fragmentation.c:80
struct GNUNET_TIME_Relative msg_delay
Current expected delay between messages.
Definition: fragmentation.c:60
void * proc_cls
Closure for proc.
Definition: fragmentation.c:85
uint16_t mtu
Target fragment size.
struct GNUNET_BANDWIDTH_Tracker * tracker
Tracker for flow control.
Definition: fragmentation.c:50
Header for all communications.
Handle for the service.
Time for relative time used by GNUnet, in microseconds.