[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1748.0. "transfering X protocol at the application level" by MARX::WALSH () Wed Nov 15 1989 22:07

I have built a PIPE tool.  It takes from SYS$NET and transfers it to a 
different node object.  I have built it somewhat similar to GATEWAYD.C which
transfers X protocol from TCP/IP to DECNET-ULTRIX.  The tool I build is for 
DECnet-VAX to DECnet-VAX.  It will be used over a gateway.  Anyways I've 
gotten the PIPE to work with standard task to task communications but I haven't
been able to get it to work with X.


I set up the ncp the following way

set object X$X3 number 0 file user$1:[walsh]x$x3.com

$! X$X3.com
$write sys$output "Entering X$X3"
$show log sys$net
$pipe :== $user2:[walsh]pipe.exe
$pipe dnet devito X$X0

PIPE.C is in the first reply.

I execute the following command
$set display/node=zeppo/server=3/create
$run sys$system:decw$clock

The netserver.log on ZEPPO looks like
       --------------------------------------------------------

        Connect request received at 31-AUG-1989 12:49:48.74
            from remote process KEATON::"0=WALSH"
            for object "USER2:[WALSH]X$X3.COM"

        --------------------------------------------------------

entering x$x3.com
   "SYS$NET" = "KEATON::"0=WALSH/P!....................X$X3"" (LNM$PROCESS_TABLE
)
pipe
ASSIGN CHANNEL
issuing read to client
start client read
ciosb.msg_len=12
after qio
reissue read on client line
finish client read
issue read to server
going to sleep now
begin server read
siosb.msg_len=8
server_read complete
begin server read
siosb.msg_len=168
server_read complete
start client read
ciosb.msg_len=48
after qio
reissue read on client line
finish client read
begin server read
siosb.msg_len=32
server_read complete
begin server read
siosb.msg_len=256
server_read complete

Nothing ever appears on the screen.
and  it seems the X gets to a certain point and then hangs.

    I would appreciate it if anyone could give me some assistance or at
    least point me in the right direction.
    
	I posted this note in the X conference and in the DECwindows
programming conference

    Dan
    
    
T.RTitleUserPersonal
Name
DateLines
1748.1pipe.cMARX::WALSHWed Nov 15 1989 22:08242
 /*     
 * DESCRIPTION
 *
 *   This program illustrates how an VMS system can be used as a
 *   PIPE to swap transports for an application protocol.  A brief 
 *   description of how the program is used is given below.  
 *
 * USAGE
 *
 *   gatewayd -inet desthost destservice
 *   gatewayd -dnet destnode destobject
 *
 *   If the connection couldn't complete to the destsystem/destentity, 
 *   the connection to the client is simply disconnected.
 *
 */

#include <stdio.h>
#include <descrip.h>
#include <iodef.h>
#include <stsdef.h>
#include <ssdef.h>

    struct io_stat_blk {
	short int status ;
        short int msg_len ;
        int unused;
    };
                  
struct io_stat_blk ciosb;
struct io_stat_blk siosb;
struct io_stat_blk iosb;

#define      STREQL(a, b)        (strcmp(a, b) == 0)
#define      NIL                 (0)

char      DestProto[40];    /* Protocol family to connect by       */
char      DestHost[256];    /* Remote system to connect to         */
char      DestObj[256];     /* Remote object/service to connect to */

static int client_read();
static int server_read();

unsigned short client;       /* Socket connected to client  */
unsigned short server;       /* Socket connected to client  */

#define BUFSIZ 256
unsigned char client_read_buffer[BUFSIZ];
unsigned char client_write_buffer[BUFSIZ];
unsigned char server_read_buffer[BUFSIZ];
unsigned char server_write_buffer[BUFSIZ];

main(argc, argv)
int    argc;           /* # of command line arguments */
char   *argv[];        /* the command line arguments  */
{
int status;
char *t;
char task_list[BUFSIZ];
int i;
$DESCRIPTOR(sys_net,"SYS$NET");
struct dsc$descriptor_s task_desc =
                   {0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};

	printf("pipe\n");
/*	t = getenv("SYS$NET");
	for (i=0;i<80;i++)
	        printf("%c",t[i]);
*/
    /* Check usage */
    if(argc != 4){
	printf("invalid number of parameters\n");
        exit(0);
	}

      printf("ASSIGN CHANNEL\n");
      status = sys$assign(&sys_net,&client,0,0);
      if ((status != SS$_NORMAL ) && (status != SS$_REMOTE)) {
	  printf("unable to connect to SYS$NET %d\n",status);
	  exit(0);
      }

      /* Fetch connect info from command line */
      strcpy(DestProto,  argv[1]);
      strcpy(DestHost,   argv[2]);
      strcpy(DestObj,    argv[3]);

    /* Time to attempt the connection */

    if( STREQL(DestProto, "dnet") ) {
	sprintf(task_list,"%s::\"task=%s\"",DestHost,DestObj);
	task_desc.dsc$w_length = strlen(task_list);
	task_desc.dsc$a_pointer = task_list;

        status = sys$assign(&task_desc,&server,0,0);
      if ((status != SS$_NORMAL ) && (status != SS$_REMOTE)) {
	  printf("unable to connect to %s\n",task_list);
          close_link();
	  exit(0);
      }
    }
    else {
      printf("Error; Request to connect via an unknown protocol\n");
      /* Some spawners (ie. DECnet) log children's exit codes */
      close_link();
	exit();
    }

    /* Now just go and move raw data between client and 
       remote system */
    dowork();
    /* ... NEVER RETURNS ... */
}

dowork()
{
int status;

     printf("issuing read to client\n");
     status = sys$qio ( 0,
	  	       client,
	  	       IO$_READVBLK,
	  	       &ciosb,
	  	       client_read, 0,
    		       client_read_buffer,
    		       sizeof(client_read_buffer),
	  	       0, 0, 0, 0 );
    if ( status & STS$M_SUCCESS ) 
	status = ciosb.status;
	if ((status != SS$_NORMAL) && (status != 0)){
		printf("status=%d\n",status);
		close_link();
		exit(0);
		}
     printf("issue read to server\n");
     status = sys$qio ( 0,
	  	       server,
	  	       IO$_READVBLK,
	  	       &siosb,
	  	       server_read, 0, 
    		       server_read_buffer,
    		       sizeof(server_read_buffer),
	  	       0, 0, 0, 0 );
    if ( status & STS$M_SUCCESS ) 
	status = siosb.status;
	if ((status != SS$_NORMAL) && (status != 0)){
		close_link();
		exit(0);
		}
	printf("going to sleep now\n");    
    while (1){ 
	status = sys$hiber();
	printf("awake\n");
	}
    printf("awake\n");
	
}
int client_read()
{
int status;
/*	DISABLE_AST;*/
	printf("start client read\n");
	printf("ciosb.msg_len=%d\n",ciosb.msg_len);
	lib$movc3(&ciosb.msg_len,client_read_buffer,server_write_buffer);
        status = sys$qiow ( 0,
	  	       server,
	  	       IO$_WRITEVBLK,
	  	       &iosb,
	  	       0, 0,
    		       server_write_buffer,
    		       ciosb.msg_len,
	  	       0, 0, 0, 0 );
        printf("after qio \n");
        if ( status & STS$M_SUCCESS ) 
         	status = iosb.status;
	if ((status != SS$_NORMAL) && (status != 0)){
		printf("status=%d\n",status);
	     	close_link();
		exit(0);
		}
     printf("reissue read on client line \n");
     status = sys$qio ( 0,
	  	       client,
	  	       IO$_READVBLK,
	  	       &ciosb,
	  	       client_read, 0, 
    		       client_read_buffer,
    		       BUFSIZ,
	  	       0, 0, 0, 0 );
    if ( status & STS$M_SUCCESS ) 
	status = ciosb.status;
	if ((status != SS$_NORMAL) && (status != 0)){
		printf("status=%d\n",status);
		close_link();
		exit(0);
		}
     printf("finish client read \n");
}
int server_read()
{
int status;
	printf("begin server read\n");
	printf("siosb.msg_len=%d\n",siosb.msg_len);
	lib$movc3(&siosb.msg_len,server_read_buffer,client_write_buffer);
        status = sys$qiow ( 0,
	  	       client,
	  	       IO$_WRITEVBLK,
	  	       &iosb,
	  	       0, 0,
    		       client_write_buffer,
    		       siosb.msg_len,
	  	       0, 0, 0, 0 );
        if ( status & STS$M_SUCCESS ) 
         	status = iosb.status;
	if ((status != SS$_NORMAL) && (status != 0)){
	     	close_link();
		exit(0);
		}
     status = sys$qio ( 0,
	  	       server,
	  	       IO$_READVBLK,
	  	       &siosb,
	  	       server_read, 0, 
    		       server_read_buffer,
    		       BUFSIZ,
	  	       0, 0, 0, 0 );
    if ( status & STS$M_SUCCESS ) 
	status = siosb.status;
	if ((status != SS$_NORMAL) && (status != 0)){
		close_link();
		exit(0);
		}
	printf("server_read complete\n");
}
int close_link()
{
int status;
	printf("close link\n");
	status = sys$dassgn(server);
	status = sys$dassgn(client);
	return;    
}