X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Frps%2Frps.h;h=f5cc2e8d10dea7083b3c213fed8e25cfd317e566;hb=0166171bb810849613164867bc3450bf5bf73a5a;hp=ad255acabaf1b4f4d3c03c7fe7fd4aefc44d32e2;hpb=9982f58b45230373960cea1fe1fb294602bdd56d;p=oweals%2Fgnunet.git diff --git a/src/rps/rps.h b/src/rps/rps.h index ad255acab..f5cc2e8d1 100644 --- a/src/rps/rps.h +++ b/src/rps/rps.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet - Copyright (C) 2012-2013 Christian Grothoff (and other contributing authors) + Copyright (C) 2012-2013 GNUnet e.V. GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ /** * @file rps/rps.h @@ -74,7 +74,7 @@ struct GNUNET_RPS_CS_RequestMessage /** * Identifyer of the message. */ - uint64_t n GNUNET_PACKED; + uint32_t id GNUNET_PACKED; /** * Number of random peer requested @@ -95,7 +95,7 @@ struct GNUNET_RPS_CS_ReplyMessage /** * Identifyer of the message. */ - uint64_t n GNUNET_PACKED; + uint32_t id GNUNET_PACKED; /** * Number of random peer replied @@ -105,6 +105,22 @@ struct GNUNET_RPS_CS_ReplyMessage /* Followed by num_peers * GNUNET_PeerIdentity */ }; +/** + * Message from client to RPS service to cancel request. + */ +struct GNUNET_RPS_CS_RequestCancelMessage +{ + /** + * Header including size and type in NBO + */ + struct GNUNET_MessageHeader header; + + /** + * Identifyer of the message. + */ + uint32_t id GNUNET_PACKED; +}; + /** * Message from client to service with seed of peers. */ @@ -154,8 +170,105 @@ struct GNUNET_RPS_CS_ActMaliciousMessage */ uint32_t num_peers GNUNET_PACKED; - /* Followed by num_peers * GNUNET_PeerIdentity */ + /* Followed by num_peers * GNUNET_PeerIdentity when the type of malicious + behaviour is 1 */ }; #endif /* ENABLE_MALICIOUS */ + +/*********************************************************************** + * Defines from old gnunet-service-rps_peers.h +***********************************************************************/ + +/** + * Different flags indicating the status of another peer. + */ +enum Peers_PeerFlags +{ + /** + * If we are waiting for a reply from that peer (sent a pull request). + */ + Peers_PULL_REPLY_PENDING = 0x01, + + /* IN_OTHER_GOSSIP_LIST = 0x02, unneeded? */ + /* IN_OWN_SAMPLER_LIST = 0x04, unneeded? */ + /* IN_OWN_GOSSIP_LIST = 0x08, unneeded? */ + + /** + * We set this bit when we know the peer is online. + */ + Peers_ONLINE = 0x20, + + /** + * We set this bit when we are going to destroy the channel to this peer. + * When cleanup_channel is called, we know that we wanted to destroy it. + * Otherwise the channel to the other peer was destroyed. + */ + Peers_TO_DESTROY = 0x40, +}; + +/** + * Keep track of the status of a channel. + * + * This is needed in order to know what to do with a channel when it's + * destroyed. + */ +enum Peers_ChannelFlags +{ + /** + * We destroyed the channel because the other peer established a second one. + */ + Peers_CHANNEL_ESTABLISHED_TWICE = 0x1, + + /** + * The channel was removed because it was not needed any more. This should be + * the sending channel. + */ + Peers_CHANNEL_CLEAN = 0x2, + + /** + * We destroyed the channel because the other peer established a second one. + */ + Peers_CHANNEL_DESTROING = 0x4, +}; + + +/** + * @brief The role of a channel. Sending or receiving. + */ +enum Peers_ChannelRole +{ + /** + * Channel is used for sending + */ + Peers_CHANNEL_ROLE_SENDING = 0x01, + + /** + * Channel is used for receiving + */ + Peers_CHANNEL_ROLE_RECEIVING = 0x02, +}; + +/** + * @brief Functions of this type can be used to be stored at a peer for later execution. + * + * @param cls closure + * @param peer peer to execute function on + */ +typedef void (* PeerOp) (void *cls, const struct GNUNET_PeerIdentity *peer); + +/** + * @brief Iterator over valid peers. + * + * @param cls closure + * @param peer current public peer id + * @return #GNUNET_YES if we should continue to + * iterate, + * #GNUNET_NO if not. + */ +typedef int +(*PeersIterator) (void *cls, + const struct GNUNET_PeerIdentity *peer); + + GNUNET_NETWORK_STRUCT_END