protocol.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
  3. (c) Copyright 2000-2004 Convergence (integrated media) GmbH
  4. All rights reserved.
  5. Written by Denis Oliver Kropp <dok@directfb.org>,
  6. Andreas Hundt <andi@fischlustig.de>,
  7. Sven Neumann <neo@directfb.org>,
  8. Ville Syrjälä <syrjala@sci.fi> and
  9. Claudio Ciccani <klan@users.sf.net>.
  10. This library is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU Lesser General Public
  12. License as published by the Free Software Foundation; either
  13. version 2 of the License, or (at your option) any later version.
  14. This library is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. Lesser General Public License for more details.
  18. You should have received a copy of the GNU Lesser General Public
  19. License along with this library; if not, write to the
  20. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. Boston, MA 02111-1307, USA.
  22. */
  23. #ifndef __FUSION_PROTOCOL_H__
  24. #define __FUSION_PROTOCOL_H__
  25. #include <sys/types.h>
  26. #include <sys/socket.h>
  27. #include <sys/un.h>
  28. #include <direct/types.h>
  29. typedef enum {
  30. FMT_SEND,
  31. FMT_ENTER,
  32. FMT_LEAVE,
  33. FMT_CALL,
  34. FMT_CALLRET,
  35. FMT_REACTOR
  36. } FusionMessageType;
  37. /*
  38. * Enter world (slave).
  39. */
  40. typedef struct {
  41. FusionMessageType type;
  42. FusionID fusion_id;
  43. } FusionEnter;
  44. /*
  45. * Leave the world (slave).
  46. */
  47. typedef struct {
  48. FusionMessageType type;
  49. FusionID fusion_id;
  50. } FusionLeave;
  51. /*
  52. * Execute a call.
  53. */
  54. typedef struct {
  55. FusionMessageType type;
  56. unsigned int serial;
  57. FusionID caller;
  58. int call_id;
  59. int call_arg;
  60. void *call_ptr;
  61. void *handler;
  62. void *ctx;
  63. FusionCallExecFlags flags;
  64. } FusionCallMessage, FusionCallExecute;
  65. /*
  66. * Send call return.
  67. */
  68. typedef struct {
  69. FusionMessageType type;
  70. int val;
  71. } FusionCallReturn;
  72. /*
  73. * Send reactor message.
  74. */
  75. typedef struct {
  76. FusionMessageType type;
  77. int id;
  78. int channel;
  79. FusionRef *ref;
  80. } FusionReactorMessage;
  81. typedef union {
  82. FusionMessageType type;
  83. FusionEnter enter;
  84. FusionLeave leave;
  85. FusionCallMessage call;
  86. FusionCallReturn callret;
  87. FusionReactorMessage reactor;
  88. } FusionMessage;
  89. #endif