Service.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /*
  24. * File: Service.h $XConsortium: Service.h /main/3 1995/10/26 15:27:03 rswiston $
  25. * Language: C
  26. *
  27. * (C) Copyright 1993, Hewlett-Packard, all rights reserved.
  28. *
  29. * (c) Copyright 1993, 1994 Hewlett-Packard Company *
  30. * (c) Copyright 1993, 1994 International Business Machines Corp. *
  31. * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
  32. * (c) Copyright 1993, 1994 Novell, Inc. *
  33. */
  34. #ifndef _Dt_Service_h
  35. #define _Dt_Service_h
  36. /************* DATA TYPES *****************************************/
  37. /* Many of the data types are standard DT types. */
  38. #include <Dt/DataTypes.h>
  39. /* Built on ICCC-based messaging library */
  40. #include <Dt/Msg.h>
  41. /* Specific messaging data types */
  42. typedef struct _DtSvcHandle * DtSvcHandle;
  43. typedef DtMsgContext DtSvcMsgContext;
  44. /************* MESSAGE DEFINITIONS *********************************/
  45. #define DT_SVC_MSG_SUCCESS "SUCCESS"
  46. #define DT_SVC_MSG_FAIL "FAIL"
  47. #define DT_SVC_MSG_REQUEST "REQUEST"
  48. #define DT_SVC_MSG_NOTIFY "NOTIFY"
  49. /************* CALLBACK PROTOTYPES ******************************
  50. */
  51. typedef void (*DtSvcReceiveProc) ();
  52. /*
  53. DtSvcHandle service,
  54. DtSvcMsgContext reply_context,
  55. Pointer client_data,
  56. String * message_fields,
  57. int num_fields);
  58. */
  59. /*
  60. * service A handle for the service.
  61. *
  62. * reply_context Opaque context information for the request that
  63. * was received. This data is needed when
  64. * generating a reply to a request.
  65. *
  66. * client_data A pointer to the data that was specified when
  67. * the callback was registered.
  68. *
  69. * message_fields A pointer to an array of strings that is the
  70. * contents of the request. (See note 2.)
  71. *
  72. * num_fields The number of fields in the message_fields
  73. * array.
  74. */
  75. typedef void (*DtSvcMessageProc) ();
  76. /*
  77. DtSvcHandle service,
  78. Pointer client_data,
  79. String * message_fields,
  80. int num_fields);
  81. */
  82. /*
  83. * service A handle for the service.
  84. *
  85. * client_data A pointer to the data that was specified when
  86. * the callback was registered.
  87. *
  88. * message_fields A pointer to an array of strings that is the
  89. * contents of the message. (See note 2.)
  90. *
  91. * num_fields The number of fields in the message_fields
  92. * array.
  93. */
  94. typedef void (*DtSvcStatusProc) ();
  95. /*
  96. DtSvcHandle service,
  97. int status,
  98. Pointer client_data);
  99. */
  100. /*
  101. * service Handle to the service whose status is being
  102. * reported.
  103. *
  104. * status The status of the service being started.
  105. *
  106. * client_data Pointer to the data that was registered when
  107. * the callback was registered.
  108. */
  109. /************* CONSTANTS ******************************************
  110. */
  111. /* The following are types of reply messages.
  112. */
  113. #define DT_SVC_SUCCESS 1 /* The request succeeded. */
  114. #define DT_SVC_FAIL -1 /* The service failed to carry
  115. * out the request.
  116. */
  117. #define DT_SVC_DELIVERY_FAIL -2 /* The request could not be
  118. * delivered to the service for
  119. * some reason. For example,
  120. * the service may not be running
  121. * and cannot be invoked.
  122. */
  123. /* The following are types of status.
  124. */
  125. #define DT_SVC_START 1 /* The service was started. */
  126. #define DT_SVC_NO_START -1 /* The service failed to start.
  127. */
  128. #define DT_SVC_LOST -2 /* The service was lost. Another
  129. provider took over ownership
  130. for this service. */
  131. #endif /*_Dt_Service_h*/
  132. /* Do not add anything after this endif. */