LibreOffice
LibreOffice 6.0 SDK C/C++ API Reference
|
Go to the documentation of this file.
20 #ifndef INCLUDED_OSL_SOCKET_DECL_HXX
21 #define INCLUDED_OSL_SOCKET_DECL_HXX
53 #if defined LIBO_INTERNAL_ONLY
77 inline SocketAddr(const ::rtl::OUString& strAddrOrHostName, sal_Int32 nPort);
88 inline bool is()
const;
109 inline bool SAL_CALL
setHostname(const ::rtl::OUString &sDottedIpOrHostname);
115 inline sal_Int32 SAL_CALL
getPort()
const;
124 inline bool SAL_CALL
setPort(sal_Int32 nPort);
131 inline bool SAL_CALL
setAddr(const ::rtl::ByteSequence & address);
143 #if defined LIBO_INTERNAL_ONLY
177 const ::rtl::OUString & strHostName ,
SocketAddr & Addr );
186 const ::rtl::OUString& strServiceName,
187 const ::rtl::OUString & strProtocolName= ::
rtl::OUString(
"tcp") );
256 inline void SAL_CALL
close();
287 inline ::rtl::OUString SAL_CALL
getPeerHost()
const;
430 sal_uInt32 BufferLen,
476 sal_uInt32 BufferLen,
556 inline sal_Int32 SAL_CALL
read(
void* pBuffer, sal_uInt32 n);
565 inline sal_Int32 SAL_CALL
write(
const void* pBuffer, sal_uInt32 n);
584 inline sal_Int32 SAL_CALL
recv(
void* pBuffer,
585 sal_uInt32 BytesToRead,
604 sal_Int32 SAL_CALL
send(
const void* pBuffer,
605 sal_uInt32 BytesToSend,
653 inline bool SAL_CALL
listen(sal_Int32 MaxPendingConnections= -1);
711 inline sal_Int32 SAL_CALL
recvFrom(
void* pBuffer,
712 sal_uInt32 BufferSize,
740 sal_uInt32 BufferSize,
@ osl_Socket_DirReadWrite
Definition: socket.h:147
sal_Int32 getOption(oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const
Retrieves option-attributes associated with the socket.
Definition: socket.hxx:347
void getLocalAddr(SocketAddr &Addr) const
Retrieves the address of the local interface of this socket.
Definition: socket.hxx:273
sal_Int32 read(void *pBuffer, sal_uInt32 n)
Retrieves n bytes from the stream and copies them into pBuffer.
Definition: socket.hxx:441
sal_Int32 getPort() const
Returns the port number of the address.
Definition: socket.hxx:93
oslSocketAddr m_handle
Definition: socket_decl.hxx:42
oslSocketType
Represents the type of a socket.
Definition: socket.h:67
sal_Int32 sendTo(const SocketAddr &ReceiverAddr, const void *pBuffer, sal_uInt32 BufferSize, oslSocketMsgFlag Flag=osl_Socket_MsgNormal)
Tries to send one datagram with BytesToSend size to the given ReceiverAddr.
Definition: socket.hxx:560
oslSocket getHandle() const
Returns the underlying handle unacquired (The caller must acquire it to keep it).
Definition: socket.hxx:413
bool listen(sal_Int32 MaxPendingConnections=-1)
Prepare a socket for the accept-call.
Definition: socket.hxx:490
oslAddrFamily
Represents the address-family of a socket.
Definition: socket.h:45
@ osl_Socket_LevelSocket
Definition: socket.h:122
sal_Int32 send(const void *pBuffer, sal_uInt32 BytesToSend, oslSocketMsgFlag=osl_Socket_MsgNormal)
Tries to send BytesToSend data to the connected socket.
Definition: socket.hxx:461
sal_Int32 getPeerPort() const
Get the remote port of the socket.
Definition: socket.hxx:301
oslSocketMsgFlag
Represents flags to be used with send/recv-calls.
Definition: socket.h:131
ConnectorSocket(oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp, oslSocketType Type=osl_Socket_TypeStream)
Creates a socket that can connect to a (remote) host.
Definition: socket.hxx:469
bool enableNonBlockingMode(bool bNonBlockingMode)
Enables/disables non-blocking mode of the socket.
Definition: socket.hxx:380
@ osl_Socket_TypeStream
Definition: socket.h:68
Definition: socket_decl.hxx:191
bool isRecvReady(const TimeValue *pTimeout=NULL) const
Checks if read operations will block.
Definition: socket.hxx:323
oslSocketDirection
Used by shutdown to denote which end of the socket to "close".
Definition: socket.h:144
~Socket()
Destructor.
Definition: socket.hxx:228
oslProtocol
represent a specific protocol within a address-family
Definition: socket.h:55
void clearError() const
clears the error status
Definition: socket.hxx:392
A connectionless socket to send and receive datagrams.
Definition: socket_decl.hxx:679
@ osl_Socket_ProtocolIp
Definition: socket.h:56
oslSocketOptionLevel
Represents the different socket-option levels.
Definition: socket.h:121
oslSocketAddr getHandle() const
Returns the underlying SocketAddr handle without copyconstructing it.
Definition: socket.hxx:168
Definition: socket_decl.hxx:609
The class should be understood as a reference to a socket address handle (struct sockaddr).
Definition: socket_decl.hxx:39
inline ::rtl::ByteSequence getAddr(oslSocketResult *pResult=NULL) const
Returns the address of the underlying socket in network byte order.
Definition: socket.hxx:117
This String class provides base functionality for C++ like Unicode character array handling.
Definition: ustring.hxx:121
Socket & operator=(oslSocket socketHandle)
Assignment operator.
Definition: socket.hxx:234
oslSocketResult
Common return codes of socket related functions.
Definition: socket.h:193
void getPeerAddr(SocketAddr &Addr) const
Retrieves the address of the remote host of this socket.
Definition: socket.hxx:295
void shutdown(oslSocketDirection Direction=osl_Socket_DirReadWrite)
Closes a definite or both directions of the bidirectional stream.
Definition: socket.hxx:261
bool bind(const SocketAddr &LocalInterface)
Binds the socket to the specified (local) interface.
Definition: socket.hxx:317
oslSocketResult connect(const SocketAddr &TargetHost, const TimeValue *pTimeout=NULL)
Connects the socket to a (remote) host.
Definition: socket.hxx:476
Definition: conditn.hxx:36
struct oslSocketImpl * oslSocket
Definition: socket.h:212
oslSocketError
Describes the various error socket error conditions, which may occur.
Definition: socket.h:154
bool setOption(oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen, oslSocketOptionLevel Level=osl_Socket_LevelSocket) const
Sets the sockets attributes.
Definition: socket.hxx:357
Definition: socket_decl.hxx:526
bool isSendReady(const TimeValue *pTimeout=NULL) const
Checks if send operations will block.
Definition: socket.hxx:329
inline ::rtl::OUString getLocalHost() const
Get the hostname for the local interface.
Definition: socket.hxx:287
DatagramSocket(oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp, oslSocketType Type=osl_Socket_TypeDgram)
Creates a datagram socket.
Definition: socket.hxx:533
oslSocketType getType() const
Queries the socket for its type.
Definition: socket.hxx:341
bool is() const
Checks if the SocketAddr was created successful.
Definition: socket.hxx:174
bool isExceptionPending(const TimeValue *pTimeout=NULL) const
Checks if a request for out-of-band data will block.
Definition: socket.hxx:335
sal_Int32 recvFrom(void *pBuffer, sal_uInt32 BufferSize, SocketAddr *pSenderAddr=NULL, oslSocketMsgFlag Flag=osl_Socket_MsgNormal)
Tries to receives BufferSize data from the socket, if no error occurs.
Definition: socket.hxx:540
sal_Int32 recv(void *pBuffer, sal_uInt32 BytesToRead, oslSocketMsgFlag flags=osl_Socket_MsgNormal)
Tries to receive BytesToRead data from the connected socket,.
Definition: socket.hxx:453
SocketAddr & assign(oslSocketAddr Addr, __osl_socket_NoCopy nocopy)
Assigns the socket addr without copyconstructing it.
Definition: socket.hxx:154
static inline ::rtl::OUString getLocalHostname(oslSocketResult *pResult=NULL)
Get the hostname for the local interface.
Definition: socket.hxx:179
__sal_NoAcquire
Definition: types.h:376
oslSocket m_handle
Definition: socket_decl.hxx:194
AcceptorSocket(oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp, oslSocketType Type=osl_Socket_TypeStream)
Definition: socket.hxx:483
bool setAddr(const ::rtl::ByteSequence &address)
Sets the address of the underlying socket address struct in network byte order.
Definition: socket.hxx:111
bool setPort(sal_Int32 nPort)
Sets the port number of the address.
Definition: socket.hxx:99
@ SAL_NO_COPY
Definition: socket_decl.hxx:33
@ osl_Socket_MsgNormal
Definition: socket.h:132
~SocketAddr()
destroys underlying oslSocketAddress
Definition: socket.hxx:76
oslSocketOption
Represents socket-options.
Definition: socket.h:85
SocketAddr()
Creates socket address of unknown type.
Definition: socket.hxx:27
inline ::rtl::OUString getPeerHost() const
Get the hostname for the remote interface.
Definition: socket.hxx:309
sal_Int32 write(const void *pBuffer, sal_uInt32 n)
Writes n bytes from pBuffer to the stream.
Definition: socket.hxx:447
@ osl_Socket_FamilyInet
Definition: socket.h:46
struct oslSocketAddrImpl * oslSocketAddr
Opaque datatype SocketAddr.
Definition: socket.h:40
bool setHostname(const ::rtl::OUString &sDottedIpOrHostname)
Sets the IP address or hostname of the SocketAddress.
Definition: socket.hxx:104
oslSocketResult acceptConnection(StreamSocket &Connection)
Accepts incoming connections on the socket.
Definition: socket.hxx:496
static sal_Int32 getServicePort(const ::rtl::OUString &strServiceName, const ::rtl::OUString &strProtocolName=::rtl::OUString("tcp"))
Tries to find the port associated with the given service/protocol- pair (e.g.
Definition: socket.hxx:194
bool operator==(const Socket &rSocket) const
Definition: socket.hxx:249
inline ::rtl::OUString getErrorAsString() const
Builds a string with the last error-message for the socket.
Definition: socket.hxx:405
bool isNonBlockingMode() const
Query blocking mode of the socket.
Definition: socket.hxx:386
void close()
Closes a socket.
Definition: socket.hxx:267
@ osl_Socket_TypeDgram
Definition: socket.h:69
Allows to accept socket connections.
Definition: socket_decl.hxx:639
static void resolveHostname(const ::rtl::OUString &strHostName, SocketAddr &Addr)
Tries to find an address for a host.
Definition: socket.hxx:188
StreamSocket(oslAddrFamily Family=osl_Socket_FamilyInet, oslProtocol Protocol=osl_Socket_ProtocolIp, oslSocketType Type=osl_Socket_TypeStream)
Creates a socket.
Definition: socket.hxx:419
sal_Int32 getLocalPort() const
Get the local port of the socket.
Definition: socket.hxx:279
__osl_socket_NoCopy
Definition: socket_decl.hxx:33
SocketAddr & operator=(oslSocketAddr Addr)
assign the handle to this reference.
Definition: socket.hxx:127
inline ::rtl::OUString getHostname(oslSocketResult *pResult=NULL) const
Converts the address to a (human readable) domain-name.
Definition: socket.hxx:83
bool operator==(oslSocketAddr Addr) const
Returns true if the underlying handle is identical to the Addr handle.
Definition: socket.hxx:163
oslSocketError getError() const
returns a constant describing the last error for the socket system.
Definition: socket.hxx:399