1: /*
   2:  * Server for Clearinghouse.
   3:  */
   4: #include "Clearinghouse2.h"
   5: #include <xnscourier/except.h>
   6: 
   7: extern CourierConnection *_serverConnection;
   8: 
   9: extern Clearinghouse2_RetrieveAddressesResults Clearinghouse2_RetrieveAddresses();
  10: 
  11: server_Clearinghouse2_RetrieveAddresses(_buf)
  12:     register Unspecified *_buf;
  13: {
  14:     register Unspecified *_bp = _buf;
  15:     register LongCardinal _n;
  16:     Clearinghouse2_RetrieveAddressesResults _Results;
  17: 
  18:     _Results = Clearinghouse2_RetrieveAddresses(_serverConnection, 0);
  19:     _n = sizeof_Clearinghouse2_RetrieveAddressesResults(&_Results);
  20:     _bp = Allocate(_n);
  21:     externalize_Clearinghouse2_RetrieveAddressesResults(&_Results, _bp);
  22:     SendReturnMessage(_n, _bp);
  23:     Deallocate(_bp);
  24: }
  25: 
  26: Server(skipcount,skippedwords)
  27:     int skipcount;
  28:     Unspecified skippedwords[];
  29: {
  30:     Cardinal _procedure;
  31:     register Unspecified *_buf;
  32:     LongCardinal programnum;
  33:     Cardinal versionnum;
  34:     Cardinal _n;
  35: 
  36:     for (;;) {
  37:         _buf = ReceiveCallMessage(&_procedure, skipcount, skippedwords);
  38:         DURING switch (_procedure) {
  39:         case 0:
  40:             server_Clearinghouse2_RetrieveAddresses(_buf);
  41:             break;
  42:         default:
  43:             NoSuchProcedureValue("Clearinghouse", _procedure);
  44:             break;
  45:         } HANDLER {
  46:             Deallocate(_buf);
  47:             switch (&Exception.Code) {
  48:             case Clearinghouse2_WrongServer:
  49:             _n = sizeof_T_cn2_48((T_cn2_48 *)Exception.Message);
  50:             _buf = Allocate(_n);
  51:             (void) externalize_T_cn2_48((T_cn2_48*)Exception.Message, _buf);
  52:             SendAbortMessage(Exception.Code-ERROR_OFFSET, _n, _buf);
  53:             break;
  54:             case Clearinghouse2_UpdateError:
  55:             _n = sizeof_T_cn2_47((T_cn2_47 *)Exception.Message);
  56:             _buf = Allocate(_n);
  57:             (void) externalize_T_cn2_47((T_cn2_47*)Exception.Message, _buf);
  58:             SendAbortMessage(Exception.Code-ERROR_OFFSET, _n, _buf);
  59:             break;
  60:             case Clearinghouse2_PropertyError:
  61:             _n = sizeof_T_cn2_46((T_cn2_46 *)Exception.Message);
  62:             _buf = Allocate(_n);
  63:             (void) externalize_T_cn2_46((T_cn2_46*)Exception.Message, _buf);
  64:             SendAbortMessage(Exception.Code-ERROR_OFFSET, _n, _buf);
  65:             break;
  66:             case Clearinghouse2_CallError:
  67:             _n = sizeof_T_cn2_45((T_cn2_45 *)Exception.Message);
  68:             _buf = Allocate(_n);
  69:             (void) externalize_T_cn2_45((T_cn2_45*)Exception.Message, _buf);
  70:             SendAbortMessage(Exception.Code-ERROR_OFFSET, _n, _buf);
  71:             break;
  72:             case Clearinghouse2_AuthenticationError:
  73:             _n = sizeof_T_cn2_44((T_cn2_44 *)Exception.Message);
  74:             _buf = Allocate(_n);
  75:             (void) externalize_T_cn2_44((T_cn2_44*)Exception.Message, _buf);
  76:             SendAbortMessage(Exception.Code-ERROR_OFFSET, _n, _buf);
  77:             break;
  78:             case Clearinghouse2_ArgumentError:
  79:             _n = sizeof_T_cn2_43((T_cn2_43 *)Exception.Message);
  80:             _buf = Allocate(_n);
  81:             (void) externalize_T_cn2_43((T_cn2_43*)Exception.Message, _buf);
  82:             SendAbortMessage(Exception.Code-ERROR_OFFSET, _n, _buf);
  83:             break;
  84:             default:
  85:             _buf = Allocate(0);
  86:             SendRejectMessage(unspecifiedError, 0, _buf);
  87:             break;
  88:             }
  89:         } END_HANDLER;
  90:         Deallocate(_buf);
  91:         for (;;) {
  92:             skipcount = LookAheadCallMsg(&programnum, &versionnum,
  93:                              skippedwords);
  94:             if (skipcount < 0) return(0);   /* timed out */
  95:             if (programnum != 2 || versionnum != 2)
  96:                 ExecCourierProgram(programnum, versionnum,
  97:                            skipcount, skippedwords);
  98:         }  /* can't exec that program */
  99:     }
 100: }

Defined functions

Server defined in line 26; never used
server_Clearinghouse2_RetrieveAddresses defined in line 11; used 1 times
  • in line 40
Last modified: 1986-03-13
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 646
Valid CSS Valid XHTML 1.0 Strict