X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fidentity%2Fidentity_api.c;h=30a6fb23d9998e2081da42fdf72b766f34e53e85;hb=341c1dd692c62a88eeff34fca155ce2377677d4b;hp=4c8a35dc2053938b18da464186fa0d0b13ddfbfb;hpb=d8c53b12a818ff7cf82d06a1a69c395bdef85ee6;p=oweals%2Fgnunet.git diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 4c8a35dc2..30a6fb23d 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2013, 2016 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public Liceidentity as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public Liceidentity for more details. - - You should have received a copy of the GNU General Public Liceidentity - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . */ /** @@ -304,7 +302,7 @@ mq_error_handler (void *cls, */ static int check_identity_result_code (void *cls, - const struct GNUNET_IDENTITY_ResultCodeMessage *rcm) + const struct ResultCodeMessage *rcm) { uint16_t size = ntohs (rcm->header.size) - sizeof (*rcm); const char *str = (const char *) &rcm[1]; @@ -328,7 +326,7 @@ check_identity_result_code (void *cls, */ static void handle_identity_result_code (void *cls, - const struct GNUNET_IDENTITY_ResultCodeMessage *rcm) + const struct ResultCodeMessage *rcm) { struct GNUNET_IDENTITY_Handle *h = cls; struct GNUNET_IDENTITY_Operation *op; @@ -363,13 +361,13 @@ handle_identity_result_code (void *cls, */ static int check_identity_update (void *cls, - const struct GNUNET_IDENTITY_UpdateMessage *um) + const struct UpdateMessage *um) { uint16_t size = ntohs (um->header.size); uint16_t name_len = ntohs (um->name_len); const char *str = (const char *) &um[1]; - if ( (size != name_len + sizeof (struct GNUNET_IDENTITY_UpdateMessage)) || + if ( (size != name_len + sizeof (struct UpdateMessage)) || ( (0 != name_len) && ('\0' != str[name_len - 1])) ) { @@ -388,7 +386,7 @@ check_identity_update (void *cls, */ static void handle_identity_update (void *cls, - const struct GNUNET_IDENTITY_UpdateMessage *um) + const struct UpdateMessage *um) { struct GNUNET_IDENTITY_Handle *h = cls; uint16_t name_len = ntohs (um->name_len); @@ -475,7 +473,7 @@ handle_identity_update (void *cls, */ static int check_identity_set_default (void *cls, - const struct GNUNET_IDENTITY_SetDefaultMessage *sdm) + const struct SetDefaultMessage *sdm) { uint16_t size = ntohs (sdm->header.size) - sizeof (*sdm); uint16_t name_len = ntohs (sdm->name_len); @@ -502,7 +500,7 @@ check_identity_set_default (void *cls, */ static void handle_identity_set_default (void *cls, - const struct GNUNET_IDENTITY_SetDefaultMessage *sdm) + const struct SetDefaultMessage *sdm) { struct GNUNET_IDENTITY_Handle *h = cls; struct GNUNET_IDENTITY_Operation *op; @@ -552,20 +550,20 @@ handle_identity_set_default (void *cls, static void reconnect (void *cls) { - GNUNET_MQ_hd_var_size (identity_result_code, - GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, - struct GNUNET_IDENTITY_ResultCodeMessage); - GNUNET_MQ_hd_var_size (identity_update, - GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, - struct GNUNET_IDENTITY_UpdateMessage); - GNUNET_MQ_hd_var_size (identity_set_default, - GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, - struct GNUNET_IDENTITY_SetDefaultMessage); struct GNUNET_IDENTITY_Handle *h = cls; struct GNUNET_MQ_MessageHandler handlers[] = { - make_identity_result_code_handler (h), - make_identity_update_handler (h), - make_identity_set_default_handler (h), + GNUNET_MQ_hd_var_size (identity_result_code, + GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE, + struct ResultCodeMessage, + h), + GNUNET_MQ_hd_var_size (identity_update, + GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE, + struct UpdateMessage, + h), + GNUNET_MQ_hd_var_size (identity_set_default, + GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, + struct SetDefaultMessage, + h), GNUNET_MQ_handler_end () }; struct GNUNET_MQ_Envelope *env; @@ -575,7 +573,7 @@ reconnect (void *cls) LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to identity service.\n"); GNUNET_assert (NULL == h->mq); - h->mq = GNUNET_CLIENT_connecT (h->cfg, + h->mq = GNUNET_CLIENT_connect (h->cfg, "identity", handlers, &mq_error_handler, @@ -665,13 +663,13 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h, { struct GNUNET_IDENTITY_Operation *op; struct GNUNET_MQ_Envelope *env; - struct GNUNET_IDENTITY_GetDefaultMessage *gdm; + struct GetDefaultMessage *gdm; size_t slen; if (NULL == h->mq) return NULL; slen = strlen (service_name) + 1; - if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_GetDefaultMessage)) + if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct GetDefaultMessage)) { GNUNET_break (0); return NULL; @@ -716,13 +714,13 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h, { struct GNUNET_IDENTITY_Operation *op; struct GNUNET_MQ_Envelope *env; - struct GNUNET_IDENTITY_SetDefaultMessage *sdm; + struct SetDefaultMessage *sdm; size_t slen; if (NULL == h->mq) return NULL; slen = strlen (service_name) + 1; - if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_SetDefaultMessage)) + if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct SetDefaultMessage)) { GNUNET_break (0); return NULL; @@ -766,14 +764,14 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, { struct GNUNET_IDENTITY_Operation *op; struct GNUNET_MQ_Envelope *env; - struct GNUNET_IDENTITY_CreateRequestMessage *crm; + struct CreateRequestMessage *crm; struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; size_t slen; if (NULL == h->mq) return NULL; slen = strlen (name) + 1; - if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_CreateRequestMessage)) + if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct CreateRequestMessage)) { GNUNET_break (0); return NULL; @@ -821,7 +819,7 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h, { struct GNUNET_IDENTITY_Operation *op; struct GNUNET_MQ_Envelope *env; - struct GNUNET_IDENTITY_RenameMessage *grm; + struct RenameMessage *grm; size_t slen_old; size_t slen_new; char *dst; @@ -830,9 +828,9 @@ GNUNET_IDENTITY_rename (struct GNUNET_IDENTITY_Handle *h, return NULL; slen_old = strlen (old_name) + 1; slen_new = strlen (new_name) + 1; - if ( (slen_old >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || - (slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || - (slen_old + slen_new >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_RenameMessage)) ) + if ( (slen_old >= GNUNET_MAX_MESSAGE_SIZE) || + (slen_new >= GNUNET_MAX_MESSAGE_SIZE) || + (slen_old + slen_new >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct RenameMessage)) ) { GNUNET_break (0); return NULL; @@ -879,13 +877,13 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *h, { struct GNUNET_IDENTITY_Operation *op; struct GNUNET_MQ_Envelope *env; - struct GNUNET_IDENTITY_DeleteMessage *gdm; + struct DeleteMessage *gdm; size_t slen; if (NULL == h->mq) return NULL; slen = strlen (name) + 1; - if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_DeleteMessage)) + if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct DeleteMessage)) { GNUNET_break (0); return NULL;