diff options
Diffstat (limited to 'src/credential/credential_serialization.h')
-rw-r--r-- | src/credential/credential_serialization.h | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/src/credential/credential_serialization.h b/src/credential/credential_serialization.h index 90ec0f56f..426034164 100644 --- a/src/credential/credential_serialization.h +++ b/src/credential/credential_serialization.h | |||
@@ -11,17 +11,17 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 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/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | 21 | ||
22 | /** | 22 | /** |
23 | * @file credential/credential_serialization.h | 23 | * @file credential/credential_serialization.h |
24 | * @brief API to serialize and deserialize delegation chains | 24 | * @brief API to serialize and deserialize delegation chains |
25 | * and credentials | 25 | * and credentials |
26 | * @author Martin Schanzenbach | 26 | * @author Martin Schanzenbach |
27 | */ | 27 | */ |
@@ -42,8 +42,8 @@ | |||
42 | * @return the required size to serialize | 42 | * @return the required size to serialize |
43 | */ | 43 | */ |
44 | size_t | 44 | size_t |
45 | GNUNET_CREDENTIAL_delegation_set_get_size (unsigned int ds_count, | 45 | GNUNET_CREDENTIAL_delegation_set_get_size(unsigned int ds_count, |
46 | const struct GNUNET_CREDENTIAL_DelegationSet *dsr); | 46 | const struct GNUNET_CREDENTIAL_DelegationSet *dsr); |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Serizalize the given delegation record entries | 49 | * Serizalize the given delegation record entries |
@@ -55,10 +55,10 @@ GNUNET_CREDENTIAL_delegation_set_get_size (unsigned int ds_count, | |||
55 | * @return the size of the data, -1 on failure | 55 | * @return the size of the data, -1 on failure |
56 | */ | 56 | */ |
57 | ssize_t | 57 | ssize_t |
58 | GNUNET_CREDENTIAL_delegation_set_serialize (unsigned int d_count, | 58 | GNUNET_CREDENTIAL_delegation_set_serialize(unsigned int d_count, |
59 | const struct GNUNET_CREDENTIAL_DelegationSet *dsr, | 59 | const struct GNUNET_CREDENTIAL_DelegationSet *dsr, |
60 | size_t dest_size, | 60 | size_t dest_size, |
61 | char *dest); | 61 | char *dest); |
62 | 62 | ||
63 | 63 | ||
64 | /** | 64 | /** |
@@ -71,89 +71,89 @@ GNUNET_CREDENTIAL_delegation_set_serialize (unsigned int d_count, | |||
71 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 71 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
72 | */ | 72 | */ |
73 | int | 73 | int |
74 | GNUNET_CREDENTIAL_delegation_set_deserialize (size_t len, | 74 | GNUNET_CREDENTIAL_delegation_set_deserialize(size_t len, |
75 | const char *src, | 75 | const char *src, |
76 | unsigned int d_count, | 76 | unsigned int d_count, |
77 | struct GNUNET_CREDENTIAL_DelegationSet *dsr); | 77 | struct GNUNET_CREDENTIAL_DelegationSet *dsr); |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Calculate how many bytes we will need to serialize | 80 | * Calculate how many bytes we will need to serialize |
81 | * the given delegation chain and credential | 81 | * the given delegation chain and credential |
82 | * | 82 | * |
83 | * @param d_count number of delegation chain entries | 83 | * @param d_count number of delegation chain entries |
84 | * @param dd array of #GNUNET_CREDENTIAL_Delegation | 84 | * @param dd array of #GNUNET_CREDENTIAL_Delegation |
85 | * @param c_count number of credential entries | 85 | * @param c_count number of credential entries |
86 | * @param cd a #GNUNET_CREDENTIAL_Credential | 86 | * @param cd a #GNUNET_CREDENTIAL_Credential |
87 | * @return the required size to serialize | 87 | * @return the required size to serialize |
88 | */ | 88 | */ |
89 | size_t | 89 | size_t |
90 | GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int d_count, | 90 | GNUNET_CREDENTIAL_delegation_chain_get_size(unsigned int d_count, |
91 | const struct GNUNET_CREDENTIAL_Delegation *dd, | 91 | const struct GNUNET_CREDENTIAL_Delegation *dd, |
92 | unsigned int c_count, | 92 | unsigned int c_count, |
93 | const struct GNUNET_CREDENTIAL_Credential *cd); | 93 | const struct GNUNET_CREDENTIAL_Credential *cd); |
94 | 94 | ||
95 | /** | 95 | /** |
96 | * Serizalize the given delegation chain entries and credential | 96 | * Serizalize the given delegation chain entries and credential |
97 | * | 97 | * |
98 | * @param d_count number of delegation chain entries | 98 | * @param d_count number of delegation chain entries |
99 | * @param dd array of #GNUNET_CREDENTIAL_Delegation | 99 | * @param dd array of #GNUNET_CREDENTIAL_Delegation |
100 | * @param c_count number of credential entries | 100 | * @param c_count number of credential entries |
101 | * @param cd a #GNUNET_CREDENTIAL_Credential | 101 | * @param cd a #GNUNET_CREDENTIAL_Credential |
102 | * @param dest_size size of the destination | 102 | * @param dest_size size of the destination |
103 | * @param dest where to store the result | 103 | * @param dest where to store the result |
104 | * @return the size of the data, -1 on failure | 104 | * @return the size of the data, -1 on failure |
105 | */ | 105 | */ |
106 | ssize_t | 106 | ssize_t |
107 | GNUNET_CREDENTIAL_delegation_chain_serialize (unsigned int d_count, | 107 | GNUNET_CREDENTIAL_delegation_chain_serialize(unsigned int d_count, |
108 | const struct GNUNET_CREDENTIAL_Delegation *dd, | 108 | const struct GNUNET_CREDENTIAL_Delegation *dd, |
109 | unsigned int c_count, | 109 | unsigned int c_count, |
110 | const struct GNUNET_CREDENTIAL_Credential *cd, | 110 | const struct GNUNET_CREDENTIAL_Credential *cd, |
111 | size_t dest_size, | 111 | size_t dest_size, |
112 | char *dest); | 112 | char *dest); |
113 | 113 | ||
114 | 114 | ||
115 | /** | 115 | /** |
116 | * Deserialize the given destination | 116 | * Deserialize the given destination |
117 | * | 117 | * |
118 | * @param len size of the serialized delegation chain and cred | 118 | * @param len size of the serialized delegation chain and cred |
119 | * @param src the serialized data | 119 | * @param src the serialized data |
120 | * @param d_count the number of delegation chain entries | 120 | * @param d_count the number of delegation chain entries |
121 | * @param dd where to put the delegation chain entries | 121 | * @param dd where to put the delegation chain entries |
122 | * @param c_count number of credential entries | 122 | * @param c_count number of credential entries |
123 | * @param cd where to put the credential data | 123 | * @param cd where to put the credential data |
124 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 124 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
125 | */ | 125 | */ |
126 | int | 126 | int |
127 | GNUNET_CREDENTIAL_delegation_chain_deserialize (size_t len, | 127 | GNUNET_CREDENTIAL_delegation_chain_deserialize(size_t len, |
128 | const char *src, | 128 | const char *src, |
129 | unsigned int d_count, | 129 | unsigned int d_count, |
130 | struct GNUNET_CREDENTIAL_Delegation *dd, | 130 | struct GNUNET_CREDENTIAL_Delegation *dd, |
131 | unsigned int c_count, | 131 | unsigned int c_count, |
132 | struct GNUNET_CREDENTIAL_Credential *cd); | 132 | struct GNUNET_CREDENTIAL_Credential *cd); |
133 | size_t | 133 | size_t |
134 | GNUNET_CREDENTIAL_credentials_get_size (unsigned int c_count, | 134 | GNUNET_CREDENTIAL_credentials_get_size(unsigned int c_count, |
135 | const struct GNUNET_CREDENTIAL_Credential *cd); | 135 | const struct GNUNET_CREDENTIAL_Credential *cd); |
136 | 136 | ||
137 | ssize_t | 137 | ssize_t |
138 | GNUNET_CREDENTIAL_credentials_serialize (unsigned int c_count, | 138 | GNUNET_CREDENTIAL_credentials_serialize(unsigned int c_count, |
139 | const struct GNUNET_CREDENTIAL_Credential *cd, | 139 | const struct GNUNET_CREDENTIAL_Credential *cd, |
140 | size_t dest_size, | 140 | size_t dest_size, |
141 | char *dest); | 141 | char *dest); |
142 | 142 | ||
143 | 143 | ||
144 | int | 144 | int |
145 | GNUNET_CREDENTIAL_credentials_deserialize (size_t len, | 145 | GNUNET_CREDENTIAL_credentials_deserialize(size_t len, |
146 | const char *src, | 146 | const char *src, |
147 | unsigned int c_count, | 147 | unsigned int c_count, |
148 | struct GNUNET_CREDENTIAL_Credential *cd); | 148 | struct GNUNET_CREDENTIAL_Credential *cd); |
149 | 149 | ||
150 | 150 | ||
151 | int | 151 | int |
152 | GNUNET_CREDENTIAL_credential_serialize (struct GNUNET_CREDENTIAL_Credential *cred, | 152 | GNUNET_CREDENTIAL_credential_serialize(struct GNUNET_CREDENTIAL_Credential *cred, |
153 | char **data); | 153 | char **data); |
154 | 154 | ||
155 | struct GNUNET_CREDENTIAL_Credential* | 155 | struct GNUNET_CREDENTIAL_Credential* |
156 | GNUNET_CREDENTIAL_credential_deserialize (const char* data, | 156 | GNUNET_CREDENTIAL_credential_deserialize(const char* data, |
157 | size_t data_size); | 157 | size_t data_size); |
158 | #endif | 158 | #endif |
159 | /* end of credential_serialization.h */ | 159 | /* end of credential_serialization.h */ |