LibreOffice
LibreOffice 25.8 SDK C/C++ API Reference
|
Go to the source code of this file.
Macros | |
#define | OSL_INADDR_NONE 0xffffffff |
#define | OSL_INVALID_PORT (-1) |
enum | oslAddrFamily { osl_Socket_FamilyInet , osl_Socket_FamilyIpx , osl_Socket_FamilyInvalid , osl_Socket_Family_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
Represents the address-family of a socket. More... | |
enum | oslProtocol { osl_Socket_ProtocolIp , osl_Socket_ProtocolIpx , osl_Socket_ProtocolSpx , osl_Socket_ProtocolSpxII , osl_Socket_ProtocolInvalid , osl_Socket_Protocol_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
represent a specific protocol within an address-family More... | |
enum | oslSocketType { osl_Socket_TypeStream , osl_Socket_TypeDgram , osl_Socket_TypeRaw , osl_Socket_TypeRdm , osl_Socket_TypeSeqPacket , osl_Socket_TypeInvalid , osl_Socket_Type_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
Represents the type of a socket. More... | |
enum | oslSocketOption { osl_Socket_OptionDebug , osl_Socket_OptionAcceptConn , osl_Socket_OptionReuseAddr , osl_Socket_OptionKeepAlive , osl_Socket_OptionDontRoute , osl_Socket_OptionBroadcast , osl_Socket_OptionUseLoopback , osl_Socket_OptionLinger , osl_Socket_OptionOOBinLine , osl_Socket_OptionSndBuf , osl_Socket_OptionRcvBuf , osl_Socket_OptionSndLowat , osl_Socket_OptionRcvLowat , osl_Socket_OptionSndTimeo , osl_Socket_OptionRcvTimeo , osl_Socket_OptionError , osl_Socket_OptionType , osl_Socket_OptionTcpNoDelay , osl_Socket_OptionInvalid , osl_Socket_Option_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
Represents socket-options. More... | |
enum | oslSocketOptionLevel { osl_Socket_LevelSocket , osl_Socket_LevelTcp , osl_Socket_LevelInvalid , osl_Socket_Level_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
Represents the different socket-option levels. More... | |
enum | oslSocketMsgFlag { osl_Socket_MsgNormal , osl_Socket_MsgOOB , osl_Socket_MsgPeek , osl_Socket_MsgDontRoute , osl_Socket_MsgMaxIOVLen , osl_Socket_MsgInvalid , osl_Socket_Msg_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
Represents flags to be used with send/recv-calls. More... | |
enum | oslSocketDirection { osl_Socket_DirRead , osl_Socket_DirWrite , osl_Socket_DirReadWrite , osl_Socket_DirInvalid , osl_Socket_Dir_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
Used by shutdown to denote which end of the socket to "close". More... | |
enum | oslSocketError { osl_Socket_E_None , osl_Socket_E_NotSocket , osl_Socket_E_DestAddrReq , osl_Socket_E_MsgSize , osl_Socket_E_Prototype , osl_Socket_E_NoProtocol , osl_Socket_E_ProtocolNoSupport , osl_Socket_E_TypeNoSupport , osl_Socket_E_OpNotSupport , osl_Socket_E_PfNoSupport , osl_Socket_E_AfNoSupport , osl_Socket_E_AddrInUse , osl_Socket_E_AddrNotAvail , osl_Socket_E_NetDown , osl_Socket_E_NetUnreachable , osl_Socket_E_NetReset , osl_Socket_E_ConnAborted , osl_Socket_E_ConnReset , osl_Socket_E_NoBufferSpace , osl_Socket_E_IsConnected , osl_Socket_E_NotConnected , osl_Socket_E_Shutdown , osl_Socket_E_TooManyRefs , osl_Socket_E_TimedOut , osl_Socket_E_ConnRefused , osl_Socket_E_HostDown , osl_Socket_E_HostUnreachable , osl_Socket_E_WouldBlock , osl_Socket_E_Already , osl_Socket_E_InProgress , osl_Socket_E_InvalidError , osl_Socket_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
Describes the various error socket error conditions, which may occur. More... | |
enum | oslSocketResult { osl_Socket_Ok , osl_Socket_Error , osl_Socket_TimedOut , osl_Socket_Interrupted , osl_Socket_InProgress , osl_Socket_FORCE_EQUAL_SIZE = SAL_MAX_ENUM } |
Common return codes of socket related functions. More... | |
typedef struct oslSocketAddrImpl * | oslSocketAddr |
Opaque datatype SocketAddr. | |
typedef sal_uInt8 | oslSocketIpxNetNumber[4] |
typedef sal_uInt8 | oslSocketIpxNodeNumber[6] |
typedef struct oslSocketImpl * | oslSocket |
SAL_DLLPUBLIC oslSocket | osl_createSocket (oslAddrFamily Family, oslSocketType Type, oslProtocol Protocol) |
Create a socket of the specified Family and Type. | |
SAL_DLLPUBLIC void | osl_acquireSocket (oslSocket Socket) |
increases the refcount of the socket handle by one | |
SAL_DLLPUBLIC void | osl_releaseSocket (oslSocket Socket) |
decreases the refcount of the socket handle by one. | |
SAL_DLLPUBLIC oslSocketAddr | osl_getLocalAddrOfSocket (oslSocket Socket) |
Retrieves the Address of the local end of the socket. | |
SAL_DLLPUBLIC oslSocketAddr | osl_getPeerAddrOfSocket (oslSocket Socket) |
Retrieves the Address of the remote end of the socket. | |
SAL_DLLPUBLIC sal_Bool | osl_bindAddrToSocket (oslSocket Socket, oslSocketAddr Addr) |
Binds the given address to the socket. | |
SAL_DLLPUBLIC oslSocketResult | osl_connectSocketTo (oslSocket Socket, oslSocketAddr Addr, const TimeValue *pTimeout) |
Connects the socket to the given address. | |
SAL_DLLPUBLIC sal_Bool | osl_listenOnSocket (oslSocket Socket, sal_Int32 MaxPendingConnections) |
Prepares the socket to act as an acceptor of incoming connections. | |
SAL_DLLPUBLIC oslSocket | osl_acceptConnectionOnSocket (oslSocket Socket, oslSocketAddr *pAddr) |
Waits for an ingoing connection on the socket. | |
SAL_DLLPUBLIC sal_Int32 | osl_receiveSocket (oslSocket Socket, void *pBuffer, sal_uInt32 BytesToRead, oslSocketMsgFlag Flag) |
Tries to receive BytesToRead data from the connected socket, if no error occurs. | |
SAL_DLLPUBLIC sal_Int32 | osl_receiveFromSocket (oslSocket Socket, oslSocketAddr SenderAddr, void *pBuffer, sal_uInt32 BufferSize, oslSocketMsgFlag Flag) |
Tries to receives BufferSize data from the (usually unconnected) (datagram-)socket, if no error occurs. | |
SAL_DLLPUBLIC sal_Int32 | osl_sendSocket (oslSocket Socket, const void *pBuffer, sal_uInt32 BytesToSend, oslSocketMsgFlag Flag) |
Tries to send BytesToSend data from the connected socket, if no error occurs. | |
SAL_DLLPUBLIC sal_Int32 | osl_sendToSocket (oslSocket Socket, oslSocketAddr ReceiverAddr, const void *pBuffer, sal_uInt32 BytesToSend, oslSocketMsgFlag Flag) |
Tries to send one datagram with BytesToSend data to the given ReceiverAddr via the (implicitly unconnected) datagram-socket. | |
SAL_DLLPUBLIC sal_Bool | osl_isReceiveReady (oslSocket Socket, const TimeValue *pTimeout) |
Checks if read operations will block. | |
SAL_DLLPUBLIC sal_Bool | osl_isSendReady (oslSocket Socket, const TimeValue *pTimeout) |
Checks if send operations will block. | |
SAL_DLLPUBLIC sal_Bool | osl_isExceptionPending (oslSocket Socket, const TimeValue *pTimeout) |
Checks if a request for out-of-band data will block. | |
SAL_DLLPUBLIC sal_Bool | osl_shutdownSocket (oslSocket Socket, oslSocketDirection Direction) |
Shuts down communication on a connected socket. | |
SAL_DLLPUBLIC sal_Int32 | osl_getSocketOption (oslSocket Socket, oslSocketOptionLevel Level, oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen) |
Retrieves attributes associated with the socket. | |
SAL_DLLPUBLIC sal_Bool | osl_setSocketOption (oslSocket Socket, oslSocketOptionLevel Level, oslSocketOption Option, void *pBuffer, sal_uInt32 BufferLen) |
Sets the sockets attributes. | |
SAL_DLLPUBLIC sal_Bool | osl_enableNonBlockingMode (oslSocket Socket, sal_Bool On) |
Enables/disables non-blocking-mode of the socket. | |
SAL_DLLPUBLIC sal_Bool | osl_isNonBlockingMode (oslSocket Socket) |
Query state of non-blocking-mode of the socket. | |
SAL_DLLPUBLIC oslSocketType | osl_getSocketType (oslSocket Socket) |
Queries the socket for its type. | |
SAL_DLLPUBLIC void | osl_getLastSocketErrorDescription (oslSocket Socket, rtl_uString **strError) |
returns a string which describes the last socket error. | |
SAL_DLLPUBLIC oslSocketError | osl_getLastSocketError (oslSocket Socket) |
Returns a constant describing the last error for the socket system. | |
SAL_DLLPUBLIC void | osl_closeSocket (oslSocket Socket) |
Closes the socket terminating any ongoing dataflow. | |
SAL_DLLPUBLIC sal_Int32 | osl_readSocket (oslSocket Socket, void *pBuffer, sal_Int32 nSize) |
Retrieves n bytes from the stream and copies them into pBuffer. | |
SAL_DLLPUBLIC sal_Int32 | osl_writeSocket (oslSocket Socket, const void *pBuffer, sal_Int32 nSize) |
Writes n bytes from pBuffer to the stream. | |
typedef struct oslHostAddrImpl * | oslHostAddr |
SAL_DLLPUBLIC oslSocketAddr | osl_createEmptySocketAddr (oslAddrFamily Family) |
Creates a socket-address for the given family. | |
SAL_DLLPUBLIC oslSocketAddr | osl_copySocketAddr (oslSocketAddr Addr) |
Creates a new SocketAddress and fills it from Addr. | |
SAL_DLLPUBLIC sal_Bool | osl_isEqualSocketAddr (oslSocketAddr Addr1, oslSocketAddr Addr2) |
Compares the values of two SocketAddresses. | |
SAL_DLLPUBLIC oslSocketAddr | osl_resolveHostname (rtl_uString *strHostname) |
Uses the systems name-service interface to find an address for strHostname. | |
SAL_DLLPUBLIC oslSocketAddr | osl_createInetBroadcastAddr (rtl_uString *strDottedAddr, sal_Int32 Port) |
Create an internet address usable for sending broadcast datagrams. | |
SAL_DLLPUBLIC oslSocketAddr | osl_createInetSocketAddr (rtl_uString *strDottedAddr, sal_Int32 Port) |
Create an internet-address, consisting of host address and port. | |
SAL_DLLPUBLIC void | osl_destroySocketAddr (oslSocketAddr Addr) |
Frees all resources allocated by Addr. | |
SAL_DLLPUBLIC sal_Int32 | osl_getServicePort (rtl_uString *strServicename, rtl_uString *strProtocol) |
Looks up the port-number designated to the specified service/protocol-pair. | |
SAL_DLLPUBLIC oslAddrFamily | osl_getFamilyOfSocketAddr (oslSocketAddr Addr) |
Retrieves the address-family from the Addr. | |
SAL_DLLPUBLIC sal_Int32 | osl_getInetPortOfSocketAddr (oslSocketAddr Addr) |
Retrieves the internet port-number of Addr. | |
SAL_DLLPUBLIC sal_Bool | osl_setInetPortOfSocketAddr (oslSocketAddr Addr, sal_Int32 Port) |
Sets the Port of Addr. | |
SAL_DLLPUBLIC oslSocketResult | osl_getHostnameOfSocketAddr (oslSocketAddr Addr, rtl_uString **strHostname) |
Returns the hostname represented by Addr. | |
SAL_DLLPUBLIC oslSocketResult | osl_getDottedInetAddrOfSocketAddr (oslSocketAddr Addr, rtl_uString **strDottedInetAddr) |
Gets the address in dotted decimal format. | |
SAL_DLLPUBLIC oslSocketResult | osl_setAddrOfSocketAddr (oslSocketAddr Addr, sal_Sequence *pByteSeq) |
Sets the addr field in the struct sockaddr with pByteSeq. | |
SAL_DLLPUBLIC oslSocketResult | osl_getAddrOfSocketAddr (oslSocketAddr Addr, sal_Sequence **ppByteSeq) |
Returns the addr field in the struct sockaddr. | |
SAL_DLLPUBLIC oslHostAddr | osl_createHostAddr (rtl_uString *strHostname, const oslSocketAddr Addr) |
Create an oslHostAddr from given hostname and socket address. | |
SAL_DLLPUBLIC oslHostAddr | osl_createHostAddrByName (rtl_uString *strHostname) |
Create an oslHostAddr by resolving the given strHostname. | |
SAL_DLLPUBLIC oslHostAddr | osl_createHostAddrByAddr (const oslSocketAddr Addr) |
Create an oslHostAddr by reverse resolution of the given Addr. | |
SAL_DLLPUBLIC oslHostAddr | osl_copyHostAddr (const oslHostAddr Addr) |
Create a copy of the given Addr. | |
SAL_DLLPUBLIC void | osl_destroyHostAddr (oslHostAddr Addr) |
Frees all resources allocated by Addr. | |
SAL_DLLPUBLIC void | osl_getHostnameOfHostAddr (const oslHostAddr Addr, rtl_uString **strHostname) |
Get the hostname member of Addr. | |
SAL_DLLPUBLIC oslSocketAddr | osl_getSocketAddrOfHostAddr (const oslHostAddr Addr) |
Get the socket address member of Addr. | |
SAL_DLLPUBLIC oslSocketResult | osl_getLocalHostname (rtl_uString **strLocalHostname) |
Retrieve this machines hostname (NOT the FQDN) |
#define OSL_INADDR_NONE 0xffffffff |
#define OSL_INVALID_PORT (-1) |
typedef struct oslHostAddrImpl* oslHostAddr |
typedef struct oslSocketAddrImpl* oslSocketAddr |
Opaque datatype SocketAddr.
begin section types
typedef sal_uInt8 oslSocketIpxNetNumber[4] |
typedef sal_uInt8 oslSocketIpxNodeNumber[6] |
enum oslAddrFamily |
enum oslProtocol |
represent a specific protocol within an address-family
enum oslSocketDirection |
enum oslSocketError |
Describes the various error socket error conditions, which may occur.
enum oslSocketMsgFlag |
enum oslSocketOption |
Represents socket-options.
enum oslSocketOptionLevel |
enum oslSocketResult |
Common return codes of socket related functions.
Enumerator | |
---|---|
osl_Socket_Ok | successful completion |
osl_Socket_Error | error occurred, check osl_getLastSocketError() for details |
osl_Socket_TimedOut | blocking operation timed out |
osl_Socket_Interrupted | blocking operation was interrupted |
osl_Socket_InProgress | nonblocking operation is in progress |
osl_Socket_FORCE_EQUAL_SIZE |
enum oslSocketType |
Represents the type of a socket.
SAL_DLLPUBLIC oslSocket osl_acceptConnectionOnSocket | ( | oslSocket | Socket, |
oslSocketAddr * | pAddr ) |
Waits for an ingoing connection on the socket.
This call blocks if there is no incoming connection present.
[in] | Socket | The socket to accept the connection on. |
[in] | pAddr | if pAddr is != 0, the peers address is returned. |
0 | if the accept-call failed, otherwise you get a socket representing the new connection. |
SAL_DLLPUBLIC void osl_acquireSocket | ( | oslSocket | Socket | ) |
increases the refcount of the socket handle by one
SAL_DLLPUBLIC sal_Bool osl_bindAddrToSocket | ( | oslSocket | Socket, |
oslSocketAddr | Addr ) |
Binds the given address to the socket.
[in] | Socket | |
[in] | Addr |
sal_False | if the bind failed |
sal_True | if bind is successful |
SAL_DLLPUBLIC void osl_closeSocket | ( | oslSocket | Socket | ) |
Closes the socket terminating any ongoing dataflow.
[in] | Socket | The socket to close. |
SAL_DLLPUBLIC oslSocketResult osl_connectSocketTo | ( | oslSocket | Socket, |
oslSocketAddr | Addr, | ||
const TimeValue * | pTimeout ) |
Connects the socket to the given address.
[in] | Socket | a bound socket. |
[in] | Addr | the peer address. |
pTimeout | Timeout value or NULL for blocking. |
osl_Socket_Ok | on successful connection, |
osl_Socket_TimedOut | if operation timed out, |
osl_Socket_Interrupted | if operation was interrupted |
osl_Socket_Error | if the connection failed. |
SAL_DLLPUBLIC oslHostAddr osl_copyHostAddr | ( | const oslHostAddr | Addr | ) |
Create a copy of the given Addr.
SAL_DLLPUBLIC oslSocketAddr osl_copySocketAddr | ( | oslSocketAddr | Addr | ) |
Creates a new SocketAddress and fills it from Addr.
SAL_DLLPUBLIC oslSocketAddr osl_createEmptySocketAddr | ( | oslAddrFamily | Family | ) |
Creates a socket-address for the given family.
begin section oslSocketAddr
Family | If family == osl_Socket_FamilyInet the address is set to INADDR_ANY port 0. |
SAL_DLLPUBLIC oslHostAddr osl_createHostAddr | ( | rtl_uString * | strHostname, |
const oslSocketAddr | Addr ) |
Create an oslHostAddr from given hostname and socket address.
[in] | strHostname | The hostname to be stored. |
[in] | Addr | The socket address to be stored. |
SAL_DLLPUBLIC oslHostAddr osl_createHostAddrByAddr | ( | const oslSocketAddr | Addr | ) |
Create an oslHostAddr by reverse resolution of the given Addr.
Successful name resolution should result in the fully qualified domain name (FQDN) and its address as hostname and socket address members of the resulting oslHostAddr.
[in] | Addr | The socket address to be reverse resolved. |
SAL_DLLPUBLIC oslHostAddr osl_createHostAddrByName | ( | rtl_uString * | strHostname | ) |
Create an oslHostAddr by resolving the given strHostname.
Successful name resolution should result in the fully qualified domain name (FQDN) and its address as hostname and socket address members of the resulting oslHostAddr.
[in] | strHostname | The hostname to be resolved. |
SAL_DLLPUBLIC oslSocketAddr osl_createInetBroadcastAddr | ( | rtl_uString * | strDottedAddr, |
sal_Int32 | Port ) |
Create an internet address usable for sending broadcast datagrams.
To limit the broadcast to your subnet, pass your hosts IP address in dotted decimal notation as first argument.
[in] | strDottedAddr | dotted decimal internet address, may be 0. |
[in] | Port | port number in host byte order. |
0 | if address could not be created. |
SAL_DLLPUBLIC oslSocketAddr osl_createInetSocketAddr | ( | rtl_uString * | strDottedAddr, |
sal_Int32 | Port ) |
Create an internet-address, consisting of host address and port.
We interpret strDottedAddr as a dotted-decimal inet-addr (e.g. "141.99.128.50").
[in] | strDottedAddr | String with dotted address. |
[in] | Port | portnumber in host byte order. |
0 | if address could not be created. |
SAL_DLLPUBLIC oslSocket osl_createSocket | ( | oslAddrFamily | Family, |
oslSocketType | Type, | ||
oslProtocol | Protocol ) |
Create a socket of the specified Family and Type.
The semantic of the Protocol parameter depends on the given family and type.
SAL_DLLPUBLIC void osl_destroyHostAddr | ( | oslHostAddr | Addr | ) |
Frees all resources allocated by Addr.
The handle Addr must not be used after the call anymore.
SAL_DLLPUBLIC void osl_destroySocketAddr | ( | oslSocketAddr | Addr | ) |
Frees all resources allocated by Addr.
The handle Addr must not be used after the call anymore.
SAL_DLLPUBLIC sal_Bool osl_enableNonBlockingMode | ( | oslSocket | Socket, |
sal_Bool | On ) |
Enables/disables non-blocking-mode of the socket.
Socket | Change mode for this socket. |
On | sal_True enables non-blocking mode, sal_False disables non-blocking mode. |
sal_True | if mode could be changed. |
SAL_DLLPUBLIC oslSocketResult osl_getAddrOfSocketAddr | ( | oslSocketAddr | Addr, |
sal_Sequence ** | ppByteSeq ) |
Returns the addr field in the struct sockaddr.
[in] | Addr | The socket address from which to extract the ipaddress. |
[out] | ppByteSeq | After the call, *ppByteSeq contains the ipaddress in network byte order. *ppByteSeq may be 0 in case of an invalid socket handle. |
osl_Socket_Ok | |
osl_Socket_Error |
SAL_DLLPUBLIC oslSocketResult osl_getDottedInetAddrOfSocketAddr | ( | oslSocketAddr | Addr, |
rtl_uString ** | strDottedInetAddr ) |
Gets the address in dotted decimal format.
[in] | Addr | The socket address from which to extract the dotted decimal address. |
[out] | strDottedInetAddr | Contains the dotted decimal address (e.g. 141.99.20.34) represented by the address. |
If | the address is invalid or not of type osl_Socket_FamilyInet, it returns 0. |
osl_Socket_Ok | |
osl_Socket_Error |
SAL_DLLPUBLIC oslAddrFamily osl_getFamilyOfSocketAddr | ( | oslSocketAddr | Addr | ) |
Retrieves the address-family from the Addr.
SAL_DLLPUBLIC void osl_getHostnameOfHostAddr | ( | const oslHostAddr | Addr, |
rtl_uString ** | strHostname ) |
Get the hostname member of Addr.
Addr | address for host name |
strHostname | The host name or 0 upon failure. |
SAL_DLLPUBLIC oslSocketResult osl_getHostnameOfSocketAddr | ( | oslSocketAddr | Addr, |
rtl_uString ** | strHostname ) |
Returns the hostname represented by Addr.
[in] | Addr | The socket address from which to extract the hostname. |
[out] | strHostname | The hostname represented by the address. If there is no hostname to be found, it returns 0. |
SAL_DLLPUBLIC sal_Int32 osl_getInetPortOfSocketAddr | ( | oslSocketAddr | Addr | ) |
Retrieves the internet port-number of Addr.
SAL_DLLPUBLIC oslSocketError osl_getLastSocketError | ( | oslSocket | Socket | ) |
Returns a constant describing the last error for the socket system.
osl_Socket_E_NONE | if no error occurred |
osl_invalid_SocketError | if an unknown (unmapped) error occurred, otherwise an enum describing the error. |
SAL_DLLPUBLIC void osl_getLastSocketErrorDescription | ( | oslSocket | Socket, |
rtl_uString ** | strError ) |
returns a string which describes the last socket error.
[in] | Socket | The socket to query. |
[out] | strError | The string that receives the error message. |
SAL_DLLPUBLIC oslSocketAddr osl_getLocalAddrOfSocket | ( | oslSocket | Socket | ) |
Retrieves the Address of the local end of the socket.
Note that a socket must be bound or connected before a valid address can be returned.
SAL_DLLPUBLIC oslSocketResult osl_getLocalHostname | ( | rtl_uString ** | strLocalHostname | ) |
Retrieve this machines hostname (NOT the FQDN)
strLocalHostname | out-parameter. The string that receives the local host name. |
sal_True | upon success |
sal_False |
SAL_DLLPUBLIC oslSocketAddr osl_getPeerAddrOfSocket | ( | oslSocket | Socket | ) |
Retrieves the Address of the remote end of the socket.
Note that a socket must be connected before a valid address can be returned.
0 | if socket-address could not be created, otherwise you get the created Socket-Address. |
SAL_DLLPUBLIC sal_Int32 osl_getServicePort | ( | rtl_uString * | strServicename, |
rtl_uString * | strProtocol ) |
Looks up the port-number designated to the specified service/protocol-pair.
(e.g. "ftp" "tcp").
OSL_INVALID_PORT | if no appropriate entry was found, otherwise the port-number. |
SAL_DLLPUBLIC oslSocketAddr osl_getSocketAddrOfHostAddr | ( | const oslHostAddr | Addr | ) |
Get the socket address member of Addr.
SAL_DLLPUBLIC sal_Int32 osl_getSocketOption | ( | oslSocket | Socket, |
oslSocketOptionLevel | Level, | ||
oslSocketOption | Option, | ||
void * | pBuffer, | ||
sal_uInt32 | BufferLen ) |
Retrieves attributes associated with the socket.
Socket | is the socket to query. |
Level | Selects the level for which an option should be queried. Valid values are:
|
Option | Denotes the option to query. Valid values (depending on the Level) are:
|
pBuffer | Pointer to a buffer large enough to take the desired attribute-value. |
BufferLen | contains the length of the Buffer. |
SAL_DLLPUBLIC oslSocketType osl_getSocketType | ( | oslSocket | Socket | ) |
Queries the socket for its type.
[in] | Socket | The socket to query. |
osl_Socket_TypeStream | |
osl_Socket_TypeDgram | |
osl_Socket_TypeRaw | |
osl_Socket_TypeRdm | |
osl_Socket_TypeSeqPacket | |
osl_invalid_SocketType | if an error occurred |
SAL_DLLPUBLIC sal_Bool osl_isEqualSocketAddr | ( | oslSocketAddr | Addr1, |
oslSocketAddr | Addr2 ) |
Compares the values of two SocketAddresses.
sal_True | if both addresses denote the same socket address. |
sal_False | if both addresses do not denote the same socket address. |
SAL_DLLPUBLIC sal_Bool osl_isExceptionPending | ( | oslSocket | Socket, |
const TimeValue * | pTimeout ) |
Checks if a request for out-of-band data will block.
You can specify a timeout-value in seconds/microseconds that denotes how long the operation will block if the Socket has no pending OOB data.
Socket | the Socket to perform the operation on. |
pTimeout | if NULL, the operation will block without a timeout. |
sal_True | if OOB-request operations (recv with appropriate flags) on the Socket will NOT block |
sal_False | if it would block or if an error occurred. |
SAL_DLLPUBLIC sal_Bool osl_isNonBlockingMode | ( | oslSocket | Socket | ) |
Query state of non-blocking-mode of the socket.
Socket | Query mode for this socket. |
True | if non-blocking-mode is enabled. |
SAL_DLLPUBLIC sal_Bool osl_isReceiveReady | ( | oslSocket | Socket, |
const TimeValue * | pTimeout ) |
Checks if read operations will block.
You can specify a timeout-value in seconds/microseconds that denotes how long the operation will block if the Socket is not ready.
Socket | the Socket to perform the operation on. |
pTimeout | if NULL, the operation will block without a timeout. |
sal_True | if read operations (recv, recvFrom, accept) on the Socket will NOT block; |
sal_False | if it would block or if an error occurred. |
SAL_DLLPUBLIC sal_Bool osl_isSendReady | ( | oslSocket | Socket, |
const TimeValue * | pTimeout ) |
Checks if send operations will block.
You can specify a timeout-value in seconds/microseconds that denotes how long the operation will block if the Socket is not ready.
Socket | the Socket to perform the operation on. |
pTimeout | if NULL, the operation will block without a timeout. Otherwise the time define by timeout value. |
sal_True | if send operations (send, sendTo) on the Socket will NOT block |
sal_False | if it would block or if an error occurred. |
SAL_DLLPUBLIC sal_Bool osl_listenOnSocket | ( | oslSocket | Socket, |
sal_Int32 | MaxPendingConnections ) |
Prepares the socket to act as an acceptor of incoming connections.
You should call "listen" before you use "accept".
[in] | Socket | The socket to listen on. |
[in] | MaxPendingConnections | denotes the length of the queue of pending connections for this socket. If MaxPendingConnections is -1, the systems default value will be used (Usually 5). |
sal_False | if the listen failed. |
SAL_DLLPUBLIC sal_Int32 osl_readSocket | ( | oslSocket | Socket, |
void * | pBuffer, | ||
sal_Int32 | nSize ) |
Retrieves n bytes from the stream and copies them into pBuffer.
The function avoids incomplete reads due to packet boundaries.
[in] | Socket | The socket to read from. |
[out] | pBuffer | receives the read data. |
[out] | nSize | the number of bytes to read. pBuffer must be large enough to hold the n bytes! |
SAL_DLLPUBLIC sal_Int32 osl_receiveFromSocket | ( | oslSocket | Socket, |
oslSocketAddr | SenderAddr, | ||
void * | pBuffer, | ||
sal_uInt32 | BufferSize, | ||
oslSocketMsgFlag | Flag ) |
Tries to receives BufferSize data from the (usually unconnected) (datagram-)socket, if no error occurs.
[in] | Socket | A bound socket to be used to listen for a datagram. |
[out] | SenderAddr | A pointer to a created oslSocketAddr handle or to a null handle. After the call, it will contain the constructed oslSocketAddr of the datagrams sender. If pSenderAddr itself is 0, it is ignored. |
[out] | pBuffer | Points to a buffer that will be filled with the received datagram. |
[in] | BufferSize | The size of pBuffer. |
[in] | Flag | Modifier for the call. Valid values are: osl_Socket_MsgNormal osl_Socket_MsgOOB osl_Socket_MsgPeek osl_Socket_MsgDontRoute osl_Socket_MsgMaxIOVLen |
SAL_DLLPUBLIC sal_Int32 osl_receiveSocket | ( | oslSocket | Socket, |
void * | pBuffer, | ||
sal_uInt32 | BytesToRead, | ||
oslSocketMsgFlag | Flag ) |
Tries to receive BytesToRead data from the connected socket, if no error occurs.
Note that incomplete recvs due to packet boundaries may occur.
[in] | Socket | A connected socket to be used to listen on. |
[out] | pBuffer | Points to a buffer that will be filled with the received data. |
[in] | BytesToRead | The number of bytes to read. pBuffer must have at least this size. |
[in] | Flag | Modifier for the call. Valid values are: osl_Socket_MsgNormal osl_Socket_MsgOOB osl_Socket_MsgPeek osl_Socket_MsgDontRoute osl_Socket_MsgMaxIOVLen |
SAL_DLLPUBLIC void osl_releaseSocket | ( | oslSocket | Socket | ) |
decreases the refcount of the socket handle by one.
If the refcount drops to zero, the underlying socket handle is destroyed and becomes invalid.
SAL_DLLPUBLIC oslSocketAddr osl_resolveHostname | ( | rtl_uString * | strHostname | ) |
Uses the systems name-service interface to find an address for strHostname.
[in] | strHostname | The name for which you search for an address. |
SAL_DLLPUBLIC sal_Int32 osl_sendSocket | ( | oslSocket | Socket, |
const void * | pBuffer, | ||
sal_uInt32 | BytesToSend, | ||
oslSocketMsgFlag | Flag ) |
Tries to send BytesToSend data from the connected socket, if no error occurs.
[in] | Socket | A connected socket. |
[in] | pBuffer | Points to a buffer that contains the send-data. |
[in] | BytesToSend | The number of bytes to send. pBuffer must have at least this size. |
[in] | Flag | Modifier for the call. Valid values are:
|
SAL_DLLPUBLIC sal_Int32 osl_sendToSocket | ( | oslSocket | Socket, |
oslSocketAddr | ReceiverAddr, | ||
const void * | pBuffer, | ||
sal_uInt32 | BytesToSend, | ||
oslSocketMsgFlag | Flag ) |
Tries to send one datagram with BytesToSend data to the given ReceiverAddr via the (implicitly unconnected) datagram-socket.
Since there is only sent one packet, the function sends the data always complete even with incomplete packet boundaries.
[in] | Socket | A bound or unbound socket. Socket will be bound after a successful call. |
[in] | ReceiverAddr | An initialized oslSocketAddress that contains the destination address for this send. |
[in] | pBuffer | Points to a buffer that contains the send-data. |
[in] | BytesToSend | The number of bytes to send. pBuffer must have at least this size. |
[in] | Flag | Modifier for the call. Valid values are:
|
SAL_DLLPUBLIC oslSocketResult osl_setAddrOfSocketAddr | ( | oslSocketAddr | Addr, |
sal_Sequence * | pByteSeq ) |
Sets the addr field in the struct sockaddr with pByteSeq.
pByteSeq must be in network byte order.
SAL_DLLPUBLIC sal_Bool osl_setInetPortOfSocketAddr | ( | oslSocketAddr | Addr, |
sal_Int32 | Port ) |
Sets the Port of Addr.
[in] | Addr | the SocketAddr to perform the operation on. |
[in] | Port | is expected in host byte-order. |
sal_False | if Addr is not an inet-addr. |
SAL_DLLPUBLIC sal_Bool osl_setSocketOption | ( | oslSocket | Socket, |
oslSocketOptionLevel | Level, | ||
oslSocketOption | Option, | ||
void * | pBuffer, | ||
sal_uInt32 | BufferLen ) |
Sets the sockets attributes.
Socket | is the socket to modify. |
Level | selects the level for which an option should be changed. Valid values are:
|
Option | denotes the option to modify. See osl_setSocketOption() for more details. |
pBuffer | Pointer to a Buffer which contains the attribute-value. |
BufferLen | contains the length of the Buffer. |
True | if the option could be changed. |
SAL_DLLPUBLIC sal_Bool osl_shutdownSocket | ( | oslSocket | Socket, |
oslSocketDirection | Direction ) |
Shuts down communication on a connected socket.
[in] | Socket | the Socket to perform the operation on. |
[in] | Direction | Direction denotes which end of the socket should be closed:
|
sal_True | if the socket could be closed down. |
SAL_DLLPUBLIC sal_Int32 osl_writeSocket | ( | oslSocket | Socket, |
const void * | pBuffer, | ||
sal_Int32 | nSize ) |
Writes n bytes from pBuffer to the stream.
The method avoids incomplete writes due to packet boundaries.
[out] | Socket | The socket to write to. |
[in] | pBuffer | contains the data to be written. |
[in] | nSize | the number of bytes to write. |