2 This file is part of GNUnet.
3 (C) 2009-2014 Christian Grothoff (and other contributing authors)
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.
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.
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.
22 * @file core/gnunet-service-core_neighbours.h
23 * @brief code for managing of 'encrypted' sessions (key exchange done)
24 * @author Christian Grothoff
26 #ifndef GNUNET_SERVICE_CORE_SESSIONS_H
27 #define GNUNET_SERVICE_CORE_SESSIONS_H
29 #include "gnunet-service-core.h"
30 #include "gnunet-service-core_kx.h"
34 * Create a session, a key exchange was just completed.
36 * @param peer peer that is now connected
37 * @param kx key exchange that completed
40 GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer,
41 struct GSC_KeyExchangeInfo *kx);
45 * The other peer has indicated that he 'lost' the session
46 * (KX down), reinitialize the session on our end, in particular
47 * this means to restart the typemap transmission.
49 * @param peer peer that is now connected
52 GSC_SESSIONS_reinit (const struct GNUNET_PeerIdentity *peer);
56 * The other peer has confirmed receiving our type map,
57 * check if it is current and if so, stop retransmitting it.
59 * @param peer peer that confirmed the type map
60 * @param msg confirmation message we received
63 GSC_SESSIONS_confirm_typemap (const struct GNUNET_PeerIdentity *peer,
64 const struct GNUNET_MessageHeader *msg);
68 * End the session with the given peer (we are no longer
71 * @param pid identity of peer to kill session with
74 GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid);
78 * Traffic is being solicited for the given peer. This means that the
79 * message queue on the transport-level (NEIGHBOURS subsystem) is now
80 * empty and it is now OK to transmit another (non-control) message.
82 * @param pid identity of peer ready to receive data
85 GSC_SESSIONS_solicit (const struct GNUNET_PeerIdentity *pid);
89 * Queue a request from a client for transmission to a particular peer.
91 * @param car request to queue; this handle is then shared between
92 * the caller (CLIENTS subsystem) and SESSIONS and must not
93 * be released by either until either 'GNUNET_SESSIONS_dequeue',
94 * or 'GNUNET_CLIENTS_failed'
95 * have been invoked on it
98 GSC_SESSIONS_queue_request (struct GSC_ClientActiveRequest *car);
102 * Dequeue a request from a client from transmission to a particular peer.
104 * @param car request to dequeue; this handle will then be 'owned' by
105 * the caller (CLIENTS sysbsystem)
108 GSC_SESSIONS_dequeue_request (struct GSC_ClientActiveRequest *car);
112 * Transmit a message to a particular peer.
114 * @param car original request that was queued and then solicited,
115 * ownership does not change (dequeue will be called soon).
116 * @param msg message to transmit
117 * @param cork is corking allowed?
118 * @param priority how important is this message
121 GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car,
122 const struct GNUNET_MessageHeader *msg,
124 enum GNUNET_CORE_Priority priority);
128 * Broadcast an updated typemap message to all neighbours.
129 * Restarts the retransmissions until the typemaps are confirmed.
131 * @param msg message to transmit
134 GSC_SESSIONS_broadcast_typemap (const struct GNUNET_MessageHeader *msg);
138 * We have a new client, notify it about all current sessions.
140 * @param client the new client
143 GSC_SESSIONS_notify_client_about_sessions (struct GSC_Client *client);
147 * We've received a typemap message from a peer, update ours.
148 * Notifies clients about the session.
150 * @param peer peer this is about
151 * @param msg typemap update message
154 GSC_SESSIONS_set_typemap (const struct GNUNET_PeerIdentity *peer,
155 const struct GNUNET_MessageHeader *msg);
159 * The given peer send a message of the specified type. Make sure the
160 * respective bit is set in its type-map and that clients are notified
163 * @param peer peer this is about
164 * @param type type of the message
167 GSC_SESSIONS_add_to_typemap (const struct GNUNET_PeerIdentity *peer,
172 * Initialize sessions subsystem.
175 GSC_SESSIONS_init (void);
179 * Shutdown sessions subsystem.
182 GSC_SESSIONS_done (void);