myco-agent.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* Copyright (C) 2016 Max Riechelmann <max.riechelmann@student.kit.edu>
  2. (Karlsruhe Institute of Technology)
  3. This library is free software; you can redistribute it and/or modify it
  4. under the terms of the GNU Lesser General Public License as published by the
  5. Free Software Foundation; either version 2.1 of the License, or (at your
  6. option) any later version.
  7. This library is distributed in the hope that it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  10. details.
  11. You should have received a copy of the GNU Lesser General Public License along
  12. with this library; if not, write to the Free Software Foundation, Inc., 51
  13. Franklin St, Fifth Floor, Boston, MA 02110, USA
  14. */
  15. /**
  16. * SECTION: myco-agent
  17. * @Short_description: agent library
  18. * @Title: MycoAgent
  19. *
  20. * MycoAgent implements the agent side of the Mycorrhiza distributed system.
  21. * It (un-)registers with the mycoagent and provides information about
  22. * accessible data RESOURCES.
  23. */
  24. #ifndef __MYCO_AGENT_H
  25. #define __MYCO_AGENT_H
  26. #include <sys/types.h>
  27. #include <sys/ipc.h>
  28. #include <sys/msg.h>
  29. #include <sys/stat.h>
  30. #include <stdio.h>
  31. #include <unistd.h>
  32. #include <errno.h>
  33. #include <string.h>
  34. #include "myco-ipc.c"
  35. #include <stdlib.h>
  36. #include <sys/file.h>
  37. #include <sys/mman.h>
  38. #include <sys/wait.h>
  39. /**
  40. * myco_agent_register:
  41. *
  42. * Registers self.
  43. *
  44. * Returns: message_queue_id on success, -1 on error
  45. */
  46. int myco_agent_register (const char *agent_name);
  47. /**
  48. * myco_agent_unregister:
  49. *
  50. * Unregisters self.
  51. *
  52. * Returns: message_queue_id on success, -1 on error
  53. */
  54. int myco_agent_unregister (const char *agent_name, int message_queue_id);
  55. /**
  56. * myco_agent_register_resource:
  57. *
  58. * Registers a resource.
  59. *
  60. * Returns: message_queue_id on success, -1 on error
  61. */
  62. void *myco_agent_register_resource (int agent_message_queue_id, const char *agent_name, const char *resource_name, int resource_transactional, pid_t pid, int size);
  63. /**
  64. * myco_agent_unregister_resource:
  65. *
  66. * Unregister a resource.
  67. *
  68. * Returns: message_queue_id on success, -1 on error
  69. */
  70. int myco_agent_unregister_resource (int message_queue_id, const char *resource_name);
  71. /**
  72. * myco_agent_request_resource:
  73. *
  74. * Requests a resource.
  75. *
  76. * Returns: message_queue_id on success, -1 on error
  77. */
  78. struct resource myco_agent_request_resource(int agent_message_queue_id, char *agent_name, char *resource_name);
  79. /**
  80. * myco_agent_request_resource_list:
  81. *
  82. * Requests resource list. Obtains a list of all resources in the current network.
  83. *
  84. * Returns: message_queue_id on success, -1 on error
  85. */
  86. int myco_agent_request_resource_list(int message_queue_id);
  87. /**
  88. * myco_agent_write_remote_resource:
  89. *
  90. * Writes to a non-transactional resource.
  91. *
  92. * Returns: message_queue_id on success, -1 on error
  93. */
  94. int myco_agent_write_remote_resource(int agent_message_queue_id, char *resource_name, void *pointer, int size, int force);
  95. /**
  96. * myco_agent_read_remote_resource:
  97. *
  98. * Reads from a non-transactional resource.
  99. *
  100. * Returns: message_queue_id on success, -1 on error
  101. */
  102. struct resource myco_agent_read_remote_resource(int message_queue_id, char *resource_name);
  103. #endif //__MYCO_AGENT_H