LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
|
The class should be understood as a reference to a socket address handle (struct sockaddr). More...
#include <socket_decl.hxx>
Public Member Functions | |
SocketAddr () | |
Creates socket address of unknown type. More... | |
SocketAddr (const SocketAddr &Addr) | |
Copy constructor. More... | |
SocketAddr (const oslSocketAddr Addr, __osl_socket_NoCopy nocopy) | |
The SocketAddr takes over the responsibility of the handle (which means that the handle gets destructed by the destructor of this reference) More... | |
SocketAddr (oslSocketAddr Addr) | |
Copyconstructs the oslSocketAddr handle. More... | |
SocketAddr (const ::rtl::OUString &strAddrOrHostName, sal_Int32 nPort) | |
TCP/IP-specific constructor. More... | |
~SocketAddr () | |
destroys underlying oslSocketAddress More... | |
bool | is () const |
Checks if the SocketAddr was created successful. More... | |
inline ::rtl::OUString | getHostname (oslSocketResult *pResult=NULL) const |
Converts the address to a (human readable) domain-name. More... | |
bool | setHostname (const ::rtl::OUString &sDottedIpOrHostname) |
Sets the IP address or hostname of the SocketAddress. More... | |
sal_Int32 | getPort () const |
Returns the port number of the address. More... | |
bool | setPort (sal_Int32 nPort) |
Sets the port number of the address. More... | |
bool | setAddr (const ::rtl::ByteSequence &address) |
Sets the address of the underlying socket address struct in network byte order. More... | |
inline ::rtl::ByteSequence | getAddr (oslSocketResult *pResult=NULL) const |
Returns the address of the underlying socket in network byte order. More... | |
SocketAddr & | operator= (oslSocketAddr Addr) |
assign the handle to this reference. More... | |
SocketAddr & | operator= (const SocketAddr &Addr) |
SocketAddr & | assign (oslSocketAddr Addr, __osl_socket_NoCopy nocopy) |
Assigns the socket addr without copyconstructing it. More... | |
bool | operator== (oslSocketAddr Addr) const |
Returns true if the underlying handle is identical to the Addr handle. More... | |
bool | operator== (const SocketAddr &Addr) const |
Returns true if the underlying handle is identical to the Addr handle. More... | |
oslSocketAddr | getHandle () const |
Returns the underlying SocketAddr handle without copyconstructing it. More... | |
Static Public Member Functions | |
static inline ::rtl::OUString | getLocalHostname (oslSocketResult *pResult=NULL) |
Get the hostname for the local interface. More... | |
static void | resolveHostname (const ::rtl::OUString &strHostName, SocketAddr &Addr) |
Tries to find an address for a host. More... | |
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. More... | |
Protected Attributes | |
oslSocketAddr | m_handle |
The class should be understood as a reference to a socket address handle (struct sockaddr).
The handle is mutable.
|
inline |
Creates socket address of unknown type.
|
inline |
Copy constructor.
|
inline |
The SocketAddr takes over the responsibility of the handle (which means that the handle gets destructed by the destructor of this reference)
Addr | a handle |
nocopy | use SAL_NO_COPY |
|
inline |
Copyconstructs the oslSocketAddr handle.
Addr | a handle |
|
inline |
TCP/IP-specific constructor.
strAddrOrHostName | strAddrOrHostName hostname or dotted ip-number of the network interface, the socket shall be created on. |
nPort | tcp-ip port number |
|
inline |
destroys underlying oslSocketAddress
|
inline |
Assigns the socket addr without copyconstructing it.
Addr | the socket address. |
nocopy | use SAL_NO_COPY |
|
inline |
Returns the address of the underlying socket in network byte order.
|
inline |
Returns the underlying SocketAddr handle without copyconstructing it.
|
inline |
Converts the address to a (human readable) domain-name.
[out] | pResult | value of 0 if you are not interested in errors, otherwise *pResult contains an error code on failure or osl_Socket_Ok on success |
|
inlinestatic |
Get the hostname for the local interface.
pResult | after the call *pResult contains osl_Socket_Ok on success or an error on failure. |
|
inline |
Returns the port number of the address.
|
inlinestatic |
Tries to find the port associated with the given service/protocol- pair (e.g.
"ftp"/"tcp").
OSL_INVALID_PORT
if no service/protocol pair could be found.
|
inline |
Checks if the SocketAddr was created successful.
true | if there is a valid underlying handle |
false | no valid underlying handle |
|
inline |
assign the handle to this reference.
The previous handle is released.
|
inline |
|
inline |
Returns true if the underlying handle is identical to the Addr handle.
|
inline |
Returns true if the underlying handle is identical to the Addr handle.
|
inlinestatic |
Tries to find an address for a host.
strHostName | hostname |
Addr | A newly created socket-address or 0 if the name could not be found. |
|
inline |
Sets the address of the underlying socket address struct in network byte order.
true | success |
false | failure |
|
inline |
Sets the IP address or hostname of the SocketAddress.
[in] | sDottedIpOrHostname | IP address or hostname |
true | success |
false | failure |
|
inline |
Sets the port number of the address.
[in] | nPort | port number |
true | success |
false | failure |
|
protected |