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