home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / n / n001 / 2.ddi / EXAMPLES / DIAG / COMMON / DIAG.RPC
Encoding:
Text File  |  1989-12-11  |  3.9 KB  |  143 lines

  1. %h{
  2. /*                                                                            *
  3.  *                                                                            *
  4.  *                  Copyright 1987, 1988, 1989 Netwise, Inc.                  *
  5.  *                              All Rights Reserved                           *
  6.  *   This software contains information which is proprietary to and a trade   *
  7.  *   secret of Netwise, Inc. It is not to be used, reproduced, or disclosed   *
  8.  *   except as authorized in your license agreement.                          *
  9.  *                                                                            *
  10.  *                          Restricted Rights Legend                          *
  11.  *   Use, duplication,  or  disclosure  by the  Government  is  subject  to   *
  12.  *   restrictions as set forth in subparagraph (c)(1)(ii) of the Rights  in   *
  13.  *   Technical Data and  Computer Software clause  at 252.227-7013, or  the   *
  14.  *   equivalent Government clause for other agencies.                         *
  15.  *   Contractor: Netwise, Inc., Boulder, CO 80301 USA                         *
  16.  *                                                                            *
  17.  */ 
  18. %}
  19.  
  20. /*
  21.  * File: diag\common\diag.rpc
  22.  *
  23.  * This RPC file runs in the following environment:
  24.  *    NetWare RPC 1.0, NetWare 2.1 or higher, DOS 3.3
  25.  *
  26.  * This is the RPC Specification file for the diag example.
  27.  */
  28.  
  29. %h{
  30. #ifndef NULL
  31. #    include <stdio.h>
  32. #endif
  33. %}
  34.  
  35. /* specify traps code for the client, server, and dispatcher so
  36.  * additional information will be displayed in case of error
  37.  */
  38.  
  39. Client_stub: {
  40.     Traps: {
  41.         extern char *_rpcestr_();
  42.         extern int _nl_error_;
  43.  
  44.         printf("CLIENT: %s() client stub error, %s\n", $PROC_NAME,
  45.                 _rpcestr_( $ERRVAL ? $ERRVAL : $TRAP ) );
  46.         printf("CLIENT:    trap = %d\n", $TRAP); 
  47.         printf("CLIENT:    errval = %d\n", $ERRVAL); 
  48.         printf("CLIENT:    nl_error = %d\n", _nl_error_); 
  49.     }
  50. }
  51.  
  52. Server_stub: {
  53.     Traps: {
  54.         extern char *_rpcestr_();
  55.         extern int _nl_error_;
  56.  
  57.         printf("SERVER: %s() server stub error, %s\n", $PROC_NAME,
  58.                 _rpcestr_( $ERRVAL ? $ERRVAL : $TRAP ) );
  59.         printf("SERVER:    trap = %d\n", $TRAP); 
  60.         printf("SERVER:    errval = %d\n", $ERRVAL); 
  61.         printf("SERVER:    nl_error = %d\n", _nl_error_); 
  62.     }
  63. }
  64.  
  65. Dispatcher: {
  66.     Traps: {
  67.         extern char *_rpcestr_();
  68.         extern int _nl_error_;
  69.  
  70.         printf("DISPATCHER: $INAME dispatcher procedure error, %s\n",
  71.                 _rpcestr_( $ERRVAL ? $ERRVAL : $TRAP ) );
  72.         printf("DISPATCHER:    trap = %d\n", $TRAP); 
  73.         printf("DISPATCHER:    errval = %d\n", $ERRVAL); 
  74.         printf("DISPATCHER:    nl_error = %d\n", _nl_error_); 
  75.     }
  76. }
  77.  
  78.  
  79. /* Declare a procedure with a nonpersistent connection to test basic
  80.  * connectivity with server.
  81.  */
  82.  
  83. int
  84. nonper(server_name [bind in] sname, int count ); 
  85.    
  86.  
  87. /* Declare connection identifier for testing persistent connections. */
  88.  
  89. extern connection_id [bind in out] conn;
  90.  
  91. /* Declare procedures to open and close persistent connection;
  92.  * these procedures pass no data.
  93.  */
  94.  
  95. int
  96. start( server_name [bind in] sname)
  97. {
  98.     extern connection_id [bind out] conn;
  99. }
  100.  
  101. int
  102. stop()
  103. {
  104.     extern connection_id [bind in] conn;
  105.  
  106.  
  107. /* Declare procedure to test simple data passing.
  108.  * This procedure will use the persistent use style of binding,
  109.  * using the external binding variable 'conn'
  110.  */
  111. int
  112. simple(
  113.     long [in] l1,
  114.     double [in] d1,
  115.     char [in] c1,
  116.     long [out] *l2,
  117.     double [out] *d2,
  118.     char [out] *c2
  119. );
  120.  
  121.  
  122. /* Declare procedure to test passing of complex data (a linked list).
  123.  * This procedure will use the persistent use style of binding,
  124.  * using the external binding variable 'conn'
  125.  */
  126.  
  127. %h{
  128. #define MAX_DATA  1024
  129. %}
  130.  
  131. struct cmplx_type {
  132.     struct cmplx_type *link;
  133.     int length;
  134.     char data[MAX_DATA] ($0 - $1 >= $2->length -1);
  135. };
  136.  
  137. int
  138. complex(
  139.     struct cmplx_type [in] *list1,
  140.     struct cmplx_type [out] *list2
  141. );
  142.