34 #ifndef PTLIB_CHANNEL_H
35 #define PTLIB_CHANNEL_H
63 virtual int_type
overflow(int_type = EOF);
66 virtual pos_type
seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
67 virtual pos_type
seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
742 #include "msos/ptlib/channel.h"
744 #include "unix/ptlib/channel.h"
750 #endif // PTLIB_CHANNEL_H
Operation fail due to insufficient privilege.
Definition: channel.h:538
PString ReadString(PINDEX len)
Read len character into a string from the channel.
PINDEX lastWriteCount
Number of byte last written by the Write() function.
Definition: channel.h:723
virtual PBoolean Shutdown(ShutdownValue option)
Close one or both of the data streams associated with a channel.
void AbortCommandString()
Abort a command string that is in progress.
virtual PBoolean Write(const void *buf, PINDEX len)
Low level write to the channel.
PTimeInterval readTimeout
Timeout for read operations.
Definition: channel.h:725
Definition: channel.h:569
int GetHandle() const
Get the integer operating system handle for the channel.
Open fail due to file already existing.
Definition: channel.h:534
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:55
Definition: channel.h:530
Array of characters.
Definition: array.h:551
Operation failed due to a timeout.
Definition: channel.h:548
virtual void OnWriteComplete(const void *buf, PINDEX len)
User callback function for when a WriteAsync() call has completed or timed out.
Error during other operation, eg Open()
Definition: channel.h:568
virtual PChannel * GetBaseWriteChannel() const
Get the base channel of channel indirection using PIndirectChannel.
virtual PBoolean Read(void *buf, PINDEX len)
Low level read from the channel.
virtual PBoolean Close()
Close the channel, shutting down the link to the data source.
PTimeInterval writeTimeout
Timeout for write operations.
Definition: channel.h:727
PChannel & operator=(const PChannel &)
Definition: channel.h:435
Operation fail due to bad parameters.
Definition: channel.h:542
PTimeInterval GetWriteTimeout() const
Get the timeout for write operations to complete.
virtual PINDEX HashFunction() const
Calculate a hash value for use in sets and dictionaries.
PBoolean WriteString(const PString &str)
Write a string to the channel.
void * iov_base
Definition: channel.h:630
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
size_t iov_len
Definition: channel.h:631
Definition: channel.h:434
PChannel()
Create the channel.
virtual PINDEX GetLastWriteCount() const
Get the number of bytes written by the last Write() call.
Open fail due to device or file not found.
Definition: channel.h:532
PBoolean SetBufferSize(PINDEX newSize)
PBoolean ReceiveCommandString(int nextChar, const PString &reply, PINDEX &pos, PINDEX start)
ShutdownValue
Definition: channel.h:433
virtual Comparison Compare(const PObject &obj) const
Get the relative rank of the two strings.
Definition: channel.h:557
PBoolean ReadBlock(void *buf, PINDEX len)
Read len bytes into the buffer from the channel.
Errors
Normalised error codes.
Definition: channel.h:529
int lastErrorNumber[NumErrorGroups+1]
The operating system error number (eg as returned by errno).
Definition: channel.h:719
static PBoolean ConvertOSError(int libcReturnValue, Errors &lastError, int &osError)
Convert an operating system error into platform independent error.
virtual PString GetName() const
Get the platform and I/O channel type name of the channel.
PINDEX lastReadCount
Number of byte last read by the Read() function.
Definition: channel.h:721
std::vector< Slice > VectorOfSlice
Definition: channel.h:635
BOOL PBoolean
Definition: object.h:102
Errors lastErrorCode[NumErrorGroups+1]
The platform independant error code.
Definition: channel.h:717
High level protocol failure.
Definition: channel.h:556
void SetReadTimeout(const PTimeInterval &time)
Set the timeout for read operations.
~PChannel()
Close down the channel.
Error during Read() operation.
Definition: channel.h:566
Definition: channel.h:436
PBoolean SetErrorValues(Errors errorCode, int osError, ErrorGroup group=LastGeneralError)
Set error values to those specified.
void SetWriteTimeout(const PTimeInterval &time)
Set the timeout for write operations to complete.
virtual bool FlowControl(const void *flowData)
Flow Control information Pass data to the channel for flowControl determination.
Abstract class defining I/O channel semantics.
Definition: channel.h:107
PBoolean SendCommandString(const PString &command)
Send a command meta-string.
Errors GetErrorCode(ErrorGroup group=NumErrorGroups) const
Get normalised error code.
virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode=ios_base::in|ios_base::out)
virtual pos_type seekpos(pos_type, ios_base::openmode=ios_base::in|ios_base::out)
int ReadCharWithTimeout(PTimeInterval &timeout)
Read a character with specified timeout.
Operations buffer was too small for data.
Definition: channel.h:552
The character string class.
Definition: pstring.h:108
virtual int_type underflow()
virtual int_type overflow(int_type=EOF)
virtual PINDEX GetLastReadCount() const
Get the number of bytes read by the last Read() call.
PChannelStreamBuffer & operator=(const PChannelStreamBuffer &sbuf)
ErrorGroup
Error groups.
Definition: channel.h:565
Operation fail due to channel not being open yet.
Definition: channel.h:546
Miscellaneous error.
Definition: channel.h:554
Operation fail due to insufficient memory.
Definition: channel.h:544
Error during Write() operation.
Definition: channel.h:567
virtual PBoolean IsOpen() const
Determine if the channel is currently open.
Open fail due to device already open for exclusive use.
Definition: channel.h:540
PTimeInterval GetReadTimeout() const
Get the timeout for read operations.
virtual PBoolean WriteAsync(const void *buf, PINDEX len)
Begin an asynchronous write from channel.
Operation was interrupted.
Definition: channel.h:550
virtual PString GetErrorText(ErrorGroup group=NumErrorGroups) const
Get error message description.
virtual int ReadChar()
Read a single 8 bit byte from the channel.
virtual PChannel * GetBaseReadChannel() const
Get the base channel of channel indirection using PIndirectChannel.
PBoolean SetBufferSize(PINDEX newSize)
Set the iostream buffer size for reads and writes.
virtual bool SetLocalEcho(bool localEcho)
Set local echo mode.
int GetErrorNumber(ErrorGroup group=NumErrorGroups) const
Get OS errro code.
Structure that defines a "slice" of memory to be written to.
Definition: channel.h:629
Write fail due to disk full.
Definition: channel.h:536
virtual void OnReadComplete(void *buf, PINDEX len)
User callback function for when a ReadAsync() call has completed or timed out.
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PChannelStreamBuffer(PChannel *chan)
int os_handle
The operating system file handle return by standard open() function.
Definition: channel.h:715
PBoolean WriteChar(int c)
Write a single character to the channel.
virtual PBoolean ReadAsync(void *buf, PINDEX len)
Begin an asynchronous read from channel.