starting re-implementation of CADET service
[oweals/gnunet.git] / src / cadet / gnunet-service-cadet-new.h
1
2 /*
3      This file is part of GNUnet.
4      Copyright (C) 2001-2017 GNUnet e.V.
5
6      GNUnet is free software; you can redistribute it and/or modify
7      it under the terms of the GNU General Public License as published
8      by the Free Software Foundation; either version 3, or (at your
9      option) any later version.
10
11      GNUnet is distributed in the hope that it will be useful, but
12      WITHOUT ANY WARRANTY; without even the implied warranty of
13      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14      General Public License for more details.
15
16      You should have received a copy of the GNU General Public License
17      along with GNUnet; see the file COPYING.  If not, write to the
18      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19      Boston, MA 02110-1301, USA.
20 */
21
22 /**
23  * @file cadet/gnunet-service-cadet-new.h
24  * @brief Information we track per peer.
25  * @author Bartlomiej Polot
26  * @author Christian Grothoff
27  */
28 #ifndef GNUNET_SERVICE_CADET_H
29 #define GNUNET_SERVICE_CADET_H
30
31 /**
32  * A client to the CADET service.
33  */
34 struct CadetClient;
35
36 /**
37  * A peer in the GNUnet network.
38  */
39 struct CadetPeer;
40
41 /**
42  * Tunnel from us to another peer.
43  */
44 struct CadetTunnel;
45
46 /**
47  * Entry in the message queue of a `struct CadetTunnel`
48  */
49 struct CadetTunnelQueueEntry;
50
51 /**
52  * A path of peer in the GNUnet network.
53  */
54 struct CadetPeerPath;
55
56 /**
57  * Active path through the network (used by a tunnel).
58  */
59 struct CadetConnection;
60
61 /**
62  * Logical end-to-end conenction between clients.
63  */
64 struct CadetChannel;
65
66 /**
67  * Handle to the statistics service.
68  */
69 extern struct GNUNET_STATISTICS_Handle *stats;
70
71 /**
72  * Handle to communicate with ATS.
73  */
74 extern struct GNUNET_ATS_ConnectivityHandle *ats_ch;
75
76 /**
77  * Local peer own ID.
78  */
79 extern struct GNUNET_PeerIdentity my_full_id;
80
81 /**
82  * Own private key.
83  */
84 extern struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
85
86 /**
87  * All ports clients of this peer have opened.
88  */
89 extern struct GNUNET_CONTAINER_MultiHashMap *open_ports;
90
91 /**
92  * Map from ports to channels where the ports were closed at the
93  * time we got the inbound connection.
94  * Indexed by port, contains `struct CadetChannel`.
95  */
96 extern struct GNUNET_CONTAINER_MultiHashMap *loose_channels;
97
98 /**
99  * Map from PIDs to `struct CadetPeer` entries.
100  */
101 extern struct GNUNET_CONTAINER_MultiPeerMap *peers;
102
103
104 /**
105  * Send a message to a client.
106  *
107  * @param c client to get the message
108  * @param env envelope with the message
109  */
110 void
111 GSC_send_to_client (struct CadetClient *c,
112                     struct GNUNET_MQ_Envelope *env);
113
114
115 /**
116  * Bind incoming channel to this client, and notify client
117  * about incoming connection.
118  *
119  * @param c client to bind to
120  * @param ch channel to be bound
121  * @param dest peer that establishes the connection
122  * @param port port number
123  * @param options options
124  * @return local channel number assigned to the new client
125  */
126 struct GNUNET_CADET_ClientChannelNumber
127 GSC_bind (struct CadetClient *c,
128           struct CadetChannel *ch,
129           struct CadetPeer *dest,
130           const struct GNUNET_HashCode *port,
131           uint32_t options);
132
133
134 /**
135  * Return identifier for a client as a string.
136  *
137  * @param c client to identify
138  * @return string for debugging
139  */
140 const char *
141 GSC_2s (struct CadetClient *c);
142
143
144 #endif