home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v6.zip / MMPM2TK / TK / FSSHT / SHROUTER.C < prev    next >
C/C++ Source or Header  |  1993-02-25  |  9KB  |  200 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                    Copyright (c) IBM Corporation 1992, 1993              */
  4. /*                           All Rights Reserved                            */
  5. /*                                                                          */
  6. /* SOURCE FILE NAME: SHROUTER.C                                             */
  7. /*                                                                          */
  8. /* DESCRIPTIVE NAME:  Stream Handler Command Router.                        */
  9. /*                                                                          */
  10. /* FUNCTION: This file contains the stream handler router routine.  It      */
  11. /*           takes SHC commands from the stream manager and routes them     */
  12. /*           to the appropriate routine.                                    */
  13. /*                                                                          */
  14. /* ENTRY POINTS: ShcRouter                                                  */
  15. /*                                                                          */
  16. /*************************** END OF SPECIFICATIONS **************************/
  17. #define  INCL_NOPMAPI                  /* no PM include files required */
  18. #define  INCL_DOSSEMAPHORES
  19. #define  INCL_DOSERRORS
  20. #define  INCL_DOSPROCESS
  21. #include <os2.h>
  22. #include <os2me.h>
  23. #include <hhpheap.h>
  24. #include <shi.h>
  25.  
  26. /************************** START OF SPECIFICATIONS *************************/
  27. /*                                                                          */
  28. /* SUBROUTINE NAME: ShcRouter                                               */
  29. /*                                                                          */
  30. /* DESCRIPTIVE NAME: Stream Handler Command Router routine                  */
  31. /*                                                                          */
  32. /* FUNCTION: This is the entry point routine that the stream manager will   */
  33. /*   call.  It should take the first parameter (function) and call the      */
  34. /*   appropriate routine to service this request.                           */
  35. /*                                                                          */
  36. /* NOTES:                                                                   */
  37. /*                                                                          */
  38. /* ENTRY POINT: ShcRouter                                                   */
  39. /*   LINKAGE:   CALL NEAR (0:32)                                            */
  40. /*                                                                          */
  41. /* INPUT: pParmIn    - Addr of input parm structure.  The contents of this  */
  42. /*                     structure is dependent on the function called.       */
  43. /*                                                                          */
  44. /* EXIT-NORMAL: NO_ERROR                                                    */
  45. /*                                                                          */
  46. /* EXIT-ERROR:                                                              */
  47. /*        ERROR_INVALID_FUNCTION                                            */
  48. /*                                                                          */
  49. /* SIDE EFFECTS:                                                            */
  50. /*                                                                          */
  51. /* INTERNAL REFERENCES:                                                     */
  52. /*        ROUTINES:                                                         */
  53. /*                                                                          */
  54. /* EXTERNAL REFERENCES:                                                     */
  55. /*        ROUTINES:                                                         */
  56. /*           ShcAssociate                                                   */
  57. /*           ShcCreate                                                      */
  58. /*           ShcDestroy                                                     */
  59. /*           ShcSeek                                                        */
  60. /*           ShcStart                                                       */
  61. /*           ShcStop                                                        */
  62. /*           ShcGetProtocol                                                 */
  63. /*           ShcInstallProtocol                                             */
  64. /*           ShcEnumerateProtocols                                          */
  65. /*           ShcNegotiateResults                                            */
  66. /*           pfnShcSendMsg                                                  */
  67. /*           pfnShcGetTime                                                  */
  68. /*           pfnShcEnableEvent                                              */
  69. /*           pfnShcDisableEvent                                             */
  70. /*           pfnShcEnableSync                                               */
  71. /*           pfnShcDisableSync                                              */
  72. /*                                                                          */
  73. /*        DATA STRUCTURES:                                                  */
  74. /*                                                                          */
  75. /*************************** END OF SPECIFICATIONS **************************/
  76.  
  77. ULONG APIENTRY ShcRouter(pshc)
  78. PVOID pshc;
  79.  
  80. { /* Start of ShcRouter */
  81.  
  82. PSHC_COMMON pshcNow;
  83. RC rc = NO_ERROR;                       /* local return code */
  84.  
  85.   pshcNow = (PSHC_COMMON)pshc;
  86.  
  87.   switch (pshcNow->ulFunction)
  88.   {
  89.     case SHC_ASSOCIATE:
  90.          {
  91.            rc = ShcAssociate((PPARM_ASSOC)pshcNow);
  92.            break;
  93.          }
  94.     case SHC_CREATE:
  95.          {
  96.            rc = ShcCreate((PPARM_CREATE)pshcNow);
  97.            break;
  98.          }
  99.     case SHC_DESTROY:
  100.          {
  101.            rc = ShcDestroy((PPARM_DESTROY)pshcNow);
  102.            break;
  103.          }
  104.     case SHC_SEEK:
  105.          {
  106.            rc = ShcSeek((PPARM_SEEK)pshcNow);
  107.            break;
  108.          }
  109.     case SHC_START:
  110.          {
  111.            rc = ShcStart((PPARM_START)pshcNow);
  112.            break;
  113.          }
  114.     case SHC_STOP:
  115.          {
  116.            rc = ShcStop((PPARM_STOP)pshcNow);
  117.            break;
  118.          }
  119.     case SHC_GET_PROTOCOL:
  120.          {
  121.            rc = ShcGetProtocol((PPARM_GPROT)pshcNow);
  122.            break;
  123.          }
  124.     case SHC_INSTALL_PROTOCOL:
  125.          {
  126.            rc = ShcInstallProtocol((PPARM_INSTPROT)pshcNow);
  127.            break;
  128.          }
  129.     case SHC_ENUMERATE_PROTOCOLS:
  130.          {
  131.            rc = ShcEnumerateProtocols((PPARM_ENUMPROT)pshcNow);
  132.            break;
  133.          }
  134.     case SHC_NEGOTIATE_RESULT:
  135.          {
  136.            rc = ShcNegotiateResult((PPARM_NEGOTIATE)pshcNow);
  137.            break;
  138.          }
  139.  
  140.     case SHC_SENDMSG:
  141.          {
  142.            if (ulHandlerFlags & HANDLER_SHC_SENDMSG)
  143.               rc = pfnShcSendMsg((PPARM_SNDMSG)pshcNow);
  144.            else
  145.               rc = ERROR_INVALID_FUNCTION;
  146.            break;
  147.          }
  148.     case SHC_GET_TIME:
  149.          {
  150.            if (ulHandlerFlags & HANDLER_SHC_GET_TIME)
  151.               rc = pfnShcGetTime((PPARM_GTIME)pshcNow);
  152.            else
  153.               rc = ERROR_INVALID_FUNCTION;
  154.            break;
  155.          }
  156.     case SHC_ENABLE_EVENT:
  157.          {
  158.            if (ulHandlerFlags & HANDLER_SHC_EVENT_CALLS)
  159.               rc = pfnShcEnableEvent((PPARM_ENEVENT)pshcNow);
  160.            else
  161.               rc = ERROR_INVALID_FUNCTION;
  162.            break;
  163.          }
  164.     case SHC_DISABLE_EVENT:
  165.          {
  166.            if (ulHandlerFlags & HANDLER_SHC_EVENT_CALLS)
  167.               rc = pfnShcDisableEvent((PPARM_DISEVENT)pshcNow);
  168.            else
  169.               rc = ERROR_INVALID_FUNCTION;
  170.            break;
  171.          }
  172.     case SHC_ENABLE_SYNC:
  173.          {
  174.            if (ulHandlerFlags & HANDLER_SHC_SYNC_CALLS)
  175.               rc = pfnShcEnableSync((PPARM_ENSYNC)pshcNow);
  176.            else
  177.               rc = ERROR_INVALID_FUNCTION;
  178.            break;
  179.          }
  180.     case SHC_DISABLE_SYNC:
  181.          {
  182.            if (ulHandlerFlags & HANDLER_SHC_SYNC_CALLS)
  183.               rc = pfnShcDisableSync((PPARM_DISSYNC)pshcNow);
  184.            else
  185.               rc = ERROR_INVALID_FUNCTION;
  186.            break;
  187.          }
  188.  
  189.     default:
  190.          {
  191.            rc = ERROR_INVALID_FUNCTION;
  192.            break;
  193.          }
  194.  
  195.   } /* endswitch */
  196.  
  197.   return(rc);
  198.  
  199. } /* End of ShcRouter */
  200.