GNUnet  0.20.0
gnunet-service-cadet_channel.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2001-2017 GNUnet e.V.
4 
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.
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  Affero General Public License for more details.
14 
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/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
27 #ifndef GNUNET_SERVICE_CADET_CHANNEL_H
28 #define GNUNET_SERVICE_CADET_CHANNEL_H
29 
30 #include "gnunet-service-cadet.h"
32 #include "cadet_protocol.h"
33 
34 
43 struct CadetChannel;
44 
45 
55 void
57  const struct GNUNET_HashCode *port,
58  const struct GNUNET_PeerIdentity *listener);
59 
65 int
66 GCCH_is_type_to_drop (struct CadetChannel *ch, const struct
67  GNUNET_MessageHeader *message);
68 
74 void
75 GCCH_assign_type_to_drop (struct CadetChannel *ch, const struct
77 
85 const char *
86 GCCH_2s (const struct CadetChannel *ch);
87 
88 
95 void
96 GCCH_debug (struct CadetChannel *ch,
97  enum GNUNET_ErrorType level);
98 
99 
108 GCCH_get_id (const struct CadetChannel *ch);
109 
110 
121 struct CadetChannel *
123  struct GNUNET_CADET_ClientChannelNumber owner_id,
124  struct CadetPeer *destination,
125  const struct GNUNET_HashCode *port,
126  uint32_t options);
127 
128 
138 void
139 GCCH_bind (struct CadetChannel *ch,
140  struct CadetClient *c,
141  const struct GNUNET_HashCode *port);
142 
143 
152 void
154  struct CadetClient *c,
156 
157 
168 void
169 GCCH_tunnel_up (struct CadetChannel *ch);
170 
171 
181 struct CadetChannel *
184  const struct GNUNET_HashCode *h_port,
185  uint32_t options);
186 
187 
196 void
198  const struct
200 
201 
210 void
212  const struct
214  const struct
216 
217 
226 void
228  const struct
230  *cti,
231  const struct
233 
234 
245 void
247  const struct
249  const struct GNUNET_HashCode *port);
250 
251 
268 void
270  const struct
272 
273 
288 int
290  struct GNUNET_CADET_ClientChannelNumber sender_ccn,
291  const char *buf,
292  size_t buf_len);
293 
294 
302 void
304  struct GNUNET_CADET_ClientChannelNumber client_ccn);
305 
306 #endif
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
P2P messages used by CADET.
static uint16_t port
Port number.
Definition: gnunet-bcd.c:147
static struct GNUNET_CADET_Channel * ch
Channel handle.
Definition: gnunet-cadet.c:117
Information we track per peer.
void GCCH_handle_channel_plaintext_data_ack(struct CadetChannel *ch, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti, const struct GNUNET_CADET_ChannelDataAckMessage *ack)
We got an acknowledgement for payload data for a channel.
int GCCH_handle_local_data(struct CadetChannel *ch, struct GNUNET_CADET_ClientChannelNumber sender_ccn, const char *buf, size_t buf_len)
Handle data given by a client.
void GCCH_bind(struct CadetChannel *ch, struct CadetClient *c, const struct GNUNET_HashCode *port)
A client is bound to the port that we have a channel open to.
void GCCH_handle_duplicate_open(struct CadetChannel *ch, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti)
We got a GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN message again for this channel.
struct CadetChannel * GCCH_channel_local_new(struct CadetClient *owner, struct GNUNET_CADET_ClientChannelNumber owner_id, struct CadetPeer *destination, const struct GNUNET_HashCode *port, uint32_t options)
Create a new channel.
void GCCH_handle_local_ack(struct CadetChannel *ch, struct GNUNET_CADET_ClientChannelNumber client_ccn)
Handle ACK from client on local channel.
void GCCH_channel_local_destroy(struct CadetChannel *ch, struct CadetClient *c, struct GNUNET_CADET_ClientChannelNumber ccn)
Destroy locally created channel.
void GCCH_assign_type_to_drop(struct CadetChannel *ch, const struct GNUNET_CADET_RequestDropCadetMessage *message)
Assign type of message to drop.
const char * GCCH_2s(const struct CadetChannel *ch)
Get the static string for identification of the channel.
void GCCH_tunnel_up(struct CadetChannel *ch)
Function called once and only once after a channel was bound to its tunnel via GCT_add_channel() is r...
void GCCH_hash_port(struct GNUNET_HashCode *h_port, const struct GNUNET_HashCode *port, const struct GNUNET_PeerIdentity *listener)
Hash the port and initiator and listener to calculate the "challenge" h_port we send to the other pee...
void GCCH_debug(struct CadetChannel *ch, enum GNUNET_ErrorType level)
Log channel info.
struct CadetChannel * GCCH_channel_incoming_new(struct CadetTunnel *t, struct GNUNET_CADET_ChannelTunnelNumber chid, const struct GNUNET_HashCode *h_port, uint32_t options)
Create a new channel based on a request coming in over the network.
void GCCH_handle_channel_plaintext_data(struct CadetChannel *ch, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti, const struct GNUNET_CADET_ChannelAppDataMessage *msg)
We got payload data for a channel.
struct GNUNET_CADET_ChannelTunnelNumber GCCH_get_id(const struct CadetChannel *ch)
Get the channel's public ID.
void GCCH_handle_remote_destroy(struct CadetChannel *ch, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti)
Destroy channel, based on the other peer closing the connection.
void GCCH_handle_channel_open_ack(struct CadetChannel *ch, const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti, const struct GNUNET_HashCode *port)
We got an acknowledgement for the creation of the channel (the port is open on the other side).
int GCCH_is_type_to_drop(struct CadetChannel *ch, const struct GNUNET_MessageHeader *message)
Check if type of message is the one to drop.
Information we track per peer.
static char buf[2048]
static struct GNUNET_SCHEDULER_Task * t
Main task.
GNUNET_ErrorType
Types of errors.
Struct containing all information regarding a channel to a remote client.
struct CadetChannelClient * owner
Client owner of the tunnel, if any.
struct GNUNET_HashCode h_port
Hash'ed port of the channel with initiator and destination PID.
Struct containing information about a client of the service.
Peer description.
Struct containing all information regarding a tunnel to a peer.
Message for cadet data traffic.
Message to acknowledge end-to-end data.
Number identifying a CADET channel within a tunnel.
Number uniquely identifying a channel of a client.
Definition: cadet.h:101
Hash uniquely identifying a connection below a tunnel.
Message to drop another message of specific type.
Definition: cadet.h:321
A 512-bit hashcode.
Header for all communications.
The identity of the host (wraps the signing key of the peer).