97f819aff86a3d02ea85d20a40194ef86a15b757
[oweals/gnunet.git] / src / peerinfo / peerinfo.h
1 /*
2      This file is part of GNUnet.
3      (C) 2009, 2010 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 3, 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 GNUNET_NETWORK_STRUCT_BEGIN
32
33 /**
34  * Message requesting a listing of peers,
35  * restricted to the specified peer identity.
36  */
37 struct ListPeerMessage
38 {
39
40   /**
41    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_GET
42    * .
43    */
44   struct GNUNET_MessageHeader header;
45
46   /**
47    * Include friend only HELLOs and peers in callbacks
48    */
49   uint32_t include_friend_only GNUNET_PACKED;
50
51   /**
52    * Restrict to peers with this identity (optional
53    * field, check header.size!).
54    */
55   struct GNUNET_PeerIdentity peer;
56
57 };
58
59 /**
60  * Message requesting a listing of all peers,
61  * restricted to the specified peer identity.
62  */
63 struct ListAllPeersMessage
64 {
65   /**
66    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL
67    */
68   struct GNUNET_MessageHeader header;
69
70   /**
71    * Include friend only HELLOs and peers in callbacks
72    */
73   uint32_t include_friend_only GNUNET_PACKED;
74
75 };
76
77
78 /**
79  * Header for all communications.
80  */
81 struct NotifyMessage
82 {
83   /**
84    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY
85    */
86   struct GNUNET_MessageHeader header;
87
88   /**
89    * Include friend only HELLOs and peers in callbacks
90    */
91   uint32_t include_friend_only GNUNET_PACKED;
92
93 };
94
95
96 /**
97  * Message used to inform the client about
98  * a particular peer; this message is optionally followed
99  * by a HELLO message for the respective peer (if available).
100  * Check the header.size field to see if a HELLO is
101  * present.
102  */
103 struct InfoMessage
104 {
105
106   /**
107    * Type will be GNUNET_MESSAGE_TYPE_PEERINFO_INFO
108    */
109   struct GNUNET_MessageHeader header;
110
111   /**
112    * Always zero.
113    */
114   uint32_t reserved GNUNET_PACKED;
115
116   /**
117    * About which peer are we talking here?
118    */
119   struct GNUNET_PeerIdentity peer;
120
121 };
122 GNUNET_NETWORK_STRUCT_END
123
124 /* end of peerinfo.h */