social: implement enter/leave/messaging; psyc: improvements and fixes
[oweals/gnunet.git] / src / social / social.h
1 /*
2  * This file is part of GNUnet
3  * (C) 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 /**
22  * @file social/social.h
23  * @brief Common type definitions for the Social service and API.
24  * @author Gabor X Toth
25  */
26
27 #ifndef SOCIAL_H      
28 #define SOCIAL_H
29
30 #include "platform.h"
31 #include "gnunet_social_service.h"
32
33 enum MessageState
34 {
35   MSG_STATE_START    = 0,
36   MSG_STATE_HEADER   = 1,
37   MSG_STATE_METHOD   = 2,
38   MSG_STATE_MODIFIER = 3,
39   MSG_STATE_MOD_CONT = 4,
40   MSG_STATE_DATA     = 5,
41   MSG_STATE_END      = 6,
42   MSG_STATE_CANCEL   = 7,
43   MSG_STATE_ERROR    = 8,
44 };
45
46
47 GNUNET_NETWORK_STRUCT_BEGIN
48
49 /**** library -> service ****/
50
51
52 struct HostEnterRequest
53 {
54   /**
55    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_HOST_ENTER
56    */
57   struct GNUNET_MessageHeader header;
58
59   uint32_t policy GNUNET_PACKED;
60
61   struct GNUNET_CRYPTO_EcdsaPrivateKey host_key;
62
63   struct GNUNET_CRYPTO_EddsaPrivateKey place_key;
64 };
65
66
67 struct GuestEnterRequest
68 {
69   /**
70    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_GUEST_ENTER_ADDR
71    */
72   struct GNUNET_MessageHeader header;
73
74   uint32_t relay_count GNUNET_PACKED;
75
76   struct GNUNET_CRYPTO_EcdsaPrivateKey guest_key;
77
78   struct GNUNET_CRYPTO_EddsaPublicKey place_key;
79
80   struct GNUNET_PeerIdentity origin;
81
82   /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
83
84   /* Followed by struct GNUNET_MessageHeader join_msg */
85 };
86
87
88 /**** service -> library ****/
89
90
91 struct CountersResult
92 {
93   /**
94    * Type: GNUNET_MESSAGE_TYPE_PSYC_RESULT_COUNTERS
95    */
96   struct GNUNET_MessageHeader header;
97
98   /**
99    * Status code for the operation.
100    */
101   int32_t result_code GNUNET_PACKED;
102
103   /**
104    * Last message ID sent to the channel.
105    */
106   uint64_t max_message_id;
107 };
108
109
110 #if REMOVE
111 struct NymEnterRequest
112 {
113   /**
114    * Type: GNUNET_MESSAGE_TYPE_SOCIAL_NYM_ENTER
115    */
116   struct GNUNET_MessageHeader header;
117   /**
118    * Public key of the joining slave.
119    */
120   struct GNUNET_CRYPTO_EcdsaPublicKey nym_key;
121
122   /* Followed by struct GNUNET_MessageHeader join_request */
123 };
124 #endif
125
126
127 GNUNET_NETWORK_STRUCT_END
128
129 #endif