gnunet-android

GNUnet for Android
Log | Files | Refs | README

gnunet_transport_application_service.h (3726B)


      1 /*
      2    This file is part of GNUnet.
      3    Copyright (C) 2010-2015, 2018, 2019 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  * @addtogroup Backbone
     22  * @{
     23  *
     24  * @file
     25  * Bandwidth allocation API for applications to interact with
     26  *
     27  * @author Christian Grothoff
     28  * @author Matthias Wachs
     29  *
     30  * @defgroup TNG Transport Next Generation service
     31  * @{
     32  */
     33 #ifndef GNUNET_TRANSPORT_APPLICATION_SERVICE_H
     34 #define GNUNET_TRANSPORT_APPLICATION_SERVICE_H
     35 
     36 
     37 #include "gnunet_constants.h"
     38 #include "gnunet_util_lib.h"
     39 
     40 /**
     41  * Handle to the TRANSPORT subsystem for making suggestions about
     42  * connections the peer would like to have.
     43  */
     44 struct GNUNET_TRANSPORT_ApplicationHandle;
     45 
     46 
     47 /**
     48  * Initialize the TRANSPORT application client handle.
     49  *
     50  * @param cfg configuration to use
     51  * @return ats application handle, NULL on error
     52  */
     53 struct GNUNET_TRANSPORT_ApplicationHandle *
     54 GNUNET_TRANSPORT_application_init (
     55   const struct GNUNET_CONFIGURATION_Handle *cfg);
     56 
     57 
     58 /**
     59  * Shutdown TRANSPORT application client.
     60  *
     61  * @param ch handle to destroy
     62  */
     63 void
     64 GNUNET_TRANSPORT_application_done (
     65   struct GNUNET_TRANSPORT_ApplicationHandle *ch);
     66 
     67 
     68 /**
     69  * An application would like TRANSPORT to connect to a peer.
     70  *
     71  * @param ch handle
     72  * @param peer identity of the peer we need an address for
     73  * @param pk what kind of application will the application require (can be
     74  *         #GNUNET_MQ_PRIO_BACKGROUND, we will still try to connect)
     75  * @param bw desired bandwidth, can be zero (we will still try to connect)
     76  * @return suggest handle, NULL if a request is already pending
     77  */
     78 struct GNUNET_TRANSPORT_ApplicationSuggestHandle *
     79 GNUNET_TRANSPORT_application_suggest (
     80   struct GNUNET_TRANSPORT_ApplicationHandle *ch,
     81   const struct GNUNET_PeerIdentity *peer,
     82   enum GNUNET_MQ_PriorityPreferences pk,
     83   struct GNUNET_BANDWIDTH_Value32NBO bw);
     84 
     85 
     86 /**
     87  * We no longer care about being connected to a peer.
     88  *
     89  * @param sh handle to stop
     90  */
     91 void
     92 GNUNET_TRANSPORT_application_suggest_cancel (
     93   struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh);
     94 
     95 
     96 /**
     97  * An application (or a communicator) has received a HELLO (or other address
     98  * data of another peer) and wants TRANSPORT to validate that the address is
     99  * correct.  The result is NOT returned, in fact TRANSPORT may do nothing
    100  * (i.e. if it has too many active validations or recently tried this one
    101  * already).  If the @a addr validates, TRANSPORT will persist the address
    102  * with PEERSTORE.
    103  *
    104  * @param ch handle
    105  * @param peer identity of the peer we have an address for
    106  * @param nt network type of @a addr (as claimed by the other peer);
    107  *        used by TRANSPORT to avoid trying @a addr's that really cannot work
    108  *        due to network type mismatches
    109  * @param addr address to validate
    110  */
    111 void
    112 GNUNET_TRANSPORT_application_validate (
    113   struct GNUNET_TRANSPORT_ApplicationHandle *ch,
    114   const struct GNUNET_PeerIdentity *peer,
    115   enum GNUNET_NetworkType nt,
    116   const char *addr);
    117 
    118 /** @} */ /* end of group */
    119 
    120 /** @} */ /* end of group addition */
    121 
    122 #endif
    123 /* end of file gnunet_ats_application_service.h */