diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2017-09-15 18:53:10 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2017-09-15 18:53:10 +0200 |
commit | 9e6994a55e64aaf7b45fdad7277c27bf30e3c0f3 (patch) | |
tree | a214a625a9fcaeacf219f2a0072fe318b5462009 /src/include | |
parent | 41315cebe1d0a074445f28d915d7d038dea80465 (diff) | |
download | gnunet-9e6994a55e64aaf7b45fdad7277c27bf30e3c0f3.tar.gz gnunet-9e6994a55e64aaf7b45fdad7277c27bf30e3c0f3.zip |
- Add attribute store API to IdP service
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_identity_provider_service.h | 109 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 4 |
2 files changed, 101 insertions, 12 deletions
diff --git a/src/include/gnunet_identity_provider_service.h b/src/include/gnunet_identity_provider_service.h index ba727eb92..2349e7012 100644 --- a/src/include/gnunet_identity_provider_service.h +++ b/src/include/gnunet_identity_provider_service.h | |||
@@ -67,6 +67,53 @@ struct GNUNET_IDENTITY_PROVIDER_Ticket; | |||
67 | struct GNUNET_IDENTITY_PROVIDER_Operation; | 67 | struct GNUNET_IDENTITY_PROVIDER_Operation; |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Flags that can be set for an attribute. | ||
71 | */ | ||
72 | enum GNUNET_IDENTITY_PROVIDER_AttributeType | ||
73 | { | ||
74 | |||
75 | /** | ||
76 | * No value attribute. | ||
77 | */ | ||
78 | GNUNET_IDENTITY_PROVIDER_AT_NULL = 0, | ||
79 | |||
80 | /** | ||
81 | * String attribute. | ||
82 | */ | ||
83 | GNUNET_IDENTITY_PROVIDER_AT_STRING = 1, | ||
84 | |||
85 | }; | ||
86 | |||
87 | |||
88 | |||
89 | /** | ||
90 | * An attribute. | ||
91 | */ | ||
92 | struct GNUNET_IDENTITY_PROVIDER_Attribute | ||
93 | { | ||
94 | |||
95 | /** | ||
96 | * Binary value stored as attribute value. Note: "data" must never | ||
97 | * be individually 'malloc'ed, but instead always points into some | ||
98 | * existing data area. | ||
99 | */ | ||
100 | const void *data; | ||
101 | |||
102 | /** | ||
103 | * Number of bytes in @e data. | ||
104 | */ | ||
105 | size_t data_size; | ||
106 | |||
107 | /** | ||
108 | * Type of Attribute. | ||
109 | */ | ||
110 | uint32_t attribute_type; | ||
111 | |||
112 | }; | ||
113 | |||
114 | |||
115 | |||
116 | /** | ||
70 | * Method called when a token has been exchanged for a ticket. | 117 | * Method called when a token has been exchanged for a ticket. |
71 | * On success returns a token | 118 | * On success returns a token |
72 | * | 119 | * |
@@ -107,6 +154,44 @@ typedef void | |||
107 | struct GNUNET_IDENTITY_PROVIDER_Handle * | 154 | struct GNUNET_IDENTITY_PROVIDER_Handle * |
108 | GNUNET_IDENTITY_PROVIDER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); | 155 | GNUNET_IDENTITY_PROVIDER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); |
109 | 156 | ||
157 | /** | ||
158 | * Continuation called to notify client about result of the | ||
159 | * operation. | ||
160 | * | ||
161 | * @param cls closure | ||
162 | * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) | ||
163 | * #GNUNET_NO if content was already there or not found | ||
164 | * #GNUNET_YES (or other positive value) on success | ||
165 | * @param emsg NULL on success, otherwise an error message | ||
166 | */ | ||
167 | typedef void | ||
168 | (*GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus) (void *cls, | ||
169 | int32_t success, | ||
170 | const char *emsg); | ||
171 | |||
172 | |||
173 | /** | ||
174 | * Store an attribute. If the attribute is already present, | ||
175 | * it is replaced with the new attribute. | ||
176 | * | ||
177 | * @param h handle to the identity provider | ||
178 | * @param pkey private key of the identity | ||
179 | * @param name the attribute name | ||
180 | * @param value the attribute value | ||
181 | * @param cont continuation to call when done | ||
182 | * @param cont_cls closure for @a cont | ||
183 | * @return handle to abort the request | ||
184 | */ | ||
185 | struct GNUNET_IDENTITY_PROVIDER_Operation * | ||
186 | GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle *h, | ||
187 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | ||
188 | const char* name, | ||
189 | const struct GNUNET_IDENTITY_PROVIDER_Attribute *value, | ||
190 | GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cont, | ||
191 | void *cont_cls); | ||
192 | |||
193 | |||
194 | |||
110 | 195 | ||
111 | /** | 196 | /** |
112 | * Issue a token for a specific audience. | 197 | * Issue a token for a specific audience. |
@@ -123,14 +208,14 @@ GNUNET_IDENTITY_PROVIDER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
123 | */ | 208 | */ |
124 | struct GNUNET_IDENTITY_PROVIDER_Operation * | 209 | struct GNUNET_IDENTITY_PROVIDER_Operation * |
125 | GNUNET_IDENTITY_PROVIDER_issue_token (struct GNUNET_IDENTITY_PROVIDER_Handle *id, | 210 | GNUNET_IDENTITY_PROVIDER_issue_token (struct GNUNET_IDENTITY_PROVIDER_Handle *id, |
126 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss_key, | 211 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss_key, |
127 | const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | 212 | const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, |
128 | const char* scope, | 213 | const char* scope, |
129 | const char* vattr, | 214 | const char* vattr, |
130 | struct GNUNET_TIME_Absolute expiration, | 215 | struct GNUNET_TIME_Absolute expiration, |
131 | uint64_t nonce, | 216 | uint64_t nonce, |
132 | GNUNET_IDENTITY_PROVIDER_IssueCallback cb, | 217 | GNUNET_IDENTITY_PROVIDER_IssueCallback cb, |
133 | void *cb_cls); | 218 | void *cb_cls); |
134 | 219 | ||
135 | 220 | ||
136 | /** | 221 | /** |
@@ -146,10 +231,10 @@ GNUNET_IDENTITY_PROVIDER_issue_token (struct GNUNET_IDENTITY_PROVIDER_Handle *id | |||
146 | */ | 231 | */ |
147 | struct GNUNET_IDENTITY_PROVIDER_Operation * | 232 | struct GNUNET_IDENTITY_PROVIDER_Operation * |
148 | GNUNET_IDENTITY_PROVIDER_exchange_ticket (struct GNUNET_IDENTITY_PROVIDER_Handle *id, | 233 | GNUNET_IDENTITY_PROVIDER_exchange_ticket (struct GNUNET_IDENTITY_PROVIDER_Handle *id, |
149 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | 234 | const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, |
150 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *aud_privkey, | 235 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *aud_privkey, |
151 | GNUNET_IDENTITY_PROVIDER_ExchangeCallback cont, | 236 | GNUNET_IDENTITY_PROVIDER_ExchangeCallback cont, |
152 | void *cont_cls); | 237 | void *cont_cls); |
153 | 238 | ||
154 | 239 | ||
155 | /** | 240 | /** |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 455a8292b..5841bd4f8 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2628,6 +2628,10 @@ extern "C" | |||
2628 | 2628 | ||
2629 | #define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_EXCHANGE_RESULT 964 | 2629 | #define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_EXCHANGE_RESULT 964 |
2630 | 2630 | ||
2631 | #define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE 965 | ||
2632 | |||
2633 | #define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE_RESPONSE 966 | ||
2634 | |||
2631 | 2635 | ||
2632 | /************************************************** | 2636 | /************************************************** |
2633 | * | 2637 | * |