socket_default_plugin.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (C) 2010 Tobias Brunner
  3. * HSR Hochschule fuer Technik Rapperswil
  4. * Copyright (C) 2010 Martin Willi
  5. * Copyright (C) 2010 revosec AG
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  14. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  15. * for more details.
  16. */
  17. #include "socket_default_plugin.h"
  18. #include "socket_default_socket.h"
  19. #include <daemon.h>
  20. typedef struct private_socket_default_plugin_t private_socket_default_plugin_t;
  21. /**
  22. * Private data of socket plugin
  23. */
  24. struct private_socket_default_plugin_t {
  25. /**
  26. * Implements plugin interface
  27. */
  28. socket_default_plugin_t public;
  29. };
  30. METHOD(plugin_t, get_name, char*,
  31. private_socket_default_plugin_t *this)
  32. {
  33. return "socket-default";
  34. }
  35. METHOD(plugin_t, destroy, void,
  36. private_socket_default_plugin_t *this)
  37. {
  38. free(this);
  39. }
  40. METHOD(plugin_t, get_features, int,
  41. private_socket_default_plugin_t *this, plugin_feature_t *features[])
  42. {
  43. static plugin_feature_t f[] = {
  44. PLUGIN_CALLBACK(socket_register, socket_default_socket_create),
  45. PLUGIN_PROVIDE(CUSTOM, "socket"),
  46. PLUGIN_SDEPEND(CUSTOM, "kernel-ipsec"),
  47. };
  48. *features = f;
  49. return countof(f);
  50. }
  51. /*
  52. * see header file
  53. */
  54. plugin_t *socket_default_plugin_create()
  55. {
  56. private_socket_default_plugin_t *this;
  57. INIT(this,
  58. .public = {
  59. .plugin = {
  60. .get_name = _get_name,
  61. .get_features = _get_features,
  62. .destroy = _destroy,
  63. },
  64. },
  65. );
  66. return &this->public.plugin;
  67. }