- Remove deprecated code, coverity 10236
[oweals/gnunet.git] / src / mesh / mesh_block_lib.h
1 /*
2      This file is part of GNUnet.
3      (C) 2012 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 3, or (at your
8      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      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @author Bartlomiej Polot
23  * @file mesh/mesh_block_lib.h
24  */
25
26 #ifndef MESH_BLOCK_LIB_H_
27 #define MESH_BLOCK_LIB_H_
28
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #if 0
33   /* keep Emacsens' auto-indent happy */
34 }
35 #endif
36 #endif
37
38 #include "platform.h"
39 #include "block_mesh.h"
40
41 /**
42  * Check if the regex block is well formed, including all edges
43  *
44  * @param block The start of the block.
45  * @param size The size of the block.
46  *
47  * @return GNUNET_OK in case it's fine, GNUNET_SYSERR otherwise.
48  */
49 int
50 GNUNET_MESH_regex_block_check (const struct MeshRegexBlock *block,
51                                size_t size);
52
53 /**
54  * Iterator over edges in a block.
55  *
56  * @param cls Closure.
57  * @param token Token that follows to next state.
58  * @param len Lenght of token.
59  * @param key Hash of next state.
60  *
61  * @return GNUNET_YES if should keep iterating, GNUNET_NO otherwise.
62  */
63 typedef int (*GNUNET_MESH_EgdeIterator)(void *cls,
64                                         const char *token,
65                                         size_t len,
66                                         const struct GNUNET_HashCode *key);
67
68
69 /**
70  * Iterate over all edges of a block of a regex state.
71  *
72  * @param block Block to iterate over.
73  * @param size Size of block.
74  * @param iterator Function to call on each edge in the block.
75  * @param iter_cls Closure for the iterator.
76  *
77  * @return GNUNET_SYSERR if an error has been encountered, GNUNET_OK otherwise
78  */
79 int
80 GNUNET_MESH_regex_block_iterate (const struct MeshRegexBlock *block,
81                                  size_t size,
82                                  GNUNET_MESH_EgdeIterator iterator,
83                                  void *iter_cls);
84
85 #if 0                           /* keep Emacsens' auto-indent happy */
86 {
87 #endif
88 #ifdef __cplusplus
89 }
90 #endif
91
92 /* ifndef MESH_BLOCK_LIB_H */
93 #endif
94 /* end of mesh_block_lib.h */