mp_s_message.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
  24. /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
  25. /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
  26. /*%% (c) Copyright 1993, 1994 Novell, Inc. */
  27. /*%% $XConsortium: mp_s_message.h /main/3 1995/10/23 11:55:57 rswiston $ */
  28. /* -*-C++-*-
  29. *
  30. * @(#)mp_s_message.h 1.13 94/11/17
  31. *
  32. * Tool Talk Message Passer (MP) - mp_s_message.h
  33. *
  34. * Copyright (c) 1990,1992 by Sun Microsystems, Inc.
  35. *
  36. * This file implements the server side of the _Tt_message object.
  37. */
  38. #ifndef _MP_S_MESSAGE_H
  39. #define _MP_S_MESSAGE_H
  40. #include "mp/mp_message.h"
  41. #include "mp/mp_trace.h"
  42. #include "mp_otype_utils.h"
  43. #include "mp_signature_utils.h"
  44. #include "mp_observer_utils.h"
  45. #include "mp_s_message_utils.h"
  46. #include "mp_s_procid_utils.h"
  47. class _Tt_s_pattern;
  48. class _Tt_s_message : public _Tt_message {
  49. public:
  50. _Tt_s_message();
  51. virtual ~_Tt_s_message();
  52. _Tt_s_message(_Tt_s_message *m, _Tt_observer_ptr &o);
  53. Tt_scope scope() const;
  54. int opnum() const;
  55. Tt_state state() const;
  56. const _Tt_string &handler_ptype() const;
  57. Tt_disposition reliability() const;
  58. void qmsg_info(_Tt_qmsg_info_ptr &qm);
  59. Tt_status indoctrinate(const _Tt_msg_trace &trace);
  60. Tt_status dispatch(const _Tt_msg_trace &trace);
  61. Tt_status set_start_env() const;
  62. int deliver(const _Tt_msg_trace &trace,
  63. int deliver_to_observers = 1);
  64. void deliver_to_observers_and_handlers(
  65. const _Tt_msg_trace &trace );
  66. void set_return_sender_flags();
  67. void set_send_handler_flags();
  68. Tt_status change_state(const _Tt_procid_ptr &changer,
  69. Tt_state s,
  70. const _Tt_msg_trace &trace );
  71. void remove_procid(const _Tt_procid_ptr &p);
  72. int is_handler_copy() const {
  73. return(_observer.is_null());
  74. }
  75. const _Tt_observer_ptr &observer() const {
  76. return _observer;
  77. }
  78. Tt_status set_state(Tt_state state);
  79. Tt_status set_scope(Tt_scope s);
  80. Tt_status set_reliability(Tt_disposition r);
  81. void add_eligible_voter(const _Tt_procid_ptr &p);
  82. private:
  83. int already_tried(const _Tt_procid_ptr &proc);
  84. Tt_status started(const _Tt_msg_trace &trace);
  85. Tt_status hdispatch();
  86. void handle_no_recipients(
  87. const _Tt_msg_trace &trace);
  88. Tt_status handler_dispatch(const _Tt_msg_trace &trace);
  89. int match_handler(const _Tt_s_pattern &pat,
  90. const _Tt_msg_trace &trace,
  91. int &best_match,
  92. Tt_category &best_category,
  93. unsigned int &best_timestamp) const;
  94. int match_handler(const _Tt_signature &sig,
  95. const _Tt_msg_trace &trace,
  96. int &best_match,
  97. Tt_category &best_category,
  98. unsigned int &best_timestamp) const;
  99. int match_observer(const _Tt_s_pattern &pat,
  100. const _Tt_s_procid_ptr &proc,
  101. const _Tt_msg_trace &trace);
  102. int match_observer(const _Tt_signature &pat,
  103. const _Tt_msg_trace &trace);
  104. int match_patterns(_Tt_pattern_list_ptr &patterns,
  105. const _Tt_msg_trace &trace,
  106. _Tt_pattern_ptr &best_pattern,
  107. int deliver_to_observers);
  108. Tt_status match_signatures(_Tt_signature_list_ptr &s,
  109. const _Tt_msg_trace &trace);
  110. int match_super_sig(_Tt_otype_ptr ot,
  111. _Tt_signature_ptr &sig,
  112. const _Tt_msg_trace &trace);
  113. Tt_status object_oriented_dispatch(
  114. const _Tt_msg_trace &trace);
  115. Tt_status procedural_dispatch(
  116. const _Tt_msg_trace &trace);
  117. Tt_status queued(const _Tt_msg_trace &trace);
  118. Tt_status rejected(const _Tt_msg_trace &trace);
  119. void report_state_change();
  120. int needs_observer_match();
  121. Tt_status add_voter(const _Tt_procid_ptr &p,
  122. Tt_state vote,
  123. const _Tt_msg_trace &trace);
  124. Tt_status count_ballots(const _Tt_procid_ptr &last_voter,
  125. const _Tt_msg_trace &trace);
  126. unsigned int _when_last_matched;
  127. _Tt_procid_list_ptr _tried;
  128. int _state_reported;
  129. _Tt_observer_list_ptr _observers;
  130. _Tt_observer_ptr _observer;
  131. int _num_recipients_yet_to_vote;
  132. _Tt_s_message_ptr _original;
  133. };
  134. #endif /* _MP_S_MESSAGE_H */