GNUnet  0.20.0
gnunet-service-core_typemap.h
Go to the documentation of this file.
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 
26 #ifndef GNUNET_SERVICE_CORE_TYPEMAP_H
27 #define GNUNET_SERVICE_CORE_TYPEMAP_H
28 
29 #include "gnunet_util_lib.h"
31 
35 struct GSC_TypeMap;
36 
37 
44 void
45 GSC_TYPEMAP_add (const uint16_t *types,
46  unsigned int tlen);
47 
48 
55 void
56 GSC_TYPEMAP_remove (const uint16_t *types,
57  unsigned int tlen);
58 
59 
65 struct GNUNET_MessageHeader *
67 
68 
75 int
76 GSC_TYPEMAP_check_hash (const struct GNUNET_HashCode *hc);
77 
78 
85 void
86 GSC_TYPEMAP_hash (const struct GSC_TypeMap *tm,
87  struct GNUNET_HashCode *hc);
88 
89 
98 struct GSC_TypeMap *
100 
101 
111 int
112 GSC_TYPEMAP_test_match (const struct GSC_TypeMap *tmap,
113  const uint16_t *types,
114  unsigned int tcnt);
115 
116 
125 struct GSC_TypeMap *
126 GSC_TYPEMAP_extend (const struct GSC_TypeMap *tmap,
127  const uint16_t *types,
128  unsigned int tcnt);
129 
130 
136 struct GSC_TypeMap *
137 GSC_TYPEMAP_create (void);
138 
139 
145 void
146 GSC_TYPEMAP_destroy (struct GSC_TypeMap *tmap);
147 
148 
152 void
153 GSC_TYPEMAP_init (void);
154 
155 
159 void
160 GSC_TYPEMAP_done (void);
161 
162 #endif
163 /* end of gnunet-service-core_typemap.h */
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
void GSC_TYPEMAP_init(void)
Initialize typemap subsystem.
struct GSC_TypeMap * GSC_TYPEMAP_create(void)
Create an empty type map.
void GSC_TYPEMAP_destroy(struct GSC_TypeMap *tmap)
Free the given type map.
struct GSC_TypeMap * GSC_TYPEMAP_extend(const struct GSC_TypeMap *tmap, const uint16_t *types, unsigned int tcnt)
Add additional types to a given typemap.
struct GNUNET_MessageHeader * GSC_TYPEMAP_compute_type_map_message(void)
Compute a type map message for this peer.
struct GSC_TypeMap * GSC_TYPEMAP_get_from_message(const struct GNUNET_MessageHeader *msg)
Extract a type map from a #GNUNET_MESSAGE_TYPE_CORE_COMRESSED_TYPE_MAP or GNUNET_MESSAGE_TYPE_CORE_BI...
int GSC_TYPEMAP_check_hash(const struct GNUNET_HashCode *hc)
Check if the given hash matches our current type map.
int GSC_TYPEMAP_test_match(const struct GSC_TypeMap *tmap, const uint16_t *types, unsigned int tcnt)
Test if any of the types from the types array is in the given type map.
void GSC_TYPEMAP_done(void)
Shutdown typemap subsystem.
void GSC_TYPEMAP_add(const uint16_t *types, unsigned int tlen)
Add a set of types to our type map.
void GSC_TYPEMAP_hash(const struct GSC_TypeMap *tm, struct GNUNET_HashCode *hc)
Hash the contents of a type map.
void GSC_TYPEMAP_remove(const uint16_t *types, unsigned int tlen)
Remove a set of message types from our type map.
A 512-bit hashcode.
Header for all communications.
A type map describing which messages a given neighbour is able to process.