home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mmpm21tk.zip / TK / FSSHT / SHNEGOT.C < prev    next >
C/C++ Source or Header  |  1993-02-25  |  5KB  |  96 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. #include <os2.h>
  20. #include <os2me.h>
  21. #include <hhpheap.h>
  22. #include <shi.h>
  23.  
  24. /************************** START OF SPECIFICATIONS *************************/
  25. /*                                                                          */
  26. /* SUBROUTINE NAME: ShcNegotiateResult                                      */
  27. /*                                                                          */
  28. /* DESCRIPTIVE NAME: Stream Handler Command Negotiate results               */
  29. /*                                                                          */
  30. /* FUNCTION: Receives the negotiated SPCB back from SSM for the Create      */
  31. /*           stream call.                                                   */
  32. /*                                                                          */
  33. /* NOTES:                                                                   */
  34. /*                                                                          */
  35. /* ENTRY POINT: ShcNegotiateResult                                          */
  36. /*   LINKAGE:   CALL NEAR (0:32)                                            */
  37. /*                                                                          */
  38. /* INPUT: Pointer to shc negotiate results parameter block (PARM_NEGOTIATE) */
  39. /*        containing:                                                       */
  40. /*   ULONG   ulFunction  Handler command function SHC_ASSOCIATE             */
  41. /*   HID     hid         handler ID                                         */
  42. /*   HSTREAM hstream     handle of stream instance                          */
  43. /*   PSPCB   pspcb       pointer to negotiated SPCB                         */
  44. /*   ULONG   ulErrorStatus SPCB failed the negotiation indicator            */
  45. /*                                                                          */
  46. /* EXIT-NORMAL: NO_ERROR (0)                                                */
  47. /*                                                                          */
  48. /* EXIT-ERROR:                                                              */
  49. /*   ERROR_INVALID_FUNCTION                                                 */
  50. /*                                                                          */
  51. /* SIDE EFFECTS:                                                            */
  52. /*                                                                          */
  53. /* INTERNAL REFERENCES:                                                     */
  54. /*        ROUTINES: None                                                    */
  55. /*                                                                          */
  56. /* EXTERNAL REFERENCES:                                                     */
  57. /*   ROUTINES:                                                              */
  58. /*     ShFindSib                                                            */
  59. /*                                                                          */
  60. /*   DATA STRUCTURES:                                                       */
  61. /*     sib                                                                  */
  62. /*                                                                          */
  63. /*************************** END OF SPECIFICATIONS **************************/
  64.  
  65. RC ShcNegotiateResult(pnrparm)
  66. PARM_NEGOTIATE* pnrparm;
  67.  
  68. { /* Start of ShcNegotiateResult */
  69.  
  70. RC rc = NO_ERROR;                       /* local return code */
  71. PSIB psib;                              /* Stream instance block */
  72.  
  73.   ENTERCRITX(rc);
  74.  
  75.   /*
  76.    * Find our Stream Instance Block
  77.    */
  78.   if (!(rc = ShFindSib(&psib, pnrparm->hstream, pnrparm->hid)))
  79.     { /* We have SIB */
  80.       /* error if we don't have something to stream */
  81.       if (psib->ulStatus != SIB_INITIALIZED)
  82.         {
  83.           rc = ERROR_INVALID_FUNCTION;
  84.         }
  85.       else
  86.         {
  87.           psib->espcb.spcb = *pnrparm->pspcb;
  88.           psib->ulStatus = SIB_NEGOTIATED;
  89.         }
  90.     } /* We have SIB */
  91.  
  92.   EXITCRIT;
  93.   return(rc);
  94.  
  95. } /* End of ShcNegotiateResult */
  96.