aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-04 20:49:35 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-04 20:49:35 +0000
commited4272a244d2770c42ffdb22c80cb4245fbcf538 (patch)
tree5e43c11209a67431bec2e49b2e82da64ab1f0fd0 /src/transport/gnunet-service-transport_neighbours.c
parentb766cf70853e0732c0785648acd74c6958fea5a7 (diff)
downloadgnunet-ed4272a244d2770c42ffdb22c80cb4245fbcf538.tar.gz
gnunet-ed4272a244d2770c42ffdb22c80cb4245fbcf538.zip
implementing blacklist
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c176
1 files changed, 176 insertions, 0 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
new file mode 100644
index 000000000..4107c0012
--- /dev/null
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -0,0 +1,176 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010,2011 Christian Grothoff (and other contributing authors)
4
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.
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 General Public License for more details.
14
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.
19*/
20
21/**
22 * @file transport/gnunet-service-transport_neighbours.c
23 * @brief neighbour management
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet-service-transport_neighbours.h"
28#include "gnunet-service-transport.h"
29
30// TODO:
31// - have a way to access the currently 'connected' session
32// (for sending and to notice disconnect of it!)
33// - have a way to access/update bandwidth/quota information per peer
34// (for CostReport/TrafficReport callbacks)
35
36
37
38/**
39 * Initialize the neighbours subsystem.
40 *
41 * @param cls closure for callbacks
42 * @param connect_cb function to call if we connect to a peer
43 * @param disconnect_cb function to call if we disconnect from a peer
44 */
45void
46GST_neighbours_start (void *cls,
47 GNUNET_TRANSPORT_NotifyConnect connect_cb,
48 GNUNET_TRANSPORT_NotifyDisconnect disconnect_cb)
49{
50}
51
52
53/**
54 * Cleanup the neighbours subsystem.
55 */
56void
57GST_neighbours_stop ()
58{
59}
60
61
62/**
63 * Try to create a connection to the given target (eventually).
64 *
65 * @param target peer to try to connect to
66 */
67void
68GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
69{
70}
71
72
73/**
74 * Test if we're connected to the given peer.
75 *
76 * @param target peer to test
77 * @return GNUNET_YES if we are connected, GNUNET_NO if not
78 */
79int
80GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target)
81{
82 return GNUNET_NO;
83}
84
85
86/**
87 * If we have an active connection to the given target, it must be shutdown.
88 *
89 * @param target peer to disconnect from
90 */
91void
92GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target)
93{
94}
95
96
97/**
98 * Iterate over all connected neighbours.
99 *
100 * @param cb function to call
101 * @param cb_cls closure for cb
102 */
103void
104GST_neighbours_iterate (GST_NeighbourIterator cb,
105 void *cb_cls)
106{
107}
108
109
110/**
111 * We have received a PONG. Update lifeness of the neighbour.
112 *
113 * @param sender peer sending the PONG
114 * @param hdr the PONG message (presumably)
115 * @param plugin_name name of transport that delivered the PONG
116 * @param sender_address address of the other peer, NULL if other peer
117 * connected to us
118 * @param sender_address_len number of bytes in sender_address
119 * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
120 */
121int
122GST_neighbours_handle_pong (const struct GNUNET_PeerIdentity *sender,
123 const struct GNUNET_MessageHeader *hdr,
124 const char *plugin_name,
125 const void *sender_address,
126 size_t sender_address_len)
127{
128 return GNUNET_SYSERR;
129}
130
131
132/**
133 * We have received a CONNECT. Set the peer to connected.
134 *
135 * @param sender peer sending the PONG
136 * @param hdr the PONG message (presumably)
137 * @param plugin_name name of transport that delivered the PONG
138 * @param sender_address address of the other peer, NULL if other peer
139 * connected to us
140 * @param sender_address_len number of bytes in sender_address
141 * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
142 */
143int
144GST_neighbours_handle_connect (const struct GNUNET_PeerIdentity *sender,
145 const struct GNUNET_MessageHeader *hdr,
146 const char *plugin_name,
147 const void *sender_address,
148 size_t sender_address_len)
149{
150 return GNUNET_SYSERR;
151}
152
153
154/**
155 * We have received a DISCONNECT. Set the peer to disconnected.
156 *
157 * @param sender peer sending the PONG
158 * @param hdr the PONG message (presumably)
159 * @param plugin_name name of transport that delivered the PONG
160 * @param sender_address address of the other peer, NULL if other peer
161 * connected to us
162 * @param sender_address_len number of bytes in sender_address
163 * @return GNUNET_OK if the message was well-formed, GNUNET_SYSERR if not
164 */
165int
166GST_neighbours_handle_disconnect (const struct GNUNET_PeerIdentity *sender,
167 const struct GNUNET_MessageHeader *hdr,
168 const char *plugin_name,
169 const void *sender_address,
170 size_t sender_address_len)
171{
172 return GNUNET_SYSERR;
173}
174
175
176/* end of file gnunet-service-transport_neighbours.c */