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 /* $XConsortium: dtpdmdP.h /main/6 1996/10/30 19:11:15 cde-hp $ */
24 /******************************************************************************
25 ******************************************************************************
29 ** Description: misc header stuff for the dtpdmd
31 ** (c) Copyright 1995, 1996, Hewlett-Packard Company, all rights reserved.
33 ******************************************************************************
34 *****************************************************************************/
44 #include "X11/Xlibint.h"
45 #include "X11/Intrinsic.h"
46 #include "X11/Xatom.h"
47 #include <X11/extensions/Print.h>
48 #include <X11/Xauth.h>
51 /*****************************************************************************
53 * dtpdm/dtpdmd Protocol
55 #include <Dt/dtpdmd.h>
58 /******************************************************************************
60 * Child Tracking Record - for each fork/exec'ed child, the following
61 * structure is added to an array to maintain status on the child.
66 * Manager selection portion.
68 Bool mgr_flag; /* is MGR tracking portion active */
70 char *video_display_str; /* Video Server Connection Info */
73 char *print_display_str; /* Print Server Connection Info */
75 XPContext print_context;
78 Display *selection_display; /* Selection & Property Connection */
83 Time time; /* time of selection request */
85 Bool seldpy_as_printdpy; /* Can the selection display connection
86 be used in lieu of opening a new
87 print display connection? */
90 * fork/exec and SIGCLD tracking portion.
95 int message_pipe[2]; /* pipe fildes, -1 if disconnected */
96 XtInputId message_xtid; /* XtAddInput id for message handler */
97 char *message_string; /* child's stderr */
98 char *message_string2; /* dtpdmd's addition to child's err */
102 char **pdm_exec_argvs; /* PDM exec string in argv[] format */
103 char *pdm_exec_errormessage; /* exec error message (opt) for log */
104 Atom pdm_exec_errorcode; /* exec error code */
105 pid_t pid; /* pid of child */
106 Bool do_launch_reply; /* can someone call mgr_launch_reply? */
109 Bool exit_received; /* child has exited (SIGCLD) */
110 int exit_code; /* exit code */
113 * Mailbox selection portion.
115 Bool mbox_flag; /* do we have valid cookies */
116 Window mbox_window; /* assigned window serving as mbox */
117 char *in_buf; /* partial-cookie crumbs received */
118 int in_sofar; /* - total in so far */
119 int in_expected; /* - grand total expected */
121 Xauth **cookies; /* completed cookie collection */
122 int cookie_cnt; /* cookie cnt - partial & completed */
123 short cookie_state; /* 0 = NULL term, 1 = non-NULL term,
125 char auth_filename[L_tmpnam];
127 } XpPdmServiceRec, *XpPdmServiceList;
129 /******************************************************************************
131 * Global dtpdmd information. Rather than pass it around in
132 * parameter lists, clump in all in one global.
137 * Type Atom References
139 Atom pdm_selection; /* PDM Selection */
140 Atom pdm_targets; /* - target */
141 Atom pdm_timestamp; /* - target */
142 Atom pdm_multiple; /* - target */
143 Atom pdm_start; /* - target */
144 Atom pdm_start_ok; /* - status code */
145 Atom pdm_start_vxauth; /* - status code */
146 Atom pdm_start_pxauth; /* - status code */
147 Atom pdm_start_error; /* - status code */
149 Atom pdm_reply; /* OK/Cancel SendMessage type */
150 Atom pdm_exit_ok; /* - status code */
151 Atom pdm_exit_cancel; /* - status code */
152 Atom pdm_exit_vxauth; /* - status code */
153 Atom pdm_exit_pxauth; /* - status code */
154 Atom pdm_exit_error; /* - status code */
156 Atom pdm_mbox; /* - target */
158 Atom pdm_mail; /* Cookie-Package SendMessage type */
161 * X-Selection Information
165 Time time; /* time selection was owned */
170 char *default_pdm, *override_pdm;
173 * Child Service Tracking Record Information
176 int maxServiceRecNum;
177 XpPdmServiceRec **serviceRecs;
182 XtAppContext context;
190 unsigned char xerrno;
191 unsigned char xerrreq;
192 unsigned char xerrmin;
193 } XpPdmGlobals, *XpPdmGlobalsP;
195 /******************************************************************************
199 * In each group, one module will define, and all other modules
200 * will make extern references to them. Here are the extern
201 * reference statements.
205 extern void dispatch_mgr();
206 extern void dispatch_mbox();
207 extern void dispatch_targets();
208 extern void dispatch_multiple();
209 extern void dispatch_timestamp();
210 extern void dispatch_not_supported();
213 extern XpPdmGlobals g;
216 extern void mbox_initialize();
217 extern void mbox_build();
218 extern void mbox_reply();
219 extern void mbox_receive();
222 extern void mgr_initialize();
223 extern void mgr_launch_pdm();
224 extern void mgr_fetch_pdm();
225 extern void mgr_launch_reply();
226 extern void mgr_shutdown_reply();
227 extern void mgr_shutdown_scan();
230 extern XpPdmServiceRec *find_rec();
231 extern XpPdmServiceRec *find_rec_by_mbox_win();
232 extern void delete_rec( XpPdmServiceRec *rec );
235 extern Bool _PdmMgrSetup();
238 extern jmp_buf xio_quickie_jmp_buf;
239 extern int xio_quickie_handler();
240 extern char *xpstrdup();
241 extern int xpstrspn();
242 extern int xpstrcspn();
243 extern char *xpstrtok();
244 extern void xp_add_argv();