diff options
Diffstat (limited to 'src/credential/credential_serialization.h')
-rw-r--r-- | src/credential/credential_serialization.h | 112 |
1 files changed, 55 insertions, 57 deletions
diff --git a/src/credential/credential_serialization.h b/src/credential/credential_serialization.h index 12988354b..0e106caa1 100644 --- a/src/credential/credential_serialization.h +++ b/src/credential/credential_serialization.h | |||
@@ -42,8 +42,9 @@ | |||
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 ( |
46 | const struct GNUNET_CREDENTIAL_DelegationSet *dsr); | 46 | unsigned int ds_count, |
47 | const struct GNUNET_CREDENTIAL_DelegationSet *dsr); | ||
47 | 48 | ||
48 | /** | 49 | /** |
49 | * Serizalize the given delegation record entries | 50 | * Serizalize the given delegation record entries |
@@ -55,10 +56,11 @@ GNUNET_CREDENTIAL_delegation_set_get_size (unsigned int ds_count, | |||
55 | * @return the size of the data, -1 on failure | 56 | * @return the size of the data, -1 on failure |
56 | */ | 57 | */ |
57 | ssize_t | 58 | ssize_t |
58 | GNUNET_CREDENTIAL_delegation_set_serialize (unsigned int d_count, | 59 | GNUNET_CREDENTIAL_delegation_set_serialize ( |
59 | const struct GNUNET_CREDENTIAL_DelegationSet *dsr, | 60 | unsigned int d_count, |
60 | size_t dest_size, | 61 | const struct GNUNET_CREDENTIAL_DelegationSet *dsr, |
61 | char *dest); | 62 | size_t dest_size, |
63 | char *dest); | ||
62 | 64 | ||
63 | 65 | ||
64 | /** | 66 | /** |
@@ -71,48 +73,51 @@ GNUNET_CREDENTIAL_delegation_set_serialize (unsigned int d_count, | |||
71 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 73 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
72 | */ | 74 | */ |
73 | int | 75 | int |
74 | GNUNET_CREDENTIAL_delegation_set_deserialize (size_t len, | 76 | GNUNET_CREDENTIAL_delegation_set_deserialize ( |
75 | const char *src, | 77 | size_t len, |
76 | unsigned int d_count, | 78 | const char *src, |
77 | struct GNUNET_CREDENTIAL_DelegationSet *dsr); | 79 | unsigned int d_count, |
80 | struct GNUNET_CREDENTIAL_DelegationSet *dsr); | ||
78 | 81 | ||
79 | /** | 82 | /** |
80 | * Calculate how many bytes we will need to serialize | 83 | * Calculate how many bytes we will need to serialize |
81 | * the given delegation chain and credential | 84 | * the given delegation chain and credential |
82 | * | 85 | * |
83 | * @param d_count number of delegation chain entries | 86 | * @param d_count number of delegation chain entries |
84 | * @param dd array of #GNUNET_CREDENTIAL_Delegation | 87 | * @param dd array of #GNUNET_CREDENTIAL_Delegation |
85 | * @param c_count number of credential entries | 88 | * @param c_count number of credential entries |
86 | * @param cd a #GNUNET_CREDENTIAL_Credential | 89 | * @param cd a #GNUNET_CREDENTIAL_Delegate |
87 | * @return the required size to serialize | 90 | * @return the required size to serialize |
88 | */ | 91 | */ |
89 | size_t | 92 | size_t |
90 | GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int d_count, | 93 | GNUNET_CREDENTIAL_delegation_chain_get_size ( |
91 | const struct GNUNET_CREDENTIAL_Delegation *dd, | 94 | unsigned int d_count, |
92 | unsigned int c_count, | 95 | const struct GNUNET_CREDENTIAL_Delegation *dd, |
93 | const struct GNUNET_CREDENTIAL_Delegate *cd); | 96 | unsigned int c_count, |
97 | const struct GNUNET_CREDENTIAL_Delegate *cd); | ||
94 | 98 | ||
95 | /** | 99 | /** |
96 | * Serizalize the given delegation chain entries and credential | 100 | * Serizalize the given delegation chain entries and credential |
97 | * | 101 | * |
98 | * @param d_count number of delegation chain entries | 102 | * @param d_count number of delegation chain entries |
99 | * @param dd array of #GNUNET_CREDENTIAL_Delegation | 103 | * @param dd array of #GNUNET_CREDENTIAL_Delegation |
100 | * @param c_count number of credential entries | 104 | * @param c_count number of credential entries |
101 | * @param cd a #GNUNET_CREDENTIAL_Credential | 105 | * @param cd a #GNUNET_CREDENTIAL_Delegate |
102 | * @param dest_size size of the destination | 106 | * @param dest_size size of the destination |
103 | * @param dest where to store the result | 107 | * @param dest where to store the result |
104 | * @return the size of the data, -1 on failure | 108 | * @return the size of the data, -1 on failure |
105 | */ | 109 | */ |
106 | ssize_t | 110 | ssize_t |
107 | GNUNET_CREDENTIAL_delegation_chain_serialize (unsigned int d_count, | 111 | GNUNET_CREDENTIAL_delegation_chain_serialize ( |
108 | const struct GNUNET_CREDENTIAL_Delegation *dd, | 112 | unsigned int d_count, |
109 | unsigned int c_count, | 113 | const struct GNUNET_CREDENTIAL_Delegation *dd, |
110 | const struct GNUNET_CREDENTIAL_Delegate *cd, | 114 | unsigned int c_count, |
111 | size_t dest_size, | 115 | const struct GNUNET_CREDENTIAL_Delegate *cd, |
112 | char *dest); | 116 | size_t dest_size, |
117 | char *dest); | ||
113 | 118 | ||
114 | 119 | ||
115 | /** | 120 | /** |
116 | * Deserialize the given destination | 121 | * Deserialize the given destination |
117 | * | 122 | * |
118 | * @param len size of the serialized delegation chain and cred | 123 | * @param len size of the serialized delegation chain and cred |
@@ -123,45 +128,38 @@ GNUNET_CREDENTIAL_delegation_set_deserialize (size_t len, | |||
123 | * @param cd where to put the credential data | 128 | * @param cd where to put the credential data |
124 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 129 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
125 | */ | 130 | */ |
126 | int | 131 | int |
127 | GNUNET_CREDENTIAL_delegation_chain_deserialize (size_t len, | 132 | GNUNET_CREDENTIAL_delegation_chain_deserialize ( |
128 | const char *src, | 133 | size_t len, |
129 | unsigned int d_count, | 134 | const char *src, |
130 | struct GNUNET_CREDENTIAL_Delegation *dd, | 135 | unsigned int d_count, |
131 | unsigned int c_count, | 136 | struct GNUNET_CREDENTIAL_Delegation *dd, |
132 | struct GNUNET_CREDENTIAL_Delegate *cd); | 137 | unsigned int c_count, |
133 | size_t | 138 | struct GNUNET_CREDENTIAL_Delegate *cd); |
134 | GNUNET_CREDENTIAL_delegates_get_size (unsigned int c_count, | 139 | size_t |
135 | const struct GNUNET_CREDENTIAL_Delegate *cd); | 140 | GNUNET_CREDENTIAL_delegates_get_size ( |
141 | unsigned int c_count, | ||
142 | const struct GNUNET_CREDENTIAL_Delegate *cd); | ||
136 | 143 | ||
137 | ssize_t | 144 | ssize_t |
138 | GNUNET_CREDENTIAL_delegates_serialize (unsigned int c_count, | 145 | GNUNET_CREDENTIAL_delegates_serialize ( |
139 | const struct GNUNET_CREDENTIAL_Delegate *cd, | 146 | unsigned int c_count, |
140 | size_t dest_size, | 147 | const struct GNUNET_CREDENTIAL_Delegate *cd, |
141 | char *dest); | 148 | size_t dest_size, |
149 | char *dest); | ||
142 | 150 | ||
143 | 151 | ||
144 | int | 152 | int |
145 | GNUNET_CREDENTIAL_delegates_deserialize (size_t len, | 153 | GNUNET_CREDENTIAL_delegates_deserialize (size_t len, |
146 | const char *src, | 154 | const char *src, |
147 | unsigned int c_count, | 155 | unsigned int c_count, |
148 | struct GNUNET_CREDENTIAL_Delegate *cd); | 156 | struct GNUNET_CREDENTIAL_Delegate *cd); |
149 | |||
150 | |||
151 | int | ||
152 | GNUNET_CREDENTIAL_credential_serialize (struct GNUNET_CREDENTIAL_Credential *cred, | ||
153 | char **data); | ||
154 | |||
155 | struct GNUNET_CREDENTIAL_Credential* | ||
156 | GNUNET_CREDENTIAL_credential_deserialize (const char* data, | ||
157 | size_t data_size); | ||
158 | 157 | ||
159 | int | 158 | int |
160 | GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *cred, | 159 | GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *cred, |
161 | char **data); | 160 | char **data); |
162 | 161 | ||
163 | struct GNUNET_CREDENTIAL_Delegate* | 162 | struct GNUNET_CREDENTIAL_Delegate * |
164 | GNUNET_CREDENTIAL_delegate_deserialize (const char* data, | 163 | GNUNET_CREDENTIAL_delegate_deserialize (const char *data, size_t data_size); |
165 | size_t data_size); | ||
166 | #endif | 164 | #endif |
167 | /* end of credential_serialization.h */ | 165 | /* end of credential_serialization.h */ |