The great includes migration of 2019 (autotools)
Ok - so one of the steps in building CDE is an early phase called the includes phase (make includes). At this point, all of the public header files are exported to exports/include/Dt, DtI, ... Then, the software is built using that include dir. This of course does not work in autotools. Much of the software does things like #include <Dt/something.h>, so in order for the build to succeed, this behavior must be represented/replicated in some way. It seems the usual way of dealing with this is to place all public headers (and in some projects, ALL headers) into a toplevel include directory. We now do this for all public headers - they have been moved from wherever they were and placed in the appropriate spot in includes/ This will break the Imake 'make includes' phase unless the Imakefiles are fixed (remove the HEADERS = stuff, and the incdir defines). This has not been done at this point since in reality, once autotools works properly, there will be no need for the Imake stuff anymore, and I intend to get rid of it. This is just a warning for now - Imake builds in this tree will now fail at the 'includes' stage. This commit is only the migration. In upcoming commits, libtt will be fixed so that the hack being used before to get around this problem is removed as there will no longer be any need. And then the autotools work continues...
This commit is contained in:
48
cde/include/SPC/chars.h
Normal file
48
cde/include/SPC/chars.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these libraries and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/*
|
||||
* File: char.h $XConsortium: chars.h /main/3 1995/10/26 15:43:03 rswiston $
|
||||
* Language: C
|
||||
*
|
||||
* (c) Copyright 1988, Hewlett-Packard Company, all rights reserved.
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
|
||||
#ifndef _chars_h
|
||||
#define _chars_h
|
||||
|
||||
#define Space (XeChar) ' '
|
||||
#define Newline (XeChar) '\n'
|
||||
#define Tab (XeChar) '\t'
|
||||
#define Pound (XeChar) '#'
|
||||
#define Pad (XeChar) '\0'
|
||||
#define Colon (XeChar) ':'
|
||||
#define Equal (XeChar) '='
|
||||
|
||||
#define Nil_String (XeString) ""
|
||||
|
||||
#endif /* _chars_h */
|
||||
118
cde/include/SPC/spc-obj.h
Normal file
118
cde/include/SPC/spc-obj.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these libraries and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/*
|
||||
* File: spc-obj.h $XConsortium: spc-obj.h /main/3 1995/10/26 15:43:20 rswiston $
|
||||
* Language: C
|
||||
*
|
||||
* (c) Copyright 1989, Hewlett-Packard Company, all rights reserved.
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
|
||||
#ifndef _spc_obj_h
|
||||
#define _spc_obj_h
|
||||
|
||||
typedef SPC_Channel_Ptr (*SPC_F_open)(SPC_Channel_Ptr, int, XeString);
|
||||
typedef int (*SPC_F_close)(SPC_Channel_Ptr);
|
||||
typedef int (*SPC_F_read)(SPC_Channel_Ptr, int, XeString, int);
|
||||
typedef int (*SPC_F_write)(SPC_Channel_Ptr, XeString, int);
|
||||
typedef int (*SPC_F_reset)(SPC_Channel_Ptr);
|
||||
typedef int (*SPC_F_exec_proc)(SPC_Channel_Ptr);
|
||||
typedef int (*SPC_F_signal)(SPC_Channel_Ptr, int);
|
||||
typedef int (*SPC_F_attach)(SPC_Channel_Ptr, int);
|
||||
typedef int (*SPC_F_add_input)(SPC_Channel_Ptr, SbInputHandlerProc, void *);
|
||||
typedef int (*SPC_F_wait_for_termination)(SPC_Channel_Ptr);
|
||||
typedef int (*SPC_F_pre_fork)(SPC_Channel_Ptr);
|
||||
typedef int (*SPC_F_post_fork)(SPC_Channel_Ptr, int);
|
||||
typedef int (*SPC_F_remove_logfile)(SPC_Channel_Ptr);
|
||||
|
||||
/*
|
||||
**
|
||||
** New methods for B.00
|
||||
**
|
||||
*/
|
||||
|
||||
typedef int (*SPC_F_send_eof)(SPC_Channel_Ptr);
|
||||
typedef int (*SPC_F_set_termio)(SPC_Channel_Ptr, int, int, struct termios *);
|
||||
|
||||
#define channel_class_part \
|
||||
root_class_part \
|
||||
SPC_F_open open; /* opening a channel */ \
|
||||
SPC_F_close close; /* close a channel */ \
|
||||
SPC_F_read read; /* read from a channel */ \
|
||||
SPC_F_write write; /* write to a channel */ \
|
||||
SPC_F_reset reset; /* reset io to channel */ \
|
||||
SPC_F_exec_proc exec_proc; /* execute a subprocess over a channel */ \
|
||||
SPC_F_signal signal; /* signal a subprocess over a channel */ \
|
||||
SPC_F_attach attach; /* attach a subprocess to this channel */ \
|
||||
SPC_F_add_input add_input; /* how to add input callbacks to channel */ \
|
||||
SbInputCallbackProc input; \
|
||||
SPC_F_wait_for_termination wait_for_termination; /* wait for subprocess to exit */ \
|
||||
SPC_F_pre_fork pre_fork; /* setup before a fork */ \
|
||||
SPC_F_post_fork post_fork; /* setup after a fork */ \
|
||||
SPC_F_remove_logfile remove_logfile; /* remove log file associated with channel */ \
|
||||
SPC_F_send_eof send_eof; /* close stdin of subprocess */ \
|
||||
SPC_F_set_termio set_termio; /* set termio struct for PTY channels */
|
||||
|
||||
typedef struct channel_class {
|
||||
root_clasp base;
|
||||
channel_class_part
|
||||
} *channel_clasp;
|
||||
|
||||
typedef struct pty_channel_class {
|
||||
channel_clasp base;
|
||||
channel_class_part
|
||||
} *pty_channel_clasp;
|
||||
|
||||
typedef struct pipe_channel_class {
|
||||
channel_clasp base;
|
||||
channel_class_part
|
||||
} *pipe_channel_clasp;
|
||||
|
||||
typedef struct noio_channel_class {
|
||||
channel_clasp base;
|
||||
channel_class_part
|
||||
} *noio_channel_clasp;
|
||||
|
||||
typedef struct remote_channel_class {
|
||||
channel_clasp base;
|
||||
channel_class_part
|
||||
} *remote_channel_clasp;
|
||||
|
||||
#define call_parent_method(channel, func, args, result) { \
|
||||
pipe_channel_clasp parent_class=(pipe_channel_clasp) (channel)->class_ptr; \
|
||||
result=base_memf(parent_class, func, args); }
|
||||
|
||||
/* class definitions */
|
||||
|
||||
extern channel_clasp channel_class;
|
||||
extern pty_channel_clasp pty_channel_class;
|
||||
extern pipe_channel_clasp pipe_channel_class;
|
||||
extern noio_channel_clasp noio_channel_class;
|
||||
extern remote_channel_clasp remote_channel_class;
|
||||
|
||||
#endif /* _spc_obj_h */
|
||||
|
||||
297
cde/include/SPC/spc-proto.h
Normal file
297
cde/include/SPC/spc-proto.h
Normal file
@@ -0,0 +1,297 @@
|
||||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these libraries and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/*
|
||||
* File: spc-proto.h $XConsortium: spc-proto.h /main/3 1995/10/26 15:43:39 rswiston $
|
||||
* Language: C
|
||||
*
|
||||
* (c) Copyright 1988, Hewlett-Packard Company, all rights reserved.
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
|
||||
#ifndef _spc_proto_h
|
||||
#define _spc_proto_h
|
||||
|
||||
/*
|
||||
* Commands which are known to spcd and clients
|
||||
*/
|
||||
|
||||
/* The internet service */
|
||||
|
||||
#define SPC_SERVICE (XeString)"dtspc" /* The name of the registered service */
|
||||
#define SPC_PROTOCOL (XeString)"tcp" /* The name of the registered protocol */
|
||||
|
||||
/* MUST be a DECIMAL number as "%d" */
|
||||
#define SPC_PROTOCOL_VERSION_CDE_BASE 1000
|
||||
#define SPC_PROTOCOL_VERSION SPC_PROTOCOL_VERSION_CDE_BASE
|
||||
/* is used to read the string version */
|
||||
#define SPC_PROTOCOL_VERSION_CDE_BASE_STR "1000"
|
||||
#define SPC_PROTOCOL_VERSION_STR SPC_PROTOCOL_VERSION_CDE_BASE_STR
|
||||
|
||||
/* We could make this user config for old domain systems? */
|
||||
#define SPC_UNKNOWN_HOSTINFO_STR "HP-UX:7.0:*"
|
||||
/*
|
||||
**
|
||||
** Pseudo-filenames used for validating user
|
||||
**
|
||||
*/
|
||||
|
||||
#define PASSED_FILE_NAME (XeString)"<!passed>!"
|
||||
#define FAILED_FILE_NAME (XeString)"<!failed>!"
|
||||
|
||||
/*
|
||||
*** Protocol command numbers. These MUST remain in the same order
|
||||
*** to work with previous version of the spcd
|
||||
*/
|
||||
|
||||
/* Connections to the server */
|
||||
|
||||
#define APPLICATION_DATA 0 /* send data to subprocess */
|
||||
#define APPLICATION_STDOUT 1 /* data from subprocess */
|
||||
#define APPLICATION_STDERR 2 /* error messages from subprocess */
|
||||
|
||||
#define ABORT 3 /* Client aborted */
|
||||
#define REGISTER 4 /* Register client */
|
||||
#define UNREGISTER 5 /* Unregister client */
|
||||
|
||||
/* Channel requests */
|
||||
|
||||
#define CHANNEL_OPEN 6 /* enable this channel for read/write */
|
||||
#define CHANNEL_CLOSE 7 /* no more i/o to this channel (send EOF) */
|
||||
#define CHANNEL_RESET 8 /* reset this channel */
|
||||
#define CHANNEL_ATTACH 9 /* attach PTY device to this channel */
|
||||
|
||||
/* Application messages, client -> server */
|
||||
|
||||
#define APPLICATION_SPAWN 10 /* start up subprocess */
|
||||
#define APPLICATION_SIGNAL 11 /* send signal to subprocess */
|
||||
|
||||
/* application messages, server -> client */
|
||||
|
||||
#define APPLICATION_DIED 12 /* sent when subprocess dies */
|
||||
|
||||
#define SERVER_ERROR 13 /* server has detected an error */
|
||||
#define REPLY 14
|
||||
#define SERVER_DEBUG 15
|
||||
#define ENVIRON_RESET 16
|
||||
|
||||
/* Query / reply protocols, client -> server -> client */
|
||||
|
||||
#define QUERY_DEVICES 17
|
||||
#define DEVICE_REPLY 18
|
||||
|
||||
#define QUERY_LOGFILE 19
|
||||
#define LOGFILE_REPLY 20
|
||||
|
||||
/* Application messages, client -> server */
|
||||
|
||||
#define DELETE_LOGFILE 21
|
||||
|
||||
#define RESET_TERMIO 22 /* This is obsolete, (hpux binary version) */
|
||||
#define RESET_TERMIOS 23
|
||||
|
||||
/* New B.00 protocol requests */
|
||||
|
||||
#define CHANNEL_SEND_EOF 24 /* Send EOF to standard input of sub process */
|
||||
#define CHANNEL_TERMIOS 25 /* Send termios info for a particular pty */
|
||||
#define APP_B00_SPAWN 26 /* Enhanced spawn */
|
||||
|
||||
#define NREQS 27 /* total number of requests. If
|
||||
any are added, this should constant
|
||||
should reflect the new total */
|
||||
|
||||
#define PROT_TO_CONNECTOR(a) a
|
||||
#define CONNECTOR_TO_PROT(a) a
|
||||
|
||||
#define PDRP(_pdata) _pdata->data+REQUEST_HEADER_LENGTH
|
||||
|
||||
#define WRITE_INT(pdata, val)\
|
||||
sprintf_len(PDRP(pdata), (XeString)"%x", val)
|
||||
#define READ_INT(pdata, val) sscanf(PDRP(pdata), (XeString)"%x", &val)
|
||||
|
||||
#define WRITE_STRING(pdata, name)\
|
||||
sprintf_len(PDRP(pdata), (XeString)"%s", name)
|
||||
#define READ_STRING(pdata, name) sscanf(PDRP(pdata), (XeString)"%s", name)
|
||||
#define READ_STRING_NO_COPY(pdata, name) (name = PDRP(pdata))
|
||||
|
||||
#define WRITE_ABORT WRITE_INT
|
||||
#define READ_ABORT READ_INT
|
||||
|
||||
#define WRITE_OPEN WRITE_INT
|
||||
#define READ_OPEN READ_INT
|
||||
|
||||
#define WRITE_ATTACH WRITE_INT
|
||||
#define READ_ATTACH READ_INT
|
||||
|
||||
#define WRITE_APPLICATION_DIED WRITE_INT
|
||||
#define READ_APPLICATION_DIED READ_INT
|
||||
|
||||
#define WRITE_DEBUG WRITE_STRING
|
||||
#define READ_DEBUG READ_STRING
|
||||
|
||||
#define WRITE_ERROR WRITE_INT
|
||||
#define READ_ERROR READ_INT
|
||||
|
||||
#define WRITE_REGISTER(pdata, name, passwd, proto_ver, hostinfo)\
|
||||
sprint_register_data(PDRP(pdata), name, passwd, proto_ver, hostinfo)
|
||||
|
||||
#define READ_REGISTER(pdata, name, passwd, proto_rev, hostinfo)\
|
||||
sscan_register_data(PDRP(pdata), &name, &passwd, &proto_rev, &hostinfo)
|
||||
|
||||
#define WRITE_REPLY(pdata, val, err)\
|
||||
sprintf_len(PDRP(pdata), (XeString)"%x %x", val, err)
|
||||
#define READ_REPLY(pdata, val, err)\
|
||||
sscanf(PDRP(pdata), (XeString)"%x %x", &val, &err)
|
||||
|
||||
#define WRITE_DEVICE_REPLY(pdata, m0, s0, m1, s1, m2, s2) \
|
||||
sprint_device_data(PDRP(pdata), m0, s0, m1, s1, m2, s2)
|
||||
#define READ_DEVICE_REPLY(pdata, m0, s0, m1, s1, m2, s2) \
|
||||
sscan_device_data(PDRP(pdata), m0, s0, m1, s1, m2, s2)
|
||||
|
||||
#define WRITE_LOGFILE_REPLY(pdata, logfile, proto_ver, hostinfo) \
|
||||
sprint_logfile_data(PDRP(pdata), logfile, proto_ver, hostinfo)
|
||||
#define READ_LOGFILE_REPLY(pdata, logfile, proto_ver, hostinfo) \
|
||||
sscan_logfile_data(PDRP(pdata), logfile, proto_ver, hostinfo)
|
||||
|
||||
#define WRITE_APPLICATION_SPAWN(pdata, path, dir, argv, envp) \
|
||||
sprint_application_data(PDRP(pdata), (XeString)"%s %d %d ", \
|
||||
path, dir, argv, envp, REQUEST_HEADER_LENGTH)
|
||||
#define READ_APPLICATION_SPAWN(pdata, path, dir, argv, envp) \
|
||||
sscan_application_data(PDRP(pdata), (XeString)"%s %d %d ", \
|
||||
&path, &dir, &argv, &envp, REQUEST_HEADER_LENGTH)
|
||||
|
||||
#define WRITE_ENVIRON_RESET(pdata, numenv) \
|
||||
sprintf_len(PDRP(pdata), (XeString)"%d ", numenv)
|
||||
#define READ_ENVIRON_RESET(pdata, numenv) \
|
||||
sscanf(PDRP(pdata), (XeString)"%d ", &numenv)
|
||||
|
||||
#define WRITE_APP_DATA(pdata, buffer, len) \
|
||||
(memcpy(PDRP(pdata), buffer, len), len)
|
||||
|
||||
/* New B.00 protocol requests */
|
||||
#define WRITE_TERMIOS(pdata, connector, side, buffer) \
|
||||
sprintf_len(PDRP(pdata), (XeString)"%d %d %s", connector, side, buffer)
|
||||
#define READ_TERMIOS(pdata, connector, side, buffer) \
|
||||
sscanf(PDRP(pdata), (XeString)"%d %d %s", &connector, &side, buffer)
|
||||
|
||||
/* Writing a header is special, as we don't want to be offset by
|
||||
REQUEST_HEADER_LENGTH */
|
||||
|
||||
#define WRITE_HEADER(pdata, cid, type, len, seq) \
|
||||
sprintf_len(pdata->data, (XeString)"%08x%02x%04x%04x", cid, type, len, seq)
|
||||
#define READ_HEADER(pdata, cid, type, len, seq) \
|
||||
sscanf(pdata->data, (XeString)"%8x%2x%4x%4x", cid, type, len, seq)
|
||||
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
/*
|
||||
**
|
||||
** The test here is reversed, that is, we check only for those
|
||||
** requests where there is no reply expected, and assume the other
|
||||
** ones do expect replies.
|
||||
**
|
||||
*/
|
||||
|
||||
#define NO_REPLY_VAL (-1)
|
||||
|
||||
#define REPLY_EXPECTED(a, retval) \
|
||||
(((a==REPLY) || \
|
||||
(a==APPLICATION_DATA) || \
|
||||
(a==APPLICATION_STDOUT) || \
|
||||
(a==APPLICATION_STDERR) || \
|
||||
(a==REGISTER) || \
|
||||
(a==QUERY_LOGFILE) || \
|
||||
(a==QUERY_DEVICES) || \
|
||||
(a==ABORT) || \
|
||||
(a==SERVER_ERROR) \
|
||||
) ? NO_REPLY_VAL : retval)
|
||||
|
||||
typedef struct _prot_request {
|
||||
buffered_data_ptr dataptr;
|
||||
int seqno;
|
||||
int request_type;
|
||||
SPC_Channel_Ptr channel;
|
||||
struct _prot_request *next;
|
||||
} protocol_request, *protocol_request_ptr;
|
||||
|
||||
typedef int (*protocol_request_handler)(protocol_request_ptr);
|
||||
|
||||
/* spc-proto.c */
|
||||
buffered_data_ptr SPC_New_Buffered_Data_Ptr (void);
|
||||
void SPC_Reset_Protocol_Ptr (protocol_request_ptr prot, SPC_Channel_Ptr channel, XeChar req, int len);
|
||||
protocol_request_ptr SPC_New_Protocol_Ptr (SPC_Channel_Ptr channel, XeChar req, int len);
|
||||
void SPC_Free_Protocol_Ptr (protocol_request_ptr prot);
|
||||
SPC_Channel_Ptr SPC_Lookup_Channel (int cid, SPC_Connection_Ptr connection);
|
||||
SPC_Connection_Ptr SPC_Alloc_Connection (void);
|
||||
SPC_Connection_Ptr SPC_Lookup_Connection (XeString hostname);
|
||||
SPC_Connection_Ptr SPC_Lookup_Connection_Fd (int fd);
|
||||
SPC_Connection_Ptr SPC_Make_Connection (XeString hostname);
|
||||
void SPC_Add_Connection (SPC_Connection_Ptr connection);
|
||||
void SPC_Close_Connection (SPC_Connection_Ptr connection);
|
||||
int SPC_Read_Chars (SPC_Connection_Ptr connection, int request_len, XeString charptr);
|
||||
int SPC_Write_Chars (int fd, XeString charptr, int request_len);
|
||||
protocol_request_ptr SPC_Read_Protocol (SPC_Connection_Ptr connection);
|
||||
protocol_request_ptr SPC_Filter_Connection (SPC_Connection_Ptr connection, SPC_Channel_Ptr channel, int reqtype, int deletep);
|
||||
void SPC_Flush_Queued_Data (SPC_Channel_Ptr channel);
|
||||
int SPC_Read_Remote_Data (SPC_Channel_Ptr channel, int connector, XeString client_buffer, int nbytes);
|
||||
int print_protocol_request (XeString name, protocol_request_ptr proto);
|
||||
int SPC_Write_Protocol_Request (SPC_Connection_Ptr connection, SPC_Channel_Ptr channel, int request, ...);
|
||||
int SPC_Write_Single_Prot_Request (SPC_Connection_Ptr connection, XeString name, protocol_request_ptr prot);
|
||||
int SPC_Waitfor_Reply (SPC_Connection_Ptr connection, SPC_Channel_Ptr channel, int seqno);
|
||||
int SPC_Dispatch_Protocol (protocol_request_ptr proto, protocol_request_handler *);
|
||||
int SPC_Write_Reply (SPC_Connection_Ptr conn, protocol_request_ptr proto, int retval, int errval);
|
||||
int SPC_Send_Environ (SPC_Connection_Ptr connection, protocol_request_ptr prot);
|
||||
int sprint_counted_string (XeString buf, int count, XeString *vect, int limit);
|
||||
XeString *sscan_counted_string (XeString buf, XeString *newbuf);
|
||||
int sprint_application_data (XeString buf, XeString fmt, XeString path, XeString dir, XeString *argv, XeString *envp, int chars_used);
|
||||
int sscan_application_data (XeString buf, XeString fmt, XeString *path, XeString *dir, XeString **argv, XeString **envp, int offset);
|
||||
int sprint_device_data (XeString buf, XeString m0, XeString s0, XeString m1, XeString s1, XeString m2, XeString s2);
|
||||
int sscan_device_data (XeString buf, XeString *m0, XeString *s0, XeString *m1, XeString *s1, XeString *m2, XeString *s2);
|
||||
int sprint_logfile_data (XeString buf, XeString logfile, XeString proto_ver, XeString hostinfo);
|
||||
int sscan_logfile_data (XeString buf, XeString *logfile, XeString *proto_ver, XeString *hostinfo);
|
||||
int sprint_register_data (XeString buf, XeString username, XeString passwd, XeString proto_ver, XeString hostinfo);
|
||||
int sscan_register_data (XeString buf, XeString *username, XeString *passwd, XeString *proto_ver, XeString *hostinfo);
|
||||
int SPC_Query_Devices (SPC_Channel_Ptr channel);
|
||||
int SPC_Query_Logfile (SPC_Channel_Ptr channel);
|
||||
int SPC_Validate_User (XeString hostname, SPC_Connection_Ptr connection);
|
||||
int SPC_Get_Termio (protocol_request_ptr prot_request);
|
||||
int SPC_Get_Termios (protocol_request_ptr prot_request);
|
||||
XeString SPC_LocalHostinfo(void);
|
||||
int SPC_Send_Multi_Packet(SPC_Connection_Ptr connection,
|
||||
protocol_request_ptr prot,
|
||||
char **str_vect,
|
||||
int num_str,
|
||||
int req,
|
||||
XeString name,
|
||||
int errid);
|
||||
char **SPC_Get_Multi_Packet(SPC_Connection_Ptr connection,
|
||||
protocol_request_ptr prot,
|
||||
char **out,
|
||||
int *outlen,
|
||||
int request,
|
||||
XeString name);
|
||||
|
||||
#endif /* _spc_proto_h */
|
||||
126
cde/include/SPC/spcE.h
Normal file
126
cde/include/SPC/spcE.h
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these libraries and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/*
|
||||
* File: spcE.h $XConsortium: spcE.h /main/3 1995/10/26 15:43:58 rswiston $
|
||||
* Language: C
|
||||
*
|
||||
* (c) Copyright 1988, Hewlett-Packard Company, all rights reserved.
|
||||
*
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
||||
* (c) Copyright 1993, 1994 Novell, Inc. *
|
||||
*/
|
||||
|
||||
#ifndef _spcE_h
|
||||
#define _spcE_h
|
||||
|
||||
/* Keep this up to date with the first error number declared below */
|
||||
#define SPC_First_Error_Number 100
|
||||
#define SPC_Min_Error SPC_First_Error_Number
|
||||
|
||||
#define SPC_Out_Of_Memory 100
|
||||
#define SPC_Bad_Argument 101
|
||||
#define SPC_Active_Channel 102
|
||||
#define SPC_Inactive_Channel 103
|
||||
#define SPC_Internal_Error 104
|
||||
#define SPC_Cannot_Fork 105
|
||||
#define SPC_Cannot_Exec 106
|
||||
#define SPC_Cannot_Execute 107
|
||||
#define SPC_No_Pipe 108
|
||||
#define SPC_No_Pty 109
|
||||
#define SPC_Bad_Connector 110
|
||||
#define SPC_Reading 111
|
||||
#define SPC_Writing 112
|
||||
#define SPC_Bad_Service 113
|
||||
#define SPC_Bad_Port 114
|
||||
#define SPC_Unknown_Host 115
|
||||
#define SPC_Bad_Socket 116
|
||||
#define SPC_Bad_Connect 117
|
||||
#define SPC_Bad_Bind 118
|
||||
#define SPC_Bad_Listen 119
|
||||
#define SPC_Bad_Accept 120
|
||||
#define SPC_Bad_Linger 121
|
||||
#define SPC_Bad_Reuse 122
|
||||
#define SPC_Bad_Sockname 123
|
||||
#define SPC_Bad_Open 124
|
||||
#define SPC_Connection_EOF 125
|
||||
#define SPC_Timeout 126
|
||||
#define SPC_Protocol 127
|
||||
#define SPC_Unexpected_Reply 128
|
||||
#define SPC_No_Channel 129
|
||||
#define SPC_Illegal_Iomode 130
|
||||
#define SPC_No_Signal_Handler 131
|
||||
#define SPC_Bad_Operation 132
|
||||
#define SPC_Bad_Fd 133
|
||||
#define SPC_Bad_Ioctl 134
|
||||
#define SPC_Bad_Select 135
|
||||
#define SPC_Bind_Timeout 136
|
||||
#define SPC_Arg_Too_Long 137
|
||||
#define SPC_Write_Prot 138
|
||||
#define SPC_Bad_Username 139
|
||||
#define SPC_Bad_Password 140
|
||||
#define SPC_Client_Not_Valid 141
|
||||
#define SPC_Cannot_Open_Slave 142
|
||||
/* #define SPC_Register_Error 143 */ /* This has been obsoleted by the
|
||||
expanded register errors below */
|
||||
#define SPC_Protocol_Abort 144
|
||||
#define SPC_Env_Too_Big 145
|
||||
#define SPC_Unlink_Logfile 146
|
||||
#define SPC_Closed_Channel 147
|
||||
#define SPC_Bad_Authentication 148
|
||||
#define SPC_Cannot_Open_Log 149
|
||||
#define SPC_Connection_Reset 150
|
||||
#define SPC_Register_Username 151
|
||||
#define SPC_Register_Netrc 152
|
||||
#define SPC_Register_Open 153
|
||||
#define SPC_Register_Handshake 154
|
||||
|
||||
#define SPC_Bad_Termios_Mode 155
|
||||
#define SPC_Bad_Termios_Speed 156
|
||||
#define SPC_Bad_Termios_CC 157
|
||||
#define SPC_Bad_Termios_Proto 158
|
||||
|
||||
#define SPC_Bad_Signal_Name 159
|
||||
#define SPC_Bad_Signal_Value 160
|
||||
#define SPC_Bad_Signal_Format 161
|
||||
|
||||
#define SPC_Bad_tc_Call 162
|
||||
|
||||
#define SPC_cannot_Chdir 163
|
||||
|
||||
#define SPC_Bad_Permission 164
|
||||
#define SPC_Cannot_Create_Netfilename 165
|
||||
#define SPC_Protocol_Version_Error 166
|
||||
|
||||
/* JET - a special error code for goobers trying to overflow our buffers. */
|
||||
/* VU#172583 */
|
||||
#define SPC_Buffer_Overflow 167
|
||||
|
||||
/* Keep this up to date with the last error number declared above */
|
||||
#define SPC_Max_Error 168
|
||||
|
||||
/* The definition of the SPC Error structure has been moved to spc.h
|
||||
(to make it public) */
|
||||
|
||||
#endif /* _spcE_h */
|
||||
564
cde/include/SPC/spcP.h
Normal file
564
cde/include/SPC/spcP.h
Normal file
@@ -0,0 +1,564 @@
|
||||
/*
|
||||
* CDE - Common Desktop Environment
|
||||
*
|
||||
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
||||
*
|
||||
* These libraries and programs are free software; you can
|
||||
* redistribute them and/or modify them under the terms of the GNU
|
||||
* Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* These libraries and programs are distributed in the hope that
|
||||
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU Lesser General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these libraries and programs; if not, write
|
||||
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
||||
* Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
/*
|
||||
* $XConsortium: spcP.h /main/4 1996/05/15 12:01:55 drk $
|
||||
* Language: C
|
||||
*
|
||||
* (c) Copyright 1996 Digital Equipment Corporation.
|
||||
* (c) Copyright 1988,1993,1994,1996 Hewlett-Packard Company.
|
||||
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
|
||||
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993,1994,1996 Novell, Inc.
|
||||
* (c) Copyright 1996 FUJITSU LIMITED.
|
||||
* (c) Copyright 1996 Hitachi.
|
||||
*/
|
||||
|
||||
#ifndef _spcP_h
|
||||
#define _spcP_h
|
||||
|
||||
#include <netdb.h> /* hostent */
|
||||
#include <termios.h>
|
||||
|
||||
#include <bms/bms.h>
|
||||
#include <bms/Symbolic.h>
|
||||
#include <bms/XeUserMsg.h>
|
||||
#include <bms/SbEvent.h>
|
||||
#include <bms/spc.h>
|
||||
#include <bms/scoop.h>
|
||||
#include <bms/connect.h>
|
||||
#include <bms/MemoryMgr.h>
|
||||
|
||||
#include "chars.h"
|
||||
#include "spcE.h"
|
||||
#include "spc-obj.h"
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
#ifndef CDE_CONFIGURATION_TOP
|
||||
#define CDE_CONFIGURATION_TOP "/etc/opt/dt"
|
||||
#endif
|
||||
#ifndef CDE_INSTALLATION_TOP
|
||||
#define CDE_INSTALLATION_TOP "/usr/dt"
|
||||
#endif
|
||||
|
||||
#define Stdin(chn) chn->file_descs[STDIN]
|
||||
#define Stdout(chn) chn->file_descs[STDOUT]
|
||||
#define Stderr(chn) chn->file_descs[STDERR]
|
||||
|
||||
/* Some necessary identifiers */
|
||||
#define OK 0
|
||||
#define ERROR -1
|
||||
#define Undefined -1
|
||||
|
||||
/* Some character constants */
|
||||
|
||||
#define Channel_ByteID (XeChar)'\077'
|
||||
|
||||
/* And finally, the common channel identifier */
|
||||
#ifndef BITSPERBYTE
|
||||
#define BITSPERBYTE 8
|
||||
#endif
|
||||
#define CID_High_Bits (Channel_ByteID << (BITSPERBYTE * (sizeof(int) - 1)))
|
||||
#define CID_Middle_Bits (0x1010 << BITSPERBYTE)
|
||||
#define CID_Low_Bits (Channel_ByteID & 0xff)
|
||||
|
||||
#define Channel_Identifier (CID_High_Bits | CID_Middle_Bits | CID_Low_Bits)
|
||||
|
||||
/*** Note: If device names ever increase from: /dev/ptym/ptyp0, look here ***/
|
||||
#define PTY_NAMLEN 20
|
||||
#define EXCEPT_FLAG -1 /* Used for TIOC handling in PTY's */
|
||||
|
||||
/* Define lengths of buffers for protocol requests and other sizes of things */
|
||||
|
||||
#define REQUEST_HEADER_LENGTH 20
|
||||
#define MAXREQLEN (SPC_BUFSIZ+REQUEST_HEADER_LENGTH)
|
||||
#define DEFAULT_ENVP_SIZE 50
|
||||
|
||||
/*
|
||||
**
|
||||
** Definitions for select.
|
||||
**
|
||||
*/
|
||||
|
||||
extern int max_fds;
|
||||
|
||||
/*
|
||||
* Macros to access SPC_IOMode bit fields
|
||||
*/
|
||||
|
||||
/* These are derived from above spc bit specifications */
|
||||
#define IS_SPCIO_STDIN(a) (a & SPCIO_WRITEONLY)
|
||||
#define IS_SPCIO_STDOUT(a) (a & SPCIO_READONLY)
|
||||
#define IS_SPCIO_STDERR(a) (a & SPCIO_ERRORONLY)
|
||||
#define IS_SPCIO_SEPARATE(a) (a & SPCIO_SEPARATEREADERROR)
|
||||
|
||||
#define IS_SPCIO_NOIO(a) ((a & SPCIO_SOURCE_MASK) == SPCIO_NOIO)
|
||||
#define IS_SPCIO_WRITEONLY(a) ((a & SPCIO_SOURCE_MASK) == SPCIO_WRITEONLY)
|
||||
#define IS_SPCIO_READONLY(a) ((a & SPCIO_SOURCE_MASK) == SPCIO_READONLY)
|
||||
#define IS_SPCIO_READWRITE(a) ((a & SPCIO_SOURCE_MASK) == SPCIO_READWRITE)
|
||||
#define IS_SPCIO_ERRORONLY(a) ((a & SPCIO_SOURCE_MASK) == SPCIO_ERRORONLY)
|
||||
#define IS_SPCIO_WRITEERROR(a) ((a & SPCIO_SOURCE_MASK) == SPCIO_WRITEERROR)
|
||||
#define IS_SPCIO_READERROR(a) ((a & SPCIO_SOURCE_MASK) == SPCIO_READERROR)
|
||||
#define IS_SPCIO_READWRITEERROR(a)((a&SPCIO_SOURCE_MASK) == SPCIO_READWRITEERROR)
|
||||
|
||||
/* Style flags (mutually exclusive) */
|
||||
#define IS_SPCIO_PIPE(a) ((a & SPCIO_STYLE_MASK) == SPCIO_PIPE)
|
||||
#define IS_SPCIO_PTY(a) ((a & SPCIO_STYLE_MASK) == SPCIO_PTY)
|
||||
#define IS_SPCIO_NOIOMODE(a) ((a & SPCIO_STYLE_MASK) == SPCIO_NOIOMODE)
|
||||
|
||||
#define IS_SPCIO_LINEEDIT(a) (a & SPCIO_LINEEDIT)
|
||||
|
||||
/* Other non-mutually exclusive flags */
|
||||
#define IS_SPCIO_SYSTEM(a) (a & SPCIO_SYSTEM)
|
||||
#define IS_SPCIO_LINEORIENTED(a)(a & SPCIO_LINEORIENTED)
|
||||
#define IS_SPCIO_WAIT(a) (a & SPCIO_WAIT)
|
||||
#define IS_SPCIO_TOOLKIT(a) (a & SPCIO_USE_XTOOLKIT)
|
||||
#define IS_SPCIO_SYNC_TERM(a) (a & SPCIO_SYNC_TERMINATOR)
|
||||
#define IS_SPCIO_USE_LOGFILE(a) (a & SPCIO_USE_LOGFILE)
|
||||
|
||||
#define IS_SPCIO_SIGNAL_PGRP(a) (a & SPCIO_SIGNAL_PGRP)
|
||||
#define IS_SPCIO_FORCE_CONTEXT(a) (a & SPCIO_FORCE_CONTEXT)
|
||||
|
||||
#define SPCIO_HAS_DATA 0x2000 /* Used for line-oriented IO */
|
||||
#define HAS_DATA(chn) (((chn->IOMode) & SPCIO_HAS_DATA) == SPCIO_HAS_DATA)
|
||||
|
||||
#define SPCIO_UNUSED3 0x80000
|
||||
|
||||
/* Flags for internal use only */
|
||||
|
||||
#define SPCIO_DEALLOC_ARGV 0x4000
|
||||
#define IS_SPCIO_DEALLOC_ARGV(a) (a & SPCIO_DEALLOC_ARGV)
|
||||
|
||||
#define SPCIO_DELAY_CLOSE 0x8000
|
||||
#define IS_SPCIO_DELAY_CLOSE(a) (a & SPCIO_DELAY_CLOSE)
|
||||
|
||||
#define SPCIO_DO_CLOSE 0x10000
|
||||
#define IS_SPCIO_DO_CLOSE(a) (a & SPCIO_DO_CLOSE)
|
||||
|
||||
/* Make sure that STATE_OFFSET is always such that you will clear the
|
||||
IOMode flags */
|
||||
|
||||
#define STATE_OFFSET 24
|
||||
#define SPCIO_ACTIVE (1<<STATE_OFFSET) /* channel has subprocess */
|
||||
#define SPCIO_DATA (2<<STATE_OFFSET) /* channel has data */
|
||||
|
||||
#define IS_SPCIO_ACTIVE(a) (a & SPCIO_ACTIVE)
|
||||
#define IS_SPCIO_DATA(a) (a & SPCIO_DATA)
|
||||
|
||||
#define IS_ACTIVE(chn) (IS_SPCIO_ACTIVE(chn->IOMode))
|
||||
#define IS_DATA(chn) (IS_SPCIO_DATA(chn->IOMode))
|
||||
|
||||
#define IS_REMOTE(chn) (chn->connection)
|
||||
|
||||
/* SPC state machine */
|
||||
|
||||
#define CHANNEL_STATE(io_mode) ((io_mode)>>STATE_OFFSET & 0x3)
|
||||
#define MAKE_CHANNEL_STATE(io_mode, _state) \
|
||||
(((_state)<<STATE_OFFSET) | (io_mode & ~(0x3<<STATE_OFFSET)))
|
||||
#define MAKE_STATE(_data,_proc) ((_data)<<1 | (_proc))
|
||||
#define MAKE_STATE_INDEX(_old,_new) ((_old)<<2 | (_new))
|
||||
#define DATA_LINE(_state) ((_state) >> 1)
|
||||
#define PROC_LINE(_state) ((_state) & 1)
|
||||
|
||||
/* Defaults */
|
||||
|
||||
#define DEFAULT_CHANNEL_CLASS pty_channel_class
|
||||
#define IS_SPCIO_DEFAULT(a) !((a) & SPCIO_STYLE_MASK)
|
||||
#define SPCIO_DEFAULT SPCIO_PTY
|
||||
|
||||
/*
|
||||
* Type definitions for SPC file descriptors
|
||||
*/
|
||||
|
||||
/* Definitions for wires */
|
||||
|
||||
#define READ_SIDE 0
|
||||
#define WRITE_SIDE 1
|
||||
|
||||
/*
|
||||
* Constants and external declarations for managing the SPC daemon's
|
||||
* logfile list, exit timer and process id list.
|
||||
*/
|
||||
#define SPCD_DEFAULT_TIMEOUT 10
|
||||
#define SPCD_DEAD_PROCESS -1
|
||||
#define SPCD_NO_TIMER -1
|
||||
#define SPCD_REQUEST_PENDING 1
|
||||
#define SPCD_NO_REQUEST_PENDING 0
|
||||
|
||||
/*
|
||||
* Constants for the 'SPC_who_am_i' variable.
|
||||
*/
|
||||
#define SPC_I_AM_A_CLIENT 1
|
||||
#define SPC_I_AM_A_DAEMON 2
|
||||
|
||||
/*
|
||||
* External variables defined in noio.c
|
||||
*/
|
||||
extern char **SPC_logfile_list;
|
||||
|
||||
/*
|
||||
* External variables defined in spc-exec.c
|
||||
*/
|
||||
extern pid_t *SPC_pid_list;
|
||||
extern char *SPC_mount_point_env_var;
|
||||
|
||||
/*
|
||||
* External variables defined in spc-obj.c
|
||||
*/
|
||||
extern int SPC_who_am_i;
|
||||
|
||||
/*
|
||||
* The client version number.
|
||||
*/
|
||||
extern int SPC_client_version_number;
|
||||
|
||||
/*
|
||||
* The name of the directory used for authentication and
|
||||
* for temporary logfiles.
|
||||
*/
|
||||
extern XeString SPCD_Authentication_Dir;
|
||||
|
||||
/*
|
||||
* Definitions for file locations
|
||||
*/
|
||||
#define SPCD_ENV_INSTALL_DIRECTORY CDE_INSTALLATION_TOP "/config"
|
||||
#define SPCD_ENV_CONFIG_DIRECTORY CDE_CONFIGURATION_TOP "/config"
|
||||
#define SPCD_ENV_HOME_DIRECTORY ".dt"
|
||||
#define SPCD_ENV_FILE "dtspcdenv"
|
||||
#define SPCD_PROG_NAME "dtspcd"
|
||||
|
||||
/*
|
||||
* The name of the remove environment 'keyword'.
|
||||
*/
|
||||
#define SPC_REMOVE_VAR "unset"
|
||||
|
||||
/*
|
||||
***
|
||||
*** Start typedefs
|
||||
***
|
||||
*/
|
||||
|
||||
typedef int Files[3]; /* Standard set of file descriptors */
|
||||
typedef int SPC_IOMode; /* Sub-Process Control IO Mode Bits */
|
||||
|
||||
/* This is a "wire", a data structure used in creating communication paths
|
||||
to / from a subprocess. It encapsulates all the information needed by
|
||||
all types of paths */
|
||||
|
||||
typedef struct _wire {
|
||||
SPC_IOMode flags; /* Basically, acts like an IOMode, but
|
||||
we are only interested in its data bits */
|
||||
int fd[2];
|
||||
XeString master_name, slave_name;
|
||||
int read_toolkit_id, except_toolkit_id;
|
||||
struct termios master_termio, slave_termio;
|
||||
struct _wire *next;
|
||||
} Wire;
|
||||
|
||||
typedef struct _buffered_data {
|
||||
XeChar data[MAXREQLEN];
|
||||
int len, offset;
|
||||
} buffered_data, *buffered_data_ptr;
|
||||
|
||||
typedef enum {
|
||||
SPC_Input,
|
||||
SPC_Exception,
|
||||
SPC_Terminator,
|
||||
SPC_Client
|
||||
} SPC_Callback_Condition;
|
||||
|
||||
/*
|
||||
* Type definition for an SPC Connection (a socket to SPCD server)
|
||||
*/
|
||||
|
||||
typedef struct _SPC_Connection {
|
||||
/* The host on which other end resides */
|
||||
XeChar hostname[MAXHOSTNAMELEN];
|
||||
int sid; /* The Socket ID */
|
||||
XeChar connected; /* Whether server connection is made */
|
||||
struct hostent *local; /* socket address information for */
|
||||
struct hostent *remote; /* ... local, remote machine */
|
||||
int termination_id;
|
||||
struct _SPC_Connection
|
||||
*next; /* The next server in the list */
|
||||
XeQueue queued_remote_data; /* queue for remote data */
|
||||
int protocol_version; /* Version of protocol of remote */
|
||||
XeString hostinfo; /* Info about remote, (type, os, etc) */
|
||||
|
||||
} SPC_Connection, *SPC_Connection_Ptr;
|
||||
|
||||
/*
|
||||
* This next macro returns a newly allocated string.
|
||||
* The caller should free it.
|
||||
*/
|
||||
|
||||
#define CONNECTION_HOSTNAME(conn) \
|
||||
((conn->remote) ? XeFindShortHost((conn)->remote->h_name) : \
|
||||
Xestrdup(XeString_Empty))
|
||||
|
||||
/*
|
||||
* Type definition for an SPC Channel
|
||||
*/
|
||||
|
||||
typedef int (*SPC_F_read_filter)(SPC_Channel_Ptr, int, XeString, int);
|
||||
|
||||
typedef struct _SPC_Channel { /* Sub-Process Control Channel */
|
||||
|
||||
/* stuff for SCOOP */
|
||||
channel_clasp class_ptr;
|
||||
root_object_part
|
||||
|
||||
/* First, we place a channel identifier, so we can check cid (see below) */
|
||||
int identifier; /* The common identifier for every channel */
|
||||
|
||||
/* The setup request information */
|
||||
SPC_Connection *connection; /* The connection structure (Local = NULL) */
|
||||
|
||||
XeString context_dir; /* Directory to "cd" to during spawn */
|
||||
XeString path; /* The command path pointer */
|
||||
XeString *argv; /* The command argument list pointers */
|
||||
XeString *envp; /* The command environment list pointers */
|
||||
|
||||
SPC_IOMode IOMode; /* The IO Control Mode settings */
|
||||
|
||||
/* User defined data handling procedures */
|
||||
SbInputHandlerProc Input_Handler;
|
||||
/* The user input handler routine */
|
||||
void * client_data; /* The user associated input handler data */
|
||||
/* Useful (ie.) as input Widget */
|
||||
SPC_TerminateHandlerType Terminate_Handler; /* The SIGCLD user handler routine */
|
||||
void * Terminate_Data; /* The client_data for user handler routine */
|
||||
|
||||
/* Now the recorded information */
|
||||
|
||||
int pid; /* The child Process IDentification number */
|
||||
/* Also the RPID for a Remote channel */
|
||||
int cid; /* The remote Channel IDentification number */
|
||||
int status; /* The Process status */
|
||||
Wire *wires[3]; /* The read side/write side file descriptors */
|
||||
Files file_descs; /* Which file descriptors to use */
|
||||
Wire *wire_list; /* Pointer to list of wires we have
|
||||
(used for reset & pre_fork processing) */
|
||||
buffered_data_ptr linebufs[3]; /* Buffers for lined oriented IO */
|
||||
SPC_F_read_filter read_filter;
|
||||
/* Function to use to read. It may
|
||||
be the actual read method, or it
|
||||
may be a filter for newlines
|
||||
(which would eventually call the read
|
||||
method) */
|
||||
XeQueue queued_remote_data; /* queue for remote data */
|
||||
XeString logfile; /* logfile name for SPCIO_USE_LOGFILE */
|
||||
int close_timeout; /* Amount of time to wait for a pty close */
|
||||
struct _SPC_Channel *next; /* The next active channel */
|
||||
|
||||
int sync_pipe[2]; /* Only used in pty.c for __hpux_pty */
|
||||
|
||||
} SPC_Channel;
|
||||
|
||||
/* The default shell when none can be derived */
|
||||
#ifdef hpV4
|
||||
#define DEFAULT_SHELL (XeString ) "/usr/bin/sh"
|
||||
#else
|
||||
#define DEFAULT_SHELL (XeString ) "/bin/sh"
|
||||
#endif /* hpV4 */
|
||||
|
||||
/* Some macros which define the bit field portions of a wait() status */
|
||||
/* NOTE: These should be independent of integer word size */
|
||||
#define WAIT_STATUS_MASK 0xff
|
||||
#define IS_WAIT_STATUS_STOPPED 0177
|
||||
#define IS_WAIT_STATUS_EXITED 0000
|
||||
#define IS_WAIT_STATUS_DUMPED 0200
|
||||
|
||||
typedef unsigned long SPCInputId;
|
||||
|
||||
/* SPC/local.c */
|
||||
int close_local_channel_object (SPC_Channel_Ptr channel);
|
||||
int write_local_channel_object (SPC_Channel_Ptr channel, XeString buffer, int nbytes);
|
||||
int signal_local_channel_object (SPC_Channel_Ptr channel, int sig);
|
||||
int local_channel_object_wait_for_termination (SPC_Channel_Ptr channel);
|
||||
int remove_logfile_local_channel_object (SPC_Channel_Ptr channel);
|
||||
void local_channel_object_input_handler (void * client_data, int *source, SPCInputId *id);
|
||||
int local_channel_object_send_eof(SPC_Channel_Ptr channel);
|
||||
|
||||
/* noio.c */
|
||||
void noio_channel_class_init (object_clasp c);
|
||||
SPC_Channel_Ptr open_noio_channel_object (SPC_Channel_Ptr channel, int iomode, XeString hostname);
|
||||
int read_noio_channel_object (SPC_Channel_Ptr channel, int connector, XeString buffer, int nbytes);
|
||||
int write_noio_channel_object (SPC_Channel_Ptr channel, XeString buffer, int nbytes);
|
||||
int pre_fork_noio_channel_object (SPC_Channel_Ptr channel);
|
||||
int post_fork_noio_channel_object (SPC_Channel_Ptr channel, int parentp);
|
||||
int reset_noio_channel_object (SPC_Channel_Ptr channel);
|
||||
int attach_noio_channel_object (SPC_Channel_Ptr channel, int);
|
||||
void noio_channel_object_input_handler (void * client_data, int *source, SPCInputId *id);
|
||||
int send_eof_noio_channel_object(SPC_Channel_Ptr channel);
|
||||
int set_termio_noio_channel_object(SPC_Channel_Ptr, int, int, struct termios *);
|
||||
|
||||
/* pipe.c */
|
||||
void pipe_channel_class_init (object_clasp c);
|
||||
Wire *getpipe (Wire *prevwire);
|
||||
SPC_Channel_Ptr open_pipe_channel_object (SPC_Channel_Ptr channel, int iomode, XeString hostname);
|
||||
int read_pipe_channel_object (SPC_Channel_Ptr channel, int connector, XeString buffer, int nbytes);
|
||||
int pre_fork_pipe_channel_object (SPC_Channel_Ptr channel);
|
||||
int post_fork_pipe_channel_object (SPC_Channel_Ptr channel, int parentp);
|
||||
int reset_pipe_channel_object (SPC_Channel_Ptr channel);
|
||||
int attach_pipe_channel_object (SPC_Channel_Ptr channel, int);
|
||||
int add_input_pipe_channel_object (SPC_Channel_Ptr channel, SbInputHandlerProc handler, void *data);
|
||||
|
||||
|
||||
/* pty.c */
|
||||
void pty_channel_class_init (object_clasp c);
|
||||
SPC_Channel_Ptr open_pty_channel_object (SPC_Channel_Ptr channel, int iomode, XeString hostname);
|
||||
int read_pty_channel_object (SPC_Channel_Ptr channel, int connector, XeString buffer, int nbytes);
|
||||
int pre_fork_pty_channel_object (SPC_Channel_Ptr channel);
|
||||
int post_fork_pty_channel_object (SPC_Channel_Ptr channel, int parentp);
|
||||
int reset_pty_channel_object (SPC_Channel_Ptr channel);
|
||||
int attach_pty_channel_object (SPC_Channel_Ptr channel, int pid);
|
||||
int add_input_pty_channel_object (SPC_Channel_Ptr channel, SbInputHandlerProc handler, void *data);
|
||||
int set_termio_pty_channel_object(SPC_Channel_Ptr channel, int, int,
|
||||
struct termios *);
|
||||
struct termios *SPC_Get_Current_Termio(void);
|
||||
int SPC_Setpgrp(int);
|
||||
|
||||
/* remote.c */
|
||||
void remote_channel_class_init (object_clasp c);
|
||||
Wire *get_new_remote_wire (Wire *prevwire);
|
||||
SPC_Channel_Ptr open_remote_channel_object (SPC_Channel_Ptr channel, int iomode, XeString hostname);
|
||||
int close_remote_channel_object (SPC_Channel_Ptr channel);
|
||||
int reset_remote_channel_object (SPC_Channel_Ptr channel);
|
||||
int exec_proc_remote_channel_object (SPC_Channel_Ptr channel);
|
||||
int write_remote_channel_object (SPC_Channel_Ptr channel, XeString buffer, int len);
|
||||
int read_remote_channel_object (SPC_Channel_Ptr channel, int connection, XeString buffer, int len);
|
||||
int signal_remote_channel_object (SPC_Channel_Ptr channel, int sig);
|
||||
int attach_remote_channel_object (SPC_Channel_Ptr channel, int pid);
|
||||
int remove_logfile_remote_channel_object (SPC_Channel_Ptr channel);
|
||||
int add_input_remote_channel_object (SPC_Channel_Ptr channel, SbInputHandlerProc handler, void *data);
|
||||
int SPC_Debug_Mode (SPC_Channel_Ptr channel, XeString file);
|
||||
int send_eof_remote_channel_object(SPC_Channel_Ptr channel);
|
||||
int set_termio_remote_channel_object(SPC_Channel_Ptr channel,
|
||||
int, int, struct termios *);
|
||||
|
||||
|
||||
/* spc-env.c */
|
||||
XeString SPC_Getenv (XeString var, XeString *envp);
|
||||
XeString *SPC_Putenv (XeString val, XeString *envp);
|
||||
XeString *SPC_Add_Env_File (XeString filename, XeString *envp);
|
||||
XeString *SPC_Create_Default_Envp (XeString *old_envp);
|
||||
XeString *SPC_Fixup_Environment (XeString *envp, SPC_Channel_Ptr channel);
|
||||
XeString *SPC_Merge_Envp (XeString *dest_envp, XeString *source_envp);
|
||||
void SPC_Free_Envp (XeString *envp);
|
||||
|
||||
|
||||
/* spc-exec.c */
|
||||
int SPC_Setup_Synchronous_Terminator (void);
|
||||
SPC_Connection_Ptr SPC_Channel_Terminator_Connection (SPC_Channel_Ptr channel);
|
||||
void SPC_Close_Unused (void);
|
||||
int SPC_MakeSystemCommand (SPC_Channel_Ptr channel);
|
||||
void SPC_Child_Terminated(int);
|
||||
int exec_proc_local_channel_object (SPC_Channel_Ptr channel);
|
||||
|
||||
|
||||
/* spc-net.c */
|
||||
Boolean SPC_Init_Local_Host_Info (void);
|
||||
int SPC_Local_Hostname (XeString hostname);
|
||||
SPC_Connection_Ptr SPC_Open_Connection (XeString hostname);
|
||||
int SPC_Open_Socket (SPC_Connection_Ptr conn, int type);
|
||||
int SPC_Contact_Server (SPC_Connection_Ptr connection);
|
||||
SPC_Connection_Ptr SPC_Init_Child (SPC_Connection_Ptr conn, int from);
|
||||
SPC_Connection_Ptr SPC_Standalone_Daemon (SPC_Connection_Ptr conn);
|
||||
int SPC_Inetd_Daemon (SPC_Connection_Ptr conn);
|
||||
SPC_Connection_Ptr SPC_Start_Daemon (int standalone);
|
||||
|
||||
|
||||
/* spc-obj.c */
|
||||
void spc_init_fds(void);
|
||||
object *alloc_channel_object (object_clasp c);
|
||||
void channel_class_init (object_clasp c);
|
||||
int SPC_ResetTerminator(void);
|
||||
int SPC_Initialize (void);
|
||||
SPC_Channel_Ptr SPC_Initialize_Channel (XeString hostname, int iomode);
|
||||
void SPC_Channel_Terminated (SPC_Channel_Ptr channel);
|
||||
int SPC_Check_Style (int iomode);
|
||||
int SPC_Transform_Iomode (int iomode);
|
||||
int SPC_Newline_Filter (SPC_Channel_Ptr channel, int connector, XeString buffer, int ntoread);
|
||||
int SPC_Input_Handler (SPC_Channel_Ptr channel, int connector);
|
||||
SPC_Channel_Ptr open_channel_object (SPC_Channel_Ptr channel, int iomode, XeString hostname);
|
||||
int close_channel_object (SPC_Channel_Ptr channel);
|
||||
int read_channel_object (SPC_Channel_Ptr channel, int connector, XeString buffer, int nbytes);
|
||||
int write_channel_object (SPC_Channel_Ptr channel, XeString buffer, int nbytes);
|
||||
int reset_channel_object (SPC_Channel_Ptr channel);
|
||||
int pre_fork_channel_object (SPC_Channel_Ptr channel);
|
||||
int post_fork_channel_object (SPC_Channel_Ptr channel, int parentp);
|
||||
int exec_proc_channel_object (SPC_Channel_Ptr channel);
|
||||
int signal_channel_object (SPC_Channel_Ptr channel, int sig);
|
||||
int channel_object_wait_for_termination (SPC_Channel_Ptr channel);
|
||||
int attach_channel_object (SPC_Channel_Ptr channel, int pid);
|
||||
int add_input_channel_object (SPC_Channel_Ptr channel, SbInputHandlerProc handler, void *data);
|
||||
int remove_logfile_channel_object (SPC_Channel_Ptr channel);
|
||||
|
||||
/* spc-sm.c */
|
||||
int SPC_Change_State (SPC_Channel_Ptr channel, int connector, int data_line, int process_line);
|
||||
int error_fun (SPC_Channel_Ptr channel, int connector);
|
||||
int connector_eof (SPC_Channel_Ptr channel, int connector);
|
||||
int connector_eof_with_reset (SPC_Channel_Ptr channel, int connector);
|
||||
int sigcld_with_reset (SPC_Channel_Ptr channel, int connector);
|
||||
|
||||
/* spc-xt.c */
|
||||
|
||||
typedef void (*spc_handler_func_type) (void *, int *, SPCInputId *);
|
||||
int SPC_Wait_For_Termination (SPC_Channel_Ptr channel);
|
||||
void SPC_XtBreak (void);
|
||||
void SPC_XtAddInput (SPC_Channel_Ptr channel, int *id_addr, int fd, spc_handler_func_type handler, SPC_Callback_Condition condition);
|
||||
void SPC_XtRemoveInput (int *id_addr, SPC_Callback_Condition condition);
|
||||
|
||||
|
||||
/* spc-util.c */
|
||||
Wire *get_new_wire (void);
|
||||
void free_wire (Wire *wire);
|
||||
SPC_Channel_Ptr SPC_Find_PID (int pid);
|
||||
int spc_close (int fd);
|
||||
int spc_dup2 (int from, int to);
|
||||
int SPC_fd_to_connector (SPC_Channel_Ptr channel, int fd);
|
||||
XeString *Alloc_Argv (int n);
|
||||
void SPC_Conditional_Packet_Handler (void * client_data, int *source, SPCInputId *id);
|
||||
int sprintf_len (XeString s, XeString format, ...);
|
||||
typedef Boolean (path_search_predicate)(XeString, XeString, XeString);
|
||||
Boolean path_search (XeString path, XeString filename, path_search_predicate p);
|
||||
|
||||
|
||||
/* spc-error.c */
|
||||
XeString SPC_copy_string (XeString str);
|
||||
void SPC_Error (int error, ...);
|
||||
int SPC_Make_Log_Filename (XeString name, int unique);
|
||||
int SPC_Open_Log (XeString filename, int unique);
|
||||
int SPC_Close_Log (void);
|
||||
int SPC_Write_Log (XeString str);
|
||||
int SPC_Format_Log (XeString format, ...);
|
||||
SPCError *SPC_Lookup_Error (int errornum);
|
||||
SPCError *SPC_Lookup_Error (int errornum);
|
||||
|
||||
|
||||
/* spc-termio.c */
|
||||
XeString SPC_Decode_Termios( struct termios * );
|
||||
void SPC_Encode_Termios(XeString buff, struct termios *tio);
|
||||
|
||||
#endif /* _spcP_h */
|
||||
Reference in New Issue
Block a user