2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
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 /*%% $TOG: mp_session.h /main/4 1999/08/30 10:59:15 mgreess $ */
29 * @(#)mp_session.h 1.36 95/01/25
31 * Copyright (c) 1990 by Sun Microsystems, Inc.
33 * This file contains the implementation of the _Tt_session object which
34 * represents the minimal message-passing domain. The primary
35 * responsibility of the _Tt_session is to advertise its presence in
36 * whatever form is appropriate (ie. as an X atom for X11, in the root
37 * directory of an NSE environment, etc.). When the _Tt_session object is
38 * created as part of a client application it represents mostly a
39 * connection to a _Tt_session object that is part of the message server.
40 * This server instance is responsible for storing session-queued
41 * messages, handling RPC requests to the server, and storing client
42 * properties. When clients will be able to join multiple sessions the
43 * server instance of _Tt_session will also be responsible for
44 * forwarding messages to other sessions (ie. the clients still pass
45 * messages through the same default session (to insure the proper
46 * flowcontrol) but those messages are passed on to their respective
51 #include "tt_options.h"
52 #include "util/tt_host_utils.h"
53 #include "mp/mp_auth.h"
54 #include "mp/mp_global.h"
56 #include "mp/mp_rpc.h"
57 #include "mp/mp_desktop_utils.h"
58 #include "mp/mp_rpc_client_utils.h"
59 #include "mp/mp_session_utils.h"
60 #include "mp/mp_session_prop_utils.h"
61 #include "mp/mp_message_utils.h"
62 #include "mp/mp_pattern_utils.h"
63 #include "mp/mp_procid_utils.h"
66 * string used to advertise a tt session in both the X and
67 * process-tree sessions. Note that in X ICCCM compliance
68 * dictates that the atom name be prefixed by the vendor
69 * string. Since there's no good reason for them to be different,
70 * the same name is used for process-tree sessions.
72 #define TT_XATOM_NAME "_SUN_TT_SESSION"
73 #define TT_CDE_XATOM_NAME "TT_SESSION"
74 #define TT_START_TOKEN "_SUN_TT_TOKEN"
75 #define TT_CDE_START_TOKEN "TT_TOKEN"
76 #define TT_FILE_HINT "_SUN_TT_FILE"
77 #define TT_CDE_FILE_HINT "TT_FILE"
78 #define TT_START_SID "_SUN_TT_SID"
79 #define TT_CDE_START_SID "_TT_SID"
87 class _Tt_session : public _Tt_object {
90 virtual ~_Tt_session();
92 _Tt_string address_string();
93 _Tt_string auth_cookie() {
94 return _auth.auth_cookie();
96 _Tt_auth_level auth_level() {
97 return _auth.auth_level();
99 Tt_status call(int rpc_proc,
100 xdrproc_t xdr_arg_fn, char *arg,
101 xdrproc_t xdr_res_fn, char *res,
102 int timeout = -1, int rebind = 0);
104 const _Tt_host_ptr &host() {
107 const _Tt_string &id() const {
112 //void print(FILE *fs = stdout) const;
119 Tt_status set_auth_level(_Tt_auth_level auth_level) {
120 return _auth.set_auth_level(auth_level);
122 void set_env(_Tt_env env, _Tt_string arg);
123 _Tt_string Xid(_Tt_string xdisp);
124 bool_t xdr(XDR *xdrs);
125 int desktop_event_callback();
126 _Tt_string displayname();
127 Tt_status set_id(char *sid = (char *)0);
128 Tt_status client_session_init();
129 _Tt_string process_tree_id();
131 // Determine if this session is in a list of sessions.
132 int has_id(const _Tt_string &id);
133 int has_id(const _Tt_string_list_ptr slist_p);
136 Tt_status auto_start_init();
137 Tt_status client_session_init_byid(_Tt_string sid);
138 Tt_status find_advertised_address(_Tt_string &addr);
139 Tt_status parsed_address(_Tt_string &session_addr);
144 _Tt_string _address_string;
146 _Tt_string _displayname;
149 _Tt_string _hostaddr;
154 _Tt_session_prop_list_ptr _properties;
155 _Tt_message_list_ptr _queued_messages;
156 _Tt_rpc_client_ptr _rpc_client;
162 _Tt_desktop_ptr _desktop;
163 #ifdef OPT_UNIX_SOCKET_RPC
165 char *local_socket_name();
166 _Tt_string _socket_name;
167 #endif /* OPT_UNIX_SOCKET_RPC */
169 friend class _Tt_s_mp;
170 friend class _Tt_s_session;
171 friend _Tt_mp::find_session_by_fd(int, _Tt_session_ptr &);
174 _Tt_string _tt_session_address(_Tt_object_ptr &o);
175 #endif /* MP_SESSION_H */