- refactor to check messages from both enc systems
[oweals/gnunet.git] / src / rps / rps.h
1 /*
2       This file is part of GNUnet
3       Copyright (C) 2012-2013 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  * @file rps/rps.h
22  * @brief example IPC messages between RPS API and GNS service
23  * @author Julius Bünger
24  */
25
26 #include "gnunet_rps_service.h"
27
28 /**
29  * Mesh port used by RPS.
30  */
31 #define GNUNET_RPS_CADET_PORT 31337
32
33
34 GNUNET_NETWORK_STRUCT_BEGIN
35
36 /***********************************************************************
37  * P2P Messages
38 ***********************************************************************/
39
40 /**
41  * P2P Message to send PeerIDs to other peer.
42  */
43 struct GNUNET_RPS_P2P_PullReplyMessage
44 {
45   /**
46    * Header including size and type in NBO
47    */
48   struct GNUNET_MessageHeader header;
49
50   /**
51    * Number of PeerIDs sent
52    */
53   uint32_t num_peers GNUNET_PACKED;
54
55   /* Followed by num_peers * GNUNET_PeerIdentity */
56 };
57
58
59
60 /***********************************************************************
61  * Client-Service Messages
62 ***********************************************************************/
63
64 /**
65  * Message from client to RPS service to request random peer(s).
66  */
67 struct GNUNET_RPS_CS_RequestMessage
68 {
69   /**
70    * Header including size and type in NBO
71    */
72   struct GNUNET_MessageHeader header;
73
74   /**
75    * Identifyer of the message.
76    */
77   uint32_t id GNUNET_PACKED;
78
79   /**
80    * Number of random peer requested
81    */
82   uint32_t num_peers GNUNET_PACKED;
83 };
84
85 /**
86  * Message from RPS service to client to reply with random peer(s).
87  */
88 struct GNUNET_RPS_CS_ReplyMessage
89 {
90   /**
91    * Type is #GNUNET_MESSAGE_TYPE_RPS_CS_REPLY.
92    */
93   struct GNUNET_MessageHeader header;
94
95   /**
96    * Identifyer of the message.
97    */
98   uint32_t id GNUNET_PACKED;
99
100   /**
101    * Number of random peer replied
102    */
103   uint32_t num_peers GNUNET_PACKED;
104
105   /* Followed by num_peers * GNUNET_PeerIdentity */
106 };
107
108 /**
109  * Message from client to service with seed of peers.
110  */
111 struct GNUNET_RPS_CS_SeedMessage
112 {
113   /**
114    * Header including size and type in NBO
115    */
116   struct GNUNET_MessageHeader header;
117
118   /**
119    * Number of peers
120    */
121   uint32_t num_peers GNUNET_PACKED;
122
123   /* Followed by num_peers * GNUNET_PeerIdentity */
124 };
125
126 #ifdef ENABLE_MALICIOUS
127 /**
128  * Message from client to service to turn service malicious.
129  */
130 struct GNUNET_RPS_CS_ActMaliciousMessage
131 {
132   /**
133    * Header including size and type in NBO
134    */
135   struct GNUNET_MessageHeader header;
136
137   /**
138    * If the type is 2 this is the attacked peer,
139    * empty otherwise.
140    */
141   struct GNUNET_PeerIdentity attacked_peer;
142
143   /**
144    * Type of malicious behaviour.
145    *
146    * 0 No malicious bahaviour at all
147    * 1 Try to maximise representation
148    * 2 Try to partition the network
149    */
150   uint32_t type GNUNET_PACKED;
151
152   /**
153    * Number of peers
154    */
155   uint32_t num_peers GNUNET_PACKED;
156
157   /* Followed by num_peers * GNUNET_PeerIdentity */
158 };
159 #endif /* ENABLE_MALICIOUS */
160
161 GNUNET_NETWORK_STRUCT_END