home *** CD-ROM | disk | FTP | other *** search
- /*
- * OS/2 Lan Manager using named pipes version of c-tree server
- *
- * CTPIPES.H
- *
- * Written by Personlige Systemer Norge A.S
- * Waldmar Thranes gate 77
- * 0175 OSLO 1
- * NORWAY
- * Phone: +47 2 113550
- *
- * Carl Henrik Bache
- * Februar 1989
- *
- */
-
- /*
- * This file included in all sources for NAMED PIPES SUPPORT
- * In sources handeling pipes (ctsmsg.c & ctamsg.c) include:
- * - Server side of pipe
- * #define INCL_SERVERPIPE
- * #include "ctpipes.h"
- * - Client side of pipe
- * #define INCL_CLIENTPIPE
- * #include "ctpipes.h"
- */
-
-
-
- #ifdef INCL_DOSNMPIPES /* This define i set if MS SDK 1.06 include files */
-
- /*
- * DosNamedPipes API Support from Microsoft SDK Toolkit 1.06
- * This is copied from <net\nmpipe.h> included with
- * 3Com Lan-Manager 1.0 release
- * Microsoft SDK Toolkit 1.06 does not have these defines yet ? ! ?
- */
-
- /****************************************************************
- *
- * Special values and constants
- *
- ****************************************************************/
-
- /* defined bits in pipe mode */
- #define NP_NBLK 0x8000 /* non-blocking read/write */
- #define NP_SERVER 0x4000 /* set if server end */
- #define NP_WMESG 0x0400 /* write messages */
- #define NP_RMESG 0x0100 /* read as messages */
- #define NP_ICOUNT 0x00FF /* instance count field */
-
-
- /* Named pipes may be in one of several states depending on the actions
- * that have been taken on it by the server end and client end. The
- * following state/action table summarizes the valid state transitions:
- *
- * Current state Action Next state
- *
- * <none> server DosMakeNmPipe DISCONNECTED
- * DISCONNECTED server connect LISTENING
- * LISTENING client open CONNECTED
- * CONNECTED server disconn DISCONNECTED
- * CONNECTED client close CLOSING
- * CLOSING server disconn DISCONNECTED
- * CONNECTED server close CLOSING
- * <any other> server close <pipe deallocated>
- *
- * If a server disconnects his end of the pipe, the client end will enter a
- * special state in which any future operations (except close) on the file
- * descriptor associated with the pipe will return an error.
- */
-
- /*
- * Values for named pipe state
- */
-
- #define NP_DISCONNECTED 1 /* after pipe creation or Disconnect */
- #define NP_LISTENING 2 /* after DosNmPipeConnect */
- #define NP_CONNECTED 3 /* after Client open */
- #define NP_CLOSING 4 /* after Client or Server close */
-
-
- #endif
-
-
-
-
- /*
- * - 0 for local use (running as background task) "\PIPE\pipename"
- * - 1 for LAN-server is to be used "\\SERVER\PIPE\pipename"
- */
- #define ct_srv_use 0 /* server or local use */
- /*
- * This could be modified to an external variables
- * to be set to server or local use at startup
- */
-
- #define SRV_NETNAME "SERVER" /* server network name */
- #define USR_NETNAME "USER" /* user net name */
- #define USR_NAME_LEN 20 /* Maximum user name length */
- /* must be the same as UNLEN in NETCONS.H */
-
- #define ISAM_PIPENAME "\\PIPE\\CTPIPE" /* name of pipe to communicate */
-
- #define ISAM_SRV_PROGNAME "CTSRVR.EXE" /* ig. ctsrvr.exe */
- /* default argument to server-program */
- #define ISAM_SRV_PARAMS "CTSRVR\0U30 F90 Z4096\0\0"
-
-
- #define PIPESIZE 4096 /* maximum pipe size, used at open */
- #define CLI_OPENFLAG 1
- #define CLI_DOSOPENMODE 0x4012
- #define SRV_DOSOPENMODE 2
- #define SRV_PIPOPENMODE (NP_WMESG | NP_RMESG | NP_ICOUNT)
- #define PIPE_TIMEOUT 50L
-
-
- /*
- * Function codes for the pipe-communication
- */
- #define PIPE_TEST 0xFEEF4321
- #define PIPE_ANSW 0xFEEF1234
- #define PIPE_TERM_SRV 0xFEEFEFFE
-
- #define PIPE_ERR_NO_ANSW 800
- #define PIPE_STARTED_LOCAL 810
- #define PIPE_ERR_COULD_NOT_START 811
-
- #define NAMESIZE 64
-
- /*
- * PROTOTYPES
- */
- extern unsigned _CDECL makepipe(unsigned *handle, char *pipename);
- extern unsigned _CDECL startusepipe(char *pipename,
- char *prog, char *prog_param, int local);
- extern unsigned _CDECL sendlogonreply(unsigned handle);
- extern unsigned _CDECL dopipe(char *pname,
- char far *pipe_inp, unsigned ilen,
- char far *pipe_outp);
- extern unsigned _CDECL startpipe(char *pname, char *pargs);
- extern unsigned _CDECL readpipe(unsigned handle, char far *buffer);
- extern unsigned _CDECL writepipe(unsigned handle,
- char far *buffer, unsigned len);
- extern unsigned _CDECL disconnect_pipe(unsigned handle);
- extern char* _CDECL get_net_user_name(void);
- extern char* _CDECL get_net_computer_name(void);
- extern void _CDECL set_max_file_handles(int maxfh);
- extern int _CDECL get_process_type(void);
- extern int _CDECL get_process_id(void);
- extern int _CDECL get_curr_screen_group(void);
- extern void _CDECL set_exec_priority(int max_min);
- extern char* _CDECL get_time_stamp(void);
- extern char* _CDECL konvert_drive_to_local(char *filename);
- extern unsigned _CDECL stfarmov(char far *src, char far *dest, unsigned n);
- extern int _CDECL get_os2_version(void);
-
- extern unsigned pipe_errcode;
-
- #ifdef INCL_CLIENTPIPE
-
- static char pipename[NAMESIZE];
-
- #endif
-
-
- #ifdef INCL_SERVERPIPE
-
- static char pipename[NAMESIZE];
-
- #endif
-
-
-
-
-