Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XWBLIB

XWBLIB.m

Go to the documentation of this file.
  1. XWBLIB ;SFISC/VYD - Various remote procedure library ;06/16/2004 17:53
  1. ;;1.1;RPC BROKER;**6,10,26,35**;Mar 28, 1997
  1. Q
  1. ;
  1. BROKER() ;EF. Running under the Broker or Vlink
  1. Q $D(XWBOS)!$D(XOBDATA)
  1. ;
  1. RTRNFMT(X,WRAP) ;EF. set the RPC return type and wrap flag
  1. N Y
  1. S:$D(WRAP) XWBWRAP=+WRAP
  1. S X=$G(X)
  1. IF X=+X,X>0,X<6 S XWBPTYPE=X Q X
  1. S X=$$UP^XLFSTR(X)
  1. S X=$S(X="SINGLE VALUE":1,X="ARRAY":2,X="WORD PROCESSING":3,X="GLOBAL ARRAY":4,X="GLOBAL INSTANCE":5,1:0)
  1. IF X=0 Q 0
  1. S XWBPTYPE=X
  1. Q X
  1. ;
  1. VARVAL(RESULT,VARIABLE) ;returns value of passed in variable
  1. S RESULT=VARIABLE ;can do this with the REFERENCE type parameter
  1. Q
  1. ;See GETV^XWBBRK for how we get the REFERENCE type parameter
  1. ;
  1. IMHERE(RESULT) ;P6
  1. ;Entry point for XWB IM HERE remote procedure
  1. S RESULT=1
  1. Q
  1. ;
  1. BRKRINFO(RESULT) ;P6
  1. ;Entry point for XWB GET BROKER INFO RPC.
  1. ;R(0) = Length of handler read timeout
  1. S RESULT(0)=$$BAT^XUPARAM
  1. Q
  1. ;
  1. CKRPC(RESULT,RPCNAME,RPCUSE,VERNUM) ;P10
  1. ;Entry point for "XWB IS RPC AVIALABLE" RPC.
  1. ;RPCUSE("L" or "R") and VERNUM are optional.
  1. ;Checks if RPC exists and if INACTIVE flag is set for specified use.
  1. ;Also checks version number if passed.
  1. ;Result = 1 for can be run; 0 for can't be run.
  1. N RPCIEN
  1. S RESULT=0
  1. S RPCIEN=$$RPCIEN($G(RPCNAME))
  1. I RPCIEN,$$RPCAVAIL(RPCIEN,$G(RPCUSE),$G(VERNUM)) S RESULT=1
  1. Q
  1. ;
  1. CKRPCS(RESULT,RPCUSE,RPC) ;P10
  1. ;Entry point for "XWB ARE RPCS AVIALABLE" RPC.
  1. ;RPCUSE("L" or "R") and VERNUM are optional.
  1. ;RPC() array has format RPCName^RPCVersionNumber.
  1. ;Checks if RPC exists and version number (if not null).
  1. ;Check INACTIVE flag if set for specified use.
  1. ;Result(I) = 1 for can be run; 0 for can't be run.
  1. N I
  1. S I=""
  1. F S I=$O(RPC(I)) Q:I="" D
  1. . N RPCNAME,VERNUM,RPCIEN
  1. . S RESULT(I)=0
  1. . S RPCNAME=$P(RPC(I),U)
  1. . S VERNUM=$P(RPC(I),U,2)
  1. . S RPCIEN=$$RPCIEN($G(RPCNAME))
  1. . I RPCIEN,$$RPCAVAIL(RPCIEN,$G(RPCUSE),$G(VERNUM)) S RESULT(I)=1
  1. Q
  1. ;
  1. RPCIEN(RPCNAME) ;P10
  1. ;Function that returns IEN of RPC based on name.
  1. ;Returns 0 if RPC does not exist.
  1. I RPCNAME="" Q 0
  1. Q +$O(^XWB(8994,"B",RPCNAME,0))
  1. ;
  1. RPCAVAIL(RPCIEN,RPCUSE,VERNUM) ;P10
  1. ;Boolean function, identifies if RPC is active and correct version.
  1. ;RPCUSE (optional) = L check local use; R check remote use.
  1. ;VERNUM (optional) only checked for remote RPCs.
  1. N RPC0,INACT
  1. S RPC0=$G(^XWB(8994,+RPCIEN,0))
  1. Q:RPC0="" 0
  1. S INACT=+$P(RPC0,U,6)
  1. I INACT=1 Q 0 ;RPC marked inactive.
  1. S RPCUSE=$G(RPCUSE)
  1. I RPCUSE="" Q 1 ;Local and remote check not needed.
  1. I RPCUSE="L",INACT=2 Q 0 ;Local use, RPC is remote only.
  1. I RPCUSE="R",INACT=3 Q 0 ;Remote use, RPC is local only.
  1. I RPCUSE="R",+$G(VERNUM),'$$CKVERNUM(VERNUM,+$P(RPC0,U,9)) Q 0 ;Failed version # check.
  1. Q 1 ;Must be ok.
  1. ;
  1. CKVERNUM(VERNUM,RPCVER,RPCIEN) ;P10
  1. ;Boolean function. Returns 1 if RPC verion is > or = version number to be checked.
  1. ;VERNUM = version number passed in (i.e., from client ap) to be checked.
  1. ;RPCVER = version number in Remote Procedure file. (optional)
  1. ;RPCIEN of RPC being checked. Needed if RPCVER not sent.
  1. I +$G(RPCIEN),'+$G(RPCVER) S RPCVER=$P($G(^XWB(8994,RPCIEN,0)),U,9)
  1. I +RPCVER<+VERNUM Q 0
  1. Q 1
  1. ;
  1. VARLST ;;XWB,XWBAPVER,XWBCLMAN,XWBNULL,XWBODEV,XWBOS,XWBP,XWBPTYPE,XWBR,XWBSEC,XWBSTATE,XWBTBUF,XWBTDEV,XWBTIME,XWBTIP,XWBTOS,XWBTSKT,XWBVER,XWBWRAP,XWBY,DEBUG,XWBSHARE,XWBDEBUG,XWBT
  1. ;P10. Variable for exclusive NEW in KILL^XUSCLEAN
  1. ;P26. Added XWBSHARE
  1. ;P35. Added XWBDEBUG,XWBT