📄 piiobuf.h
字号:
Description:
Reads data from the IO channel into the buffer pIOBuf. Up to iMaxLen
bytes will be read. A positive return value gives the number of bytes
written into the buffer.
Notes:
Return Values:
Returns PIAPI_ERROR (-1) on error, PIAPI_FALSE (0) for channel closed
and >0 for success.
Errors:
Returns PIAPI_ERROR (-1) on IO error, PIAPI_FALSE (0) on channel closed.
See Also:
PIIOBuffer_read().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIIOBuffer_readToBuffer( PIIOBuffer *pIOBuf, char *pszBuf,
int iMaxLen );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_write
Synopsis:
int PIIOBuffer_write( PIIOBuffer *pIOBuf, const char *pszBuf, int iLen,
int iFlags )
Description:
Write the contents of the buffer pszBuf of length iLen into the
the internal output buffer optionally flushing the output buffer.
The value iFlags is formed by OR'ing the following flags
<TABLE>
<TR><TD>PIIOBUF_NONE <TD>No flags (0).
<TR><TD>PIIOBUF_NOBUFFER <TD>Don't buffer, output data with directly after
flushing existing output buffer.
<TR><TD>PIIOBUF_CHUNKED <TD>Output data using HTTP/1.1 chunked transfer encoding.
</TABLE>
Notes:
If iLen is -1, PIIOBuffer_write() uses strlen() to determine the
length of the string pszBuf. If PIIOBUF_CHUNKED has been used,
subsequent calls of PIIOBuffer_write() must also provide the flag.
Return Values:
Returns number of bytes written or 0 on error.
Errors:
Returns 0 on error.
See Also:
PIIOBuffer_writeLn().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIIOBuffer_write( PIIOBuffer *pIOBuf, const char *pszBuf,
int iLen, int iFlags );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_writeLn
Synopsis:
int PIIOBuffer_writeLn( PIIOBuffer *pIOBuf, const char *pszBuf, int iLen,
int iFlags )
Description:
Write the contents of the buffer pszBuf of length iLen into the
the internal output buffer followed by CRLF to terminate the line.
See PIIOBuffer_write() for a description of flags.
Notes:
If iLen is -1, PIIOBuffer_write() uses strlen() to determine the
length of the string pszBuf.
Return Values:
Returns number of bytes written or 0 on error.
Errors:
Returns 0 on error.
See Also:
PIIOBuffer_write().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIIOBuffer_writeLn( PIIOBuffer *pIOBuf, const char *pszBuf,
int iLen, int iFlags );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_flush
Synopsis:
int PIIOBuffer_flush( PIIOBuffer *pIOBuf )
Description:
Flush contents of output buffer to the IO channel.
Notes:
If PIIOBUF_CHUNKED has been used to write data to the client,
the last chunk will be closed accordingly to HTTP/1.1.
Return Values:
Returns an integer which is interpreted as a boolean.
Errors:
Returns non-zero on success, 0 on failure.
See Also:
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIIOBuffer_flush( PIIOBuffer *pIOBuf );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_getOutputBuffer
Synopsis:
int PIIOBuffer_getOutputBuffer( PIIOBuffer *pIOBuf, char **ppBuffer )
Description:
Returns the output buffer and its length so data can be written into
it directly rather than using intermediate buffering. If the buffer
length is not sufficient PIIOBuffer_flush() may be invoked followed by
PIIOBuffer_getOutputBuffer() to get the flushed buffer.
The pointer ppBuffer will be set to point at the internal buffer.
After data has been written to the buffer and before any other output
buffer functions are invoked the function PIIOBuffer_advanceBufferPointer()
should be called to set the internal length of the output buffer.
Notes:
Return Values:
Returns the length of the output buffer.
Errors:
See Also:
PIIOBuffer_advanceBufferPointer().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIIOBuffer_getOutputBuffer( PIIOBuffer *pIOBuf,
char **ppBuffer );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_advanceBufferPointer
Synopsis:
int PIIOBuffer_advanceBufferPointer( PIIOBuffer *pIOBuf, int iCount )
Description:
Advances the internal buffer pointer by iCount bytes. See
PIIOBuffer_getOutputBuffer() for more information.
Notes:
Return Values:
Returns a positive integer on success.
Errors:
Returns a negative or zero value on failure.
See Also:
PIIOBuffer_getOutputBuffer.
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIIOBuffer_advanceBufferPointer( PIIOBuffer *pIOBuf,
int iCount );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_getBytesSent
Synopsis:
int PIIOBuffer_getBytesSent( PIIOBuffer *pIOBuf )
Description:
Returns the number of byes which have been place into this buffer
object since it was created or PIIOBuffer_resetBytesSent() was
last invoked. This value is the sum of the data sent down the IO channel
and data currently in the output buffer.
Notes:
Return Values:
Returns number of bytes sent.
Errors:
This function does not raise an error.
See Also:
PIIOBuffer_resetBytesSent().
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIIOBuffer_getBytesSent( PIIOBuffer *pIOBuf );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_resetBytesSent
Synopsis:
int PIIOBuffer_resetBytesSent( PIIOBuffer *pIOBuf )
Description:
Resets the count of bytes sent through this buffer object to 0.
Refer to PIIOBuffer_getBytesSent() for more information.
Notes:
Return Values:
This function does not return a value.
Returns number of bytes sent.
Errors:
This function does not raise an error.
See Also:
PIIOBuffer_getBytesSent().
\*____________________________________________________________________________*/
PUBLIC_PIAPI void PIIOBuffer_resetBytesSent( PIIOBuffer *pIOBuf );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_getUserData
Synopsis:
void *PIIOBuffer_getUserData( PIIOBuffer *pIOBuf )
Description:
Used to retrieve additional user data assigned to pIOBuf.
Notes:
Return Values:
Pointer to the additional user data or NULL.
Errors:
This function does not raise an error.
See Also:
PIIOBuffer_setUserData
\*____________________________________________________________________________*/
PUBLIC_PIAPI void *PIIOBuffer_getUserData( PIIOBuffer *pIOBuf );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_setUserData
Synopsis:
void PIIOBuffer_setUserData( PIIOBuffer *pIOBuf, void *pUserData )
Description:
Used to assign additional user data to pIOBuf.
Notes:
Return Values:
Errors:
This function does not raise an error.
See Also:
PIIOBuffer_getUserData
\*____________________________________________________________________________*/
PUBLIC_PIAPI void PIIOBuffer_setUserData( PIIOBuffer *pIOBuf, void *pUserData );
/*____________________________________________________________________________*\
*
Name:
PIIOBuffer_getBufferLen
Synopsis:
int PIIOBuffer_getBufferLen( PIIOBuffer *pIOBuf )
Description:
Returns the length of data in the internal input buffer.
Mainly used to determine buggy browser Content-Length.
Notes:
Return Values:
The length of data in the input buffer or 0 if
there's no more input data.
Errors:
This function does not raise an error.
See Also:
\*____________________________________________________________________________*/
PUBLIC_PIAPI int PIIOBuffer_getBufferLen( PIIOBuffer *pIOBuf );
#endif /* PIIOBUF_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -