diff options
Diffstat (limited to 'src/credential/credential_serialization.h')
-rw-r--r-- | src/credential/credential_serialization.h | 91 |
1 files changed, 67 insertions, 24 deletions
diff --git a/src/credential/credential_serialization.h b/src/credential/credential_serialization.h index 7e984ce0a..7f6d0dda9 100644 --- a/src/credential/credential_serialization.h +++ b/src/credential/credential_serialization.h | |||
@@ -32,50 +32,93 @@ | |||
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Calculate how many bytes we will need to serialize | 34 | * Calculate how many bytes we will need to serialize |
35 | * the given delegation chain and credential | 35 | * the given delegation record |
36 | * | 36 | * |
37 | * @param d_count number of delegation chain entries | 37 | * @param ds_count number of delegation chain entries |
38 | * @param dd array of #GNUNET_CREDENTIAL_Delegation | 38 | * @param dsr array of #GNUNET_CREDENTIAL_Delegation |
39 | * @param cd a #GNUNET_CREDENTIAL_Credential | ||
40 | * @return the required size to serialize | 39 | * @return the required size to serialize |
41 | */ | 40 | */ |
42 | size_t | 41 | size_t |
43 | GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int d_count, | 42 | GNUNET_CREDENTIAL_delegation_set_get_size (unsigned int ds_count, |
44 | const struct GNUNET_CREDENTIAL_Delegation *dd, | 43 | const struct GNUNET_CREDENTIAL_DelegationSetRecord *dsr); |
45 | const struct GNUNET_CREDENTIAL_Credential *cd); | ||
46 | 44 | ||
47 | /** | 45 | /** |
48 | * Serizalize the given delegation chain entries and credential | 46 | * Serizalize the given delegation record entries |
49 | * | 47 | * |
50 | * @param d_count number of delegation chain entries | 48 | * @param d_count number of delegation chain entries |
51 | * @param dd array of #GNUNET_CREDENTIAL_Delegation | 49 | * @param dsr array of #GNUNET_CREDENTIAL_Delegation |
52 | * @param cd a #GNUNET_CREDENTIAL_Credential | ||
53 | * @param dest_size size of the destination | 50 | * @param dest_size size of the destination |
54 | * @param dest where to store the result | 51 | * @param dest where to store the result |
55 | * @return the size of the data, -1 on failure | 52 | * @return the size of the data, -1 on failure |
56 | */ | 53 | */ |
57 | ssize_t | 54 | ssize_t |
58 | GNUNET_CREDENTIAL_delegation_chain_serialize (unsigned int d_count, | 55 | GNUNET_CREDENTIAL_delegation_set_serialize (unsigned int d_count, |
59 | const struct GNUNET_CREDENTIAL_Delegation *dd, | 56 | const struct GNUNET_CREDENTIAL_DelegationSetRecord *dsr, |
60 | const struct GNUNET_CREDENTIAL_Credential *cd, | 57 | size_t dest_size, |
61 | size_t dest_size, | 58 | char *dest); |
62 | char *dest); | ||
63 | 59 | ||
64 | 60 | ||
65 | /** | 61 | /** |
66 | * Deserialize the given destination | 62 | * Deserialize the given destination |
67 | * | 63 | * |
68 | * @param len size of the serialized delegation chain and cred | 64 | * @param len size of the serialized delegation recird |
69 | * @param src the serialized data | 65 | * @param src the serialized data |
70 | * @param d_count the number of delegation chain entries | 66 | * @param d_count the number of delegation chain entries |
71 | * @param dd where to put the delegation chain entries | 67 | * @param dsr where to put the delegation chain entries |
72 | * @param cd where to put the credential data | ||
73 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 68 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
74 | */ | 69 | */ |
75 | int | 70 | int |
76 | GNUNET_CREDENTIAL_delegation_chain_deserialize (size_t len, | 71 | GNUNET_CREDENTIAL_delegation_set_deserialize (size_t len, |
77 | const char *src, | 72 | const char *src, |
78 | unsigned int d_count, | 73 | unsigned int d_count, |
79 | struct GNUNET_CREDENTIAL_Delegation *dd, | 74 | struct GNUNET_CREDENTIAL_DelegationSetRecord *dsr); |
80 | struct GNUNET_CREDENTIAL_Credential *cd); | 75 | |
81 | /* end of credential_serialization.h */ | 76 | /** |
77 | * Calculate how many bytes we will need to serialize | ||
78 | * the given delegation chain and credential | ||
79 | * | ||
80 | * @param d_count number of delegation chain entries | ||
81 | * @param dd array of #GNUNET_CREDENTIAL_Delegation | ||
82 | * @param cd a #GNUNET_CREDENTIAL_Credential | ||
83 | * @return the required size to serialize | ||
84 | */ | ||
85 | size_t | ||
86 | GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int d_count, | ||
87 | const struct GNUNET_CREDENTIAL_Delegation *dd, | ||
88 | const struct GNUNET_CREDENTIAL_Credential *cd); | ||
89 | |||
90 | /** | ||
91 | * Serizalize the given delegation chain entries and credential | ||
92 | * | ||
93 | * @param d_count number of delegation chain entries | ||
94 | * @param dd array of #GNUNET_CREDENTIAL_Delegation | ||
95 | * @param cd a #GNUNET_CREDENTIAL_Credential | ||
96 | * @param dest_size size of the destination | ||
97 | * @param dest where to store the result | ||
98 | * @return the size of the data, -1 on failure | ||
99 | */ | ||
100 | ssize_t | ||
101 | GNUNET_CREDENTIAL_delegation_chain_serialize (unsigned int d_count, | ||
102 | const struct GNUNET_CREDENTIAL_Delegation *dd, | ||
103 | const struct GNUNET_CREDENTIAL_Credential *cd, | ||
104 | size_t dest_size, | ||
105 | char *dest); | ||
106 | |||
107 | |||
108 | /** | ||
109 | * Deserialize the given destination | ||
110 | * | ||
111 | * @param len size of the serialized delegation chain and cred | ||
112 | * @param src the serialized data | ||
113 | * @param d_count the number of delegation chain entries | ||
114 | * @param dd where to put the delegation chain entries | ||
115 | * @param cd where to put the credential data | ||
116 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | ||
117 | */ | ||
118 | int | ||
119 | GNUNET_CREDENTIAL_delegation_chain_deserialize (size_t len, | ||
120 | const char *src, | ||
121 | unsigned int d_count, | ||
122 | struct GNUNET_CREDENTIAL_Delegation *dd, | ||
123 | struct GNUNET_CREDENTIAL_Credential *cd); | ||
124 | /* end of credential_serialization.h */ | ||