
Public Types | |
| enum | { IO_SEEK_SET = 0, IO_SEEK_CUR, IO_SEEK_END, NUM_IO_SEEKS } |
| Values to pass in to DataIO::Seek()'s second parameter. More... | |
Public Member Functions | |
| SSLSocketDataIO (const SocketRef &sockfd, bool blocking, bool accept=false) | |
| Constructor. | |
| status_t | SetCertificate (const char *certFilePath) |
| Adds a certification to use for this session. | |
| status_t | SetKey (const char *privateKeyFilePath) |
| Adds a private key to use for this session. | |
| virtual int32 | Read (void *buffer, uint32 size) |
| Tries to place (size) bytes of new data into (buffer). | |
| virtual int32 | Write (const void *buffer, uint32 size) |
| Takes (size) bytes from (buffer) and pushes them in to the outgoing I/O stream. | |
| virtual void | Shutdown () |
| Closes our socket connection. | |
| virtual status_t | Seek (int64, int) |
| This method implementation always returns B_ERROR, because you can't seek on a socket! | |
| virtual int64 | GetPosition () const |
| Always returns -1, since a socket has no position to speak of. | |
| virtual uint64 | GetOutputStallLimit () const |
| Stall limit for TCP streams is 3*60*1000000 microseconds (3 minutes) by default. | |
| void | SetOutputStallLimit (uint64 limit) |
| Set a new output stall time limit. | |
| virtual void | FlushOutput () |
| Flushes the output buffer by turning off Nagle's Algorithm and then turning it back on again. | |
| virtual const SocketRef & | GetSelectSocket () const |
| Returns our socket descriptor. | |
| status_t | SetBlockingIOEnabled (bool blocking) |
| Enables or diables blocking I/O on this socket. | |
| status_t | SetNaglesAlgorithmEnabled (bool enabled) |
| Turns Nagle's algorithm (output packet buffering/coalescing) on or off. | |
| bool | IsBlockingIOEnabled () const |
| Returns true iff our socket is set to use blocking I/O (as specified in the constructor or in our SetBlockingIOEnabled() method). | |
| bool | IsNaglesAlgorithmEnabled () const |
| Returns true iff our socket has Nagle's algorithm enabled (as specified in our SetNaglesAlgorithmEnabled() method. | |
| virtual status_t | GetReadByteTimeStamp (int32 whichByte, uint64 &retStamp) const |
| Optional interface for returning information on when a given byte returned by the previous Read() call was received. | |
| virtual bool | HasBufferedOutput () const |
| Optional: If your DataIO subclass is holding buffered data that it wants to output as soon as possible but hasn't been able to yet, then override this method to return true, and that will cause FlushBufferedOutput() to be called ASAP. | |
| virtual void | WriteBufferedOutput () |
| Optional: If this DataIO is holding any buffered output data, this method should be implemented to Write() as much of that data as possible. | |
| uint32 | WriteFully (const void *buffer, uint32 size) |
| Convenience method: Calls Write() in a loop until the entire buffer is written, or until an error occurs. | |
| uint32 | ReadFully (void *buffer, uint32 size) |
| Convenience method: Calls Read() in a loop until the entire buffer is written, or until an error occurs. | |
| virtual int64 | GetLength () |
| Convenience method: Determines the length of this DataIO stream by Seek()'ing to the end of the stream, recording the current seek position, and then Seek()'ing back to the previous position in the stream. | |
| void | IncrementRefCount () const |
| Increments the counter and returns true iff the new value is zero. | |
| bool | DecrementRefCount () const |
| Decrements the counter and returns true iff the new value is zero. | |
| void | SetManager (AbstractObjectManager *manager) |
| Sets the recycle-pointer for this object. | |
| AbstractObjectManager * | GetManager () const |
| Returns this object's current recyler pointer. | |
| uint32 | GetRefCount () const |
| Returns this object's current reference count. | |
Definition at line 9 of file SSLSocketDataIO.h.
anonymous enum [inherited] |
Values to pass in to DataIO::Seek()'s second parameter.
| SSLSocketDataIO::SSLSocketDataIO | ( | const SocketRef & | sockfd, | |
| bool | blocking, | |||
| bool | accept = false | |||
| ) |
Constructor.
| sockfd | The socket to use. | |
| blocking | If true, the socket will be set to blocking mode; otherwise non-blocking | |
| accept | If true, accept a connection at start. Defaults to false. |
| status_t SSLSocketDataIO::SetCertificate | ( | const char * | certFilePath | ) |
Adds a certification to use for this session.
| certFilePath | File path of the certificate file to use. |
| status_t SSLSocketDataIO::SetKey | ( | const char * | privateKeyFilePath | ) |
Adds a private key to use for this session.
| privateKeyFilePath | File path of the private key file to use. |
| virtual int32 SSLSocketDataIO::Read | ( | void * | buffer, | |
| uint32 | size | |||
| ) | [virtual] |
Tries to place (size) bytes of new data into (buffer).
Returns the actual number of bytes placed, or a negative value if there was an error.
| buffer | Buffer to write the bytes into | |
| size | Number of bytes in the buffer. |
Reimplemented from TCPSocketDataIO.
| virtual int32 SSLSocketDataIO::Write | ( | const void * | buffer, | |
| uint32 | size | |||
| ) | [virtual] |
Takes (size) bytes from (buffer) and pushes them in to the outgoing I/O stream.
Returns the actual number of bytes read from (buffer) and pushed, or a negative value if there was an error.
| buffer | Buffer to read the bytes from. | |
| size | Number of bytes in the buffer. |
Reimplemented from TCPSocketDataIO.
| virtual uint64 TCPSocketDataIO::GetOutputStallLimit | ( | ) | const [inline, virtual, inherited] |
Stall limit for TCP streams is 3*60*1000000 microseconds (3 minutes) by default.
Or change it by calling SetOutputStallLimit().
Reimplemented from DataIO.
Definition at line 58 of file TCPSocketDataIO.h.
| void TCPSocketDataIO::SetOutputStallLimit | ( | uint64 | limit | ) | [inline, inherited] |
Set a new output stall time limit.
Set to MUSCLE_TIME_NEVER to disable stall limiting.
Definition at line 61 of file TCPSocketDataIO.h.
| virtual void TCPSocketDataIO::FlushOutput | ( | ) | [inline, virtual, inherited] |
Flushes the output buffer by turning off Nagle's Algorithm and then turning it back on again.
If Nagle's Algorithm is disabled, then this call is a no-op (since there is never anything to flush)
Implements DataIO.
Definition at line 67 of file TCPSocketDataIO.h.
| status_t TCPSocketDataIO::SetBlockingIOEnabled | ( | bool | blocking | ) | [inline, inherited] |
Enables or diables blocking I/O on this socket.
If this object is to be used by an AbstractMessageIOGateway, then non-blocking I/O is usually better to use.
| blocking | If true, socket is set to blocking I/O mode. Otherwise, non-blocking I/O. |
Definition at line 94 of file TCPSocketDataIO.h.
Referenced by TCPSocketDataIO::TCPSocketDataIO().
| status_t TCPSocketDataIO::SetNaglesAlgorithmEnabled | ( | bool | enabled | ) | [inline, inherited] |
Turns Nagle's algorithm (output packet buffering/coalescing) on or off.
| enabled | If true, data will be held momentarily before sending, to allow for bigger packets. If false, each Write() call will cause a new packet to be sent immediately. |
Definition at line 107 of file TCPSocketDataIO.h.
| bool TCPSocketDataIO::IsNaglesAlgorithmEnabled | ( | ) | const [inline, inherited] |
Returns true iff our socket has Nagle's algorithm enabled (as specified in our SetNaglesAlgorithmEnabled() method.
Default state is true.
Definition at line 122 of file TCPSocketDataIO.h.
| virtual status_t DataIO::GetReadByteTimeStamp | ( | int32 | whichByte, | |
| uint64 & | retStamp | |||
| ) | const [inline, virtual, inherited] |
Optional interface for returning information on when a given byte returned by the previous Read() call was received.
Not implemented by default, and not implemented by any of the standard MUSCLE DataIO subclasses. (Used by an LCS dataIO class that needs precision timing)
| whichByte | Index of the byte in the previously returned read-buffer that you are interested in. | |
| retStamp | On success, this value is set to the timestamp of the byte. |
Reimplemented in FailoverDataIO, MultiDataIO, and XorDataIO.
Definition at line 114 of file DataIO.h.
Referenced by MultiDataIO::GetReadByteTimeStamp(), and FailoverDataIO::GetReadByteTimeStamp().
| virtual bool DataIO::HasBufferedOutput | ( | ) | const [inline, virtual, inherited] |
Optional: If your DataIO subclass is holding buffered data that it wants to output as soon as possible but hasn't been able to yet, then override this method to return true, and that will cause FlushBufferedOutput() to be called ASAP.
Default implementation always returns false.
Reimplemented in FailoverDataIO, MultiDataIO, PacketizedDataIO, and XorDataIO.
Definition at line 123 of file DataIO.h.
Referenced by FailoverDataIO::HasBufferedOutput().
| virtual void DataIO::WriteBufferedOutput | ( | ) | [inline, virtual, inherited] |
Optional: If this DataIO is holding any buffered output data, this method should be implemented to Write() as much of that data as possible.
Default implementation is a no-op.
Reimplemented in FailoverDataIO, MultiDataIO, PacketizedDataIO, and XorDataIO.
Definition at line 130 of file DataIO.h.
Referenced by FailoverDataIO::WriteBufferedOutput().
| uint32 DataIO::WriteFully | ( | const void * | buffer, | |
| uint32 | size | |||
| ) | [inherited] |
Convenience method: Calls Write() in a loop until the entire buffer is written, or until an error occurs.
This method should only be used in conjunction with blocking I/O; it will not work reliably with non-blocking I/O.
| buffer | Pointer to the first byte of the buffer to write data from. | |
| size | Number of bytes to write |
| uint32 DataIO::ReadFully | ( | void * | buffer, | |
| uint32 | size | |||
| ) | [inherited] |
Convenience method: Calls Read() in a loop until the entire buffer is written, or until an error occurs.
This method should only be used in conjunction with blocking I/O; it will not work reliably with non-blocking I/O.
| buffer | Pointer to the first byte of the buffer to place the read data into. | |
| size | Number of bytes to read |
| virtual int64 DataIO::GetLength | ( | ) | [virtual, inherited] |
Convenience method: Determines the length of this DataIO stream by Seek()'ing to the end of the stream, recording the current seek position, and then Seek()'ing back to the previous position in the stream.
Of course this only works with DataIOs that support seeking and have a fixed length.
Reimplemented in PacketizedDataIO.
| void RefCountable::IncrementRefCount | ( | ) | const [inline, inherited] |
Increments the counter and returns true iff the new value is zero.
Thread safe.
Definition at line 32 of file RefCount.h.
References AtomicCounter::AtomicIncrement().
| bool RefCountable::DecrementRefCount | ( | ) | const [inline, inherited] |
Decrements the counter and returns true iff the new value is zero.
Thread safe.
Definition at line 35 of file RefCount.h.
References AtomicCounter::AtomicDecrement().
| void RefCountable::SetManager | ( | AbstractObjectManager * | manager | ) | [inline, inherited] |
Sets the recycle-pointer for this object.
If set to non-NULL, this pointer is used by the ObjectPool class to recycle this object when it is no longer in use, so as to avoid the overhead of having to delete it and re-create it later on. The RefCountable class itself does nothing with this pointer. Default value is NULL.
| manager | Pointer to the new manager object to use, or NULL to use no manager. |
Definition at line 44 of file RefCount.h.
| uint32 RefCountable::GetRefCount | ( | ) | const [inline, inherited] |
Returns this object's current reference count.
Note that the value returned by this method is volatile in multithreaded environments, so it may already be wrong by the time it is returned. Be careful!
Definition at line 54 of file RefCount.h.
References AtomicCounter::GetCount().
1.5.1