Merge branch 'master' of gnunet.org:gnunet
[oweals/gnunet.git] / src / peerinfo / peerinfo.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009, 2010 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your 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      Affero General Public License for more details.
14     
15      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /**
20  * @file peerinfo/peerinfo.h
21  * @brief common internal definitions for peerinfo service
22  * @author Christian Grothoff
23  */
24
25 #ifndef PEERINFO_H
26 #define PEERINFO_H
27
28 #include "gnunet_crypto_lib.h"
29 #include "gnunet_time_lib.h"
30 #include "gnunet_peerinfo_service.h"
31
32
33
34 GNUNET_NETWORK_STRUCT_BEGIN
35
36 /**
37  * Message requesting a listing of peers,
38  * restricted to the specified peer identity.
39  */
40 struct ListPeerMessage
41 {
42
43   /**
44    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_GET
45    */
46   struct GNUNET_MessageHeader header;
47
48   /**
49    * Include friend only HELLOs and peers in callbacks
50    */
51   uint32_t include_friend_only GNUNET_PACKED;
52
53   /**
54    * Restrict to peers with this identity (optional
55    * field, check header.size!).
56    */
57   struct GNUNET_PeerIdentity peer;
58
59 };
60
61 /**
62  * Message requesting a listing of all peers,
63  * restricted to the specified peer identity.
64  */
65 struct ListAllPeersMessage
66 {
67   /**
68    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL
69    */
70   struct GNUNET_MessageHeader header;
71
72   /**
73    * Include friend only HELLOs and peers in callbacks
74    */
75   uint32_t include_friend_only GNUNET_PACKED;
76
77 };
78
79
80 /**
81  * Header for all communications.
82  */
83 struct NotifyMessage
84 {
85   /**
86    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY
87    */
88   struct GNUNET_MessageHeader header;
89
90   /**
91    * Include friend only HELLOs and peers in callbacks
92    */
93   uint32_t include_friend_only GNUNET_PACKED;
94
95 };
96
97
98 /**
99  * Message used to inform the client about
100  * a particular peer; this message is optionally followed
101  * by a HELLO message for the respective peer (if available).
102  * Check the header.size field to see if a HELLO is
103  * present.
104  */
105 struct InfoMessage
106 {
107
108   /**
109    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_INFO
110    */
111   struct GNUNET_MessageHeader header;
112
113   /**
114    * Always zero.
115    */
116   uint32_t reserved GNUNET_PACKED;
117
118   /**
119    * About which peer are we talking here?
120    */
121   struct GNUNET_PeerIdentity peer;
122
123 };
124 GNUNET_NETWORK_STRUCT_END
125
126 /*#ifndef PEERINFO_H*/
127 #endif
128 /* end of peerinfo.h */