home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / mm / fssht / shnegot.c < prev    next >
C/C++ Source or Header  |  1999-05-11  |  5KB  |  97 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                    Copyright (c) IBM Corporation 1992, 1993              */
  4. /*                           All Rights Reserved                            */
  5. /*                                                                          */
  6. /* SOURCE FILE NAME: SHNEGOT.C                                              */
  7. /*                                                                          */
  8. /* DESCRIPTIVE NAME:  Stream Handler Negotiate Results routine              */
  9. /*                                                                          */
  10. /* FUNCTION: This function starts a stream instance.                        */
  11. /*                                                                          */
  12. /* ENTRY POINTS: ShcNegotiateResult                                         */
  13. /*                                                                          */
  14. /*************************** END OF SPECIFICATIONS **************************/
  15. #define  INCL_NOPMAPI                  /* no PM include files required */
  16. #define  INCL_DOSSEMAPHORES
  17. #define  INCL_DOSPROCESS
  18. #define  INCL_DOSERRORS
  19. #define  INCL_OS2MM
  20. #include <os2.h>
  21. #include <os2me.h>
  22. #include <hhpheap.h>
  23. #include <shi.h>
  24.  
  25. /************************** START OF SPECIFICATIONS *************************/
  26. /*                                                                          */
  27. /* SUBROUTINE NAME: ShcNegotiateResult                                      */
  28. /*                                                                          */
  29. /* DESCRIPTIVE NAME: Stream Handler Command Negotiate results               */
  30. /*                                                                          */
  31. /* FUNCTION: Receives the negotiated SPCB back from SSM for the Create      */
  32. /*           stream call.                                                   */
  33. /*                                                                          */
  34. /* NOTES:                                                                   */
  35. /*                                                                          */
  36. /* ENTRY POINT: ShcNegotiateResult                                          */
  37. /*   LINKAGE:   CALL NEAR (0:32)                                            */
  38. /*                                                                          */
  39. /* INPUT: Pointer to shc negotiate results parameter block (PARM_NEGOTIATE) */
  40. /*        containing:                                                       */
  41. /*   ULONG   ulFunction  Handler command function SHC_ASSOCIATE             */
  42. /*   HID     hid         handler ID                                         */
  43. /*   HSTREAM hstream     handle of stream instance                          */
  44. /*   PSPCB   pspcb       pointer to negotiated SPCB                         */
  45. /*   ULONG   ulErrorStatus SPCB failed the negotiation indicator            */
  46. /*                                                                          */
  47. /* EXIT-NORMAL: NO_ERROR (0)                                                */
  48. /*                                                                          */
  49. /* EXIT-ERROR:                                                              */
  50. /*   ERROR_INVALID_FUNCTION                                                 */
  51. /*                                                                          */
  52. /* SIDE EFFECTS:                                                            */
  53. /*                                                                          */
  54. /* INTERNAL REFERENCES:                                                     */
  55. /*        ROUTINES: None                                                    */
  56. /*                                                                          */
  57. /* EXTERNAL REFERENCES:                                                     */
  58. /*   ROUTINES:                                                              */
  59. /*     ShFindSib                                                            */
  60. /*                                                                          */
  61. /*   DATA STRUCTURES:                                                       */
  62. /*     sib                                                                  */
  63. /*                                                                          */
  64. /*************************** END OF SPECIFICATIONS **************************/
  65.  
  66. RC ShcNegotiateResult(pnrparm)
  67. PARM_NEGOTIATE* pnrparm;
  68.  
  69. { /* Start of ShcNegotiateResult */
  70.  
  71. RC rc = NO_ERROR;                       /* local return code */
  72. PSIB psib;                              /* Stream instance block */
  73.  
  74.   ENTERCRITX(rc);
  75.  
  76.   /*
  77.    * Find our Stream Instance Block
  78.    */
  79.   if (!(rc = ShFindSib(&psib, pnrparm->hstream, pnrparm->hid)))
  80.     { /* We have SIB */
  81.       /* error if we don't have something to stream */
  82.       if (psib->ulStatus != SIB_INITIALIZED)
  83.         {
  84.           rc = ERROR_INVALID_FUNCTION;
  85.         }
  86.       else
  87.         {
  88.           psib->espcb.spcb = *pnrparm->pspcb;
  89.           psib->ulStatus = SIB_NEGOTIATED;
  90.         }
  91.     } /* We have SIB */
  92.  
  93.   EXITCRIT;
  94.   return(rc);
  95.  
  96. } /* End of ShcNegotiateResult */
  97.