From 2b3767b6c7f244f55b9738da102f848eb19f984d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 4 Aug 2011 12:21:21 +0000 Subject: draft headers --- src/transport/gnunet-service-transport.h | 51 ++++++++++ src/transport/gnunet-service-transport_blacklist.h | 81 +++++++++++++++ src/transport/gnunet-service-transport_clients.h | 51 ++++++++++ src/transport/gnunet-service-transport_hello.h | 71 +++++++++++++ .../gnunet-service-transport_neighbours.h | 110 +++++++++++++++++++++ src/transport/gnunet-service-transport_plugins.h | 61 ++++++++++++ .../gnunet-service-transport_validation.h | 107 ++++++++++++++++++++ 7 files changed, 532 insertions(+) create mode 100644 src/transport/gnunet-service-transport.h create mode 100644 src/transport/gnunet-service-transport_blacklist.h create mode 100644 src/transport/gnunet-service-transport_clients.h create mode 100644 src/transport/gnunet-service-transport_hello.h create mode 100644 src/transport/gnunet-service-transport_neighbours.h create mode 100644 src/transport/gnunet-service-transport_plugins.h create mode 100644 src/transport/gnunet-service-transport_validation.h (limited to 'src/transport') diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h new file mode 100644 index 000000000..544b60507 --- /dev/null +++ b/src/transport/gnunet-service-transport.h @@ -0,0 +1,51 @@ +/* + This file is part of GNUnet. + (C) 2010,2011 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +/** + * @file transport/gnunet-service-transport.h + * @brief globals + * @author Christian Grothoff + */ +#ifndef GNUNET_SERVICE_TRANSPORT_H +#define GNUNET_SERVICE_TRANSPORT_H + +#include "gnunet_statistics_service.h" +#include "gnunet_transport_plugins.h" +#include "gnunet_transport_service.h" +#include "gnunet_util_lib.h" + +/** + * Statistics handle. + */ +extern struct GNUNET_STATISTICS_Handle *GST_stats; + +/** + * Configuration handle. + */ +extern const struct GNUNET_CONFIGURATION_Handle *GST_cfg; + +/** + * Configuration handle. + */ +extern struct GNUNET_PeerIdentity GST_my_identity; + + +#endif +/* end of file gnunet-service-transport_plugins.h */ diff --git a/src/transport/gnunet-service-transport_blacklist.h b/src/transport/gnunet-service-transport_blacklist.h new file mode 100644 index 000000000..e1674ead3 --- /dev/null +++ b/src/transport/gnunet-service-transport_blacklist.h @@ -0,0 +1,81 @@ +/* + This file is part of GNUnet. + (C) 2010,2011 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +/** + * @file transport/gnunet-service-transport_blacklist.h + * @brief blacklisting API + * @author Christian Grothoff + */ +#ifndef GNUNET_SERVICE_TRANSPORT_BLACKLIST_H +#define GNUNET_SERVICE_TRANSPORT_BLACKLIST_H + +#include "gnunet_statistics_service.h" +#include "gnunet_transport_blacklist.h" +#include "gnunet_util_lib.h" + +/** + * + */ +void +GST_blacklist_start (void); + + +/** + * + */ +void +GST_blacklist_stop (void); + + +/** + * + */ +void +GST_blacklist_handle_init (void *cls, + const struct GNUNET_SERVER_Client *client, + const struct GNUNET_MessageHeader *message); + +/** + * + */ +void +GST_blacklist_handle_reply (void *cls, + const struct GNUNET_SERVER_Client *client, + const struct GNUNET_MessageHeader *message); + +/** + * + */ +void +GST_blacklist_add_peer (const struct GNUNET_PeerIdentity *peer, + const char *transport_name); + + +/** + * + */ +int +GST_blacklist_test (const struct GNUNET_PeerIdentity *peer, + const char *transport_name); + + + +#endif +/* end of file gnunet-service-transport_blacklist.h */ diff --git a/src/transport/gnunet-service-transport_clients.h b/src/transport/gnunet-service-transport_clients.h new file mode 100644 index 000000000..299d75857 --- /dev/null +++ b/src/transport/gnunet-service-transport_clients.h @@ -0,0 +1,51 @@ +/* + This file is part of GNUnet. + (C) 2010,2011 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +/** + * @file transport/gnunet-service-transport_clients.h + * @brief plugin management API + * @author Christian Grothoff + */ +#ifndef GNUNET_SERVICE_TRANSPORT_CLIENTS_H +#define GNUNET_SERVICE_TRANSPORT_CLIENTS_H + +#include "gnunet_statistics_service.h" +#include "gnunet_transport_clients.h" +#include "gnunet_util_lib.h" + + +/** + * + */ +void +GST_clients_start (struct GNUNET_SERVER_Handle *server); + + +/** + * + */ +void +GST_clients_stop (void); + + + + +#endif +/* end of file gnunet-service-transport_clients.h */ diff --git a/src/transport/gnunet-service-transport_hello.h b/src/transport/gnunet-service-transport_hello.h new file mode 100644 index 000000000..75fef07ae --- /dev/null +++ b/src/transport/gnunet-service-transport_hello.h @@ -0,0 +1,71 @@ +/* + This file is part of GNUnet. + (C) 2010,2011 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +/** + * @file transport/gnunet-service-transport_hello.h + * @brief hello API + * @author Christian Grothoff + */ +#ifndef GNUNET_SERVICE_TRANSPORT_HELLO_H +#define GNUNET_SERVICE_TRANSPORT_HELLO_H + +#include "gnunet_statistics_service.h" +#include "gnunet_transport_service.h" +#include "gnunet_util_lib.h" + + +/** + * + */ +void +GST_hello_start (void); + +/** + * + */ +void +GST_hello_stop (void); + +/** + * + */ +const struct GNUNET_MessageHeader * +GST_hello_get (void); + +/** + * + */ +void +GST_hello_modify_addresses (int addremove, + const char *plugin_name, + const void *plugin_address, + size_t plugin_address_len); + +/** + * + */ +int +GST_hello_test_address (const char *plugin_name, + const void *plugin_address, + size_t plugin_address_len); + + +#endif +/* end of file gnunet-service-transport_hello.h */ diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h new file mode 100644 index 000000000..18134fd33 --- /dev/null +++ b/src/transport/gnunet-service-transport_neighbours.h @@ -0,0 +1,110 @@ +/* + This file is part of GNUnet. + (C) 2010,2011 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +/** + * @file transport/gnunet-service-transport_neighbours.h + * @brief plugin management API + * @author Christian Grothoff + */ +#ifndef GNUNET_SERVICE_TRANSPORT_NEIGHBOURS_H +#define GNUNET_SERVICE_TRANSPORT_NEIGHBOURS_H + +#include "gnunet_statistics_service.h" +#include "gnunet_transport_service.h" +#include "gnunet_util_lib.h" + + +/** + * + */ +void +GST_neighbours_start (void *cls, + GNUNET_TRANSPORT_NotifyConnect connect_cb, + GNUNET_TRANSPORT_NotifyDisconnect disconnect_cb); + +/** + * + */ +void +GST_neighbours_stop (void); + +/** + * + */ +void +GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target); + +/** + * + */ +int +GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target); + +/** + * + */ +void +GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target); + + +typedef void (*GST_NeighbourIterator)(void *cls, + const struct GNUNET_PeerIdentity *neighbour); + + +void +GST_neighbours_iterate (GST_NeighbourIterator cb, + void *cb_cls); + + +/** + * + */ +int +GST_neighbours_handle_pong (const GNUNET_PeerIdentity *sender, + const struct GNUNET_MessageHeader *hdr, + const char *plugin_name, + const void *sender_address, + size_t sender_address_len); + +/** + * + */ +int +GST_neighbours_handle_connect (const GNUNET_PeerIdentity *sender, + const struct GNUNET_MessageHeader *hdr, + const char *plugin_name, + const void *sender_address, + size_t sender_address_len); + +/** + * + */ +int +GST_neighbours_handle_disconnect (const GNUNET_PeerIdentity *sender, + const struct GNUNET_MessageHeader *hdr, + const char *plugin_name, + const void *sender_address, + size_t sender_address_len); + + + + +#endif +/* end of file gnunet-service-transport_neighbours.h */ diff --git a/src/transport/gnunet-service-transport_plugins.h b/src/transport/gnunet-service-transport_plugins.h new file mode 100644 index 000000000..ad8746b4c --- /dev/null +++ b/src/transport/gnunet-service-transport_plugins.h @@ -0,0 +1,61 @@ +/* + This file is part of GNUnet. + (C) 2010,2011 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +/** + * @file transport/gnunet-service-transport_plugins.h + * @brief plugin management API + * @author Christian Grothoff + */ +#ifndef GNUNET_SERVICE_TRANSPORT_PLUGINS_H +#define GNUNET_SERVICE_TRANSPORT_PLUGINS_H + +#include "gnunet_statistics_service.h" +#include "gnunet_transport_plugins.h" +#include "gnunet_util_lib.h" + + +/** + * + */ +int +GST_plugins_load (GNUNET_TRANSPORT_PluginReceiveCallback recv_cb, + GNUNET_TRANSPORT_AddressNotification address_cb, + GNUNET_TRANSPORT_TrafficReport traffic_cb, + GNUNET_TRANSPORT_SessionEnd session_end_cb, + GNUNET_TRANSPORT_CostReport cost_cb); + + +/** + * + */ +int +GST_plugins_unload (void); + + +/** + * + */ +struct GNUNET_TRANSPORT_PluginFunctions * +GST_plugins_find (const char *name); + + + +#endif +/* end of file gnunet-service-transport_plugins.h */ diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h new file mode 100644 index 000000000..374512e47 --- /dev/null +++ b/src/transport/gnunet-service-transport_validation.h @@ -0,0 +1,107 @@ +/* + This file is part of GNUnet. + (C) 2010,2011 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +/** + * @file transport/gnunet-service-transport_validation.h + * @brief plugin management API + * @author Christian Grothoff + */ +#ifndef GNUNET_SERVICE_TRANSPORT_VALIDATION_H +#define GNUNET_SERVICE_TRANSPORT_VALIDATION_H + +#include "gnunet_statistics_service.h" +#include "gnunet_transport_validation.h" +#include "gnunet_util_lib.h" + + +/** + * + */ +void +GST_validation_start (void); + + +/** + * + */ +void +GST_validation_stop (void); + + +/** + * + */ +int +GST_validation_handle_ping (const GNUNET_PeerIdentity *sender, + const struct GNUNET_MessageHeader *hdr, + const char *plugin_name, + const void *sender_address, + size_t sender_address_len); + +/** + * + */ +int +GST_validation_handle_pong (const GNUNET_PeerIdentity *sender, + const struct GNUNET_MessageHeader *hdr, + const char *plugin_name, + const void *sender_address, + size_t sender_address_len); + + +/** + * + */ +void +GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello); + + +struct GST_ValidationIteratorContext; + +/** + * @param last_validated_at is FOREVER if the address has not been validated (we're currently checking) + * is ZERO if the address was validated a long time ago (from PEERINFO) + * is a time in the past if this process validated the address + * @param validation_block is FOREVER if the address is for an unsupported plugin (from PEERINFO) + * is ZERO if the address is considered valid (no validation needed) + * is a time in the future if we're currently denying re-validation + */ +typedef void (*GST_ValidationAddressCallback)(void *cls, + const GNUNET_PeerIdentity *target, + struct GNUNET_TIME_Absolute last_validated_at, + struct GNUNET_TIME_Absolute validation_block, + const char *plugin_name, + const void *plugin_address, + size_t plugin_address_len); + +struct GST_ValidationIteratorContext * +GST_validation_get_addresses (const GNUNET_PeerIdentity *target, + GST_ValidationAddressCallback cb, + void *cb_cls); + + + +void +GST_validation_get_addresses_cancel (struct GST_ValidationIteratorContext *ctx); + + + +#endif +/* end of file gnunet-service-transport_validation.h */ -- cgit v1.2.3