⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pipechan.h

📁 mgcp协议源代码。支持多种编码:g711
💻 H
📖 第 1 页 / 共 2 页
字号:
       similar to end of file for the PFile channel.       The GetErrorCode() function should be consulted after Read() returns       FALSE to determine what caused the failure.       @return       TRUE indicates that at least one character was read from the channel.       FALSE means no bytes were read due to timeout or some other I/O error.     */    virtual BOOL Read(      void * buf,   /// Pointer to a block of memory to receive the read bytes.      PINDEX len    /// Maximum number of bytes to read into the buffer.    );    /**Low level write to the channel. This function will block until the       requested number of characters are written or the write timeout is       reached. The GetLastWriteCount() function returns the actual number       of bytes written.       If the sub-program has completed its run then this function will fail       returning FALSE.       The GetErrorCode() function should be consulted after Write() returns       FALSE to determine what caused the failure.       @return       TRUE if at least len bytes were written to the channel.     */    virtual BOOL Write(      const void * buf, /// Pointer to a block of memory to write.      PINDEX len        /// Number of bytes to write.    );    /**Close the channel. This will kill the sub-program's process (on       platforms where that is relevent).              For #WriteOnly# or #ReadWrite# mode pipe channels       on platforms that do no support concurrent multi-processing and have       not yet called the #Execute()# function this will run the       sub-program.     */    virtual BOOL Close();  //@}  /**@name New member functions */  //@{    /** Open a channel. */    BOOL Open(      const PString & subProgram,  /// Sub program name or command line.      OpenMode mode = ReadWrite,   /// Mode for the pipe channel.      BOOL searchPath = TRUE,      /// Flag for system PATH to be searched.      BOOL stderrSeparate = FALSE  /// Standard error is on separate pipe    );    /** Open a channel. */    BOOL Open(      const PString & subProgram,  /// Sub program name or command line.      const PStringArray & argumentList, /// Array of arguments to sub-program.      OpenMode mode = ReadWrite,   /// Mode for the pipe channel.      BOOL searchPath = TRUE,      /// Flag for system PATH to be searched.      BOOL stderrSeparate = FALSE  /// Standard error is on separate pipe    );    /** Open a channel. */    BOOL Open(      const PString & subProgram,  /// Sub program name or command line.      const PStringToString & environment, /// Array of arguments to sub-program.      OpenMode mode = ReadWrite,   /// Mode for the pipe channel.      BOOL searchPath = TRUE,      /// Flag for system PATH to be searched.      BOOL stderrSeparate = FALSE  /// Standard error is on separate pipe    );    /**Open a new pipe channel allowing the subProgram to be executed and       data transferred from its stdin/stdout/stderr.              If the mode is #ReadOnly# then the #stdout# of the       sub-program is supplied via the #Read()# calls of the PPipeChannel.       The sub-programs input is set to the platforms null device (eg       /dev/nul).       If mode is #WriteOnly# then #Write()# calls of the       PPipeChannel are suppied to the sub-programs #stdin# and its       #stdout# is sent to the null device.              If mode is #ReadWrite# then both read and write actions can       occur.       The #subProgram# parameter may contain just the path of the       program to be run or a program name and space separated arguments,       similar to that provided to the platforms command processing shell.       Which use of this parameter is determiend by whether arguments are       passed via the #argumentPointers# or       #argumentList# parameters.       The #searchPath# parameter indicates that the system PATH       for executables should be searched for the sub-program. If FALSE then       only the explicit or implicit path contained in the       #subProgram# parameter is searched for the executable.       The #stderrSeparate# parameter indicates that the standard       error stream is not included in line with the standard output stream.       In this case, data in this stream must be read using the       #ReadStandardError()# function.       The #environment# parameter is a null terminated sequence       of null terminated strings of the form name=value. If NULL is passed       then the same invironment as calling process uses is passed to the       child process.     */    BOOL Open(      const PString & subProgram,  /// Sub program name or command line.      const PStringArray & argumentList, /// Array of arguments to sub-program.      const PStringToString & environment, /// Array of arguments to sub-program.      OpenMode mode = ReadWrite,   /// Mode for the pipe channel.      BOOL searchPath = TRUE,      /// Flag for system PATH to be searched.      BOOL stderrSeparate = FALSE  /// Standard error is on separate pipe    );    /**Get the full file path for the sub-programs executable file.       @return       file path name for sub-program.     */    const PFilePath & GetSubProgram() const;    /**Start execution of sub-program for platforms that do not support       multi-processing, this will actually run the sub-program passing all       data written to the PPipeChannel.              For platforms that do support concurrent multi-processing this will       close the pipe from the current process to the sub-process.             As the sub-program is run immediately and concurrently, this will just       give an end of file to the stdin of the remote process. This is often       necessary.       @return TRUE if execute was successful.     */    BOOL Execute();    /**Determine if the program associated with the PPipeChannel is still       executing. This is useful for determining the status of PPipeChannels       which take a long time to execute on operating systems which support       concurrent multi-processing.              @return       TRUE if the program associated with the PPipeChannel is still running     */    BOOL IsRunning() const;    /**Get the return code from the most recent Close;       @return       Return code from the closing process     */    int GetReturnCode() const;    /**This function will block and wait for the sub-program to terminate.           @return       Return code from the closing process     */    int WaitForTermination();        /**This function will block and wait for the sub-program to terminate.       It will wait only for the specified amount of time.           @return       Return code from the closing process, -1 if timed out.     */    int WaitForTermination(      const PTimeInterval & timeout  /// Amount of time to wait for process.    );    /**This function will terminate the sub-program using the signal code       specified.            @return       TRUE if the process received the signal. Note that this does not mean       that the process has actually terminated.     */    BOOL Kill(      int signal = 9  /// Signal code to be sent to process.    );    /**Read all available data on the standard error stream of the       sub-process. If the #wait# parameter is FALSE then only       the text currently available is returned. If TRUE then the function       blocks as long as necessary to get some number of bytes.       @return       TRUE indicates that at least one character was read from stderr.       FALSE means no bytes were read due to timeout or some other I/O error.     */    BOOL ReadStandardError(      PString & errors,   /// String to receive standard error text.      BOOL wait = FALSE   /// Flag to indicate if function should block    );    /**Determine if the platform can support simultaneous read and writes from       the PPipeChannel (eg MSDOS returns FALSE, Unix returns TRUE).              @return       TRUE if platform supports concurrent multi-processing.     */    static BOOL CanReadAndWrite();  //@}  protected:    // Member variables    /// The fully qualified path name for the sub-program executable.    PFilePath subProgName;  private:    BOOL PlatformOpen(const PString & subProgram,                      const PStringArray & arguments,                      OpenMode mode,                      BOOL searchPath,                      BOOL stderrSeparate,                      const PStringToString * environment);#ifdef DOC_PLUS_PLUS};#endif// Class declaration continued in platform specific header file ///////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -