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