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

  1. //   ╔════════════════════════════════════════════════════════════════════╗
  2. //   ║                                                                    ║
  3. //   ║ module:      dap017.c                                              ║
  4. //   ║ abstract:    This module contains DAP request 1017                 ║
  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 Store Value
  32. //  DAP.
  33. //
  34.  
  35. typedef struct{                         // store value request pkt
  36.         SINT32      value;              // value to store
  37. }SVRequest;
  38.  
  39. typedef struct{                         // store value reply pkt
  40.         SINT32      oldval;             // the old stored value
  41. }SVReply;
  42.  
  43. #if !defined(ENGINE)
  44.  
  45. //
  46. //  Following is the Client-Side API for Store Value
  47. //
  48. //      DAPid     - this is obtained from DAPInitialize.  It is
  49. //                  normally a pointer to some sort of structure
  50. //                  containing info needed to connect to the server.
  51. //      val       - the value to store
  52. //      oldval    - the previous stored value
  53. //
  54.  
  55. T_RC    DAPStoreValue(DAPDATA *DAPid,long val, long *oldval)
  56. {
  57.         T_RC        rc;
  58.         SVRequest   *request = (SVRequest *)DAPid->dapRequest.data;
  59.         SVReply     *reply   = (SVReply *)DAPid->dapReply.data;
  60.         //
  61.         //  fill in the request structure
  62.         //
  63.         request->value = val;
  64.         //
  65.         //  Send the request
  66.         //
  67.         if( (rc = DAPSendRequest(DAPid,DAPSTOREVALUE)) == 0){
  68.             //
  69.             //  Copy result 
  70.             //
  71.             *oldval = reply->oldval;
  72.         }
  73.         return rc;
  74. }
  75.  
  76. #else   // !defined(ENGINE)
  77.  
  78. //
  79. //  Following is the Server-Side API for Store Value
  80. //
  81.  
  82. void    DAPStoreValue(DAPDATA *DAPid)
  83. {
  84.         SVRequest *request = (SVRequest *)DAPid->dapRequest.data;
  85.         SVReply *reply = (SVReply *)DAPid->dapReply.data;
  86.         DIAG4("Inside StoreValue DAP");
  87.         //
  88.         //  Do the work
  89.         //
  90.         reply->oldval = DAPGetApplDataStructure(DAPid).mailBox001;
  91.         DAPGetApplDataStructure(DAPid).mailBox001 = request->value;
  92.         //
  93.         //  Set the DAP return code
  94.         //
  95.         DAPid->dapReply.returnCode = 0;
  96.         //
  97.         //  Now send the result to the client
  98.         //
  99.         DAPEnqueueServiceReply(DAPid);
  100. }
  101.  
  102. #endif  // !defined(ENGINE)
  103.