aboutsummaryrefslogtreecommitdiff
path: root/src/core/gnunet-service-core_typemap.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/gnunet-service-core_typemap.h')
-rw-r--r--src/core/gnunet-service-core_typemap.h163
1 files changed, 0 insertions, 163 deletions
diff --git a/src/core/gnunet-service-core_typemap.h b/src/core/gnunet-service-core_typemap.h
deleted file mode 100644
index 7acdec53b..000000000
--- a/src/core/gnunet-service-core_typemap.h
+++ /dev/null
@@ -1,163 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2011 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
21/**
22 * @file core/gnunet-service-core_typemap.h
23 * @brief management of map that specifies which message types this peer supports
24 * @author Christian Grothoff
25 */
26#ifndef GNUNET_SERVICE_CORE_TYPEMAP_H
27#define GNUNET_SERVICE_CORE_TYPEMAP_H
28
29#include "gnunet_util_lib.h"
30#include "gnunet_transport_service.h"
31
32/**
33 * Map specifying which message types a peer supports.
34 */
35struct GSC_TypeMap;
36
37
38/**
39 * Add a set of types to our type map.
40 *
41 * @param types array of message types supported by this peer
42 * @param tlen number of entries in @a types
43 */
44void
45GSC_TYPEMAP_add (const uint16_t *types,
46 unsigned int tlen);
47
48
49/**
50 * Remove a set of message types from our type map.
51 *
52 * @param types array of message types no longer supported by this peer
53 * @param tlen number of entries in @a types
54 */
55void
56GSC_TYPEMAP_remove (const uint16_t *types,
57 unsigned int tlen);
58
59
60/**
61 * Compute a type map message for this peer.
62 *
63 * @return this peers current type map message.
64 */
65struct GNUNET_MessageHeader *
66GSC_TYPEMAP_compute_type_map_message (void);
67
68
69/**
70 * Check if the given hash matches our current type map.
71 *
72 * @param hc hash code to check if it matches our type map
73 * @return #GNUNET_YES if the hash matches, #GNUNET_NO if not
74 */
75int
76GSC_TYPEMAP_check_hash (const struct GNUNET_HashCode *hc);
77
78
79/**
80 * Hash the contents of a type map.
81 *
82 * @param tm map to hash
83 * @param hc where to store the hash code
84 */
85void
86GSC_TYPEMAP_hash (const struct GSC_TypeMap *tm,
87 struct GNUNET_HashCode *hc);
88
89
90/**
91 * Extract a type map from a
92 * #GNUNET_MESSAGE_TYPE_CORE_COMRESSED_TYPE_MAP or
93 * #GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP message.
94 *
95 * @param msg a type map message
96 * @return NULL on error
97 */
98struct GSC_TypeMap *
99GSC_TYPEMAP_get_from_message (const struct GNUNET_MessageHeader *msg);
100
101
102/**
103 * Test if any of the types from the types array is in the
104 * given type map.
105 *
106 * @param tmap map to test
107 * @param types array of types
108 * @param tcnt number of entries in @a types
109 * @return #GNUNET_YES if a type is in the map, #GNUNET_NO if not
110 */
111int
112GSC_TYPEMAP_test_match (const struct GSC_TypeMap *tmap,
113 const uint16_t *types,
114 unsigned int tcnt);
115
116
117/**
118 * Add additional types to a given typemap.
119 *
120 * @param tmap map to extend (not changed)
121 * @param types array of types to add
122 * @param tcnt number of entries in @a types
123 * @return updated type map (fresh copy)
124 */
125struct GSC_TypeMap *
126GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap,
127 const uint16_t *types,
128 unsigned int tcnt);
129
130
131/**
132 * Create an empty type map.
133 *
134 * @return an empty type map
135 */
136struct GSC_TypeMap *
137GSC_TYPEMAP_create (void);
138
139
140/**
141 * Free the given type map.
142 *
143 * @param tmap a type map
144 */
145void
146GSC_TYPEMAP_destroy (struct GSC_TypeMap *tmap);
147
148
149/**
150 * Initialize typemap subsystem.
151 */
152void
153GSC_TYPEMAP_init (void);
154
155
156/**
157 * Shutdown typemap subsystem.
158 */
159void
160GSC_TYPEMAP_done (void);
161
162#endif
163/* end of gnunet-service-core_typemap.h */