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

  1. //   ╔════════════════════════════════════════════════════════════════════╗
  2. //   ║                                                                    ║
  3. //   ║ module:      dapswit.c                                             ║
  4. //   ║ abstract:    This module contains the API that demultiplexes all   ║
  5. //   ║              incoming requests, and calls the appropriate API to   ║
  6. //   ║              service the request.                                  ║
  7. //   ║                                                                    ║
  8. //   ║ environment: NetWare 3.x v3.11                                     ║
  9. //   ║              Network C for NLMs SDK                                ║
  10. //   ║              CLib v3.11                                            ║
  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   03/03/92    kl   initial release.                           ║
  26. //   ╚════════════════════════════════════════════════════════════════════╝
  27.  
  28. #include "dap/dapsys.h"
  29.  
  30. //
  31. //  This routine is called when a new DAP is received.  It determines
  32. //  the DAP type, and calls the corresponding DAP API.  It executes
  33. //  using the caller's thread of execution, in this case the Service
  34. //  RequestQueue thread.
  35. //
  36.  
  37. void    DAPInvalidRequest(DAPDATA *DAPid)
  38. {
  39.         DAPprintf("Invalid request code %d from (%x)",
  40.                   DAPid->dapRequest.requestCode,
  41.                   DAPid->dapRequest.sessionID);
  42.         //
  43.         //  Set the DAP return code
  44.         //
  45.         DAPid->dapReply.returnCode = DAP_INVALID_REQUEST;
  46.         //
  47.         //  Now send the result to the client
  48.         //
  49.         DAPEnqueueServiceReply(DAPid);
  50. }
  51.  
  52. //
  53. //  The following API is modified to support new DAP's.
  54. //
  55. //  It is called from the service request queue thread to execute
  56. //  the appropriate DAP request.
  57. //
  58.  
  59. void    DAPDispatchRequestAPI(DAPDATA *DAPid)
  60. {
  61.         DAPStateON(DAPid,DAP_SERVICE);
  62.         switch( DAPid->dapRequest.requestCode ){
  63.         case DAPALLOCATESESSION:    DAPAllocateSession(DAPid);   break;
  64.         case DAPDEALLOCATESESSION:  DAPDeAllocateSession(DAPid); break;
  65.         case DAPADDOPERANDS:        DAPAddOperands(DAPid);       break;
  66.         case DAPSUBTRACTOPERANDS:   DAPSubtractOperands(DAPid);  break;
  67.         case DAPMULTIPLYOPERANDS:   DAPMultiplyOperands(DAPid);  break;
  68.         case DAPDIVIDEOPERANDS:     DAPDivideOperands(DAPid);    break;
  69.         case DAPRESETCALCULATOR:    DAPResetCalculator(DAPid);   break;
  70.         case DAPSTOREVALUE:         DAPStoreValue(DAPid);        break;
  71.         case DAPRECALLVALUE:        DAPRecallValue(DAPid);       break;
  72.         default:                    DAPInvalidRequest(DAPid);    break;
  73.         }
  74.         DAPStateOFF(DAPid,DAP_SERVICE);
  75. }
  76.