[613] | 1 | XUSC1 ;SFISC/RWF - Interface to Server services. ;10/09/2002 16:53
|
---|
| 2 | ;;8.0;KERNEL;**283**;Jul 10, 1995
|
---|
| 3 | ;XUSC("STAT") is used to pass subroutine status around.
|
---|
| 4 | ;The entry points EN, OPEN, DATA, CLOSE are supported ref.
|
---|
| 5 | ;Calls a server service on a port depending on service.
|
---|
| 6 | ;Service:port; "ECHO":10250, "CRC32":10255, "SHA1":10260, "DSIG":10265,1:23)
|
---|
| 7 | ;Return 0 = OK, else -1^msg
|
---|
| 8 | EN(XUSC3,XUSC1,XUSC2) ;
|
---|
| 9 | ;XUSC3 is the service we want.
|
---|
| 10 | ;XUSC1 input data array
|
---|
| 11 | ;XUSC2 return data array.
|
---|
| 12 | N %,R,XUSC ;XUSC holds data not passed as a parameter.
|
---|
| 13 | I "DSIG/ECHO/SHA1/DES/CRC32/CRL /"'[XUSC3 S R="-1^Bad service" G EXIT
|
---|
| 14 | D SAVDEV^%ZISUTL("XUSC-HOME"),IP
|
---|
| 15 | I $G(XUSC("IP"))="" S R="-1^Server not defined" G EXIT
|
---|
| 16 | S R=$$EN^XUSC1C(XUSC1,XUSC2,$G(XUSC3,"MPI"))
|
---|
| 17 | EXIT D USE^%ZISUTL("XUSC-HOME"),RMDEV^%ZISUTL("XUSC-HOME")
|
---|
| 18 | Q R
|
---|
| 19 | ;
|
---|
| 20 | OPEN(XUSCITE) ;Open Connection, Setup
|
---|
| 21 | K XUSC N R
|
---|
| 22 | D IP(XUSCITE),SAVDEV^%ZISUTL("XUSC-HOME")
|
---|
| 23 | I $G(XUSC("IP"))="" Q "-1^Bad site"
|
---|
| 24 | D SETUP^XUSC1C S XUSC("HOME")=IO
|
---|
| 25 | N $ESTACK,$ETRAP S $ETRAP="D ERROR^XUSC1C"
|
---|
| 26 | D OPEN^XUSC1C I 'XUSC("STAT") D SAVDEV^%ZISUTL("XUSC-IP") U IO D HELO^XUSC1C
|
---|
| 27 | D USE^%ZISUTL("XUSC-HOME")
|
---|
| 28 | Q $S('XUSC("STAT"):0,1:XUSC("STAT"))
|
---|
| 29 | ;
|
---|
| 30 | DATA(INPUT,OUTPUT,TYPE) ;Pass Data, Get Responce
|
---|
| 31 | S XUSC("STAT")=0 D USE^%ZISUTL("XUSC-IP")
|
---|
| 32 | D DATA^XUSC1C G:XUSC("STAT") ERR
|
---|
| 33 | D TURN^XUSC1C G:XUSC("STAT") ERR
|
---|
| 34 | D GET^XUSC1C G:XUSC("STAT") ERR
|
---|
| 35 | D USE^%ZISUTL("XUSC-HOME")
|
---|
| 36 | Q 0
|
---|
| 37 | ;
|
---|
| 38 | CLOSE() ;Close connection
|
---|
| 39 | D USE^%ZISUTL("XUSC-IP"),QUIT^XUSC1C,USE^%ZISUTL("XUSC-HOME")
|
---|
| 40 | D RMDEV^%ZISUTL("XUSC-IP"),RMDEV^%ZISUTL("XUSC-HOME")
|
---|
| 41 | K XUSC Q 0
|
---|
| 42 | ;
|
---|
| 43 | ERR ;Report an error
|
---|
| 44 | D TRACE^XUSC1C("ERROR "_XUSC("STAT"))
|
---|
| 45 | D QUIT^XUSC1C,USE^%ZISUTL("XUSC-HOME")
|
---|
| 46 | Q XUSC("STAT")
|
---|
| 47 | ;
|
---|
| 48 | IP ;Lookup name pass back parameters in XUSC
|
---|
| 49 | N %,XUSCY,XUSCE
|
---|
| 50 | S %=$P(XUSC3," ") D
|
---|
| 51 | . I $L($T(@%)) D @% Q
|
---|
| 52 | . D ASK Q
|
---|
| 53 | Q
|
---|
| 54 | ;
|
---|
| 55 | DSIG S XUSC("IP")=$P($G(^XTV(8989.3,1,"IP1")),"^",1)
|
---|
| 56 | S XUSC("SOCK")=10265
|
---|
| 57 | Q
|
---|
| 58 | CRL S XUSC("IP")=$P($G(^XTV(8989.3,1,"IP1")),"^",1)
|
---|
| 59 | S XUSC("SOCK")=10270
|
---|
| 60 | Q
|
---|
| 61 | SHA1 S XUSC("IP")=$P($G(^XTV(8989.3,1,"IP1")),"^",1)
|
---|
| 62 | S XUSC("SOCK")=10260
|
---|
| 63 | Q
|
---|
| 64 | ASK ; ASK USER FOR IP AND PORT
|
---|
| 65 | S XUSC("IP")="",XUSC("SOCK")=""
|
---|
| 66 | R !,"IP Address to use: ",%:DTIME Q:"^"[% S XUSC("IP")=%
|
---|
| 67 | R !," Port TO use: ",%:DTIME Q:"^"[% S XUSC("SOCK")=%
|
---|
| 68 | Q
|
---|
| 69 | ;
|
---|
| 70 | NOOP() ;
|
---|
| 71 | S XUSC("STAT")=0 D USE^%ZISUTL("XUSC-IP")
|
---|
| 72 | S XUSC("OK")=$$POST^XUSC1C("NOOP")
|
---|
| 73 | D USE^%ZISUTL("XUSC-HOME")
|
---|
| 74 | Q XUSC("OK")
|
---|