diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-01-26 20:49:59 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-01-26 20:49:59 +0100 |
commit | 7fc78674a6d3f2edb41e32cea59200908d0b344b (patch) | |
tree | b99608184fa08dcc6cd3e297369cb2761a03524f /src/cadet/cadet_api_get_channel.c | |
parent | a5a54c51011a9498e72b2a9341b35333c6beef1a (diff) | |
download | gnunet-7fc78674a6d3f2edb41e32cea59200908d0b344b.tar.gz gnunet-7fc78674a6d3f2edb41e32cea59200908d0b344b.zip |
starting with #5385 in earnest
Diffstat (limited to 'src/cadet/cadet_api_get_channel.c')
-rw-r--r-- | src/cadet/cadet_api_get_channel.c | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/cadet/cadet_api_get_channel.c b/src/cadet/cadet_api_get_channel.c new file mode 100644 index 000000000..c36766a3f --- /dev/null +++ b/src/cadet/cadet_api_get_channel.c | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2011, 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 | /** | ||
21 | * @file cadet/cadet_api_get_channel.c | ||
22 | * @brief cadet api: client implementation of cadet service | ||
23 | * @author Bartlomiej Polot | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_constants.h" | ||
29 | #include "gnunet_cadet_service.h" | ||
30 | #include "cadet.h" | ||
31 | #include "cadet_protocol.h" | ||
32 | |||
33 | |||
34 | |||
35 | /** | ||
36 | * Ugly legacy hack. | ||
37 | */ | ||
38 | struct GNUNET_CADET_ChannelMonitor | ||
39 | { | ||
40 | |||
41 | /** | ||
42 | * Channel callback. | ||
43 | */ | ||
44 | GNUNET_CADET_ChannelCB channel_cb; | ||
45 | |||
46 | /** | ||
47 | * Info callback closure for @c channel_cb. | ||
48 | */ | ||
49 | void *channel_cb_cls; | ||
50 | |||
51 | }; | ||
52 | |||
53 | |||
54 | /** | ||
55 | * Send message of @a type to CADET service of @a h | ||
56 | * | ||
57 | * @param h handle to CADET service | ||
58 | * @param type message type of trivial information request to send | ||
59 | */ | ||
60 | static void | ||
61 | send_info_request (struct GNUNET_CADET_Handle *h, | ||
62 | uint16_t type) | ||
63 | { | ||
64 | struct GNUNET_MessageHeader *msg; | ||
65 | struct GNUNET_MQ_Envelope *env; | ||
66 | |||
67 | env = GNUNET_MQ_msg (msg, | ||
68 | type); | ||
69 | GNUNET_MQ_send (h->mq, | ||
70 | env); | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * Request information about a specific channel of the running cadet peer. | ||
75 | * | ||
76 | * WARNING: unstable API, likely to change in the future! | ||
77 | * | ||
78 | * @param h Handle to the cadet peer. | ||
79 | * @param peer ID of the other end of the channel. | ||
80 | * @param channel_number Channel number. | ||
81 | * @param callback Function to call with the requested data. | ||
82 | * @param callback_cls Closure for @c callback. | ||
83 | */ | ||
84 | struct GNUNET_CADET_ChannelMonitor * | ||
85 | GNUNET_CADET_get_channel (struct GNUNET_CADET_Handle *h, | ||
86 | struct GNUNET_PeerIdentity *peer, | ||
87 | uint32_t /* UGH */ channel_number, | ||
88 | GNUNET_CADET_ChannelCB callback, | ||
89 | void *callback_cls) | ||
90 | { | ||
91 | } | ||
92 | |||
93 | |||
94 | void * | ||
95 | GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm); | ||
96 | |||