| 1 | HLCSGTM ;OIFO-O/RWF - (TCP/IP) GT.M Linux ;08/13/2007
 | 
|---|
| 2 |  ;;1.6;HEALTH LEVEL SEVEN;**122**;Oct 13, 1995;Build 4;WorldVistA 30-Jan-08
 | 
|---|
| 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 |  ;Modified from FOIA VISTA,
 | 
|---|
| 10 |  ;Copyright 2008 WorldVistA.  Licensed under the terms of the GNU
 | 
|---|
| 11 |  ;General Public License See attached copy of the License.
 | 
|---|
| 12 |  ;
 | 
|---|
| 13 |  ;This program is free software; you can redistribute it and/or modify
 | 
|---|
| 14 |  ;it under the terms of the GNU General Public License as published by
 | 
|---|
| 15 |  ;the Free Software Foundation; either version 2 of the License, or
 | 
|---|
| 16 |  ;(at your option) any later version.
 | 
|---|
| 17 |  ;
 | 
|---|
| 18 |  ;This program is distributed in the hope that it will be useful,
 | 
|---|
| 19 |  ;but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 20 |  ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 21 |  ;GNU General Public License for more details.
 | 
|---|
| 22 |  ;
 | 
|---|
| 23 |  ;You should have received a copy of the GNU General Public License along
 | 
|---|
| 24 |  ;with this program; if not, write to the Free Software Foundation, Inc.,
 | 
|---|
| 25 |  ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 | 
|---|
| 26 |  Q
 | 
|---|
| 27 |  ;
 | 
|---|
| 28 | IEN(HLPORT) ;
 | 
|---|
| 29 |  ; HLIEN870: ien in #870 (logical link file)
 | 
|---|
| 30 |  ; HLPRTS: port number in entry to be tested
 | 
|---|
| 31 |  ;
 | 
|---|
| 32 |  N HLPRTS,HLIEN870
 | 
|---|
| 33 |  I '$G(HLPORT) D ^%ZTER Q
 | 
|---|
| 34 |  S HLIEN870=0
 | 
|---|
| 35 |  F  S HLIEN870=$O(^HLCS(870,"E","M",HLIEN870)) Q:'HLIEN870  D  Q:(HLPRTS=HLPORT)
 | 
|---|
| 36 |  . S HLPRTS=$P(^HLCS(870,HLIEN870,400),"^",2)
 | 
|---|
| 37 |  I 'HLIEN870 D ^%ZTER Q
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 |  Q HLIEN870
 | 
|---|
| 40 |  ;
 | 
|---|
| 41 | GTMLNX ; From Linux xinetd script
 | 
|---|
| 42 |  ;Get port from ZSHOW "D"
 | 
|---|
| 43 |  S U="^",$ZT="",$ET="D ^%ZTER HALT" ;Setup the error trap
 | 
|---|
| 44 |  ; GTM specific code
 | 
|---|
| 45 |  S IO=$P X "U IO:(nowrap:nodelimiter:IOERROR=""TRAP"")" ;Setup device
 | 
|---|
| 46 |  S @("$ZINTERRUPT=""I $$JOBEXAM^ZU($ZPOSITION)""")
 | 
|---|
| 47 |  K ^TMP($J) ZSHOW "D":^TMP($J)
 | 
|---|
| 48 |  F %=1:1 Q:'$D(^TMP($J,"D",%))  S X=^(%) Q:X["LOCAL"
 | 
|---|
| 49 |  S IO("IP")=$P($P(X,"REMOTE=",2),"@"),IO("PORT")=+$P($P(X,"LOCAL=",2),"@",2)
 | 
|---|
| 50 |  S %=$P($ZTRNLNM("SSH_CLIENT")," ") S:%="" %=$ZTRNLNM("REMOTEHOST")
 | 
|---|
| 51 |  S HLDP=$$IEN(IO("PORT"))
 | 
|---|
| 52 |  ;
 | 
|---|
| 53 |  D LISTEN^HLCSTCP
 | 
|---|
| 54 |  Q
 | 
|---|
| 55 |  ;
 | 
|---|
| 56 |  ;Sample Linux script
 | 
|---|
| 57 |  ;#!/bin/bash
 | 
|---|
| 58 |  ;#HL7 Listener
 | 
|---|
| 59 |  ;cd /home/vista/dev/
 | 
|---|
| 60 |  ;. ./gtmprofile
 | 
|---|
| 61 |  ;#env > hl7log.txt
 | 
|---|
| 62 |  ;$gtm_dist/mumps -r GTMLNX^HLCSGTM
 | 
|---|
| 63 |  ;exit 0
 | 
|---|
| 64 |  ;
 | 
|---|
| 65 |  ;Sample xinetd config file
 | 
|---|
| 66 |  ;service hl7tcp
 | 
|---|
| 67 |  ;{
 | 
|---|
| 68 |  ;        socket_type     = stream
 | 
|---|
| 69 |  ;        user            = gtmuser
 | 
|---|
| 70 |  ;        wait            = no
 | 
|---|
| 71 |  ;        disable         = no
 | 
|---|
| 72 |  ;        server          = /bin/bash
 | 
|---|
| 73 |  ;        server_args     = -l /home/vista/dev/hl7tcp.sh
 | 
|---|
| 74 |  ;        passenv         = REMOTE_HOST
 | 
|---|
| 75 |  ;}
 | 
|---|