gnunet_rest_plugin.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. This file is part of GNUnet.
  3. Copyright (C) 2012-2015 Christian Grothoff (and other contributing authors)
  4. GNUnet is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published
  6. by the Free Software Foundation; either version 3, or (at your
  7. 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. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNUnet; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. /**
  18. * @author Martin Schanzenbach
  19. *
  20. * @file
  21. * GNUnet service REST plugin header
  22. *
  23. * @defgroup rest-plugin REST plugin for GNUnet services
  24. * @{
  25. */
  26. #ifndef GNUNET_REST_PLUGIN_H
  27. #define GNUNET_REST_PLUGIN_H
  28. #include "gnunet_util_lib.h"
  29. #include "gnunet_rest_lib.h"
  30. #include "microhttpd.h"
  31. #ifdef __cplusplus
  32. extern "C"
  33. {
  34. #if 0 /* keep Emacsens' auto-indent happy */
  35. }
  36. #endif
  37. #endif
  38. /**
  39. * @brief struct returned by the initialization function of the plugin
  40. */
  41. struct GNUNET_REST_Plugin
  42. {
  43. /**
  44. *
  45. * The closure of the plugin
  46. *
  47. */
  48. void *cls;
  49. /**
  50. * Plugin name. Used as the namespace for the API.
  51. * e.g. http://hostname:port/<name>
  52. */
  53. char *name;
  54. /**
  55. * Function to process a REST call
  56. *
  57. * @param method the HTTP method called
  58. * @param url the relative url accessed
  59. * @param data the REST data (can be NULL)
  60. * @param data_size the length of the data
  61. * @param proc the callback for result
  62. * @param proc_cls closure for callback
  63. */
  64. void (*process_request) (struct RestConnectionDataHandle *handle,
  65. GNUNET_REST_ResultProcessor proc,
  66. void *proc_cls);
  67. };
  68. #if 0 /* keep Emacsens' auto-indent happy */
  69. {
  70. #endif
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif
  75. /** @} */ /* end of group */