home *** CD-ROM | disk | FTP | other *** search
/ Network Support Encyclopedia 96-1 / novell-nsepro-1996-1-cd2.iso / download / netware / dax1.exe / DAP / DAP012.C < prev    next >
Text File  |  1992-07-15  |  4KB  |  104 lines

  1. //   ╔════════════════════════════════════════════════════════════════════╗
  2. //   ║                                                                    ║
  3. //   ║ module:      dap012.c                                              ║
  4. //   ║ abstract:    This module contains DAP request 1012                 ║
  5. //   ║                                                                    ║
  6. //   ║ environment: NetWare 3.x v3.11                                     ║
  7. //   ║              Network C for NLMs SDK                                ║
  8. //   ║              CLib v3.11                                            ║
  9. //   ║              Network C for DOS v2.0                                ║
  10. //   ║              NetWare C Interface DOS v1.2                          ║
  11. //   ║                                                                    ║
  12. //   ║  This software is provided as is and carries no warranty           ║
  13. //   ║  whatsoever.  Novell disclaims and excludes any and all implied    ║
  14. //   ║  warranties of merchantability, title and fitness for a particular ║
  15. //   ║  purpose.  Novell does not warrant that the software will satisfy  ║
  16. //   ║  your requirements or that the software is without defect or error ║
  17. //   ║  or that operation of the software will be uninterrupted.  You are ║
  18. //   ║  using the software at your risk.  The software is not a product   ║
  19. //   ║  of Novell, Inc. or any of subsidiaries.                           ║
  20. //   ║                                                                    ║
  21. //   ╟────────────────────────────────────────────────────────────────────╢
  22. //   ║ maintenance history:                                               ║
  23. //   ║ level    date      pi   description                                ║
  24. //   ╟────────────────────────────────────────────────────────────────────╢
  25. //   ║  001   02/04/92    kl   initial release.                           ║
  26. //   ╚════════════════════════════════════════════════════════════════════╝
  27.  
  28. #include    "dap/dapsys.h"
  29.  
  30. //
  31. //  The following are the request/reply structures for the AddOperands
  32. //  DAP.
  33. //
  34.  
  35. typedef struct{                         // add operands request pkt
  36.         SINT32      operand1;           // operand1
  37.         SINT32      operand2;           // operand2
  38. }AORequest;
  39.  
  40. typedef struct{                         // add operands reply pkt
  41.         SINT32      result;             // the result
  42. }AOReply;
  43.  
  44. #if !defined(ENGINE)
  45.  
  46. //
  47. //  Following is the Client-Side API for AddOperands
  48. //
  49. //      DAPid     - this is obtained from DAPInitialize.  It is
  50. //                  normally a pointer to some sort of structure
  51. //                  containing info needed to connect to the server.
  52. //      op1       - the first operand to add
  53. //      op2       - the second operand to add
  54. //
  55.  
  56. T_RC    DAPAddOperands(DAPDATA *DAPid,long op1, long op2, long *result)
  57. {
  58.         T_RC        rc;
  59.         AORequest   *request = (AORequest *)DAPid->dapRequest.data;
  60.         AOReply     *reply   = (AOReply *)DAPid->dapReply.data;
  61.         //
  62.         //  fill in the request structure
  63.         //
  64.         request->operand1 = op1;
  65.         request->operand2 = op2;
  66.         //
  67.         //  Send the request
  68.         //
  69.         if( (rc = DAPSendRequest(DAPid,DAPADDOPERANDS)) == 0){
  70.             //
  71.             //  Copy result 
  72.             //
  73.             *result = reply->result;
  74.         }
  75.         return rc;
  76. }
  77.  
  78. #else   // !defined(ENGINE)
  79.  
  80. //
  81. //  Following is the Server-Side API for AddOperands
  82. //
  83.  
  84. void    DAPAddOperands(DAPDATA *DAPid)
  85. {
  86.         AORequest *request = (AORequest *)DAPid->dapRequest.data;
  87.         AOReply *reply = (AOReply *)DAPid->dapReply.data;
  88.         DIAG4("Inside AddOperands DAP");
  89.         //
  90.         //  Do the work
  91.         //
  92.         reply->result = request->operand1 + request->operand2;
  93.         //
  94.         //  Set the DAP return code
  95.         //
  96.         DAPid->dapReply.returnCode = 0;
  97.         //
  98.         //  Now send the result to the client
  99.         //
  100.         DAPEnqueueServiceReply(DAPid);
  101. }
  102.  
  103. #endif  // !defined(ENGINE)
  104.