summaryrefslogtreecommitdiff
path: root/src/credential/credential_serialization.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/credential/credential_serialization.h')
-rw-r--r--src/credential/credential_serialization.h112
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 */
44size_t 44size_t
45GNUNET_CREDENTIAL_delegation_set_get_size (unsigned int ds_count, 45GNUNET_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 */
57ssize_t 58ssize_t
58GNUNET_CREDENTIAL_delegation_set_serialize (unsigned int d_count, 59GNUNET_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 */
73int 75int
74GNUNET_CREDENTIAL_delegation_set_deserialize (size_t len, 76GNUNET_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 92size_t
90 GNUNET_CREDENTIAL_delegation_chain_get_size (unsigned int d_count, 93GNUNET_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 110ssize_t
107 GNUNET_CREDENTIAL_delegation_chain_serialize (unsigned int d_count, 111GNUNET_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 131int
127 GNUNET_CREDENTIAL_delegation_chain_deserialize (size_t len, 132GNUNET_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, 139size_t
135 const struct GNUNET_CREDENTIAL_Delegate *cd); 140GNUNET_CREDENTIAL_delegates_get_size (
141 unsigned int c_count,
142 const struct GNUNET_CREDENTIAL_Delegate *cd);
136 143
137ssize_t 144ssize_t
138GNUNET_CREDENTIAL_delegates_serialize (unsigned int c_count, 145GNUNET_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
144int 152int
145GNUNET_CREDENTIAL_delegates_deserialize (size_t len, 153GNUNET_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
151int
152GNUNET_CREDENTIAL_credential_serialize (struct GNUNET_CREDENTIAL_Credential *cred,
153 char **data);
154
155struct GNUNET_CREDENTIAL_Credential*
156GNUNET_CREDENTIAL_credential_deserialize (const char* data,
157 size_t data_size);
158 157
159int 158int
160GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *cred, 159GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *cred,
161 char **data); 160 char **data);
162 161
163struct GNUNET_CREDENTIAL_Delegate* 162struct GNUNET_CREDENTIAL_Delegate *
164GNUNET_CREDENTIAL_delegate_deserialize (const char* data, 163GNUNET_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 */