gnunet-service-transport_hello.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2010,2011 GNUnet e.V.
  4. GNUnet is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Affero General Public License as published
  6. by the Free Software Foundation, either version 3 of the License,
  7. or (at your option) any later version.
  8. GNUnet is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. SPDX-License-Identifier: AGPL3.0-or-later
  15. */
  16. /**
  17. * @file transport/gnunet-service-transport_hello.h
  18. * @brief hello API
  19. * @author Christian Grothoff
  20. */
  21. #ifndef GNUNET_SERVICE_TRANSPORT_HELLO_H
  22. #define GNUNET_SERVICE_TRANSPORT_HELLO_H
  23. #include "gnunet_statistics_service.h"
  24. #include "gnunet_transport_service.h"
  25. #include "gnunet_util_lib.h"
  26. #include "gnunet_hello_lib.h"
  27. /**
  28. * Signature of a function to call whenever our hello changes.
  29. *
  30. * @param cls closure
  31. * @param hello updated HELLO
  32. */
  33. typedef void
  34. (*GST_HelloCallback) (void *cls,
  35. const struct GNUNET_MessageHeader *hello);
  36. /**
  37. * Initialize the HELLO module.
  38. *
  39. * @param friend_only use a friend only hello
  40. * @param cb function to call whenever our HELLO changes
  41. * @param cb_cls closure for @a cb
  42. */
  43. void
  44. GST_hello_start (int friend_only,
  45. GST_HelloCallback cb,
  46. void *cb_cls);
  47. /**
  48. * Shutdown the HELLO module.
  49. */
  50. void
  51. GST_hello_stop (void);
  52. /**
  53. * Obtain this peers HELLO message.
  54. *
  55. * @return our HELLO message
  56. */
  57. const struct GNUNET_MessageHeader *
  58. GST_hello_get (void);
  59. /**
  60. * Add or remove an address from this peer's HELLO message.
  61. *
  62. * @param addremove #GNUNET_YES to add, #GNUNET_NO to remove
  63. * @param address address to add or remove
  64. */
  65. void
  66. GST_hello_modify_addresses (int addremove,
  67. const struct GNUNET_HELLO_Address *address);
  68. /**
  69. * Test if a particular address is one of ours.
  70. *
  71. * @param address the address to test
  72. * @param sig location where to cache PONG signatures for this address [set]
  73. * @param sig_expiration how long until the current 'sig' expires?
  74. * (ZERO if sig was never created) [set]
  75. * @return #GNUNET_YES if this is one of our addresses,
  76. * #GNUNET_NO if not
  77. */
  78. int
  79. GST_hello_test_address (const struct GNUNET_HELLO_Address *address,
  80. struct GNUNET_CRYPTO_EddsaSignature **sig,
  81. struct GNUNET_TIME_Absolute **sig_expiration);
  82. #endif
  83. /* end of file gnunet-service-transport_hello.h */