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

  1. //   ╔════════════════════════════════════════════════════════════════════╗
  2. //   ║                                                                    ║
  3. //   ║ module:      dap011.c                                              ║
  4. //   ║ abstract:    This module contains DAP request 1011                 ║
  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/11/92    kl   initial release.                           ║
  26. //   ╚════════════════════════════════════════════════════════════════════╝
  27.  
  28. #include    "dap/dapsys.h"
  29. #include    "cp/cpapi.h"
  30.  
  31. //
  32. //  The following are the request/reply structures for the AllocateSession
  33. //  DAP.
  34. //
  35.  
  36. typedef struct{                         // deallocate session request pkt
  37.         UINT32      sessionID;          // sessionID to drop
  38. }DSRequest;
  39.  
  40. typedef struct{                         // deallocate session reply pkt
  41.         UINT32      dummy;              // nothing returned
  42. }DSReply;
  43.  
  44. #if !defined(ENGINE)
  45.  
  46. //
  47. //  Following is the Client-Side API for DeAllocateSession
  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. //
  53.  
  54. T_RC    DAPDeAllocateSession(DAPDATA *DAPid)
  55. {
  56.         T_RC        rc;
  57.         DSRequest   *request = (DSRequest *)DAPid->dapRequest.data;
  58.         //
  59.         //  Fill in the request buffer for this DAP
  60.         //
  61.         request->sessionID   = DAPid->sessionID;
  62.         //
  63.         //  Send the request to the application server
  64.         //
  65.         rc = DAPSendRequest(DAPid,DAPDEALLOCATESESSION);
  66.         //
  67.         //  Now disconnect the client from the server
  68.         //
  69.         CPDisConnectFromServer(DAPid->CPid);
  70.         return rc;
  71. }
  72.  
  73. #else   // !defined(ENGINE)
  74.  
  75. //
  76. //  Following is the Server-Side API for DeAllocateSession
  77. //
  78.  
  79. void    DAPDeAllocateSession(DAPDATA *DAPid)
  80. {
  81.         //
  82.         //  Define the following, if your deallocate packet has
  83.         //  elements which will be returned to the client.
  84.         //
  85.         //  DSReply *reply = (DSReply *)DAPid->dapReply.data;
  86.         //
  87.         DIAG4("Inside DeAllocateSession DAP");
  88.         //
  89.         //  Set the flag that tells the Reply Thread to free this
  90.         //  entry upon sending the reply.
  91.         //
  92.         DAPSetFlag(DAPid,DAP_FREE_THIS_SLOT);
  93.         //
  94.         //  Set return code to zero
  95.         //
  96.         DAPid->dapReply.returnCode = 0;
  97.         //
  98.         //  Update the TotalLogoutRequests Statistic, but only if the client
  99.         //  is really logged in.  This is really just to keep our state up
  100.         //  to date, since he wouldn't be able to resend a logout request 
  101.         //  because the DAP would have already been freed...
  102.         //
  103.         if( DAPStateActive(DAPid,DAP_CLIENTLOGIN) ){
  104.             DAPStateOFF(DAPid,DAP_CLIENTLOGIN);
  105.             DAPIncLogoutRequests();
  106.         }
  107.         //
  108.         //  Now send the result to the client
  109.         //
  110.         DAPEnqueueServiceReply(DAPid);
  111. }
  112.  
  113. #endif  // !defined(ENGINE)
  114.