some documentation and bugfix in testcase
[oweals/gnunet.git] / src / peerinfo / peerinfo.h
1 /*
2      This file is part of GNUnet.
3      (C) 2009 Christian Grothoff (and other contributing authors)
4
5      GNUnet is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published
7      by the Free Software Foundation; either version 2, or (at your
8      option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      General Public License for more details.
14
15      You should have received a copy of the GNU General Public License
16      along with GNUnet; see the file COPYING.  If not, write to the
17      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.
19 */
20
21 /**
22  * @file peerinfo/peerinfo.h
23  * @brief common internal definitions for peerinfo service
24  * @author Christian Grothoff
25  */
26 #include "gnunet_crypto_lib.h"
27 #include "gnunet_time_lib.h"
28 #include "gnunet_peerinfo_service.h"
29
30
31 /**
32  * Add the given peer to the list.  This message
33  * is always followed by a verified HELLO message.
34  */
35 struct PeerAddMessage
36 {
37
38   /**
39    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_ADD
40    */
41   struct GNUNET_MessageHeader header;
42
43   /**
44    * Always zero.
45    */
46   uint32_t reserved GNUNET_PACKED;
47
48   /**
49    * For which peer do we provide a HELLO message here?
50    */
51   struct GNUNET_PeerIdentity peer;
52
53 };
54
55
56 /**
57  * Message requesting a listing of all known peers,
58  * possibly modified by the specified trust value
59  * and restricted to the specified peer identity.
60  */
61 struct ListPeerMessage
62 {
63
64   /**
65    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_GET
66    */
67   struct GNUNET_MessageHeader header;
68
69   /**
70    * How much to change the trust in each returned peer,
71    * in network byte order.
72    */
73   int32_t trust_change GNUNET_PACKED;
74
75   /**
76    * Restrict to peers with this identity (optional
77    * field, check header.size!).
78    */
79   struct GNUNET_PeerIdentity peer;
80
81 };
82
83
84 /**
85  * Message requesting a listing of all known peers,
86  * possibly modified by the specified trust value
87  * and restricted to the specified peer identity.
88  */
89 struct ListAllPeersMessage
90 {
91
92   /**
93    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_GET
94    */
95   struct GNUNET_MessageHeader header;
96
97   /**
98    * How much to change the trust in each returned peer,
99    * in network byte order.
100    */
101   int32_t trust_change GNUNET_PACKED;
102
103 };
104
105
106 /**
107  * Message used to inform the client about
108  * a particular peer; this message is optionally followed
109  * by a HELLO message for the respective peer (if available).
110  * Check the header.size field to see if a HELLO is
111  * present.
112  */
113 struct InfoMessage
114 {
115
116   /**
117    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_INFO
118    */
119   struct GNUNET_MessageHeader header;
120
121   /**
122    * Amount of trust we now have in the peer,
123    * in network byte order.
124    */
125   uint32_t trust GNUNET_PACKED;
126
127   /**
128    * About which peer are we talking here?
129    */
130   struct GNUNET_PeerIdentity peer;
131
132 };
133
134
135 /* end of peerinfo.h */