LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
|
#include <socket_decl.hxx>
Public Member Functions | |
Socket () | |
Socket (const Socket &socket) | |
Socket (oslSocket socketHandle) | |
Socket (oslSocket socketHandle, __sal_NoAcquire noacquire) | |
The instance takes over the handle's ownership without acquiring the handle, but releases it within the dtor. More... | |
~Socket () | |
Destructor. More... | |
Socket & | operator= (oslSocket socketHandle) |
Assignment operator. More... | |
Socket & | operator= (const Socket &sock) |
Assignment operator. More... | |
bool | operator== (const Socket &rSocket) const |
bool | operator== (const oslSocket socketHandle) const |
void | shutdown (oslSocketDirection Direction=osl_Socket_DirReadWrite) |
Closes a definite or both directions of the bidirectional stream. More... | |
void | close () |
Closes a socket. More... | |
void | getLocalAddr (SocketAddr &Addr) const |
Retrieves the address of the local interface of this socket. More... | |
sal_Int32 | getLocalPort () const |
Get the local port of the socket. More... | |
inline ::rtl::OUString | getLocalHost () const |
Get the hostname for the local interface. More... | |
void | getPeerAddr (SocketAddr &Addr) const |
Retrieves the address of the remote host of this socket. More... | |
sal_Int32 | getPeerPort () const |
Get the remote port of the socket. More... | |
inline ::rtl::OUString | getPeerHost () const |
Get the hostname for the remote interface. More... | |
bool | bind (const SocketAddr &LocalInterface) |
Binds the socket to the specified (local) interface. More... | |
bool | isRecvReady (const TimeValue *pTimeout=NULL) const |
Checks if read operations will block. More... | |
bool | isSendReady (const TimeValue *pTimeout=NULL) const |
Checks if send operations will block. More... | |
bool | isExceptionPending (const TimeValue *pTimeout=NULL) const |
Checks if a request for out-of-band data will block. More... | |
oslSocketType | getType () const |
Queries the socket for its type. More... | |
sal_Int32 | getOption (oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const |
Retrieves option-attributes associated with the socket. More... | |
bool | setOption (oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const |
Sets the sockets attributes. More... | |
bool | setOption (oslSocketOption option, sal_Int32 nValue) |
Convenience function for setting sal_Bool and sal_Int32 option values. More... | |
sal_Int32 | getOption (oslSocketOption option) const |
Convenience function for retrieving sal_Bool and sal_Int32 option values. More... | |
bool | enableNonBlockingMode (bool bNonBlockingMode) |
Enables/disables non-blocking mode of the socket. More... | |
bool | isNonBlockingMode () const |
Query blocking mode of the socket. More... | |
void | clearError () const |
clears the error status More... | |
oslSocketError | getError () const |
returns a constant describing the last error for the socket system. More... | |
inline ::rtl::OUString | getErrorAsString () const |
Builds a string with the last error-message for the socket. More... | |
oslSocket | getHandle () const |
Returns the underlying handle unacquired (The caller must acquire it to keep it). More... | |
Protected Member Functions | |
Socket (oslSocketType Type, oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp) | |
Creates a socket. More... | |
Protected Attributes | |
oslSocket | m_handle |
|
inlineprotected |
Creates a socket.
Note it's protected.
Type | |
Family | |
Protocol |
|
inline |
|
inline |
|
inline |
|
inline |
The instance takes over the handle's ownership without acquiring the handle, but releases it within the dtor.
socketHandle | the handle |
noacquire | use SAL_NO_ACQUIRE |
|
inline |
Destructor.
Releases the underlying handle
|
inline |
Binds the socket to the specified (local) interface.
LocalInterface | Address of the Interface |
|
inline |
clears the error status
|
inline |
Closes a socket.
Note that closing a socket is identical to shutdown( osl_Socket_DirReadWrite ), as the operating system distinguish both cases, both functions or offered in this API.
|
inline |
Enables/disables non-blocking mode of the socket.
bNonBlockingMode | If true , blocking mode will be switched off If false , the socket will become a blocking socket (which is the default behaviour of a socket). |
true
if mode could be set.
|
inline |
returns a constant describing the last error for the socket system.
|
inline |
Builds a string with the last error-message for the socket.
|
inline |
Returns the underlying handle unacquired (The caller must acquire it to keep it).
|
inline |
Retrieves the address of the local interface of this socket.
Addr | [out] receives the address. |
|
inline |
Get the hostname for the local interface.
|
inline |
Get the local port of the socket.
Usually used after bind().
|
inline |
Retrieves option-attributes associated with the socket.
Option | The attribute to query. Valid values (depending on the Level) are:
|
If not above mentioned otherwise, the options are only valid for level osl_Socket_LevelSocket
.
pBuffer | The Buffer will be filled with the attribute. |
BufferLen | The size of pBuffer. |
Level | The option level. |
Valid values are:
osl_Socket_LevelSocket
: Socket Level osl_Socket_LevelTcp
: Level of Transmission Control Protocol
|
inline |
Convenience function for retrieving sal_Bool and sal_Int32 option values.
|
inline |
Retrieves the address of the remote host of this socket.
Addr | [out] receives the address. |
|
inline |
Get the hostname for the remote interface.
|
inline |
Get the remote port of the socket.
|
inline |
Queries the socket for its type.
osl_Socket_TypeStream | |
osl_Socket_TypeDgram | |
osl_Socket_TypeRaw | |
osl_Socket_TypeRdm | |
osl_Socket_TypeSeqPacket | |
osl_invalid_SocketType | if an error occurred |
|
inline |
Checks if a request for out-of-band data will block.
You can specify a timeout-value in seconds/nanoseconds that denotes how the operation will block if the Socket has no pending OOB data.
true
if OOB-request operations (recv with appropriate flags) on the Socket will NOT block; false
if it would block or if an error occurred.pTimeout | if 0, the operation will block without a timeout. Otherwise the specified amount of time. |
|
inline |
Query blocking mode of the socket.
true
if non-blocking mode is set.
|
inline |
Checks if read operations will block.
You can specify a timeout-value in seconds/nanoseconds that denotes how the operation will block if the Socket is not ready.
true
if read operations (recv, recvFrom, accept) on the Socket will NOT block; false
if it would block or if an error occurred.pTimeout | if 0, the operation will block without a timeout. Otherwise the specified amount of time. |
|
inline |
Checks if send operations will block.
You can specify a timeout-value in seconds/nanoseconds that denotes how the operation will block if the Socket is not ready.
true
if send operations (send, sendTo) on the Socket will NOT block; false
if it would block or if an error occurred.pTimeout | if 0, the operation will block without a timeout. Otherwise the specified amount of time. |
Assignment operator.
If socket was already created, the old one will be discarded.
Assignment operator.
If socket was already created, the old one will be discarded.
|
inline |
true
, when the underlying handle of both Socket instances are identical, false
otherwise.
|
inline |
true
, when the underlying handle of both Socket instances are identical, false
otherwise.
|
inline |
Sets the sockets attributes.
Option | denotes the option to modify. Valid values (depending on the Level) are:
|
If not above mentioned otherwise, the options are only valid for level osl_Socket_LevelSocket.
pBuffer | Pointer to a Buffer which contains the attribute-value. |
BufferLen | contains the length of the Buffer. |
Level | selects the level for which an option should be changed. Valid values are:
|
|
inline |
Convenience function for setting sal_Bool and sal_Int32 option values.
|
inline |
Closes a definite or both directions of the bidirectional stream.
Direction |
|
protected |