| 1 | HLCSGTM ;OIFO-O/RWF - (TCP/IP) GT.M Linux ;08/13/2007 | 
|---|
| 2 | ;;1.6;HEALTH LEVEL SEVEN;**122**;Oct 13, 1995;Build 14 | 
|---|
| 3 | ;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | ; | 
|---|
| 5 | ; 1. port number is input from VMS COM file, such as HLSxxxxDSM.COM, | 
|---|
| 6 | ;    HLSxxxxCACHE.COM, or HLSxxxxGTM.COM file, where xxxx is port | 
|---|
| 7 | ;    number. | 
|---|
| 8 | ; 2. find the ien of #870(logical link file) for the multi-listener | 
|---|
| 9 | Q | 
|---|
| 10 | ; | 
|---|
| 11 | IEN(HLPORT) ; | 
|---|
| 12 | ; HLIEN870: ien in #870 (logical link file) | 
|---|
| 13 | ; HLPRTS: port number in entry to be tested | 
|---|
| 14 | ; | 
|---|
| 15 | N HLPRTS,HLIEN870 | 
|---|
| 16 | I '$G(HLPORT) D ^%ZTER Q | 
|---|
| 17 | S HLIEN870=0 | 
|---|
| 18 | F  S HLIEN870=$O(^HLCS(870,"E","M",HLIEN870)) Q:'HLIEN870  D  Q:(HLPRTS=HLPORT) | 
|---|
| 19 | . S HLPRTS=$P(^HLCS(870,HLIEN870,400),"^",2) | 
|---|
| 20 | I 'HLIEN870 D ^%ZTER Q | 
|---|
| 21 | ; | 
|---|
| 22 | Q HLIEN870 | 
|---|
| 23 | ; | 
|---|
| 24 | GTMLNX ; From Linux xinetd script | 
|---|
| 25 | ;Get port from ZSHOW "D" | 
|---|
| 26 | S U="^",$ZT="",$ET="D ^%ZTER HALT" ;Setup the error trap | 
|---|
| 27 | ; GTM specific code | 
|---|
| 28 | S IO=$P X "U IO:(nowrap:nodelimiter:IOERROR=""TRAP"")" ;Setup device | 
|---|
| 29 | S @("$ZINTERRUPT=""I $$JOBEXAM^ZU($ZPOSITION)""") | 
|---|
| 30 | K ^TMP($J) ZSHOW "D":^TMP($J) | 
|---|
| 31 | F %=1:1 Q:'$D(^TMP($J,"D",%))  S X=^(%) Q:X["LOCAL" | 
|---|
| 32 | S IO("IP")=$P($P(X,"REMOTE=",2),"@"),IO("PORT")=+$P($P(X,"LOCAL=",2),"@",2) | 
|---|
| 33 | S %=$P($ZTRNLNM("SSH_CLIENT")," ") S:%="" %=$ZTRNLNM("REMOTEHOST") | 
|---|
| 34 | S HLDP=$$IEN(IO("PORT")) | 
|---|
| 35 | ; | 
|---|
| 36 | D LISTEN^HLCSTCP | 
|---|
| 37 | Q | 
|---|
| 38 | ; | 
|---|
| 39 | ;Sample Linux script | 
|---|
| 40 | ;#!/bin/bash | 
|---|
| 41 | ;#HL7 Listener | 
|---|
| 42 | ;cd /home/vista/dev/ | 
|---|
| 43 | ;. ./gtmprofile | 
|---|
| 44 | ;#env > hl7log.txt | 
|---|
| 45 | ;$gtm_dist/mumps -r GTMLNX^HLCSGTM | 
|---|
| 46 | ;exit 0 | 
|---|
| 47 | ; | 
|---|
| 48 | ;Sample xinetd config file | 
|---|
| 49 | ;service hl7tcp | 
|---|
| 50 | ;{ | 
|---|
| 51 | ;        socket_type     = stream | 
|---|
| 52 | ;        user            = gtmuser | 
|---|
| 53 | ;        wait            = no | 
|---|
| 54 | ;        disable         = no | 
|---|
| 55 | ;        server          = /bin/bash | 
|---|
| 56 | ;        server_args     = -l /home/vista/dev/hl7tcp.sh | 
|---|
| 57 | ;        passenv         = REMOTE_HOST | 
|---|
| 58 | ;} | 
|---|