GNUnet  0.17.6
gnunet_mst_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2009-2013, 2016 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  */
20 
42 #ifndef GNUNET_MST_LIB_H
43 #define GNUNET_MST_LIB_H
44 
45 #ifdef __cplusplus
46 extern "C"
47 {
48 #if 0 /* keep Emacsens' auto-indent happy */
49 }
50 #endif
51 #endif
52 
53 #include "gnunet_common.h"
54 
55 
60 
61 
75 typedef int
77  const struct GNUNET_MessageHeader *message);
78 
79 
89  void *cb_cls);
90 
91 
106 int
108  const char *buf,
109  size_t size,
110  int purge,
111  int one_shot);
112 
113 
128 int
130  struct GNUNET_NETWORK_Handle *sock,
131  int purge,
132  int one_shot);
133 
134 
146 int
148  int one_shot);
149 
150 
156 void
158 
159 
160 #if 0 /* keep Emacsens' auto-indent happy */
161 {
162 #endif
163 #ifdef __cplusplus
164 }
165 #endif
166 
167 #endif
168  /* end of group server */
170  /* end of group addition */
172 
173 /* end of gnunet_mst_lib.h */
static char buf[2048]
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
int GNUNET_MST_next(struct GNUNET_MessageStreamTokenizer *mst, int one_shot)
Obtain the next message from the mst, assuming that there are more unprocessed messages in the intern...
Definition: mst.c:401
int GNUNET_MST_read(struct GNUNET_MessageStreamTokenizer *mst, struct GNUNET_NETWORK_Handle *sock, int purge, int one_shot)
Add incoming data to the receive buffer and call the callback for all complete messages.
Definition: mst.c:352
int(* GNUNET_MessageTokenizerCallback)(void *cls, const struct GNUNET_MessageHeader *message)
Functions with this signature are called whenever a complete message is received by the tokenizer.
void GNUNET_MST_destroy(struct GNUNET_MessageStreamTokenizer *mst)
Destroys a tokenizer.
Definition: mst.c:418
struct GNUNET_MessageStreamTokenizer * GNUNET_MST_create(GNUNET_MessageTokenizerCallback cb, void *cb_cls)
Create a message stream tokenizer.
Definition: mst.c:85
int GNUNET_MST_from_buffer(struct GNUNET_MessageStreamTokenizer *mst, const char *buf, size_t size, int purge, int one_shot)
Add incoming data to the receive buffer and call the callback for all complete messages.
Definition: mst.c:114
static unsigned int size
Size of the "table".
Definition: peer.c:67
Header for all communications.
Handle to a message stream tokenizer.
Definition: mst.c:44
void * cb_cls
Closure for cb.
Definition: mst.c:53
GNUNET_MessageTokenizerCallback cb
Function to call on completed messages.
Definition: mst.c:48
handle to a socket
Definition: network.c:53