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

  1. //   ╔════════════════════════════════════════════════════════════════════╗
  2. //   ║                                                                    ║
  3. //   ║ module:      dap013.c                                              ║
  4. //   ║ abstract:    This module contains DAP request 1013                 ║
  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/21/92    kl   initial release.                           ║
  26. //   ╚════════════════════════════════════════════════════════════════════╝
  27.  
  28. #include    "dap/dapsys.h"
  29.  
  30. //
  31. //  The following are the request/reply structures for the SubOperands
  32. //  DAP.
  33. //
  34.  
  35. typedef struct{                         // sub operands request pkt
  36.         SINT32      operand1;           // operand1
  37.         SINT32      operand2;           // operand2
  38. }SORequest;
  39.  
  40. typedef struct{                         // sub operands reply pkt
  41.         SINT32      result;             // the result
  42. }SOReply;
  43.  
  44. #if !defined(ENGINE)
  45.  
  46. //
  47. //  Following is the Client-Side API for subOperands
  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 sub
  53. //      op2       - the second operand to sub
  54. //
  55.  
  56. T_RC    DAPSubtractOperands(DAPDATA *DAPid,long op1, long op2, long *result)
  57. {
  58.         T_RC        rc;
  59.         SORequest   *request = (SORequest *)DAPid->dapRequest.data;
  60.         SOReply     *reply   = (SOReply *)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,DAPSUBTRACTOPERANDS)) == 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 subOperands
  82. //
  83.  
  84. void    DAPSubtractOperands(DAPDATA *DAPid)
  85. {
  86.         SORequest *request = (SORequest *)DAPid->dapRequest.data;
  87.         SOReply *reply = (SOReply *)DAPid->dapReply.data;
  88.         DIAG4("Inside SubtractOperands 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.