home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / external / rpc / idl_rpc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-08  |  4.2 KB  |  139 lines

  1. /*
  2.  *   $Id: idl_rpc.h,v 1.2 1997/01/18 08:23:00 ali Exp $
  3.  */
  4.  
  5. /*
  6.   Copyright (c) 1989-1997, Research Systems Inc.  All rights reserved.
  7.   This software includes information which is proprietary to and a
  8.   trade secret of Research Systems, Inc.  It is not to be disclosed
  9.   to anyone outside of this organization. Reproduction by any means
  10.   whatsoever is  prohibited without express written permission.
  11.   */
  12.  
  13. #ifndef _RPC_IDL_
  14. #define _RPC_IDL_
  15.  
  16. #include <stdio.h>
  17. #include <sys/types.h>
  18. #include <ctype.h>
  19. #include <rpc/rpc.h>
  20.  
  21. #include "export.h"
  22.  
  23. #define IDL_RPC_MAX_STRLEN    512        /* max string length */
  24.  
  25. /*
  26.  * Define the default Service IDL and Version number for the 
  27.  * IDL rpc Server
  28.  */
  29. #define     IDL_RPC_DEFAULT_ID        0x2010CAFE
  30. #define      IDL_RPC_DEFAULT_VERSION        1
  31.  
  32. /*
  33.  * Define the Macros for the Server request messages
  34.  */
  35. #define     IDL_RPC_SET_VAR        0x10
  36. #define     IDL_RPC_GET_VAR        0x20
  37. #define     IDL_RPC_SET_MAIN_VAR    0x30
  38. #define        IDL_RPC_GET_MAIN_VAR    0x40
  39. #define        IDL_RPC_EXE_STR        0x50
  40. #define        IDL_RPC_OUT_CAPTURE    0x60
  41. #define        IDL_RPC_OUT_STR            0x70
  42. #define     IDL_RPC_CLEANUP        0x90
  43.  
  44. /*
  45.  * Now define the helper routines used to access data in the vptr
  46.  */
  47.  
  48. #define     IDL_RPCGetVarType(v)        ((v)->type)
  49. #define        IDL_RPCGetVarByte(v)        ((v)->value.c)
  50. #define        IDL_RPCGetVarInt(v)        ((v)->value.i)
  51. #define        IDL_RPCGetVarLong(v)        ((v)->value.l)
  52. #define        IDL_RPCGetVarFloat(v)        ((v)->value.f)
  53. #define        IDL_RPCGetVarDouble(v)        ((v)->value.d)
  54. #define        IDL_RPCGetVarComplex(v)        ((v)->value.cmp)
  55. #define        IDL_RPCGetVarComplexR(v)    ((v)->value.cmp.r)
  56. #define        IDL_RPCGetVarComplexI(v)    ((v)->value.cmp.i)
  57. #define        IDL_RPCGetVarDComplex(v)    ((v)->value.dcmp)
  58. #define        IDL_RPCGetVarDComplexR(v)    ((v)->value.dcmp.r)
  59. #define        IDL_RPCGetVarDComplexI(v)    ((v)->value.dcmp.i)
  60. #define        IDL_RPCGetVarString(v)        IDL_STRING_STR((v)->value.str)
  61. #define        IDL_RPCVarIsArray(v)        ((v)->flags & IDL_V_ARR)
  62. #define        IDL_RPCGetArrayData(v)        ( ((v)->flags & IDL_V_ARR)? \
  63.                 (v)->value.arr->data : (UCHAR*)NULL)
  64.  
  65. #define        IDL_RPCGetArrayDimensions(v)    ( ((v)->flags & IDL_V_ARR)? \
  66.                 (v)->value.arr->dim : (IDL_LONG*)NULL)
  67.  
  68. #define     IDL_RPCGetArrayNumDims(v)    ( ((v)->flags * IDL_V_ARR)? \
  69.                 (v)->value.arr->n_dim : (IDL_LONG)NULL)
  70.  
  71. #define     IDL_RPCGetArrayNumElts(v)    ( ((v)->flags * IDL_V_ARR)? \
  72.                 (v)->value.arr->n_elts : 0)
  73.  
  74. /*
  75.  * Define the length of an IDL variable name. If this changes, the following
  76.  * definition should be changed.
  77.  */
  78. #ifndef MAXIDLEN
  79. #define MAXIDLEN   128
  80. #endif
  81.  
  82. /*
  83.  * Define a structure used to pass variables between client and server.
  84.  */
  85. typedef struct idl_rpc_variable{
  86.     char     *name;
  87.     IDL_VPTR  pVariable;
  88. }IDL_RPC_VARIABLE;
  89.  
  90. /*
  91.  * Define a structure type that is used to pass output lines between
  92.  * the server and the client
  93.  */
  94.  
  95. typedef struct idl_rpc_line{
  96.     int    flags;
  97.     char  *buf;
  98. }IDL_RPC_LINE_S;
  99.  
  100. /*
  101.  * function prototypes for the client side
  102.  */
  103.  
  104. void IDL_RPCStrEnsureLength(IDL_STRING *s, int n);   
  105. void IDL_RPCStrDup(IDL_STRING *str, IDL_LONG n);
  106. void IDL_RPCStrDelete(IDL_STRING *str, IDL_LONG n);
  107. void IDL_RPCStrStore( IDL_STRING *s, char *fs);
  108.  
  109. char *IDL_RPCMakeArray(int type, int n_dim, IDL_LONG dim[], 
  110.                 int init, IDL_VPTR *var);
  111. IDL_VPTR IDL_RPCImportArray(int n_dim, IDL_LONG dim[], int type, 
  112.                 UCHAR *data, IDL_ARRAY_FREE_CB free_cb);
  113. void IDL_RPCVarCopy(IDL_VPTR src, IDL_VPTR dst);
  114. void IDL_RPCDeltmp(IDL_VPTR vTmp);
  115. IDL_VPTR IDL_RPCGettmp(void);
  116. int IDL_RPCSetVariable(CLIENT *pClient, char *Name, IDL_VPTR pVar);
  117. IDL_VPTR IDL_RPCGetVariable(CLIENT *pClient, char *Name);
  118. int IDL_RPCSetMainVariable(CLIENT *pClient, char *Name, IDL_VPTR pVar);
  119. IDL_VPTR IDL_RPCGetMainVariable(CLIENT *pClient, char *Name);
  120. CLIENT *IDL_RPCInit( long lServerId, char* pszHostname);
  121. int IDL_RPCCleanup( CLIENT *pClient, int iKill);
  122. int IDL_RPCTimeout(long lTimeOut);
  123. int IDL_RPCExecuteStr( CLIENT *pClient, char * pszCommand);
  124. int IDL_RPCOutputCapture( CLIENT *pClient, int n_lines);
  125. int IDL_RPCOutputGetStr(CLIENT *pClient, IDL_RPC_LINE_S *pLine, int first);
  126.  
  127. void IDL_RPCOutListInit( int maxLines );
  128. char *IDL_RPCOutListDequeue(void);
  129. char *IDL_RPCOutListPop(void);
  130. char * IDL_RPCOutListAdd( char *pData );
  131. int   IDL_RPCOutListCnt(void);
  132. IDL_TOUT_OUTF IDL_RPCToutFunc( int flags, char *buf, int n);
  133.  
  134.  
  135. #endif
  136.  
  137.  
  138.  
  139.