GNUnet 0.22.2
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#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
43#error "Only <gnunet_util_lib.h> can be included directly."
44#endif
45
46#ifndef GNUNET_MST_LIB_H
47#define GNUNET_MST_LIB_H
48
49#ifdef __cplusplus
50extern "C"
51{
52#if 0 /* keep Emacsens' auto-indent happy */
53}
54#endif
55#endif
56
57
62
63
77typedef int
79 const struct GNUNET_MessageHeader *message);
80
81
91 void *cb_cls);
92
93
110 const char *buf,
111 size_t size,
112 int purge,
113 int one_shot);
114
115
132 struct GNUNET_NETWORK_Handle *sock,
133 int purge,
134 int one_shot);
135
136
150 int one_shot);
151
152
158void
160
161
162#if 0 /* keep Emacsens' auto-indent happy */
163{
164#endif
165#ifdef __cplusplus
166}
167#endif
168
169#endif
170 /* end of group server */
172 /* end of group addition to networking */
174 /* end of group addition to libgnunetutil*/
176
177/* end of gnunet_mst_lib.h */
GNUNET_GenericReturnValue
Named constants for return values.
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.
enum GNUNET_GenericReturnValue 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:387
enum GNUNET_GenericReturnValue 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:101
struct GNUNET_MessageStreamTokenizer * GNUNET_MST_create(GNUNET_MessageTokenizerCallback cb, void *cb_cls)
Create a message stream tokenizer.
Definition: mst.c:86
void GNUNET_MST_destroy(struct GNUNET_MessageStreamTokenizer *mst)
Destroys a tokenizer.
Definition: mst.c:404
enum GNUNET_GenericReturnValue 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:338
static unsigned int size
Size of the "table".
Definition: peer.c:68
Header for all communications.
Handle to a message stream tokenizer.
Definition: mst.c:45
void * cb_cls
Closure for cb.
Definition: mst.c:54
GNUNET_MessageTokenizerCallback cb
Function to call on completed messages.
Definition: mst.c:49
handle to a socket
Definition: network.c:53