From 7ecc3a03a0670a1620c603502c9958b95e6dc1d0 Mon Sep 17 00:00:00 2001 From: TheJackiMonster Date: Mon, 27 Sep 2021 11:02:56 +0200 Subject: -indentation of parameters Signed-off-by: TheJackiMonster --- src/include/gnunet_messenger_service.h | 47 ++++--- src/messenger/gnunet-messenger.c | 21 ++- src/messenger/gnunet-service-messenger.c | 51 +++++--- src/messenger/gnunet-service-messenger_basement.c | 8 +- src/messenger/gnunet-service-messenger_basement.h | 8 +- src/messenger/gnunet-service-messenger_ego_store.c | 37 ++++-- src/messenger/gnunet-service-messenger_ego_store.h | 21 ++- src/messenger/gnunet-service-messenger_handle.c | 79 ++++++++---- src/messenger/gnunet-service-messenger_handle.h | 40 ++++-- .../gnunet-service-messenger_list_handles.c | 9 +- .../gnunet-service-messenger_list_handles.h | 9 +- .../gnunet-service-messenger_list_messages.c | 15 ++- .../gnunet-service-messenger_list_messages.h | 15 ++- src/messenger/gnunet-service-messenger_member.c | 61 ++++++--- src/messenger/gnunet-service-messenger_member.h | 28 ++-- .../gnunet-service-messenger_member_session.c | 26 ++-- .../gnunet-service-messenger_member_session.h | 12 +- .../gnunet-service-messenger_member_store.c | 44 +++++-- .../gnunet-service-messenger_member_store.h | 21 ++- .../gnunet-service-messenger_message_handle.c | 51 +++++--- .../gnunet-service-messenger_message_handle.h | 48 ++++--- .../gnunet-service-messenger_message_kind.c | 6 +- .../gnunet-service-messenger_message_kind.h | 6 +- .../gnunet-service-messenger_message_recv.c | 32 +++-- .../gnunet-service-messenger_message_recv.h | 18 ++- .../gnunet-service-messenger_message_send.c | 24 ++-- .../gnunet-service-messenger_message_send.h | 24 ++-- .../gnunet-service-messenger_message_state.c | 12 +- .../gnunet-service-messenger_message_state.h | 12 +- .../gnunet-service-messenger_message_store.c | 54 +++++--- .../gnunet-service-messenger_message_store.h | 21 ++- src/messenger/gnunet-service-messenger_operation.c | 6 +- src/messenger/gnunet-service-messenger_operation.h | 6 +- .../gnunet-service-messenger_operation_store.c | 20 ++- .../gnunet-service-messenger_operation_store.h | 3 +- src/messenger/gnunet-service-messenger_room.c | 142 ++++++++++++++------- src/messenger/gnunet-service-messenger_room.h | 55 +++++--- src/messenger/gnunet-service-messenger_service.c | 37 ++++-- src/messenger/gnunet-service-messenger_service.h | 33 +++-- src/messenger/gnunet-service-messenger_tunnel.c | 49 ++++--- src/messenger/gnunet-service-messenger_tunnel.h | 22 +++- src/messenger/messenger_api.c | 90 ++++++++----- src/messenger/messenger_api_contact.c | 6 +- src/messenger/messenger_api_contact.h | 6 +- src/messenger/messenger_api_contact_store.c | 22 +++- src/messenger/messenger_api_contact_store.h | 15 ++- src/messenger/messenger_api_handle.c | 29 +++-- src/messenger/messenger_api_handle.h | 25 ++-- src/messenger/messenger_api_list_tunnels.c | 22 +++- src/messenger/messenger_api_list_tunnels.h | 19 ++- src/messenger/messenger_api_message.c | 74 +++++++---- src/messenger/messenger_api_message.h | 37 ++++-- src/messenger/messenger_api_room.c | 75 +++++++---- src/messenger/messenger_api_room.h | 21 ++- src/messenger/messenger_api_util.c | 6 +- src/messenger/messenger_api_util.h | 6 +- src/messenger/test_messenger.c | 10 +- src/messenger/test_messenger_adapt.c | 3 +- src/messenger/test_messenger_anonymous.c | 10 +- src/messenger/test_messenger_async_client.c | 3 +- src/messenger/test_messenger_async_p2p.c | 3 +- src/messenger/test_messenger_growth.c | 3 +- src/messenger/test_messenger_ring.c | 3 +- src/messenger/test_messenger_server.c | 3 +- src/messenger/test_messenger_sync_client.c | 3 +- src/messenger/test_messenger_sync_p2p.c | 3 +- src/messenger/test_messenger_worst_client.c | 3 +- src/messenger/test_messenger_worst_p2p.c | 3 +- src/messenger/testing_messenger_barrier.c | 6 +- src/messenger/testing_messenger_setup.c | 41 ++++-- src/messenger/testing_messenger_setup.h | 3 +- 71 files changed, 1219 insertions(+), 567 deletions(-) diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h index 5d7155a3d..b54567aa7 100644 --- a/src/include/gnunet_messenger_service.h +++ b/src/include/gnunet_messenger_service.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - Copyright (C) 2020 GNUnet e.V. + Copyright (C) 2020--2021 GNUnet e.V. GNUnet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published @@ -527,7 +527,8 @@ enum GNUNET_MESSENGER_MessageFlags * @param[in/out] handle Messenger handle */ typedef void -(*GNUNET_MESSENGER_IdentityCallback) (void *cls, struct GNUNET_MESSENGER_Handle *handle); +(*GNUNET_MESSENGER_IdentityCallback) (void *cls, + struct GNUNET_MESSENGER_Handle *handle); /** * Method called whenever a message is sent or received from a room. @@ -543,7 +544,8 @@ typedef void * @param[in] flags Flags of the message */ typedef void -(*GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, +(*GNUNET_MESSENGER_MessageCallback) (void *cls, + struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, @@ -558,7 +560,8 @@ typedef void * @param[in] contact Contact handle */ typedef int -(*GNUNET_MESSENGER_MemberCallback) (void* cls, struct GNUNET_MESSENGER_Room *room, +(*GNUNET_MESSENGER_MemberCallback) (void* cls, + struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact); /** @@ -574,9 +577,12 @@ typedef int * @return Messenger handle to use, NULL on error */ struct GNUNET_MESSENGER_Handle* -GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, - GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, - GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls); +GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, + const char *name, + GNUNET_MESSENGER_IdentityCallback identity_callback, + void *identity_cls, + GNUNET_MESSENGER_MessageCallback msg_callback, + void *msg_cls); /** * Update a handle of the messenger to use a different ego key and replace the old one with a newly generated one. All @@ -619,7 +625,8 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle); * @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if handle is NULL */ int -GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); +GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, + const char *name); /** * Get the public key used by the messenger or NULL if the anonymous key was used. @@ -647,7 +654,8 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle); * @return Room handle, NULL on error */ struct GNUNET_MESSENGER_Room* -GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); +GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key); /** * Enter a room to send and receive messages through a door opened using #GNUNET_MESSENGER_open_room. @@ -668,7 +676,8 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct * @return Room handle, NULL on error */ struct GNUNET_MESSENGER_Room* -GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, +GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); /** @@ -695,8 +704,10 @@ GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room); * @return Amount of rooms iterated */ int -GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, - GNUNET_MESSENGER_MemberCallback callback, void *cls); +GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_MESSENGER_Contact *contact, + GNUNET_MESSENGER_MemberCallback callback, + void *cls); /** * Get the key of a given room. @@ -717,7 +728,8 @@ GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room); * @return Contact handle, NULL otherwise */ const struct GNUNET_MESSENGER_Contact* -GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); +GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_HashCode *hash); /** * Get the name used by the contact. @@ -756,7 +768,8 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact * @param[in] contact Contact or NULL */ void -GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, +GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_Contact* contact); /** @@ -767,7 +780,8 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct * @return Message struct or NULL if no message with that hash is known */ const struct GNUNET_MESSENGER_Message* -GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); +GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_HashCode *hash); /** * Iterates through all members of a given room and calls a selected callback @@ -780,7 +794,8 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const st * @return Amount of members iterated */ int -GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, +GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, + GNUNET_MESSENGER_MemberCallback callback, void* cls); #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/messenger/gnunet-messenger.c b/src/messenger/gnunet-messenger.c index 28fa4b147..e2d106be8 100644 --- a/src/messenger/gnunet-messenger.c +++ b/src/messenger/gnunet-messenger.c @@ -42,8 +42,11 @@ struct GNUNET_MESSENGER_Handle *messenger; * @param[in] flags Flags of message */ void -on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, +on_message (void *cls, + struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags) { const char *sender_name = GNUNET_MESSENGER_contact_get_name (sender); @@ -124,7 +127,8 @@ listen_stdio (void *cls); #define MAX_BUFFER_SIZE 60000 static int -iterate_send_private_message (void *cls, struct GNUNET_MESSENGER_Room *room, +iterate_send_private_message (void *cls, + struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact) { struct GNUNET_MESSENGER_Message *message = cls; @@ -226,7 +230,8 @@ struct GNUNET_SCHEDULER_Task *shutdown_task; * @param[in/out] handle Handle of messenger service */ static void -on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) +on_identity (void *cls, + struct GNUNET_MESSENGER_Handle *handle) { struct GNUNET_HashCode key; memset (&key, 0, sizeof(key)); @@ -292,7 +297,10 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) * @param[in] cfg configuration */ static void -run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) +run (void *cls, + char *const*args, + const char *cfgfile, + const struct GNUNET_CONFIGURATION_Handle *cfg) { messenger = GNUNET_MESSENGER_connect (cfg, ego_name, &on_identity, NULL, &on_message, NULL); @@ -307,7 +315,8 @@ run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFI * @return #EXIT_SUCCESS ok, #EXIT_FAILURE on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { const char *description = "Open and connect to rooms using the MESSENGER to chat."; diff --git a/src/messenger/gnunet-service-messenger.c b/src/messenger/gnunet-service-messenger.c index 7edd76d32..989157ceb 100644 --- a/src/messenger/gnunet-service-messenger.c +++ b/src/messenger/gnunet-service-messenger.c @@ -39,14 +39,16 @@ struct GNUNET_MESSENGER_Client struct GNUNET_MESSENGER_Service *messenger; static int -check_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) +check_create (void *cls, + const struct GNUNET_MESSENGER_CreateMessage *msg) { GNUNET_MQ_check_zero_termination(msg); return GNUNET_OK; } static void -handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) +handle_create (void *cls, + const struct GNUNET_MESSENGER_CreateMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -60,7 +62,8 @@ handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) } static void -handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg) +handle_update (void *cls, + const struct GNUNET_MESSENGER_UpdateMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -70,7 +73,8 @@ handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg) } static void -handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg) +handle_destroy (void *cls, + const struct GNUNET_MESSENGER_DestroyMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -78,14 +82,16 @@ handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg) } static int -check_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) +check_set_name (void *cls, + const struct GNUNET_MESSENGER_NameMessage *msg) { GNUNET_MQ_check_zero_termination(msg); return GNUNET_OK; } static void -handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) +handle_set_name (void *cls, + const struct GNUNET_MESSENGER_NameMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -99,7 +105,8 @@ handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) } static void -handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) +handle_room_open (void *cls, + const struct GNUNET_MESSENGER_RoomMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -125,7 +132,8 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) } static void -handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) +handle_room_entry (void *cls, + const struct GNUNET_MESSENGER_RoomMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -153,7 +161,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) } static void -handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) +handle_room_close (void *cls, + const struct GNUNET_MESSENGER_RoomMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -179,7 +188,8 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) } static int -check_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) +check_send_message (void *cls, + const struct GNUNET_MESSENGER_SendMessage *msg) { const uint16_t full_length = ntohs (msg->header.size); @@ -224,7 +234,8 @@ check_for_message: } static void -handle_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) +handle_send_message (void *cls, + const struct GNUNET_MESSENGER_SendMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -271,7 +282,8 @@ end_handling: } static void -callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, +callback_found_message (void *cls, + struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) { @@ -300,7 +312,8 @@ callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, } static void -handle_get_message (void *cls, const struct GNUNET_MESSENGER_GetMessage *msg) +handle_get_message (void *cls, + const struct GNUNET_MESSENGER_GetMessage *msg) { struct GNUNET_MESSENGER_Client *msg_client = cls; @@ -341,7 +354,9 @@ end_handling: } static void* -callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq) +callback_client_connect (void *cls, + struct GNUNET_SERVICE_Client *client, + struct GNUNET_MQ_Handle *mq) { struct GNUNET_MESSENGER_Client *msg_client = GNUNET_new(struct GNUNET_MESSENGER_Client); @@ -352,7 +367,9 @@ callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct } static void -callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls) +callback_client_disconnect (void *cls, + struct GNUNET_SERVICE_Client *client, + void *internal_cls) { struct GNUNET_MESSENGER_Client *msg_client = internal_cls; @@ -369,7 +386,9 @@ callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, voi * @param[in/out] service the initialized service */ static void -run (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service) +run (void *cls, + const struct GNUNET_CONFIGURATION_Handle *config, + struct GNUNET_SERVICE_Handle *service) { messenger = create_service (config, service); diff --git a/src/messenger/gnunet-service-messenger_basement.c b/src/messenger/gnunet-service-messenger_basement.c index f302c8d66..89aa103ee 100644 --- a/src/messenger/gnunet-service-messenger_basement.c +++ b/src/messenger/gnunet-service-messenger_basement.c @@ -40,7 +40,9 @@ count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels) } int -should_connect_tunnel_to (size_t count, size_t src, size_t dst) +should_connect_tunnel_to (size_t count, + size_t src, + size_t dst) { if ((src + 1) % count == dst % count) return GNUNET_YES; @@ -49,7 +51,9 @@ should_connect_tunnel_to (size_t count, size_t src, size_t dst) } int -required_connection_between (size_t count, size_t src, size_t dst) +required_connection_between (size_t count, + size_t src, + size_t dst) { if (GNUNET_YES == should_connect_tunnel_to (count, src, dst)) return GNUNET_YES; diff --git a/src/messenger/gnunet-service-messenger_basement.h b/src/messenger/gnunet-service-messenger_basement.h index b19aec405..a097b482f 100644 --- a/src/messenger/gnunet-service-messenger_basement.h +++ b/src/messenger/gnunet-service-messenger_basement.h @@ -48,7 +48,9 @@ count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels); * @return #GNUNET_YES or #GNUNET_NO based on topologic requirement */ int -should_connect_tunnel_to (size_t count, size_t src, size_t dst); +should_connect_tunnel_to (size_t count, + size_t src, + size_t dst); /** * Returns #GNUNET_YES or #GNUNET_NO to determine if the peers of index src and @@ -61,6 +63,8 @@ should_connect_tunnel_to (size_t count, size_t src, size_t dst); * @return #GNUNET_YES or #GNUNET_NO based on topologic requirement */ int -required_connection_between (size_t count, size_t src, size_t dst); +required_connection_between (size_t count, + size_t src, + size_t dst); #endif //GNUNET_SERVICE_MESSENGER_BASEMENT_H diff --git a/src/messenger/gnunet-service-messenger_ego_store.c b/src/messenger/gnunet-service-messenger_ego_store.c index 3b069fcf5..c460ac1c7 100644 --- a/src/messenger/gnunet-service-messenger_ego_store.c +++ b/src/messenger/gnunet-service-messenger_ego_store.c @@ -28,7 +28,10 @@ #include "gnunet-service-messenger_handle.h" static void -callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier) +callback_update_ego (void *cls, + struct GNUNET_IDENTITY_Ego *ego, + void **ctx, + const char *identifier) { if ((!ego) || (!identifier)) return; @@ -41,7 +44,8 @@ callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, con } void -init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config) +init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, + const struct GNUNET_CONFIGURATION_Handle *config) { GNUNET_assert ((store) && (config)); @@ -58,7 +62,9 @@ init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONF static int -iterate_destroy_egos (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_egos (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_Ego *ego = value; GNUNET_free(ego); @@ -112,7 +118,9 @@ clear_ego_store(struct GNUNET_MESSENGER_EgoStore *store) } static void -callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, const char *emsg) +callback_ego_create (void *cls, + const struct GNUNET_IDENTITY_PrivateKey *key, + const char *emsg) { struct GNUNET_MESSENGER_EgoOperation *element = cls; struct GNUNET_MESSENGER_EgoStore *store = element->store; @@ -139,7 +147,8 @@ callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, co } void -create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, +create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, + const char *identifier, void *handle) { GNUNET_assert ((store) && (identifier)); @@ -158,7 +167,8 @@ create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie } static void -callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego) +callback_ego_lookup (void *cls, + struct GNUNET_IDENTITY_Ego *ego) { struct GNUNET_MESSENGER_EgoLookup *element = cls; struct GNUNET_MESSENGER_EgoStore *store = element->store; @@ -183,8 +193,10 @@ callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego) } void -lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, - GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls) +lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, + const char *identifier, + GNUNET_MESSENGER_EgoLookupCallback lookup, + void *cls) { GNUNET_assert (store); @@ -219,7 +231,8 @@ lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier } struct GNUNET_MESSENGER_Ego* -update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, +update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, + const char *identifier, const struct GNUNET_IDENTITY_PrivateKey *key) { GNUNET_assert ((store) && (identifier) && (key)); @@ -244,7 +257,8 @@ update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier } static void -callback_ego_rename (void *cls, const char *emsg) +callback_ego_rename (void *cls, + const char *emsg) { struct GNUNET_MESSENGER_EgoOperation *element = cls; struct GNUNET_MESSENGER_EgoStore *store = element->store; @@ -277,7 +291,8 @@ callback_ego_rename (void *cls, const char *emsg) } void -rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, +rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, + const char *old_identifier, const char *new_identifier) { GNUNET_assert ((store) && (old_identifier) && (new_identifier)); diff --git a/src/messenger/gnunet-service-messenger_ego_store.h b/src/messenger/gnunet-service-messenger_ego_store.h index 41f14fff2..4222a4e91 100644 --- a/src/messenger/gnunet-service-messenger_ego_store.h +++ b/src/messenger/gnunet-service-messenger_ego_store.h @@ -35,7 +35,8 @@ struct GNUNET_MESSENGER_Ego; struct GNUNET_MESSENGER_EgoStore; typedef void -(*GNUNET_MESSENGER_EgoLookupCallback) (void *cls, const char *identifier, +(*GNUNET_MESSENGER_EgoLookupCallback) (void *cls, + const char *identifier, const struct GNUNET_MESSENGER_Ego *ego); struct GNUNET_MESSENGER_EgoLookup @@ -87,7 +88,8 @@ struct GNUNET_MESSENGER_EgoStore * @param[in] config Configuration handle */ void -init_ego_store (struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config); +init_ego_store (struct GNUNET_MESSENGER_EgoStore *store, + const struct GNUNET_CONFIGURATION_Handle *config); /** * Clears an EGO-store, wipes its content and deallocates its memory. @@ -107,7 +109,8 @@ clear_ego_store (struct GNUNET_MESSENGER_EgoStore *store); * @param[in/out] handle Handle or NULL */ void -create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, +create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, + const char *identifier, void *handle); /** @@ -120,8 +123,10 @@ create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie * @param[in] cls Closure */ void -lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, - GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls); +lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, + const char *identifier, + GNUNET_MESSENGER_EgoLookupCallback lookup, + void *cls); /** * Updates the registration of an EGO to a store under @@ -133,7 +138,8 @@ lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie * @return Updated EGO */ struct GNUNET_MESSENGER_Ego* -update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, +update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, + const char *identifier, const struct GNUNET_IDENTITY_PrivateKey *key); /** @@ -146,7 +152,8 @@ update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie * @param[in] new_identifier New identifier string */ void -rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, +rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, + const char *old_identifier, const char *new_identifier); #endif //GNUNET_SERVICE_MESSENGER_EGO_STORE_H diff --git a/src/messenger/gnunet-service-messenger_handle.c b/src/messenger/gnunet-service-messenger_handle.c index d7007dbf6..2095f8b29 100644 --- a/src/messenger/gnunet-service-messenger_handle.c +++ b/src/messenger/gnunet-service-messenger_handle.c @@ -31,7 +31,8 @@ #include "messenger_api_util.h" struct GNUNET_MESSENGER_SrvHandle* -create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) +create_handle (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MQ_Handle *mq) { GNUNET_assert((service) && (mq)); @@ -49,7 +50,9 @@ create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle } int -iterate_free_member_ids (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_free_member_ids (void *cls, + const struct GNUNET_HashCode *key, + void *value) { GNUNET_free(value); @@ -74,7 +77,9 @@ destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle) } void -get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir) +get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, + const char *name, + char **dir) { GNUNET_assert((handle) && (dir)); @@ -87,7 +92,8 @@ get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const c } static int -create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) +create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); @@ -112,7 +118,8 @@ create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const } const struct GNUNET_ShortHashCode* -get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) +get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); @@ -120,7 +127,8 @@ get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const str } int -change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, +change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *unique_id) { GNUNET_assert((handle) && (key) && (unique_id)); @@ -165,7 +173,8 @@ send_message_to_client: } static void -change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) +change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, + const char *name) { GNUNET_assert(handle); @@ -192,7 +201,8 @@ change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) } static void -change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego) +change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Ego *ego) { GNUNET_assert(handle); @@ -222,7 +232,9 @@ struct GNUNET_MESSENGER_MessageHandle }; static int -iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_send_message (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_MessageHandle *msg_handle = cls; @@ -232,7 +244,8 @@ iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value) } void -set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego) +set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Ego *ego) { GNUNET_assert((handle) && (ego)); @@ -271,7 +284,9 @@ get_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle) } static void -callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) +callback_setup_handle_name (void *cls, + const char *name, + const struct GNUNET_MESSENGER_Ego *ego) { struct GNUNET_MESSENGER_SrvHandle *handle = cls; @@ -285,7 +300,8 @@ callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MES } void -setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) +setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, + const char *name) { GNUNET_assert(handle); @@ -295,7 +311,9 @@ setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) } static void -callback_update_handle (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) +callback_update_handle (void *cls, + const char *name, + const struct GNUNET_MESSENGER_Ego *ego) { struct GNUNET_MESSENGER_SrvHandle *handle = cls; @@ -326,7 +344,9 @@ update_handle (struct GNUNET_MESSENGER_SrvHandle *handle) } static void -callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) +callback_set_handle_name (void *cls, + const char *name, + const struct GNUNET_MESSENGER_Ego *ego) { struct GNUNET_MESSENGER_SrvHandle *handle = cls; @@ -383,7 +403,8 @@ callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSE } void -set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) +set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, + const char *name) { GNUNET_assert(handle); @@ -403,7 +424,8 @@ set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) } int -open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) +open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); @@ -414,7 +436,8 @@ open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET } int -entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, +entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (door) && (key)); @@ -426,7 +449,8 @@ entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE } int -close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) +close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); @@ -437,7 +461,8 @@ close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE } int -send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, +send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key, const struct GNUNET_MESSENGER_Message *message) { GNUNET_assert((handle) && (key) && (message)); @@ -475,7 +500,8 @@ get_next_member_session_contect(const struct GNUNET_MESSENGER_MemberSession *ses } static const struct GNUNET_MESSENGER_MemberSession* -get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) +get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key) && (handle->service)); @@ -497,9 +523,11 @@ get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const stru } void -notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, +notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key, const struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { GNUNET_assert((handle) && (key) && (session) && (message) && (hash)); @@ -563,7 +591,8 @@ notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct G } static int -callback_scan_for_rooms (void *cls, const char *filename) +callback_scan_for_rooms (void *cls, + const char *filename) { struct GNUNET_MESSENGER_SrvHandle *handle = cls; @@ -606,7 +635,9 @@ load_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle) } static int -iterate_save_rooms (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_save_rooms (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_SrvHandle *handle = cls; struct GNUNET_ShortHashCode *member_id = value; diff --git a/src/messenger/gnunet-service-messenger_handle.h b/src/messenger/gnunet-service-messenger_handle.h index d8ff3aaa8..97a984721 100644 --- a/src/messenger/gnunet-service-messenger_handle.h +++ b/src/messenger/gnunet-service-messenger_handle.h @@ -60,7 +60,8 @@ struct GNUNET_MESSENGER_SrvHandle * @return New handle */ struct GNUNET_MESSENGER_SrvHandle* -create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq); +create_handle (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MQ_Handle *mq); /** * Destroys a handle and frees its memory fully. @@ -79,7 +80,9 @@ destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle); * @param[out] dir Path to store data */ void -get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir); +get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, + const char *name, + char **dir); /** * Returns the member id of a given handle in a specific room. @@ -91,7 +94,8 @@ get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const c * @return Member id or NULL */ const struct GNUNET_ShortHashCode* -get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); +get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key); /** * Changes the member id of a given handle in a specific room to match a unique_id @@ -105,7 +109,8 @@ get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const str * @return GNUNET_OK on success, otherwise GNUNET_SYSERR */ int -change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, +change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *unique_id); /** @@ -115,7 +120,8 @@ change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct * @param[in] ego EGO key pair */ void -set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego); +set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Ego *ego); /** * Returns the EGO used by a given handle. @@ -133,7 +139,8 @@ get_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle); * @param[in] name Name (optionally: valid EGO name) */ void -setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); +setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, + const char *name); /** * Tries to change the key pair of an EGO of a handle under the same name and informs all rooms @@ -154,7 +161,8 @@ update_handle (struct GNUNET_MESSENGER_SrvHandle *handle); * @param[in] name New name */ void -set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); +set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, + const char *name); /** * Makes a given handle a member of the room using a specific key and opens the @@ -165,7 +173,8 @@ set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); +open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key); /** * Makes a given handle a member of the room using a specific key and enters the room @@ -177,7 +186,8 @@ open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, +entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); /** @@ -189,7 +199,8 @@ entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); +close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key); /** * Sends a message from a given handle to the room using a specific key. @@ -200,7 +211,8 @@ close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE * @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise. */ int -send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, +send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key, const struct GNUNET_MESSENGER_Message *message); /** @@ -213,9 +225,11 @@ send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNU * @param[in] hash Hash of message */ void -notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, +notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key, const struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Loads member ids and other potential configuration from a given handle which diff --git a/src/messenger/gnunet-service-messenger_list_handles.c b/src/messenger/gnunet-service-messenger_list_handles.c index adcbf6a42..c0ae18716 100644 --- a/src/messenger/gnunet-service-messenger_list_handles.c +++ b/src/messenger/gnunet-service-messenger_list_handles.c @@ -55,7 +55,8 @@ clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles) } void -add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle) +add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, + struct GNUNET_MESSENGER_SrvHandle *handle) { GNUNET_assert((handles) && (handle)); @@ -67,7 +68,8 @@ add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MES } int -remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle) +remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, + struct GNUNET_MESSENGER_SrvHandle *handle) { GNUNET_assert((handles) && (handle)); @@ -87,7 +89,8 @@ remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_ } struct GNUNET_MESSENGER_SrvHandle* -find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key) +find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, + const struct GNUNET_HashCode *key) { GNUNET_assert((handles) && (key)); diff --git a/src/messenger/gnunet-service-messenger_list_handles.h b/src/messenger/gnunet-service-messenger_list_handles.h index 9f7ca725f..f4d7ca5c0 100644 --- a/src/messenger/gnunet-service-messenger_list_handles.h +++ b/src/messenger/gnunet-service-messenger_list_handles.h @@ -69,7 +69,8 @@ clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles); * @param[in/out] handle Handle */ void -add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle); +add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, + struct GNUNET_MESSENGER_SrvHandle *handle); /** * Removes the first entry matching with a specific handle from the list of @@ -80,7 +81,8 @@ add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MES * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle); +remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, + struct GNUNET_MESSENGER_SrvHandle *handle); /** * Searches linearly through the list of handles for members of a specific room @@ -93,6 +95,7 @@ remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_ * @return First handle which is a current member */ struct GNUNET_MESSENGER_SrvHandle* -find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key); +find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, + const struct GNUNET_HashCode *key); #endif //GNUNET_SERVICE_MESSENGER_LIST_HANDLES_H diff --git a/src/messenger/gnunet-service-messenger_list_messages.c b/src/messenger/gnunet-service-messenger_list_messages.c index 2666ccdab..7092dc76f 100644 --- a/src/messenger/gnunet-service-messenger_list_messages.c +++ b/src/messenger/gnunet-service-messenger_list_messages.c @@ -52,7 +52,8 @@ clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages) } void -add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) +add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, + const struct GNUNET_HashCode *hash) { GNUNET_assert((messages) && (hash)); @@ -64,7 +65,8 @@ add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const stru } void -copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin) +copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, + const struct GNUNET_MESSENGER_ListMessages *origin) { GNUNET_assert((messages) && (origin)); @@ -75,7 +77,8 @@ copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct } void -remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) +remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, + const struct GNUNET_HashCode *hash) { GNUNET_assert((messages) && (hash)); @@ -91,7 +94,8 @@ remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const } void -load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path) +load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, + const char *path) { GNUNET_assert((messages) && (path)); @@ -125,7 +129,8 @@ load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char * } void -save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, const char *path) +save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, + const char *path) { GNUNET_assert((messages) && (path)); diff --git a/src/messenger/gnunet-service-messenger_list_messages.h b/src/messenger/gnunet-service-messenger_list_messages.h index 93ec203ea..7abc8c00f 100644 --- a/src/messenger/gnunet-service-messenger_list_messages.h +++ b/src/messenger/gnunet-service-messenger_list_messages.h @@ -68,7 +68,8 @@ clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages); * @param[in] hash Hash of message */ void -add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); +add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, + const struct GNUNET_HashCode *hash); /** * Copies all message hashes from an origin to another list. @@ -77,7 +78,8 @@ add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const stru * @param[in] origin Source list of hashes */ void -copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin); +copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, + const struct GNUNET_MESSENGER_ListMessages *origin); /** * Removes the first entry with a matching hash from the list. @@ -86,7 +88,8 @@ copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct * @param[in] hash Hash of message */ void -remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); +remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, + const struct GNUNET_HashCode *hash); /** * Loads the list of message hashes from a file under a given path. @@ -95,7 +98,8 @@ remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const * @param[in] path Path of file */ void -load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path); +load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, + const char *path); /** * Saves the list of message hashes to a file under a given path. @@ -104,6 +108,7 @@ load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char * * @param[in] path Path of file */ void -save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, const char *path); +save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, + const char *path); #endif //GNUNET_SERVICE_MESSENGER_LIST_MESSAGES_H diff --git a/src/messenger/gnunet-service-messenger_member.c b/src/messenger/gnunet-service-messenger_member.c index b0a735dbe..def57aef9 100644 --- a/src/messenger/gnunet-service-messenger_member.c +++ b/src/messenger/gnunet-service-messenger_member.c @@ -28,7 +28,8 @@ #include "gnunet-service-messenger_member_session.h" struct GNUNET_MESSENGER_Member* -create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) +create_member (struct GNUNET_MESSENGER_MemberStore *store, + const struct GNUNET_ShortHashCode *id) { GNUNET_assert (store); @@ -50,7 +51,9 @@ create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_S } static int -iterate_destroy_session (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_session (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_MemberSession *session = value; destroy_member_session(session); @@ -77,7 +80,8 @@ get_member_id (const struct GNUNET_MESSENGER_Member *member) } static int -callback_scan_for_sessions (void *cls, const char *filename) +callback_scan_for_sessions (void *cls, + const char *filename) { struct GNUNET_MESSENGER_Member *member = cls; @@ -95,7 +99,8 @@ callback_scan_for_sessions (void *cls, const char *filename) } void -load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) +load_member (struct GNUNET_MESSENGER_MemberStore *store, + const char *directory) { GNUNET_assert ((store) && (directory)); @@ -139,7 +144,9 @@ free_config: } static int -iterate_load_next_session (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_load_next_session (void *cls, + const struct GNUNET_HashCode *key, + void *value) { const char* sessions_directory = cls; @@ -156,7 +163,8 @@ iterate_load_next_session (void *cls, const struct GNUNET_HashCode *key, void *v } void -load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory) +load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, + const char *directory) { GNUNET_assert ((member) && (directory)); @@ -169,7 +177,9 @@ load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const c } static int -iterate_save_session (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_save_session (void *cls, + const struct GNUNET_HashCode *key, + void *value) { const char* sessions_directory = cls; @@ -187,7 +197,8 @@ iterate_save_session (void *cls, const struct GNUNET_HashCode *key, void *value) } void -save_member (struct GNUNET_MESSENGER_Member *member, const char *directory) +save_member (struct GNUNET_MESSENGER_Member *member, + const char *directory) { GNUNET_assert ((member) && (directory)); @@ -221,7 +232,8 @@ save_member (struct GNUNET_MESSENGER_Member *member, const char *directory) } static void -sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next) +sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session, + struct GNUNET_MESSENGER_MemberSession *next) { GNUNET_assert((session) && (next)); @@ -235,7 +247,9 @@ sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session, } static int -iterate_sync_session_contact (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_sync_session_contact (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_MemberSession *session = value; @@ -254,7 +268,8 @@ sync_member_contacts (struct GNUNET_MESSENGER_Member *member) } struct GNUNET_MESSENGER_MemberSession* -get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key) +get_member_session (const struct GNUNET_MESSENGER_Member *member, + const struct GNUNET_IDENTITY_PublicKey *public_key) { GNUNET_assert ((member) && (public_key)); @@ -272,7 +287,9 @@ struct GNUNET_MESSENGER_ClosureSearchSession { }; static int -iterate_search_session (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_search_session (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_ClosureSearchSession* search = cls; struct GNUNET_MESSENGER_MemberSession *session = value; @@ -285,7 +302,8 @@ iterate_search_session (void *cls, const struct GNUNET_HashCode *key, void *valu } static struct GNUNET_MESSENGER_MemberSession* -try_member_session (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key) +try_member_session (struct GNUNET_MESSENGER_Member *member, + const struct GNUNET_IDENTITY_PublicKey *public_key) { struct GNUNET_MESSENGER_MemberSession* session = get_member_session(member, public_key); @@ -301,7 +319,8 @@ try_member_session (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_ } struct GNUNET_MESSENGER_MemberSession* -get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, +get_member_session_of (struct GNUNET_MESSENGER_Member *member, + const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) { GNUNET_assert ((member) && (message) && (hash) && @@ -324,7 +343,8 @@ get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUN } void -add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session) +add_member_session (struct GNUNET_MESSENGER_Member *member, + struct GNUNET_MESSENGER_MemberSession *session) { if (!session) return; @@ -344,7 +364,8 @@ add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSEN } void -remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session) +remove_member_session (struct GNUNET_MESSENGER_Member *member, + struct GNUNET_MESSENGER_MemberSession *session) { GNUNET_assert ((member) && (session) && (session->member == member)); @@ -364,7 +385,9 @@ struct GNUNET_MESSENGER_ClosureIterateSessions { }; static int -iterate_member_sessions_it (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_member_sessions_it (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_ClosureIterateSessions *iterate = cls; struct GNUNET_MESSENGER_MemberSession *session = value; @@ -373,7 +396,9 @@ iterate_member_sessions_it (void *cls, const struct GNUNET_HashCode *key, void * } int -iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void *cls) +iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, + GNUNET_MESSENGER_MemberIteratorCallback it, + void *cls) { GNUNET_assert ((member) && (member->sessions) && (it)); diff --git a/src/messenger/gnunet-service-messenger_member.h b/src/messenger/gnunet-service-messenger_member.h index fb2e57cfb..46269315a 100644 --- a/src/messenger/gnunet-service-messenger_member.h +++ b/src/messenger/gnunet-service-messenger_member.h @@ -52,7 +52,8 @@ struct GNUNET_MESSENGER_Member * @return New member or NULL */ struct GNUNET_MESSENGER_Member* -create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); +create_member (struct GNUNET_MESSENGER_MemberStore *store, + const struct GNUNET_ShortHashCode *id); /** * Destroys a member and frees its memory fully. @@ -80,7 +81,8 @@ get_member_id (const struct GNUNET_MESSENGER_Member *member); * @param[in] directory Path to a directory */ void -load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); +load_member (struct GNUNET_MESSENGER_MemberStore *store, + const char *directory); /** * Loads data about next sessions from a directory into an empty loaded @@ -90,7 +92,8 @@ load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); * @param[in] directory Path to a directory */ void -load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory); +load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, + const char *directory); /** * Saves data from a member into a directory which @@ -100,7 +103,8 @@ load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const c * @param[in] directory Path to a directory */ void -save_member (struct GNUNET_MESSENGER_Member *member, const char *directory); +save_member (struct GNUNET_MESSENGER_Member *member, + const char *directory); /** * Synchronizes contacts between all sessions from a given member @@ -120,7 +124,8 @@ sync_member_contacts (struct GNUNET_MESSENGER_Member *member); * @return Member session */ struct GNUNET_MESSENGER_MemberSession* -get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key); +get_member_session (const struct GNUNET_MESSENGER_Member *member, + const struct GNUNET_IDENTITY_PublicKey *public_key); /** * Returns the member session of a member using a public key which can verify @@ -133,7 +138,8 @@ get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct G * @return Member session */ struct GNUNET_MESSENGER_MemberSession* -get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, +get_member_session_of (struct GNUNET_MESSENGER_Member *member, + const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); /** @@ -143,7 +149,8 @@ get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUN * @param[in/out] session Member session */ void -add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); +add_member_session (struct GNUNET_MESSENGER_Member *member, + struct GNUNET_MESSENGER_MemberSession *session); /** * Removes a given member session from its member. @@ -152,7 +159,8 @@ add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSEN * @param[in/out] session Member session */ void -remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); +remove_member_session (struct GNUNET_MESSENGER_Member *member, + struct GNUNET_MESSENGER_MemberSession *session); /** * Iterate through all member sessions currently connected to a given member @@ -165,6 +173,8 @@ remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MES * @return Amount of sessions iterated through */ int -iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void* cls); +iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, + GNUNET_MESSENGER_MemberIteratorCallback it, + void* cls); #endif //GNUNET_SERVICE_MESSENGER_MEMBER_H diff --git a/src/messenger/gnunet-service-messenger_member_session.c b/src/messenger/gnunet-service-messenger_member_session.c index 690c703b2..03736941f 100644 --- a/src/messenger/gnunet-service-messenger_member_session.c +++ b/src/messenger/gnunet-service-messenger_member_session.c @@ -158,7 +158,9 @@ completion: } static int -iterate_copy_history (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_copy_history (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_MemberSession *next = cls; @@ -460,7 +462,8 @@ struct GNUNET_MESSENGER_MemberSessionHistoryEntry }; static void -load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path) +load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, + const char *path) { GNUNET_assert((session) && (path)); @@ -502,7 +505,8 @@ load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, con } void -load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory) +load_member_session (struct GNUNET_MESSENGER_Member *member, + const char *directory) { GNUNET_assert ((member) && (directory)); @@ -571,7 +575,8 @@ free_config: } static struct GNUNET_MESSENGER_MemberSession* -get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next) +get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, + struct GNUNET_MESSENGER_MemberSession *next) { if (!next) return NULL; @@ -589,7 +594,8 @@ get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, str } void -load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory) +load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, + const char *directory) { GNUNET_assert ((session) && (directory)); @@ -640,7 +646,9 @@ free_config: } static int -iterate_save_member_session_history_hentries (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_save_member_session_history_hentries (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_DISK_FileHandle *handle = cls; unsigned char ownership = value? GNUNET_YES : GNUNET_NO; @@ -652,7 +660,8 @@ iterate_save_member_session_history_hentries (void *cls, const struct GNUNET_Has } static void -save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path) +save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, + const char *path) { GNUNET_assert((session) && (path)); @@ -678,7 +687,8 @@ save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, con } void -save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory) +save_member_session (struct GNUNET_MESSENGER_MemberSession *session, + const char *directory) { GNUNET_assert ((session) && (directory)); diff --git a/src/messenger/gnunet-service-messenger_member_session.h b/src/messenger/gnunet-service-messenger_member_session.h index bf4d10f67..9ba801776 100644 --- a/src/messenger/gnunet-service-messenger_member_session.h +++ b/src/messenger/gnunet-service-messenger_member_session.h @@ -225,7 +225,8 @@ verify_member_session_as_sender (const struct GNUNET_MESSENGER_MemberSession *se */ int check_member_session_history (const struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_HashCode *hash, int ownership); + const struct GNUNET_HashCode *hash, + int ownership); /** * Adds a given message to the history of a session using the messages @@ -262,7 +263,8 @@ clear_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, * @param[in] directory Path to a directory */ void -load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory); +load_member_session (struct GNUNET_MESSENGER_Member *member, + const char *directory); /** * Loads the connection from one session to another through the @@ -273,7 +275,8 @@ load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directo * @param[in] directory Path to a directory */ void -load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory); +load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, + const char *directory); /** * Saves data from a member session into a directory which can be @@ -283,6 +286,7 @@ load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const * @param[in] directory Path to a directory */ void -save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory); +save_member_session (struct GNUNET_MESSENGER_MemberSession *session, + const char *directory); #endif //GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H diff --git a/src/messenger/gnunet-service-messenger_member_store.c b/src/messenger/gnunet-service-messenger_member_store.c index 2925965d4..e96ee3883 100644 --- a/src/messenger/gnunet-service-messenger_member_store.c +++ b/src/messenger/gnunet-service-messenger_member_store.c @@ -30,7 +30,8 @@ #include "gnunet-service-messenger_room.h" void -init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room) +init_member_store (struct GNUNET_MESSENGER_MemberStore *store, + struct GNUNET_MESSENGER_SrvRoom *room) { GNUNET_assert ((store) && (room)); @@ -39,7 +40,9 @@ init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MES } static int -iterate_destroy_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) +iterate_destroy_members (void *cls, + const struct GNUNET_ShortHashCode *key, + void *value) { struct GNUNET_MESSENGER_Member *member = value; destroy_member(member); @@ -75,7 +78,8 @@ get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store) } static int -callback_scan_for_members (void *cls, const char *filename) +callback_scan_for_members (void *cls, + const char *filename) { struct GNUNET_MESSENGER_MemberStore *store = cls; @@ -94,7 +98,9 @@ callback_scan_for_members (void *cls, const char *filename) } static int -iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode *id, void *value) +iterate_load_next_member_sessions (void *cls, + const struct GNUNET_ShortHashCode *id, + void *value) { const char *sync_dir = cls; @@ -114,7 +120,9 @@ iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode } static int -iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id, void *value) +iterate_sync_member_contacts (void *cls, + const struct GNUNET_ShortHashCode *id, + void *value) { struct GNUNET_MESSENGER_Member *member = value; @@ -126,7 +134,8 @@ iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id, } void -load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) +load_member_store (struct GNUNET_MESSENGER_MemberStore *store, + const char *directory) { GNUNET_assert ((store) && (directory)); @@ -143,7 +152,9 @@ load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc } static int -iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *value) +iterate_save_members (void *cls, + const struct GNUNET_ShortHashCode *id, + void *value) { const char *save_dir = cls; @@ -164,7 +175,8 @@ iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *va } void -save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) +save_member_store (struct GNUNET_MESSENGER_MemberStore *store, + const char *directory) { GNUNET_assert ((store) && (directory)); @@ -179,7 +191,8 @@ save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc } struct GNUNET_MESSENGER_Member* -get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) +get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, + const struct GNUNET_ShortHashCode *id) { GNUNET_assert ((store) && (store->members) && (id)); @@ -187,7 +200,8 @@ get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct } struct GNUNET_MESSENGER_Member* -get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message) +get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, + const struct GNUNET_MESSENGER_Message *message) { if ((GNUNET_MESSENGER_KIND_INFO == message->header.kind) || (GNUNET_MESSENGER_KIND_JOIN == message->header.kind)) @@ -197,7 +211,8 @@ get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GN } struct GNUNET_MESSENGER_Member* -add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) +add_store_member (struct GNUNET_MESSENGER_MemberStore *store, + const struct GNUNET_ShortHashCode *id) { GNUNET_assert ((store) && (store->members)); @@ -227,7 +242,9 @@ struct GNUNET_MESSENGER_ClosureIterateMembers { }; static int -iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, void *value) +iterate_store_members_it (void *cls, + const struct GNUNET_ShortHashCode *key, + void *value) { struct GNUNET_MESSENGER_ClosureIterateMembers *iterate = cls; struct GNUNET_MESSENGER_Member *member = value; @@ -236,7 +253,8 @@ iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, voi } int -iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, +iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, + GNUNET_MESSENGER_MemberIteratorCallback it, void* cls) { GNUNET_assert ((store) && (store->members) && (it)); diff --git a/src/messenger/gnunet-service-messenger_member_store.h b/src/messenger/gnunet-service-messenger_member_store.h index 859e4683d..af50f0d36 100644 --- a/src/messenger/gnunet-service-messenger_member_store.h +++ b/src/messenger/gnunet-service-messenger_member_store.h @@ -56,7 +56,8 @@ typedef int (*GNUNET_MESSENGER_MemberIteratorCallback) ( * @param room Room */ void -init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room); +init_member_store (struct GNUNET_MESSENGER_MemberStore *store, + struct GNUNET_MESSENGER_SrvRoom *room); /** * Clears a member store, wipes its content and deallocates its memory. @@ -91,7 +92,8 @@ get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store); * @param[in] directory Path to a directory */ void -load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); +load_member_store (struct GNUNET_MESSENGER_MemberStore *store, + const char *directory); /** * Saves members from a member store into a directory. @@ -100,7 +102,8 @@ load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc * @param[in] directory Path to a directory */ void -save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); +save_member_store (struct GNUNET_MESSENGER_MemberStore *store, + const char *directory); /** * Returns the member in a store identified by a given id. If the store @@ -111,7 +114,8 @@ save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc * @return Member or NULL */ struct GNUNET_MESSENGER_Member* -get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); +get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, + const struct GNUNET_ShortHashCode *id); /** * Returns the member of a store using a sender id of a given message. @@ -122,7 +126,8 @@ get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct * @return Member or NULL */ struct GNUNET_MESSENGER_Member* -get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message); +get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, + const struct GNUNET_MESSENGER_Message *message); /** * Adds a member to a store under a specific id and returns it on success. @@ -132,7 +137,8 @@ get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GN * @return Member or NULL */ struct GNUNET_MESSENGER_Member* -add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); +add_store_member (struct GNUNET_MESSENGER_MemberStore *store, + const struct GNUNET_ShortHashCode *id); /** * Iterate through all member sessions currently connected to the members of the given @@ -145,7 +151,8 @@ add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNE * @return Amount of members iterated through */ int -iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, +iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, + GNUNET_MESSENGER_MemberIteratorCallback it, void* cls); #endif //GNUNET_SERVICE_MESSENGER_MEMBER_STORE_H diff --git a/src/messenger/gnunet-service-messenger_message_handle.c b/src/messenger/gnunet-service-messenger_message_handle.c index 86f2b901a..701d78c89 100644 --- a/src/messenger/gnunet-service-messenger_message_handle.c +++ b/src/messenger/gnunet-service-messenger_message_handle.c @@ -27,7 +27,8 @@ static void handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_MESSENGER_MemberSession *next = switch_member_session(session, message, hash); @@ -36,8 +37,10 @@ handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session, } void -handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) joins room (%s).\n", GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room))); @@ -54,8 +57,10 @@ handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN } void -handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) leaves room (%s).\n", GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room))); @@ -64,8 +69,10 @@ handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE } void -handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_MESSENGER_Contact *contact = get_member_session_contact(session); @@ -76,15 +83,19 @@ handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN } void -handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { handle_session_switch (session, message, hash); } void -handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if (GNUNET_NO == contains_list_tunnels (&(room->basement), &(message->body.peer.peer))) add_to_list_tunnels (&(room->basement), &(message->body.peer.peer)); @@ -94,8 +105,10 @@ handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN } void -handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { handle_session_switch (session, message, hash); @@ -108,8 +121,10 @@ handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE } void -handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_MESSENGER_ListTunnel *element = find_list_tunnels (&(room->basement), &(message->body.peer.peer), NULL); @@ -123,8 +138,10 @@ handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN } void -handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh (message->body.deletion.delay); struct GNUNET_TIME_Absolute action = GNUNET_TIME_absolute_ntoh (message->header.timestamp); diff --git a/src/messenger/gnunet-service-messenger_message_handle.h b/src/messenger/gnunet-service-messenger_message_handle.h index 844142b77..0e5be3408 100644 --- a/src/messenger/gnunet-service-messenger_message_handle.h +++ b/src/messenger/gnunet-service-messenger_message_handle.h @@ -45,8 +45,10 @@ * @param[in] hash Hash of the message */ void -handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received or sent leave message to make changes of current member information. @@ -58,8 +60,10 @@ handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN * @param[in] hash Hash of the message */ void -handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received or sent name message to rename a current member. @@ -71,8 +75,10 @@ handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE * @param[in] hash Hash of the message */ void -handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received or sent key message to change the key of a member and rearrange the contacts accordingly. @@ -84,8 +90,10 @@ handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN * @param[in] hash Hash of the message */ void -handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received or sent peer message to make changes of the basement in the room. @@ -97,8 +105,10 @@ handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENG * @param[in] hash Hash of the message */ void -handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received or sent id message to change a members id. @@ -110,8 +120,10 @@ handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN * @param[in] hash Hash of the message */ void -handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received or sent miss message to drop a peer from the basement in the room. @@ -123,8 +135,10 @@ handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE * @param[in] hash Hash of the message */ void -handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received or sent delete message to delete a specific message from the store. @@ -136,7 +150,9 @@ handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN * @param[in] hash Hash of the message */ void -handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H diff --git a/src/messenger/gnunet-service-messenger_message_kind.c b/src/messenger/gnunet-service-messenger_message_kind.c index 3edcade91..2449b9230 100644 --- a/src/messenger/gnunet-service-messenger_message_kind.c +++ b/src/messenger/gnunet-service-messenger_message_kind.c @@ -190,7 +190,8 @@ create_message_request (const struct GNUNET_HashCode *hash) } struct GNUNET_MESSENGER_Message* -create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) +create_message_invite (const struct GNUNET_PeerIdentity *door, + const struct GNUNET_HashCode *key) { if ((!door) || (!key)) return NULL; @@ -222,7 +223,8 @@ create_message_text (const char *text) } struct GNUNET_MESSENGER_Message* -create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) +create_message_delete (const struct GNUNET_HashCode *hash, + const struct GNUNET_TIME_Relative delay) { if (!hash) return NULL; diff --git a/src/messenger/gnunet-service-messenger_message_kind.h b/src/messenger/gnunet-service-messenger_message_kind.h index c098868c0..508f19074 100644 --- a/src/messenger/gnunet-service-messenger_message_kind.h +++ b/src/messenger/gnunet-service-messenger_message_kind.h @@ -146,7 +146,8 @@ create_message_request (const struct GNUNET_HashCode *hash); * @return New message */ struct GNUNET_MESSENGER_Message* -create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); +create_message_invite (const struct GNUNET_PeerIdentity *door, + const struct GNUNET_HashCode *key); /** * Creates and allocates a new text message containing a string representing text. @@ -167,6 +168,7 @@ create_message_text (const char *text); * @return New message */ struct GNUNET_MESSENGER_Message* -create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay); +create_message_delete (const struct GNUNET_HashCode *hash, + const struct GNUNET_TIME_Relative delay); #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H diff --git a/src/messenger/gnunet-service-messenger_message_recv.c b/src/messenger/gnunet-service-messenger_message_recv.c index b2a5052d2..bb6ee6f17 100644 --- a/src/messenger/gnunet-service-messenger_message_recv.c +++ b/src/messenger/gnunet-service-messenger_message_recv.c @@ -28,8 +28,10 @@ #include "gnunet-service-messenger_operation.h" static void -forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_CONTAINER_MultiHashMap *map) +forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_MESSENGER_MemberSession *session, + struct GNUNET_CONTAINER_MultiHashMap *map) { if (session->prev) forward_about_members (room, tunnel, session->prev, map); @@ -54,8 +56,9 @@ forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESS } static int -iterate_forward_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, - struct GNUNET_MESSENGER_MemberSession *session) +iterate_forward_members (void *cls, + const struct GNUNET_IDENTITY_PublicKey *public_key, + struct GNUNET_MESSENGER_MemberSession *session) { struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; @@ -71,8 +74,10 @@ iterate_forward_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *publ } int -recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { const uint32_t version = get_tunnel_messenger_version(tunnel); @@ -108,8 +113,10 @@ recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE } int -recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_PeerIdentity peer; GNUNET_PEER_resolve (tunnel->peer, &peer); @@ -126,7 +133,8 @@ recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE } static void -callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, +callback_found_message (void *cls, + struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) { @@ -152,8 +160,10 @@ callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, * It will only be forwarded if it can't be answered! */ int -recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); diff --git a/src/messenger/gnunet-service-messenger_message_recv.h b/src/messenger/gnunet-service-messenger_message_recv.h index 9cb36c466..400c10245 100644 --- a/src/messenger/gnunet-service-messenger_message_recv.h +++ b/src/messenger/gnunet-service-messenger_message_recv.h @@ -46,8 +46,10 @@ * @return #GNUNET_NO to not forward the message */ int -recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received peer message to link it to its origin tunnel if the peer identity matches. @@ -60,8 +62,10 @@ recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE * @return #GNUNET_YES to forward the message */ int -recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a received request message by checking for the requested message and forwarding it back @@ -75,7 +79,9 @@ recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE * @return #GNUNET_YES or #GNUNET_NO depending on required forwarding */ int -recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H diff --git a/src/messenger/gnunet-service-messenger_message_send.c b/src/messenger/gnunet-service-messenger_message_send.c index a59a178cc..8cc2466d7 100644 --- a/src/messenger/gnunet-service-messenger_message_send.c +++ b/src/messenger/gnunet-service-messenger_message_send.c @@ -30,15 +30,19 @@ #include "gnunet-service-messenger_operation.h" void -send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { check_room_peer_status(room, NULL); } void -send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if (!room->peer_message) room->peer_message = GNUNET_new(struct GNUNET_HashCode); @@ -47,15 +51,19 @@ send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE } void -send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { change_handle_member_id (handle, get_room_key(room), &(message->body.id.id)); } void -send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room); diff --git a/src/messenger/gnunet-service-messenger_message_send.h b/src/messenger/gnunet-service-messenger_message_send.h index 63320ab17..232355c41 100644 --- a/src/messenger/gnunet-service-messenger_message_send.h +++ b/src/messenger/gnunet-service-messenger_message_send.h @@ -44,8 +44,10 @@ * @param[in] hash Hash of the message */ void -send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a sent peer message to update the rooms peer message of this service. @@ -57,8 +59,10 @@ send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE * @param[in] hash Hash of the message */ void -send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a sent id message to update the handles member id in the room. @@ -70,8 +74,10 @@ send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE * @param[in] hash Hash of the message */ void -send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Handles a sent request message to trigger the request operation for this service. @@ -83,7 +89,9 @@ send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_ * @param[in] hash Hash of the message */ void -send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_SEND_H diff --git a/src/messenger/gnunet-service-messenger_message_state.c b/src/messenger/gnunet-service-messenger_message_state.c index cdd2d9712..344962d11 100644 --- a/src/messenger/gnunet-service-messenger_message_state.c +++ b/src/messenger/gnunet-service-messenger_message_state.c @@ -65,8 +65,10 @@ get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state) } void -update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +update_message_state (struct GNUNET_MESSENGER_MessageState *state, + int requested, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { GNUNET_assert((state) && (message) && (hash)); @@ -83,7 +85,8 @@ update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested } void -load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path) +load_message_state (struct GNUNET_MESSENGER_MessageState *state, + const char *path) { GNUNET_assert((state) && (path)); @@ -95,7 +98,8 @@ load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *pat } void -save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path) +save_message_state (const struct GNUNET_MESSENGER_MessageState *state, + const char *path) { GNUNET_assert((state) && (path)); diff --git a/src/messenger/gnunet-service-messenger_message_state.h b/src/messenger/gnunet-service-messenger_message_state.h index dc8671df4..af52b26b6 100644 --- a/src/messenger/gnunet-service-messenger_message_state.h +++ b/src/messenger/gnunet-service-messenger_message_state.h @@ -51,13 +51,17 @@ const struct GNUNET_HashCode* get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state); void -update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +update_message_state (struct GNUNET_MESSENGER_MessageState *state, + int requested, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); void -load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path); +load_message_state (struct GNUNET_MESSENGER_MessageState *state, + const char *path); void -save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path); +save_message_state (const struct GNUNET_MESSENGER_MessageState *state, + const char *path); #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STATE_H diff --git a/src/messenger/gnunet-service-messenger_message_store.c b/src/messenger/gnunet-service-messenger_message_store.c index 1984eba21..56448997a 100644 --- a/src/messenger/gnunet-service-messenger_message_store.c +++ b/src/messenger/gnunet-service-messenger_message_store.c @@ -42,7 +42,9 @@ init_message_store (struct GNUNET_MESSENGER_MessageStore *store) } static int -iterate_destroy_entries (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_entries (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_MessageEntry *entry = value; @@ -52,7 +54,9 @@ iterate_destroy_entries (void *cls, const struct GNUNET_HashCode *key, void *val } static int -iterate_destroy_messages (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_messages (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_Message *message = value; @@ -62,7 +66,9 @@ iterate_destroy_messages (void *cls, const struct GNUNET_HashCode *key, void *va } static int -iterate_destroy_links (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_links (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_HashCode *previous = value; @@ -99,7 +105,8 @@ struct GNUNET_MESSENGER_MessageEntryStorage }; static void -load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store, const char *filename) +load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store, + const char *filename) { enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ); @@ -146,7 +153,8 @@ struct GNUNET_MESSENGER_MessageLinkStorage }; static void -load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const char *filename) +load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, + const char *filename) { enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ); @@ -187,7 +195,8 @@ load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const cha } void -load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) +load_message_store (struct GNUNET_MESSENGER_MessageStore *store, + const char *directory) { GNUNET_assert((store) && (directory)); @@ -232,7 +241,9 @@ struct GNUNET_MESSENGER_ClosureMessageSave }; static int -iterate_save_entries (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_save_entries (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; struct GNUNET_MESSENGER_MessageEntry *entry = value; @@ -248,7 +259,9 @@ iterate_save_entries (void *cls, const struct GNUNET_HashCode *key, void *value) } static int -iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_save_messages (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; @@ -279,7 +292,9 @@ iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value } static int -iterate_save_links (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_save_links (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; struct GNUNET_MESSENGER_MessageLink *link = value; @@ -295,7 +310,8 @@ iterate_save_links (void *cls, const struct GNUNET_HashCode *key, void *value) } void -save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) +save_message_store (struct GNUNET_MESSENGER_MessageStore *store, + const char *directory) { GNUNET_assert((store) && (directory)); @@ -372,7 +388,8 @@ close_entries: } int -contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) +contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash) { GNUNET_assert((store) && (hash)); @@ -383,7 +400,8 @@ contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const } const struct GNUNET_MESSENGER_Message* -get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) +get_store_message (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash) { GNUNET_assert((store) && (hash)); @@ -444,7 +462,8 @@ free_buffer: } const struct GNUNET_MESSENGER_MessageLink* -get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, +get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash, int deleted_only) { if (deleted_only) @@ -473,7 +492,8 @@ get_link: } int -put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, +put_store_message (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Message *message) { GNUNET_assert((store) && (hash) && (message)); @@ -483,7 +503,8 @@ put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU } static void -add_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, +add_link (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Message *message) { struct GNUNET_MESSENGER_MessageLink *link = GNUNET_new(struct GNUNET_MESSENGER_MessageLink); @@ -503,7 +524,8 @@ add_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashC } int -delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) +delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash) { GNUNET_assert((store) && (hash)); diff --git a/src/messenger/gnunet-service-messenger_message_store.h b/src/messenger/gnunet-service-messenger_message_store.h index 87305826a..476d98dd5 100644 --- a/src/messenger/gnunet-service-messenger_message_store.h +++ b/src/messenger/gnunet-service-messenger_message_store.h @@ -81,7 +81,8 @@ clear_message_store (struct GNUNET_MESSENGER_MessageStore *store); * @param[in] directory Path to a directory */ void -load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); +load_message_store (struct GNUNET_MESSENGER_MessageStore *store, + const char *directory); /** * Saves messages from a message store into a directory. @@ -90,7 +91,8 @@ load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir * @param[in] directory Path to a directory */ void -save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); +save_message_store (struct GNUNET_MESSENGER_MessageStore *store, + const char *directory); /** * Checks if a message matching a given hash is stored in a message store. @@ -103,7 +105,8 @@ save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir * @return #GNUNET_YES on match, otherwise #GNUNET_NO */ int -contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); +contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash); /** * Returns the message from a message store matching a given hash. If no matching @@ -117,7 +120,8 @@ contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const * @return Message or NULL */ const struct GNUNET_MESSENGER_Message* -get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); +get_store_message (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash); /** * Returns the message link from a message store matching a given hash. If the @@ -133,7 +137,8 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU * @return Message link or NULL */ const struct GNUNET_MESSENGER_MessageLink* -get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, +get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash, int deleted_only); /** @@ -145,7 +150,8 @@ get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struc * @return #GNUNET_OK on success, otherwise #GNUNET_NO */ int -put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, +put_store_message (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash, struct GNUNET_MESSENGER_Message *message); /** @@ -157,6 +163,7 @@ put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure */ int -delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); +delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, + const struct GNUNET_HashCode *hash); #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STORE_H diff --git a/src/messenger/gnunet-service-messenger_operation.c b/src/messenger/gnunet-service-messenger_operation.c index d0c378699..a8744e577 100644 --- a/src/messenger/gnunet-service-messenger_operation.c +++ b/src/messenger/gnunet-service-messenger_operation.c @@ -58,7 +58,8 @@ static void callback_operation (void *cls); struct GNUNET_MESSENGER_Operation* -load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path) +load_operation (struct GNUNET_MESSENGER_OperationStore *store, + const char *path) { GNUNET_assert((store) && (path)); @@ -118,7 +119,8 @@ destroy_config: } void -save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path) +save_operation (const struct GNUNET_MESSENGER_Operation *op, + const char *path) { GNUNET_assert((path) && (op)); diff --git a/src/messenger/gnunet-service-messenger_operation.h b/src/messenger/gnunet-service-messenger_operation.h index f1e06f4a7..485668548 100644 --- a/src/messenger/gnunet-service-messenger_operation.h +++ b/src/messenger/gnunet-service-messenger_operation.h @@ -86,7 +86,8 @@ destroy_operation (struct GNUNET_MESSENGER_Operation *op); * @param[in] path Path of a configuration file */ struct GNUNET_MESSENGER_Operation* -load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path); +load_operation (struct GNUNET_MESSENGER_OperationStore *store, + const char *path); /** * Saves data from an operation into a configuration file at a @@ -97,7 +98,8 @@ load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path) * @param[in] path Path of a configuration file */ void -save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path); +save_operation (const struct GNUNET_MESSENGER_Operation *op, + const char *path); /** * Starts an inactive operation with a given delay in a diff --git a/src/messenger/gnunet-service-messenger_operation_store.c b/src/messenger/gnunet-service-messenger_operation_store.c index a32fbad2c..4f8419daa 100644 --- a/src/messenger/gnunet-service-messenger_operation_store.c +++ b/src/messenger/gnunet-service-messenger_operation_store.c @@ -29,7 +29,8 @@ #include "gnunet-service-messenger_room.h" void -init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room) +init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, + struct GNUNET_MESSENGER_SrvRoom *room) { GNUNET_assert((store) && (room)); @@ -38,7 +39,9 @@ init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUN } static int -iterate_destroy_operations (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_operations (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_Operation *op = value; @@ -57,7 +60,8 @@ clear_operation_store (struct GNUNET_MESSENGER_OperationStore *store) } static int -callback_scan_for_operations (void *cls, const char *filename) +callback_scan_for_operations (void *cls, + const char *filename) { struct GNUNET_MESSENGER_OperationStore *store = cls; @@ -94,7 +98,9 @@ load_operation_store (struct GNUNET_MESSENGER_OperationStore *store, } static int -iterate_save_operations (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_save_operations (void *cls, + const struct GNUNET_HashCode *key, + void *value) { const char *save_dir = cls; @@ -192,10 +198,12 @@ cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store, } extern void -callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash); +callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_HashCode *hash); extern void -callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash); +callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_HashCode *hash); void callback_store_operation (struct GNUNET_MESSENGER_OperationStore *store, diff --git a/src/messenger/gnunet-service-messenger_operation_store.h b/src/messenger/gnunet-service-messenger_operation_store.h index 4c613437c..18eb7f8a1 100644 --- a/src/messenger/gnunet-service-messenger_operation_store.h +++ b/src/messenger/gnunet-service-messenger_operation_store.h @@ -48,7 +48,8 @@ struct GNUNET_MESSENGER_OperationStore * @param[in/out] room Room */ void -init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room); +init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, + struct GNUNET_MESSENGER_SrvRoom *room); /** * Clears an operation store, stops all operations and deallocates its memory. diff --git a/src/messenger/gnunet-service-messenger_room.c b/src/messenger/gnunet-service-messenger_room.c index 73e94908f..920abb10e 100644 --- a/src/messenger/gnunet-service-messenger_room.c +++ b/src/messenger/gnunet-service-messenger_room.c @@ -43,7 +43,8 @@ static void idle_request_room_messages (void *cls); struct GNUNET_MESSENGER_SrvRoom* -create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) +create_room (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); @@ -78,7 +79,9 @@ create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_Hash } static int -iterate_destroy_tunnels (void *cls, const struct GNUNET_PeerIdentity *key, void *value) +iterate_destroy_tunnels (void *cls, + const struct GNUNET_PeerIdentity *key, + void *value) { struct GNUNET_MESSENGER_SrvTunnel *tunnel = value; destroy_tunnel (tunnel); @@ -150,7 +153,8 @@ get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room) } static int -send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, +send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_SrvTunnel *tunnel) { if ((!handle) || (!is_tunnel_connected (tunnel))) @@ -160,7 +164,9 @@ send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_S } static void* -callback_room_connect (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *source) +callback_room_connect (void *cls, + struct GNUNET_CADET_Channel *channel, + const struct GNUNET_PeerIdentity *source) { struct GNUNET_MESSENGER_SrvRoom *room = cls; @@ -197,7 +203,8 @@ callback_room_connect (void *cls, struct GNUNET_CADET_Channel *channel, const st } static int -join_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, +join_room (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Member *member) { GNUNET_assert((room) && (handle) && (member)); @@ -228,8 +235,10 @@ struct GNUNET_MESSENGER_MemberNotify }; static void -notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNET_MESSENGER_MemberSession *session, - struct GNUNET_CONTAINER_MultiHashMap *map, int check_permission) +notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, + struct GNUNET_MESSENGER_MemberSession *session, + struct GNUNET_CONTAINER_MultiHashMap *map, + int check_permission) { if (session->prev) notify_about_members (notify, session->prev, map, GNUNET_YES); @@ -258,7 +267,8 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNE } static int -iterate_notify_about_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, +iterate_notify_about_members (void *cls, + const struct GNUNET_IDENTITY_PublicKey *public_key, struct GNUNET_MESSENGER_MemberSession *session) { struct GNUNET_MESSENGER_MemberNotify *notify = cls; @@ -275,7 +285,8 @@ iterate_notify_about_members (void *cls, const struct GNUNET_IDENTITY_PublicKey } static int -join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) +join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle) { const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (handle, get_room_key(room)); @@ -306,16 +317,20 @@ join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE } extern int -check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); +check_tunnel_message (void *cls, + const struct GNUNET_MessageHeader *header); extern void -handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); +handle_tunnel_message (void *cls, + const struct GNUNET_MessageHeader *header); extern void -callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channel); +callback_tunnel_disconnect (void *cls, + const struct GNUNET_CADET_Channel *channel); int -open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) +open_room (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle) { GNUNET_assert((room) && (handle)); @@ -366,7 +381,8 @@ exit_open_room: } int -enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, +enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door) { GNUNET_assert((room) && (handle) && (door)); @@ -404,8 +420,11 @@ enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_Sr } struct GNUNET_MQ_Envelope* -pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, - struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode) +pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_MESSENGER_SrvHandle *handle, + struct GNUNET_MESSENGER_Message *message, + struct GNUNET_HashCode *hash, + int mode) { GNUNET_assert((room) && (handle) && (message) && (hash)); @@ -432,7 +451,9 @@ struct GNUNET_MESSENGER_ClosureSendRoom }; static int -iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, void *value) +iterate_send_room_message (void *cls, + const struct GNUNET_PeerIdentity *key, + void *value) { struct GNUNET_MESSENGER_SrvTunnel *tunnel = value; @@ -466,14 +487,18 @@ iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, voi int update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, - struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); + struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); void -callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); int -send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, +send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Message *message) { GNUNET_assert((room) && (handle)); @@ -530,8 +555,10 @@ send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE } void -forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { GNUNET_assert((room) && (tunnel)); @@ -554,7 +581,8 @@ forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE } void -check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel) +check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel) { if (!room->peer_message) return; @@ -592,7 +620,8 @@ resend_peer_message: } void -merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) +merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle) { GNUNET_assert(room); @@ -612,7 +641,8 @@ merge_next: } void -callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) +callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_HashCode *hash) { if (GNUNET_OK != delete_store_message (get_room_message_store(room), hash)) { @@ -622,7 +652,8 @@ callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUN } void -callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) +callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_HashCode *hash) { if (!room->host) return; @@ -631,8 +662,10 @@ callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ } int -delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) +delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_HashCode *hash, + const struct GNUNET_TIME_Relative delay) { GNUNET_assert((room) && (session) && (hash)); @@ -687,7 +720,8 @@ get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room) } const struct GNUNET_MESSENGER_SrvTunnel* -get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer) +get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_PeerIdentity *peer) { GNUNET_assert((room) && (peer)); @@ -695,9 +729,11 @@ get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNE } static int -request_room_message_step (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, +request_room_message_step (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_MemberSession *session, - GNUNET_MESSENGER_MessageRequestCallback callback, void* cls) + GNUNET_MESSENGER_MessageRequestCallback callback, + void* cls) { struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); @@ -732,9 +768,11 @@ forward: } int -request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, +request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_MemberSession *session, - GNUNET_MESSENGER_MessageRequestCallback callback, void* cls) + GNUNET_MESSENGER_MessageRequestCallback callback, + void* cls) { GNUNET_assert((room) && (hash)); @@ -747,7 +785,8 @@ request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET } void -callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls) +callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, + void *cls) { struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; @@ -766,8 +805,10 @@ callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls) } int -callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, - struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash) +callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + void *cls, + struct GNUNET_MESSENGER_Message *message, + struct GNUNET_HashCode *hash) { if (GNUNET_MESSENGER_KIND_UNKNOWN == message->header.kind) { @@ -826,8 +867,10 @@ idle_request_room_messages (void *cls) } void -solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key, - const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp) +solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_IDENTITY_PublicKey *public_key, + const struct GNUNET_ShortHashCode *member_id, + struct GNUNET_TIME_Absolute timestamp) { GNUNET_assert ((room) && (public_key) && (member_id)); @@ -945,7 +988,8 @@ finish_handling: int update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, - struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) + struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { GNUNET_assert((room) && (message) && (hash)); @@ -1008,7 +1052,8 @@ struct GNUNET_MESSENGER_MemberUpdate }; static int -iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, +iterate_update_member_sessions (void *cls, + const struct GNUNET_IDENTITY_PublicKey *public_key, struct GNUNET_MESSENGER_MemberSession *session) { struct GNUNET_MESSENGER_MemberUpdate *update = cls; @@ -1030,11 +1075,14 @@ iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKe } static void -remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session); +remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session); void -callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); @@ -1113,7 +1161,8 @@ callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUN } static void -get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom *room, char **dir) +get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom *room, + char **dir) { GNUNET_assert((room) && (dir)); @@ -1178,7 +1227,8 @@ save_room (struct GNUNET_MESSENGER_SrvRoom *room) } static void -remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session) +remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session) { GNUNET_assert ((room) && (session)); diff --git a/src/messenger/gnunet-service-messenger_room.h b/src/messenger/gnunet-service-messenger_room.h index 31ec877af..4b3811104 100644 --- a/src/messenger/gnunet-service-messenger_room.h +++ b/src/messenger/gnunet-service-messenger_room.h @@ -89,7 +89,8 @@ struct GNUNET_MESSENGER_SrvRoom * @return New room */ struct GNUNET_MESSENGER_SrvRoom* -create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); +create_room (struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_HashCode *key); /** * Destroys a room and frees its memory fully. @@ -139,7 +140,8 @@ get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room); * @return #GNUNET_YES on success, #GNUNET_NO on failure. */ int -open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); +open_room (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle); /** * Connects a tunnel to a hosting peer of a room through a so called door which is represented by @@ -152,7 +154,8 @@ open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHan * @return #GNUNET_YES on success, #GNUNET_NO on failure. */ int -enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, +enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door); /** @@ -173,8 +176,11 @@ enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_Sr * @return New envelope or NULL */ struct GNUNET_MQ_Envelope* -pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, - struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode); +pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_MESSENGER_SrvHandle *handle, + struct GNUNET_MESSENGER_Message *message, + struct GNUNET_HashCode *hash, + int mode); /** * Sends a message from a given handle into a room. The hash parameter will be @@ -192,7 +198,8 @@ pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNU * @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise. */ int -send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, +send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Message *message); /** @@ -204,8 +211,10 @@ send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE * @param[in] hash Hash of message */ void -forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, - struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Checks the current state of opening a given room from this peer and re-publishes it @@ -216,7 +225,8 @@ forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE * @param[in/out] tunnel Tunnel */ void -check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel); +check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvTunnel *tunnel); /** * Reduces all current forks inside of the message history of a room to one remaining last message @@ -226,7 +236,8 @@ check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MES * @param[in/out] handle Handle */ void -merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); +merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle); /** * Deletes a message from the room with a given hash in a specific delay if @@ -239,8 +250,10 @@ merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_M * @return #GNUNET_YES on success, #GNUNET_NO if permission gets denied, #GNUNET_SYSERR on operation failure */ int -delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay); +delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_MemberSession *session, + const struct GNUNET_HashCode *hash, + const struct GNUNET_TIME_Relative delay); /** * Returns the CADET handle from a rooms service. @@ -269,7 +282,8 @@ get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room); * @return Tunnel or NULL */ const struct GNUNET_MESSENGER_SrvTunnel* -get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer); +get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_PeerIdentity *peer); /** * Method called whenever a message is found during a request in a room. @@ -280,7 +294,8 @@ get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNE * @param[in] hash Hash of message */ typedef void (GNUNET_MESSENGER_MessageRequestCallback) ( - void *cls, struct GNUNET_MESSENGER_SrvRoom *room, + void *cls, + struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash ); @@ -301,9 +316,11 @@ typedef void (GNUNET_MESSENGER_MessageRequestCallback) ( * @return #GNUNET_YES if the request could be processed, otherwise #GNUNET_NO */ int -request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, +request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_MemberSession *session, - GNUNET_MESSENGER_MessageRequestCallback callback, void* cls); + GNUNET_MESSENGER_MessageRequestCallback callback, + void* cls); /** * Checks for potential collisions with member ids and solves them changing active handles ids if they @@ -315,8 +332,10 @@ request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET * @param[in] timestamp Timestamp */ void -solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key, - const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp); +solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_IDENTITY_PublicKey *public_key, + const struct GNUNET_ShortHashCode *member_id, + struct GNUNET_TIME_Absolute timestamp); /** * Rebuilds the decentralized structure for a room by ensuring all required connections are made diff --git a/src/messenger/gnunet-service-messenger_service.c b/src/messenger/gnunet-service-messenger_service.c index 8c63e9bf4..91165cf63 100644 --- a/src/messenger/gnunet-service-messenger_service.c +++ b/src/messenger/gnunet-service-messenger_service.c @@ -41,7 +41,8 @@ callback_shutdown_service (void *cls) } struct GNUNET_MESSENGER_Service* -create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle) +create_service (const struct GNUNET_CONFIGURATION_Handle *config, + struct GNUNET_SERVICE_Handle *service_handle) { GNUNET_assert((config) && (service_handle)); @@ -88,7 +89,9 @@ create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_ } static int -iterate_destroy_rooms (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_rooms (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_SrvRoom *room = value; destroy_room (room); @@ -151,7 +154,8 @@ get_service_contact_store (struct GNUNET_MESSENGER_Service *service) } struct GNUNET_MESSENGER_SrvHandle* -add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) +add_service_handle (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MQ_Handle *mq) { GNUNET_assert((service) && (mq)); @@ -166,7 +170,8 @@ add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_H } void -remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle) +remove_service_handle (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvHandle *handle) { GNUNET_assert((service) && (handle)); @@ -178,7 +183,8 @@ remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_M } int -get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer) +get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, + struct GNUNET_PeerIdentity *peer) { GNUNET_assert((service) && (peer)); @@ -186,7 +192,8 @@ get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struc } struct GNUNET_MESSENGER_SrvRoom* -get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key) +get_service_room (const struct GNUNET_MESSENGER_Service *service, + const struct GNUNET_HashCode *key) { GNUNET_assert((service) && (key)); @@ -194,7 +201,8 @@ get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct G } int -open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, +open_service_room (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) { GNUNET_assert((service) && (handle) && (key)); @@ -217,8 +225,10 @@ open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSE } int -entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) +entry_service_room (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_PeerIdentity *door, + const struct GNUNET_HashCode *key) { GNUNET_assert((service) && (handle) && (door) && (key)); @@ -250,7 +260,8 @@ entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS } int -close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, +close_service_room (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) { GNUNET_assert((service) && (handle) && (key)); @@ -290,9 +301,11 @@ close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS } void -handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, +handle_service_message (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { GNUNET_assert((service) && (room) && (session) && (message) && (hash)); diff --git a/src/messenger/gnunet-service-messenger_service.h b/src/messenger/gnunet-service-messenger_service.h index aa43fa457..d364a93c0 100644 --- a/src/messenger/gnunet-service-messenger_service.h +++ b/src/messenger/gnunet-service-messenger_service.h @@ -68,7 +68,8 @@ struct GNUNET_MESSENGER_Service * @return New service */ struct GNUNET_MESSENGER_Service* -create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle); +create_service (const struct GNUNET_CONFIGURATION_Handle *config, + struct GNUNET_SERVICE_Handle *service_handle); /** * Destroys a service and frees its memory fully. @@ -104,7 +105,8 @@ get_service_contact_store (struct GNUNET_MESSENGER_Service *service); * @return New handle */ struct GNUNET_MESSENGER_SrvHandle* -add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq); +add_service_handle (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MQ_Handle *mq); /** * Removes a handle from a service and destroys it. @@ -113,7 +115,8 @@ add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_H * @param[in/out] handle Handle */ void -remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle); +remove_service_handle (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvHandle *handle); /** * Tries to write the peer identity of the peer running a service on to the peer @@ -124,7 +127,8 @@ remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_M * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR */ int -get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer); +get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, + struct GNUNET_PeerIdentity *peer); /** * Returns the room identified by a given key for a service. If the service doesn't know any room @@ -135,7 +139,8 @@ get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struc * @return Room or NULL */ struct GNUNET_MESSENGER_SrvRoom* -get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key); +get_service_room (const struct GNUNET_MESSENGER_Service *service, + const struct GNUNET_HashCode *key); /** * Tries to open a room using a given key for a service by a specific handle. The room will be @@ -147,7 +152,8 @@ get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct G * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, +open_service_room (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); /** @@ -164,8 +170,10 @@ open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSE * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); +entry_service_room (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_PeerIdentity *door, + const struct GNUNET_HashCode *key); /** * Tries to close a room using a given key for a service by a specific handle. The room will @@ -180,7 +188,8 @@ entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, +close_service_room (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); /** @@ -194,8 +203,10 @@ close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS * @param[in] hash Hash of message */ void -handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, +handle_service_message (struct GNUNET_MESSENGER_Service *service, + struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_MemberSession *session, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); #endif //GNUNET_SERVICE_MESSENGER_SERVICE_H diff --git a/src/messenger/gnunet-service-messenger_tunnel.c b/src/messenger/gnunet-service-messenger_tunnel.c index b9d063813..fdd6429e6 100644 --- a/src/messenger/gnunet-service-messenger_tunnel.c +++ b/src/messenger/gnunet-service-messenger_tunnel.c @@ -33,7 +33,8 @@ #include "messenger_api_util.h" struct GNUNET_MESSENGER_SrvTunnel* -create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door) +create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_PeerIdentity *door) { GNUNET_assert((room) && (door)); @@ -72,7 +73,8 @@ destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel) } void -bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel) +bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_CADET_Channel *channel) { GNUNET_assert(tunnel); @@ -83,10 +85,12 @@ bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Chan } extern void -callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls); +callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, + void *cls); void -callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channel) +callback_tunnel_disconnect (void *cls, + const struct GNUNET_CADET_Channel *channel) { struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; @@ -99,11 +103,14 @@ callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channe } extern int -callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, - struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash); +callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, + void *cls, + struct GNUNET_MESSENGER_Message *message, + struct GNUNET_HashCode *hash); int -check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header) +check_tunnel_message (void *cls, + const struct GNUNET_MessageHeader *header) { struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; @@ -137,14 +144,18 @@ check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header) extern int update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, - struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); + struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); extern void -callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, + struct GNUNET_MESSENGER_SrvHandle *handle, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); static void -update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_HashCode *hash) +update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_HashCode *hash) { struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(tunnel->room); @@ -281,7 +292,8 @@ callback_tunnel_sent (void *cls) } void -send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, +send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_MQ_Envelope *env, const struct GNUNET_HashCode *hash) { GNUNET_assert((tunnel) && (env) && (hash)); @@ -299,7 +311,9 @@ send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_M } int -send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message) +send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + void *handle, + struct GNUNET_MESSENGER_Message *message) { GNUNET_assert((tunnel) && (handle)); @@ -325,7 +339,8 @@ send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, st } void -forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, +forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) { GNUNET_assert((tunnel) && (message) && (hash)); @@ -353,7 +368,8 @@ get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel) } void -get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer) +get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_PeerIdentity *peer) { GNUNET_assert(tunnel); @@ -369,7 +385,8 @@ get_tunnel_messenger_version (const struct GNUNET_MESSENGER_SrvTunnel *tunnel) } int -update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version) +update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + uint32_t version) { GNUNET_assert(tunnel); diff --git a/src/messenger/gnunet-service-messenger_tunnel.h b/src/messenger/gnunet-service-messenger_tunnel.h index 96d98546d..7bd749281 100644 --- a/src/messenger/gnunet-service-messenger_tunnel.h +++ b/src/messenger/gnunet-service-messenger_tunnel.h @@ -55,7 +55,8 @@ struct GNUNET_MESSENGER_SrvTunnel * @return New tunnel */ struct GNUNET_MESSENGER_SrvTunnel* -create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door); +create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, + const struct GNUNET_PeerIdentity *door); /** * Destroys a tunnel and frees its memory fully. @@ -73,7 +74,8 @@ destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); * @param[in/out] channel CADET channel */ void -bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel); +bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_CADET_Channel *channel); /** * Tries to connect a tunnel by creating a new CADET channel and binding it. @@ -112,7 +114,8 @@ is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel); * @param[in] hash Hash of message */ void -send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, +send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_MQ_Envelope *env, const struct GNUNET_HashCode *hash); /** @@ -126,7 +129,9 @@ send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_M * @return #GNUNET_YES on success, GNUNET_NO otherwise */ int -send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message); +send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + void *handle, + struct GNUNET_MESSENGER_Message *message); /** * Forwards a given message with a known hash through a tunnel. @@ -136,7 +141,8 @@ send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, st * @param[in] hash Hash of message */ void -forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, +forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); /** @@ -158,7 +164,8 @@ get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel); * @param[out] peer Peer identity */ void -get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer); +get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, + struct GNUNET_PeerIdentity *peer); /** * Returns the current messenger version the peer connected via a given tunnel @@ -181,6 +188,7 @@ get_tunnel_messenger_version (const struct GNUNET_MESSENGER_SrvTunnel *tunnel); * @param[in] version Version of messenger */ int -update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version); +update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, + uint32_t version); #endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H diff --git a/src/messenger/messenger_api.c b/src/messenger/messenger_api.c index f7c73f769..ef6244e19 100644 --- a/src/messenger/messenger_api.c +++ b/src/messenger/messenger_api.c @@ -70,14 +70,16 @@ GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind) } static int -check_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) +check_get_name (void *cls, + const struct GNUNET_MESSENGER_NameMessage *msg) { GNUNET_MQ_check_zero_termination(msg); return GNUNET_OK; } static void -handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) +handle_get_name (void *cls, + const struct GNUNET_MESSENGER_NameMessage *msg) { struct GNUNET_MESSENGER_Handle *handle = cls; @@ -89,7 +91,8 @@ handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) } static int -check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) +check_get_key (void *cls, + const struct GNUNET_MESSENGER_KeyMessage *msg) { const uint16_t full_length = ntohs (msg->header.size); @@ -107,7 +110,8 @@ check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) } static void -handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) +handle_get_key (void *cls, + const struct GNUNET_MESSENGER_KeyMessage *msg) { struct GNUNET_MESSENGER_Handle *handle = cls; @@ -129,7 +133,8 @@ handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) } static void -handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg) +handle_member_id (void *cls, + const struct GNUNET_MESSENGER_MemberMessage *msg) { struct GNUNET_MESSENGER_Handle *handle = cls; @@ -150,7 +155,8 @@ handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg) } static void -handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) +handle_room_open (void *cls, + const struct GNUNET_MESSENGER_RoomMessage *msg) { struct GNUNET_MESSENGER_Handle *handle = cls; @@ -162,7 +168,8 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) } static void -handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) +handle_room_entry (void *cls, + const struct GNUNET_MESSENGER_RoomMessage *msg) { struct GNUNET_MESSENGER_Handle *handle = cls; @@ -175,7 +182,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) } static void -handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) +handle_room_close (void *cls, + const struct GNUNET_MESSENGER_RoomMessage *msg) { struct GNUNET_MESSENGER_Handle *handle = cls; @@ -187,7 +195,8 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) } static int -check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) +check_recv_message (void *cls, + const struct GNUNET_MESSENGER_RecvMessage *msg) { const uint16_t full_length = ntohs (msg->header.size); @@ -209,7 +218,8 @@ check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) } static void -handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) +handle_recv_message (void *cls, + const struct GNUNET_MESSENGER_RecvMessage *msg) { struct GNUNET_MESSENGER_Handle *handle = cls; @@ -255,7 +265,8 @@ static void reconnect (struct GNUNET_MESSENGER_Handle *handle); static void -send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) +send_open_room (struct GNUNET_MESSENGER_Handle *handle, + struct GNUNET_MESSENGER_Room *room) { struct GNUNET_MESSENGER_RoomMessage *msg; struct GNUNET_MQ_Envelope *env; @@ -266,7 +277,8 @@ send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_ } static void -send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, +send_enter_room (struct GNUNET_MESSENGER_Handle *handle, + struct GNUNET_MESSENGER_Room *room, const struct GNUNET_PeerIdentity *door) { struct GNUNET_MESSENGER_RoomMessage *msg; @@ -279,7 +291,8 @@ send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER } static void -send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room) +send_close_room (struct GNUNET_MESSENGER_Handle *handle, + struct GNUNET_MESSENGER_Room *room) { struct GNUNET_MESSENGER_RoomMessage *msg; struct GNUNET_MQ_Envelope *env; @@ -290,7 +303,9 @@ send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER } static int -iterate_reset_room (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_reset_room (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_Handle *handle = cls; struct GNUNET_MESSENGER_Room *room = value; @@ -329,7 +344,9 @@ callback_reconnect (void *cls) } static int -iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_close_room (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_Handle *handle = cls; struct GNUNET_MESSENGER_Room *room = value; @@ -340,7 +357,8 @@ iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value) } static void -callback_mq_error (void *cls, enum GNUNET_MQ_Error error) +callback_mq_error (void *cls, + enum GNUNET_MQ_Error error) { struct GNUNET_MESSENGER_Handle *handle = cls; @@ -402,9 +420,12 @@ reconnect (struct GNUNET_MESSENGER_Handle *handle) } struct GNUNET_MESSENGER_Handle* -GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, - GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, - GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) +GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, + const char *name, + GNUNET_MESSENGER_IdentityCallback identity_callback, + void *identity_cls, + GNUNET_MESSENGER_MessageCallback msg_callback, + void *msg_cls) { struct GNUNET_MESSENGER_Handle *handle = create_handle (cfg, identity_callback, identity_cls, msg_callback, msg_cls); @@ -475,7 +496,8 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle) } int -GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) +GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, + const char *name) { if (!handle) return GNUNET_SYSERR; @@ -517,7 +539,8 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle) } struct GNUNET_MESSENGER_Room* -GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) +GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key) { if ((!handle) || (!key)) return NULL; @@ -541,7 +564,8 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct } struct GNUNET_MESSENGER_Room* -GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, +GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) { if ((!handle) || (!door) || (!key)) @@ -583,7 +607,9 @@ struct GNUNET_MESSENGER_RoomFind }; static int -iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value) +iterate_find_room (void* cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_RoomFind *find = cls; struct GNUNET_MESSENGER_Room *room = value; @@ -602,8 +628,10 @@ iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value) } int -GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, - GNUNET_MESSENGER_MemberCallback callback, void *cls) +GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_MESSENGER_Contact *contact, + GNUNET_MESSENGER_MemberCallback callback, + void *cls) { if (!handle) return GNUNET_SYSERR; @@ -628,7 +656,8 @@ GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room) } const struct GNUNET_MESSENGER_Contact* -GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) +GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_HashCode *hash) { if ((!room) || (!hash)) return NULL; @@ -655,7 +684,8 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact } void -GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, +GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_Contact *contact) { if ((!room) || (!message)) @@ -723,7 +753,8 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct } const struct GNUNET_MESSENGER_Message* -GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) +GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_HashCode *hash) { if ((!room) || (!hash)) return NULL; @@ -745,7 +776,8 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const st } int -GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, +GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, + GNUNET_MESSENGER_MemberCallback callback, void *cls) { if (!room) diff --git a/src/messenger/messenger_api_contact.c b/src/messenger/messenger_api_contact.c index 04e1f60c1..cbca17640 100644 --- a/src/messenger/messenger_api_contact.c +++ b/src/messenger/messenger_api_contact.c @@ -60,7 +60,8 @@ get_contact_name (const struct GNUNET_MESSENGER_Contact *contact) } void -set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name) +set_contact_name (struct GNUNET_MESSENGER_Contact *contact, + const char *name) { GNUNET_assert(contact); @@ -98,7 +99,8 @@ decrease_contact_rc (struct GNUNET_MESSENGER_Contact *contact) } void -get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, +get_context_from_member (const struct GNUNET_HashCode *key, + const struct GNUNET_ShortHashCode *id, struct GNUNET_HashCode *context) { GNUNET_assert((key) && (id) && (context)); diff --git a/src/messenger/messenger_api_contact.h b/src/messenger/messenger_api_contact.h index e94d1fcd0..b5410f998 100644 --- a/src/messenger/messenger_api_contact.h +++ b/src/messenger/messenger_api_contact.h @@ -71,7 +71,8 @@ get_contact_name (const struct GNUNET_MESSENGER_Contact *contact); * @param[in] name Name */ void -set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name); +set_contact_name (struct GNUNET_MESSENGER_Contact *contact, + const char *name); /** * Returns the public key of a given contact. @@ -108,7 +109,8 @@ decrease_contact_rc (struct GNUNET_MESSENGER_Contact *contact); * @param[out] hash Member context */ void -get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, +get_context_from_member (const struct GNUNET_HashCode *key, + const struct GNUNET_ShortHashCode *id, struct GNUNET_HashCode *context); #endif //GNUNET_MESSENGER_API_CONTACT_H diff --git a/src/messenger/messenger_api_contact_store.c b/src/messenger/messenger_api_contact_store.c index 6a517c2e0..1c10a8fbf 100644 --- a/src/messenger/messenger_api_contact_store.c +++ b/src/messenger/messenger_api_contact_store.c @@ -38,7 +38,9 @@ init_contact_store (struct GNUNET_MESSENGER_ContactStore *store) } static int -iterate_destroy_contacts (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_contacts (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_Contact *contact = value; destroy_contact (contact); @@ -58,7 +60,8 @@ clear_contact_store (struct GNUNET_MESSENGER_ContactStore *store) } static struct GNUNET_CONTAINER_MultiHashMap* -select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, +select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, + const struct GNUNET_HashCode *context, struct GNUNET_HashCode *hash) { const struct GNUNET_IDENTITY_PublicKey *anonymous = get_anonymous_public_key (); @@ -76,7 +79,8 @@ select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, const str } struct GNUNET_MESSENGER_Contact* -get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, +get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, + const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *key_hash) { GNUNET_assert ((store) && (store->contacts) && (context) && (key_hash)); @@ -92,7 +96,8 @@ get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct } struct GNUNET_MESSENGER_Contact* -get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, +get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, + const struct GNUNET_HashCode *context, const struct GNUNET_IDENTITY_PublicKey *pubkey) { GNUNET_assert ((store) && (store->contacts) && (context) && (pubkey)); @@ -130,8 +135,10 @@ get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNU } void -update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, - const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context, +update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, + struct GNUNET_MESSENGER_Contact* contact, + const struct GNUNET_HashCode *context, + const struct GNUNET_HashCode *next_context, const struct GNUNET_IDENTITY_PublicKey *pubkey) { GNUNET_assert ((store) && (store->contacts) && (contact) && (pubkey)); @@ -163,7 +170,8 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET } void -remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, +remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, + struct GNUNET_MESSENGER_Contact* contact, const struct GNUNET_HashCode *context) { GNUNET_assert ((store) && (store->contacts) && (contact)); diff --git a/src/messenger/messenger_api_contact_store.h b/src/messenger/messenger_api_contact_store.h index f2dad9f84..bdab2ceeb 100644 --- a/src/messenger/messenger_api_contact_store.h +++ b/src/messenger/messenger_api_contact_store.h @@ -68,7 +68,8 @@ clear_contact_store (struct GNUNET_MESSENGER_ContactStore *store); * @param[in] key_hash Hash of public key */ struct GNUNET_MESSENGER_Contact* -get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, +get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, + const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *key_hash); /** @@ -87,7 +88,8 @@ get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct * @param[in] pubkey Public key of EGO */ struct GNUNET_MESSENGER_Contact* -get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, +get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, + const struct GNUNET_HashCode *context, const struct GNUNET_IDENTITY_PublicKey *pubkey); /** @@ -103,8 +105,10 @@ get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNU * @param[in] pubkey Public key of EGO */ void -update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, - const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context, +update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, + struct GNUNET_MESSENGER_Contact* contact, + const struct GNUNET_HashCode *context, + const struct GNUNET_HashCode *next_context, const struct GNUNET_IDENTITY_PublicKey *pubkey); /** @@ -116,7 +120,8 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET * @param[in] context Member context */ void -remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, +remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, + struct GNUNET_MESSENGER_Contact* contact, const struct GNUNET_HashCode *context); #endif //GNUNET_MESSENGER_API_CONTACT_STORE_H diff --git a/src/messenger/messenger_api_handle.c b/src/messenger/messenger_api_handle.c index ab57f82cc..516807e13 100644 --- a/src/messenger/messenger_api_handle.c +++ b/src/messenger/messenger_api_handle.c @@ -28,8 +28,11 @@ #include "messenger_api_util.h" struct GNUNET_MESSENGER_Handle* -create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, - void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) +create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_MESSENGER_IdentityCallback identity_callback, + void *identity_cls, + GNUNET_MESSENGER_MessageCallback msg_callback, + void *msg_cls) { GNUNET_assert(cfg); @@ -58,7 +61,9 @@ create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_I } static int -iterate_destroy_room (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_room (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_Room *room = value; @@ -97,7 +102,8 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle) } void -set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) +set_handle_name (struct GNUNET_MESSENGER_Handle *handle, + const char *name) { GNUNET_assert(handle); @@ -116,7 +122,8 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle *handle) } void -set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey) +set_handle_key (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_IDENTITY_PublicKey *pubkey) { GNUNET_assert(handle); @@ -146,7 +153,8 @@ get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle) } struct GNUNET_MESSENGER_Contact* -get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) +get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); @@ -162,7 +170,8 @@ get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_ } void -open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) +open_handle_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); @@ -173,7 +182,8 @@ open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_Ha } void -entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, +entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (door) && (key)); @@ -185,7 +195,8 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE } void -close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) +close_handle_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); diff --git a/src/messenger/messenger_api_handle.h b/src/messenger/messenger_api_handle.h index e6ca474f2..6a43f13a6 100644 --- a/src/messenger/messenger_api_handle.h +++ b/src/messenger/messenger_api_handle.h @@ -71,8 +71,11 @@ struct GNUNET_MESSENGER_Handle * @return New handle */ struct GNUNET_MESSENGER_Handle* -create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, - void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls); +create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, + GNUNET_MESSENGER_IdentityCallback identity_callback, + void *identity_cls, + GNUNET_MESSENGER_MessageCallback msg_callback, + void *msg_cls); /** * Destroys a handle and frees its memory fully from the client API. @@ -89,7 +92,8 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle); * @param[in] name New name */ void -set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); +set_handle_name (struct GNUNET_MESSENGER_Handle *handle, + const char *name); /** * Returns the current name of a given handle or NULL if no valid name was assigned yet. @@ -107,7 +111,8 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle *handle); * @param[in] pubkey Public key */ void -set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey); +set_handle_key (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_IDENTITY_PublicKey *pubkey); /** * Returns the public key of a given handle. @@ -136,7 +141,8 @@ get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle); * @return Contact */ struct GNUNET_MESSENGER_Contact* -get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); +get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key); /** * Marks a room known to a handle identified by a given key as open. @@ -145,7 +151,8 @@ get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_ * @param[in] key Key of room */ void -open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); +open_handle_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key); /** * Adds a tunnel for a room known to a handle identified by a given key to a @@ -156,7 +163,8 @@ open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_Ha * @param[in] key Key of room */ void -entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, +entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); /** @@ -166,6 +174,7 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE * @param[in] key Key of room */ void -close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); +close_handle_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key); #endif //GNUNET_MESSENGER_API_HANDLE_H diff --git a/src/messenger/messenger_api_list_tunnels.c b/src/messenger/messenger_api_list_tunnels.c index 990e36878..7e77d8f2f 100644 --- a/src/messenger/messenger_api_list_tunnels.c +++ b/src/messenger/messenger_api_list_tunnels.c @@ -53,14 +53,16 @@ clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels) } static int -compare_list_tunnels (void *cls, struct GNUNET_MESSENGER_ListTunnel *element0, +compare_list_tunnels (void *cls, + struct GNUNET_MESSENGER_ListTunnel *element0, struct GNUNET_MESSENGER_ListTunnel *element1) { return ((int) element0->peer) - ((int) element1->peer); } void -add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) +add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const struct GNUNET_PeerIdentity *peer) { GNUNET_assert((tunnels) && (peer)); @@ -73,7 +75,9 @@ add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct } struct GNUNET_MESSENGER_ListTunnel* -find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index) +find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const struct GNUNET_PeerIdentity *peer, + size_t *index) { GNUNET_assert((tunnels) && (peer)); @@ -98,7 +102,8 @@ find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GN } int -contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) +contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const struct GNUNET_PeerIdentity *peer) { GNUNET_assert((tunnels) && (peer)); @@ -106,7 +111,8 @@ contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struc } struct GNUNET_MESSENGER_ListTunnel* -remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element) +remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + struct GNUNET_MESSENGER_ListTunnel *element) { GNUNET_assert((tunnels) && (element)); @@ -120,7 +126,8 @@ remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct G } void -load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) +load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const char *path) { GNUNET_assert((tunnels) && (path)); @@ -154,7 +161,8 @@ load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *pat } void -save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) +save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const char *path) { GNUNET_assert((tunnels) && (path)); diff --git a/src/messenger/messenger_api_list_tunnels.h b/src/messenger/messenger_api_list_tunnels.h index c952da3c2..0e086ee5e 100644 --- a/src/messenger/messenger_api_list_tunnels.h +++ b/src/messenger/messenger_api_list_tunnels.h @@ -67,7 +67,8 @@ clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); * @param[in] peer Peer identity of tunnel */ void -add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); +add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const struct GNUNET_PeerIdentity *peer); /** * Searches linearly through the list of tunnels peer identities for matching a @@ -85,7 +86,9 @@ add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct * @return Element in the list with matching peer identity */ struct GNUNET_MESSENGER_ListTunnel* -find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index); +find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const struct GNUNET_PeerIdentity *peer, + size_t *index); /** * Tests linearly if the list of tunnels peer identities contains a specific @@ -96,7 +99,8 @@ find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GN * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); +contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const struct GNUNET_PeerIdentity *peer); /** * Removes a specific element from the list of tunnels peer identities and returns @@ -107,7 +111,8 @@ contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struc * @return Next element in the list */ struct GNUNET_MESSENGER_ListTunnel* -remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element); +remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + struct GNUNET_MESSENGER_ListTunnel *element); /** * Loads the list of tunnels peer identities from a file under a given path. @@ -116,7 +121,8 @@ remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct G * @param[in] path Path of file */ void -load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path); +load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const char *path); /** * Saves the list of tunnels peer identities to a file under a given path. @@ -125,6 +131,7 @@ load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *pat * @param[in] path Path of file */ void -save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path); +save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, + const char *path); #endif //GNUNET_MESSENGER_API_LIST_TUNNELS_H diff --git a/src/messenger/messenger_api_message.c b/src/messenger/messenger_api_message.c index c7364d51c..05bf654fb 100644 --- a/src/messenger/messenger_api_message.c +++ b/src/messenger/messenger_api_message.c @@ -103,7 +103,8 @@ copy_message (const struct GNUNET_MESSENGER_Message *message) } static void -destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind, struct GNUNET_MESSENGER_MessageBody *body) +destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind, + struct GNUNET_MESSENGER_MessageBody *body) { switch (kind) { @@ -150,7 +151,8 @@ is_message_session_bound (const struct GNUNET_MESSENGER_Message *message) } static void -fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_ShortMessage *shortened) +fold_short_message (const struct GNUNET_MESSENGER_Message *message, + struct GNUNET_MESSENGER_ShortMessage *shortened) { shortened->kind = message->header.kind; @@ -158,7 +160,8 @@ fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNE } static void -unfold_short_message (struct GNUNET_MESSENGER_ShortMessage *shortened, struct GNUNET_MESSENGER_Message *message) +unfold_short_message (struct GNUNET_MESSENGER_ShortMessage *shortened, + struct GNUNET_MESSENGER_Message *message) { destroy_message_body (message->header.kind, &(message->body)); @@ -231,7 +234,8 @@ get_message_kind_size (enum GNUNET_MESSENGER_MessageKind kind) } static uint16_t -get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body) +get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind, + const struct GNUNET_MESSENGER_MessageBody *body) { uint16_t length = 0; @@ -283,7 +287,8 @@ get_message_size (const struct GNUNET_MESSENGER_Message *message, } static uint16_t -get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message, int include_body) +get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message, + int include_body) { const uint16_t minimum_size = sizeof(struct GNUNET_HashCode) + sizeof(kind_t); @@ -370,8 +375,11 @@ calc_padded_length (uint16_t length) } while (0) static void -encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body, - uint16_t length, char *buffer, uint16_t offset) +encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, + const struct GNUNET_MESSENGER_MessageBody *body, + uint16_t length, + char *buffer, + uint16_t offset) { uint32_t version; switch (kind) @@ -445,7 +453,9 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET } void -encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, +encode_message (const struct GNUNET_MESSENGER_Message *message, + uint16_t length, + char *buffer, int include_signature) { GNUNET_assert((message) && (buffer)); @@ -466,7 +476,9 @@ encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, } static void -encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, char *buffer) +encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, + uint16_t length, + char *buffer) { struct GNUNET_HashCode hash; uint16_t offset = sizeof(hash); @@ -512,8 +524,11 @@ encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint1 } while (0) static uint16_t -decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESSENGER_MessageBody *body, - uint16_t length, const char *buffer, uint16_t offset) +decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, + struct GNUNET_MESSENGER_MessageBody *body, + uint16_t length, + const char *buffer, + uint16_t offset) { uint16_t padding = 0; @@ -593,8 +608,11 @@ decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESS } int -decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, - int include_signature, uint16_t *padding) +decode_message (struct GNUNET_MESSENGER_Message *message, + uint16_t length, + const char *buffer, + int include_signature, + uint16_t *padding) { GNUNET_assert((message) && (buffer) && (length >= get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN))); @@ -638,7 +656,9 @@ decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const } static int -decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, const char *buffer) +decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, + uint16_t length, + const char *buffer) { struct GNUNET_HashCode expected, hash; uint16_t offset = sizeof(hash); @@ -675,7 +695,9 @@ decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t le } void -hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, +hash_message (const struct GNUNET_MESSENGER_Message *message, + uint16_t length, + const char *buffer, struct GNUNET_HashCode *hash) { GNUNET_assert((message) && (buffer) && (hash)); @@ -688,8 +710,11 @@ hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, c } void -sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, - const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Ego *ego) +sign_message (struct GNUNET_MESSENGER_Message *message, + uint16_t length, + char *buffer, + const struct GNUNET_HashCode *hash, + const struct GNUNET_MESSENGER_Ego *ego) { GNUNET_assert((message) && (buffer) && (hash) && (ego)); @@ -706,7 +731,8 @@ sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *b } int -verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, +verify_message (const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash, const struct GNUNET_IDENTITY_PublicKey *key) { GNUNET_assert((message) && (hash) && (key)); @@ -726,7 +752,8 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNU } int -encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key) +encrypt_message (struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_IDENTITY_PublicKey *key) { GNUNET_assert((message) && (key)); @@ -760,7 +787,8 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I } int -decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key) +decrypt_message (struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_IDENTITY_PrivateKey *key) { GNUNET_assert((message) && (key)); @@ -788,8 +816,10 @@ decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I } struct GNUNET_MQ_Envelope* -pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, - const struct GNUNET_MESSENGER_Ego *ego, int mode) +pack_message (struct GNUNET_MESSENGER_Message *message, + struct GNUNET_HashCode *hash, + const struct GNUNET_MESSENGER_Ego *ego, + int mode) { GNUNET_assert(message); diff --git a/src/messenger/messenger_api_message.h b/src/messenger/messenger_api_message.h index 7ce30dc92..6aebf4014 100644 --- a/src/messenger/messenger_api_message.h +++ b/src/messenger/messenger_api_message.h @@ -107,7 +107,9 @@ get_message_size (const struct GNUNET_MESSENGER_Message *message, * @param[in] encode_signature Flag to include signature */ void -encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, +encode_message (const struct GNUNET_MESSENGER_Message *message, + uint16_t length, + char *buffer, int include_signature); /** @@ -125,8 +127,11 @@ encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, - int include_signature, uint16_t *padding); +decode_message (struct GNUNET_MESSENGER_Message *message, + uint16_t length, + const char *buffer, + int include_signature, + uint16_t *padding); /** * Calculates a hash of a given buffer with a length in bytes @@ -138,7 +143,9 @@ decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const * @param[out] hash Hash */ void -hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, +hash_message (const struct GNUNET_MESSENGER_Message *message, + uint16_t length, + const char *buffer, struct GNUNET_HashCode *hash); /** @@ -152,8 +159,11 @@ hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, c * @param[in] ego EGO */ void -sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, - const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Ego *ego); +sign_message (struct GNUNET_MESSENGER_Message *message, + uint16_t length, + char *buffer, + const struct GNUNET_HashCode *hash, + const struct GNUNET_MESSENGER_Ego *ego); /** * Verifies the signature of a given message and its hash with a specific @@ -166,7 +176,8 @@ sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *b * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR */ int -verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, +verify_message (const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash, const struct GNUNET_IDENTITY_PublicKey *key); /** @@ -179,7 +190,8 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNU * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key); +encrypt_message (struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_IDENTITY_PublicKey *key); /** * Decrypts a private message using a given private key and replaces its body @@ -191,7 +203,8 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I * @return #GNUNET_YES on success, otherwise #GNUNET_NO */ int -decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key); +decrypt_message (struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_IDENTITY_PrivateKey *key); #define GNUNET_MESSENGER_PACK_MODE_ENVELOPE 0x1 #define GNUNET_MESSENGER_PACK_MODE_UNKNOWN 0x0 @@ -209,8 +222,10 @@ decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I * @return Envelope or NULL */ struct GNUNET_MQ_Envelope* -pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, - const struct GNUNET_MESSENGER_Ego *ego, int mode); +pack_message (struct GNUNET_MESSENGER_Message *message, + struct GNUNET_HashCode *hash, + const struct GNUNET_MESSENGER_Ego *ego, + int mode); /** * Returns if a specific kind of message should be sent by a client. The function returns diff --git a/src/messenger/messenger_api_room.c b/src/messenger/messenger_api_room.c index 0d9237a2e..6e2d33f48 100644 --- a/src/messenger/messenger_api_room.c +++ b/src/messenger/messenger_api_room.c @@ -28,7 +28,8 @@ #include "messenger_api_handle.h" struct GNUNET_MESSENGER_Room* -create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) +create_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key) { GNUNET_assert((handle) && (key)); @@ -49,7 +50,9 @@ create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCod } static int -iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *value) +iterate_destroy_message (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_MESSENGER_RoomMessageEntry *entry = value; @@ -83,7 +86,8 @@ destroy_room (struct GNUNET_MESSENGER_Room *room) } const struct GNUNET_MESSENGER_Message* -get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) +get_room_message (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_HashCode *hash) { GNUNET_assert((room) && (hash)); @@ -95,7 +99,8 @@ get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ } struct GNUNET_MESSENGER_Contact* -get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) +get_room_sender (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_HashCode *hash) { GNUNET_assert((room) && (hash)); @@ -107,8 +112,10 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H } static struct GNUNET_MESSENGER_Contact* -handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_join_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if (!sender) { @@ -129,8 +136,10 @@ handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER } static void -handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_leave_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if ((!sender) || (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender))) @@ -144,8 +153,10 @@ handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGE } static void -handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_name_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if (!sender) return; @@ -154,8 +165,10 @@ handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER } static void -handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_key_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if (!sender) return; @@ -169,8 +182,10 @@ handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_ } static void -handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_id_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if ((!sender) || (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender)) || @@ -188,8 +203,10 @@ handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_C } static void -handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_miss_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if ((room->contact_id) && (0 == GNUNET_memcmp(&(message->header.sender_id), room->contact_id))) { @@ -201,8 +218,10 @@ handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER } static void -handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_delete_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_CONTAINER_multihashmap_get ( room->messages, &(message->body.deletion.hash) @@ -217,8 +236,10 @@ handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENG } struct GNUNET_MESSENGER_Contact* -handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) +handle_room_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash) { if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash)) return sender; @@ -276,7 +297,9 @@ struct GNUNET_MESSENGER_MemberCall }; static int -iterate_local_members (void* cls, const struct GNUNET_ShortHashCode *key, void *value) +iterate_local_members (void* cls, + const struct GNUNET_ShortHashCode *key, + void *value) { struct GNUNET_MESSENGER_MemberCall *call = cls; struct GNUNET_MESSENGER_Contact *contact = value; @@ -285,7 +308,8 @@ iterate_local_members (void* cls, const struct GNUNET_ShortHashCode *key, void * } int -iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, +iterate_room_members (struct GNUNET_MESSENGER_Room *room, + GNUNET_MESSENGER_MemberCallback callback, void* cls) { GNUNET_assert(room); @@ -311,7 +335,9 @@ struct GNUNET_MESSENGER_MemberFind }; static int -iterate_find_member (void* cls, const struct GNUNET_ShortHashCode *key, void *value) +iterate_find_member (void* cls, + const struct GNUNET_ShortHashCode *key, + void *value) { struct GNUNET_MESSENGER_MemberFind *find = cls; struct GNUNET_MESSENGER_Contact *contact = value; @@ -326,7 +352,8 @@ iterate_find_member (void* cls, const struct GNUNET_ShortHashCode *key, void *va } int -find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact) +find_room_member (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_MESSENGER_Contact *contact) { GNUNET_assert(room); diff --git a/src/messenger/messenger_api_room.h b/src/messenger/messenger_api_room.h index 634052272..320312f0c 100644 --- a/src/messenger/messenger_api_room.h +++ b/src/messenger/messenger_api_room.h @@ -64,7 +64,8 @@ struct GNUNET_MESSENGER_Room * @return New room */ struct GNUNET_MESSENGER_Room* -create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); +create_room (struct GNUNET_MESSENGER_Handle *handle, + const struct GNUNET_HashCode *key); /** * Destroys a room and frees its memory fully from the client API. @@ -83,7 +84,8 @@ destroy_room (struct GNUNET_MESSENGER_Room *room); * @return Message or NULL */ const struct GNUNET_MESSENGER_Message* -get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); +get_room_message (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_HashCode *hash); /** * Returns a messages sender locally stored from a map for a given hash in a room. If no @@ -94,7 +96,8 @@ get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ * @return Contact of sender or NULL */ struct GNUNET_MESSENGER_Contact* -get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); +get_room_sender (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_HashCode *hash); /** * Handles a message with a given hash in a room for the client API to update @@ -110,8 +113,10 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H * @return Contact of sender */ struct GNUNET_MESSENGER_Contact* -handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); +handle_room_message (struct GNUNET_MESSENGER_Room *room, + struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash); /** * Iterates through all members of a given room to forward each of them to a selected @@ -123,7 +128,8 @@ handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER * @return Amount of members iterated */ int -iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, +iterate_room_members (struct GNUNET_MESSENGER_Room *room, + GNUNET_MESSENGER_MemberCallback callback, void* cls); /** @@ -135,6 +141,7 @@ iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_Membe * @return #GNUNET_YES if found, otherwise #GNUNET_NO */ int -find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact); +find_room_member (const struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_MESSENGER_Contact *contact); #endif //GNUNET_MESSENGER_API_ROOM_H diff --git a/src/messenger/messenger_api_util.c b/src/messenger/messenger_api_util.c index 4ad00c45e..52b4e934a 100644 --- a/src/messenger/messenger_api_util.c +++ b/src/messenger/messenger_api_util.c @@ -45,7 +45,8 @@ delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel) } int -generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members) +generate_free_member_id (struct GNUNET_ShortHashCode *id, + const struct GNUNET_CONTAINER_MultiShortmap *members) { GNUNET_assert(id); @@ -84,7 +85,8 @@ get_anonymous_public_key () } void -convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port) +convert_messenger_key_to_port(const struct GNUNET_HashCode *key, + struct GNUNET_HashCode *port) { static uint32_t version_value = 0; static struct GNUNET_HashCode version; diff --git a/src/messenger/messenger_api_util.h b/src/messenger/messenger_api_util.h index af562a1e8..af64790b6 100644 --- a/src/messenger/messenger_api_util.h +++ b/src/messenger/messenger_api_util.h @@ -51,7 +51,8 @@ delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel); * @return #GNUNET_YES on success, #GNUNET_NO on failure */ int -generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members); +generate_free_member_id (struct GNUNET_ShortHashCode *id, + const struct GNUNET_CONTAINER_MultiShortmap *members); /** * Returns the public identity key of #GNUNET_IDENTITY_ego_get_anonymous() without @@ -73,6 +74,7 @@ get_anonymous_public_key (); * @param[out] port CADET service port */ void -convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port); +convert_messenger_key_to_port(const struct GNUNET_HashCode *key, + struct GNUNET_HashCode *port); #endif //GNUNET_SERVICE_MESSENGER_UTIL_H diff --git a/src/messenger/test_messenger.c b/src/messenger/test_messenger.c index fb3e3e1bc..5784dfd82 100644 --- a/src/messenger/test_messenger.c +++ b/src/messenger/test_messenger.c @@ -100,7 +100,8 @@ static int identity_counter = 0; * @param handle Handle of messenger service */ static void -on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) +on_identity (void *cls, + struct GNUNET_MESSENGER_Handle *handle) { if (op_task) { @@ -150,7 +151,9 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) * @param peer Peer for testing */ static void -run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) +run (void *cls, + const struct GNUNET_CONFIGURATION_Handle *cfg, + struct GNUNET_TESTING_Peer *peer) { die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); @@ -168,7 +171,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TES * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL)) return 1; diff --git a/src/messenger/test_messenger_adapt.c b/src/messenger/test_messenger_adapt.c index 90e8ac28d..3230af6b7 100644 --- a/src/messenger/test_messenger_adapt.c +++ b/src/messenger/test_messenger_adapt.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 5, 1, 2, 3, 6, 7, 8, 4 }; unsigned int stages [] = { 0x21, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x21 }; diff --git a/src/messenger/test_messenger_anonymous.c b/src/messenger/test_messenger_anonymous.c index a70121a30..8cb339f0e 100644 --- a/src/messenger/test_messenger_anonymous.c +++ b/src/messenger/test_messenger_anonymous.c @@ -96,7 +96,8 @@ end_operation (void *cls) * @param handle Handle of messenger service */ static void -on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) +on_identity (void *cls, + struct GNUNET_MESSENGER_Handle *handle) { if (op_task) { @@ -144,7 +145,9 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) * @param peer Peer for testing */ static void -run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) +run (void *cls, + const struct GNUNET_CONFIGURATION_Handle *cfg, + struct GNUNET_TESTING_Peer *peer) { die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); @@ -160,7 +163,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TES * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL)) return 1; diff --git a/src/messenger/test_messenger_async_client.c b/src/messenger/test_messenger_async_client.c index 1067b9a6d..8404195dc 100644 --- a/src/messenger/test_messenger_async_client.c +++ b/src/messenger/test_messenger_async_client.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 0, 1 }; unsigned int stages [] = { 0x10, 0x20 }; diff --git a/src/messenger/test_messenger_async_p2p.c b/src/messenger/test_messenger_async_p2p.c index d827aae16..25746f7ff 100644 --- a/src/messenger/test_messenger_async_p2p.c +++ b/src/messenger/test_messenger_async_p2p.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 2, 1 }; unsigned int stages [] = { 0x30, 0x30 }; diff --git a/src/messenger/test_messenger_growth.c b/src/messenger/test_messenger_growth.c index 3781f3ee5..c3f243cbf 100644 --- a/src/messenger/test_messenger_growth.c +++ b/src/messenger/test_messenger_growth.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 }; unsigned int stages [] = { 0x01, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 }; diff --git a/src/messenger/test_messenger_ring.c b/src/messenger/test_messenger_ring.c index 07cfd0c47..777d79eb8 100644 --- a/src/messenger/test_messenger_ring.c +++ b/src/messenger/test_messenger_ring.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 8, 1, 2, 3, 4, 5, 6, 7 }; unsigned int stages [] = { 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 }; diff --git a/src/messenger/test_messenger_server.c b/src/messenger/test_messenger_server.c index 1cf2fcc27..61e96e879 100644 --- a/src/messenger/test_messenger_server.c +++ b/src/messenger/test_messenger_server.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 }; unsigned int stages [] = { 0x01, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; diff --git a/src/messenger/test_messenger_sync_client.c b/src/messenger/test_messenger_sync_client.c index 99f26b018..02d90a61d 100644 --- a/src/messenger/test_messenger_sync_client.c +++ b/src/messenger/test_messenger_sync_client.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 0, 1 }; unsigned int stages [] = { 0x01, 0x20 }; diff --git a/src/messenger/test_messenger_sync_p2p.c b/src/messenger/test_messenger_sync_p2p.c index 77ce280a1..0a900a39e 100644 --- a/src/messenger/test_messenger_sync_p2p.c +++ b/src/messenger/test_messenger_sync_p2p.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 2, 1 }; unsigned int stages [] = { 0x21, 0x21 }; diff --git a/src/messenger/test_messenger_worst_client.c b/src/messenger/test_messenger_worst_client.c index 63826631c..a3d5aafec 100644 --- a/src/messenger/test_messenger_worst_client.c +++ b/src/messenger/test_messenger_worst_client.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 0, 1 }; unsigned int stages [] = { 0x10, 0x02 }; diff --git a/src/messenger/test_messenger_worst_p2p.c b/src/messenger/test_messenger_worst_p2p.c index c89288eea..89e54cfbd 100644 --- a/src/messenger/test_messenger_worst_p2p.c +++ b/src/messenger/test_messenger_worst_p2p.c @@ -33,7 +33,8 @@ * @return 0 ok, 1 on error */ int -main (int argc, char **argv) +main (int argc, + char **argv) { unsigned int doors [] = { 2, 1 }; unsigned int stages [] = { 0x12, 0x12 }; diff --git a/src/messenger/testing_messenger_barrier.c b/src/messenger/testing_messenger_barrier.c index 618d255b7..a95ea9ef1 100644 --- a/src/messenger/testing_messenger_barrier.c +++ b/src/messenger/testing_messenger_barrier.c @@ -61,7 +61,8 @@ GNUNET_init_barrier (unsigned int requirement, } static void -exit_status (struct GNUNET_BarrierHandle *barrier, int status); +exit_status (struct GNUNET_BarrierHandle *barrier, + int status); static void cancel_barrier (void *cls) @@ -96,7 +97,8 @@ struct GNUNET_BarrierWaitHandle }; static void -exit_status (struct GNUNET_BarrierHandle *barrier, int status) +exit_status (struct GNUNET_BarrierHandle *barrier, + int status) { struct GNUNET_BarrierWaitHandle *waiting = barrier->head; while (waiting) diff --git a/src/messenger/testing_messenger_setup.c b/src/messenger/testing_messenger_setup.c index 98241fa08..3cde8c9bb 100644 --- a/src/messenger/testing_messenger_setup.c +++ b/src/messenger/testing_messenger_setup.c @@ -204,7 +204,9 @@ end_error_cb (void *cls) } static void -barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) +barrier2_wait_cb (void *cls, + struct GNUNET_BarrierWaitHandle *waiting, + int status) { struct test_peer *peer = cls; @@ -215,7 +217,9 @@ barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int statu } static void -barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) +barrier_wait_cb (void *cls, + struct GNUNET_BarrierWaitHandle *waiting, + int status) { struct test_peer *peer = cls; @@ -259,8 +263,11 @@ barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status * @param flags Flags of message */ static void -on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, - const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, +on_message (void *cls, + struct GNUNET_MESSENGER_Room *room, + const struct GNUNET_MESSENGER_Contact *sender, + const struct GNUNET_MESSENGER_Message *message, + const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags) { struct test_peer *peer = cls; @@ -340,7 +347,9 @@ second_stage (void *cls) } static void -on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, +on_peer (void *cb_cls, + struct GNUNET_TESTBED_Operation *op, + const struct GNUNET_TESTBED_PeerInformation *pinfo, const char *emsg) { struct test_peer *peer = cb_cls; @@ -396,7 +405,8 @@ on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_ * @param event Information about the event */ static void -run (void *cls, const struct GNUNET_TESTBED_EventInformation *event) +run (void *cls, + const struct GNUNET_TESTBED_EventInformation *event) { struct test_properties *properties = cls; @@ -420,7 +430,9 @@ run (void *cls, const struct GNUNET_TESTBED_EventInformation *event) } static void -barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) +barrier2_cb (void *cls, + struct GNUNET_BarrierHandle *barrier, + int status) { struct test_properties *properties = cls; @@ -449,7 +461,9 @@ barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) } static void -barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) +barrier_cb (void *cls, + struct GNUNET_BarrierHandle *barrier, + int status) { struct test_properties *properties = cls; @@ -485,8 +499,12 @@ barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) } static void -init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, - unsigned int links_succeeded, unsigned int links_failed) +init (void *cls, + struct GNUNET_TESTBED_RunHandle *h, + unsigned int num_peers, + struct GNUNET_TESTBED_Peer **peers, + unsigned int links_succeeded, + unsigned int links_failed) { struct test_properties *properties = cls; @@ -500,7 +518,8 @@ init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, str } int -GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg) +GNUNET_run_messenger_setup (const char* test_name, + const struct test_configuration *cfg) { struct test_properties properties; memset(&properties, 0, sizeof(properties)); diff --git a/src/messenger/testing_messenger_setup.h b/src/messenger/testing_messenger_setup.h index 5e6b5d461..e5ae0c151 100644 --- a/src/messenger/testing_messenger_setup.h +++ b/src/messenger/testing_messenger_setup.h @@ -34,6 +34,7 @@ struct test_configuration }; int -GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg); +GNUNET_run_messenger_setup (const char* test_name, + const struct test_configuration *cfg); #endif /* GNUNET_TESTING_MESSENGER_SETUP_H_ */ -- cgit v1.2.3