2 This file is part of GNUnet.
3 Copyright (C) 2009-2014 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @file core/gnunet-service-core_neighbours.h
21 * @brief code for managing of 'encrypted' sessions (key exchange done)
22 * @author Christian Grothoff
24 #ifndef GNUNET_SERVICE_CORE_SESSIONS_H
25 #define GNUNET_SERVICE_CORE_SESSIONS_H
27 #include "gnunet-service-core.h"
28 #include "gnunet-service-core_kx.h"
32 * Create a session, a key exchange was just completed.
34 * @param peer peer that is now connected
35 * @param kx key exchange that completed
38 GSC_SESSIONS_create (const struct GNUNET_PeerIdentity *peer,
39 struct GSC_KeyExchangeInfo *kx);
43 * The other peer has indicated that it 'lost' the session
44 * (KX down), reinitialize the session on our end, in particular
45 * this means to restart the typemap transmission.
47 * @param peer peer that is now connected
50 GSC_SESSIONS_reinit (const struct GNUNET_PeerIdentity *peer);
54 * The other peer has confirmed receiving our type map,
55 * check if it is current and if so, stop retransmitting it.
57 * @param peer peer that confirmed the type map
58 * @param msg confirmation message we received
61 GSC_SESSIONS_confirm_typemap (const struct GNUNET_PeerIdentity *peer,
62 const struct GNUNET_MessageHeader *msg);
66 * End the session with the given peer (we are no longer
69 * @param pid identity of peer to kill session with
72 GSC_SESSIONS_end (const struct GNUNET_PeerIdentity *pid);
76 * Traffic is being solicited for the given peer. This means that the
77 * message queue on the transport-level (NEIGHBOURS subsystem) is now
78 * empty and it is now OK to transmit another (non-control) message.
80 * @param pid identity of peer ready to receive data
83 GSC_SESSIONS_solicit (const struct GNUNET_PeerIdentity *pid);
87 * Queue a request from a client for transmission to a particular peer.
89 * @param car request to queue; this handle is then shared between
90 * the caller (CLIENTS subsystem) and SESSIONS and must not
91 * be released by either until either 'GNUNET_SESSIONS_dequeue',
92 * or 'GNUNET_CLIENTS_failed'
93 * have been invoked on it
96 GSC_SESSIONS_queue_request (struct GSC_ClientActiveRequest *car);
100 * Dequeue a request from a client from transmission to a particular peer.
102 * @param car request to dequeue; this handle will then be 'owned' by
103 * the caller (CLIENTS sysbsystem)
106 GSC_SESSIONS_dequeue_request (struct GSC_ClientActiveRequest *car);
110 * Transmit a message to a particular peer.
112 * @param car original request that was queued and then solicited,
113 * ownership does not change (dequeue will be called soon).
114 * @param msg message to transmit
115 * @param cork is corking allowed?
116 * @param priority how important is this message
119 GSC_SESSIONS_transmit (struct GSC_ClientActiveRequest *car,
120 const struct GNUNET_MessageHeader *msg,
122 enum GNUNET_CORE_Priority priority);
126 * Broadcast an updated typemap message to all neighbours.
127 * Restarts the retransmissions until the typemaps are confirmed.
129 * @param msg message to transmit
132 GSC_SESSIONS_broadcast_typemap (const struct GNUNET_MessageHeader *msg);
136 * We have a new client, notify it about all current sessions.
138 * @param client the new client
141 GSC_SESSIONS_notify_client_about_sessions (struct GSC_Client *client);
145 * We've received a typemap message from a peer, update ours.
146 * Notifies clients about the session.
148 * @param peer peer this is about
149 * @param msg typemap update message
152 GSC_SESSIONS_set_typemap (const struct GNUNET_PeerIdentity *peer,
153 const struct GNUNET_MessageHeader *msg);
157 * The given peer send a message of the specified type. Make sure the
158 * respective bit is set in its type-map and that clients are notified
161 * @param peer peer this is about
162 * @param type type of the message
165 GSC_SESSIONS_add_to_typemap (const struct GNUNET_PeerIdentity *peer,
170 * Initialize sessions subsystem.
173 GSC_SESSIONS_init (void);
177 * Shutdown sessions subsystem.
180 GSC_SESSIONS_done (void);