xref: /aoo42x/main/sal/inc/osl/socket_decl.hxx (revision 565d668c)
1*565d668cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*565d668cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*565d668cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*565d668cSAndrew Rist  * distributed with this work for additional information
6*565d668cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*565d668cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*565d668cSAndrew Rist  * "License"); you may not use this file except in compliance
9*565d668cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*565d668cSAndrew Rist  *
11*565d668cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*565d668cSAndrew Rist  *
13*565d668cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*565d668cSAndrew Rist  * software distributed under the License is distributed on an
15*565d668cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*565d668cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*565d668cSAndrew Rist  * specific language governing permissions and limitations
18*565d668cSAndrew Rist  * under the License.
19*565d668cSAndrew Rist  *
20*565d668cSAndrew Rist  *************************************************************/
21*565d668cSAndrew Rist 
22*565d668cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _OSL_SOCKET_DECL_HXX_
25cdf0e10cSrcweir #define _OSL_SOCKET_DECL_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <osl/socket.h>
28cdf0e10cSrcweir #include <rtl/ustring.hxx>
29cdf0e10cSrcweir #include <rtl/byteseq.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /** @HTML
32cdf0e10cSrcweir  */
33cdf0e10cSrcweir namespace osl
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	enum __osl_socket_NoCopy { SAL_NO_COPY };
36cdf0e10cSrcweir 
37cdf0e10cSrcweir     /** The class should be understood as a reference to a socket address handle ( struct sockaddr ).
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 		The handle is mutable.
40cdf0e10cSrcweir 	 */
41cdf0e10cSrcweir 	class SocketAddr
42cdf0e10cSrcweir 	{
43cdf0e10cSrcweir 	protected:
44cdf0e10cSrcweir 		oslSocketAddr m_handle;
45cdf0e10cSrcweir 	public:
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 		/** Creates socket address of unknown type.
48cdf0e10cSrcweir 		 */
49cdf0e10cSrcweir 		inline SocketAddr();
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 		/** Copy constructor.
52cdf0e10cSrcweir 		 */
53cdf0e10cSrcweir 		inline SocketAddr(const SocketAddr& Addr);
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 		/** The SocketAddr takes over the responsibility of the handle ( which means,
56cdf0e10cSrcweir 			that the handle gets destructed by the destructor of this reference)
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 			@param nocopy use SAL_NO_COPY
59cdf0e10cSrcweir 		 */
60cdf0e10cSrcweir 		inline SocketAddr(const oslSocketAddr , __osl_socket_NoCopy nocopy );
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 		/** Copyconstructs the oslSocketAddr handle.
63cdf0e10cSrcweir 		 */
64cdf0e10cSrcweir 		inline SocketAddr(oslSocketAddr Addr);
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 		/** tcpip-specif constructor.
67cdf0e10cSrcweir 			@param strAddrOrHostName strAddrOrHostName hostname or dotted ip-number of the network
68cdf0e10cSrcweir 			                         interface, the socket shall be created on.
69cdf0e10cSrcweir 			@param nPort             tcp-ip port number
70cdf0e10cSrcweir 		 */
71cdf0e10cSrcweir 		inline SocketAddr( const ::rtl::OUString& strAddrOrHostName, sal_Int32 nPort );
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 		/** destroys underlying oslSocketAddress
74cdf0e10cSrcweir 		 */
75cdf0e10cSrcweir 		inline ~SocketAddr();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 		/** checks, if the SocketAddr was created successful.
78cdf0e10cSrcweir 			@return <code>sal_True</code> if there is a valid underlying handle,
79cdf0e10cSrcweir 			        otherwise sal_False.
80cdf0e10cSrcweir 		 */
81cdf0e10cSrcweir 		inline sal_Bool is() const;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 		/** Converts the address to a (human readable) domain-name.
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 			@param pResult 0, if you are not interested in errors,
86cdf0e10cSrcweir 			               otherwise *pResult contains an error code on failure
87cdf0e10cSrcweir 						   or osl_Socket_Ok on success
88cdf0e10cSrcweir 			@return the hostname of this SocketAddr or an empty string on failure.
89cdf0e10cSrcweir 			@see osl_getHostnameOfSocketAddr()
90cdf0e10cSrcweir 		*/
91cdf0e10cSrcweir 		inline ::rtl::OUString SAL_CALL getHostname( oslSocketResult *pResult = 0 ) const;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 		/** Sets the ipaddress or hostname of the SocketAddress
94cdf0e10cSrcweir 		 */
95cdf0e10cSrcweir 		inline sal_Bool SAL_CALL setHostname( const ::rtl::OUString &sDottedIpOrHostname );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 		/** Returns the port number of the address.
98cdf0e10cSrcweir 			@return the port in host-byte order or or OSL_INVALID_PORT on errors.
99cdf0e10cSrcweir 		*/
100cdf0e10cSrcweir 		inline sal_Int32 SAL_CALL getPort() const;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 		/** Sets the port number of the address.
103cdf0e10cSrcweir 		   @return true if successfule.
104cdf0e10cSrcweir 		 */
105cdf0e10cSrcweir 		inline sal_Bool SAL_CALL setPort( sal_Int32 nPort );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 		/** Sets the address of the underlying socket address struct in network byte order.
108cdf0e10cSrcweir 			@return true on success, false signales falure.
109cdf0e10cSrcweir 		 */
110cdf0e10cSrcweir 		inline sal_Bool SAL_CALL setAddr( const ::rtl::ByteSequence & address );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 		/** Returns the address of the underlying socket in network byte order
113cdf0e10cSrcweir 		  */
114cdf0e10cSrcweir 		inline ::rtl::ByteSequence  SAL_CALL getAddr( oslSocketResult *pResult = 0 ) const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 		/** assign the handle to this reference. The previous handle is released.
117cdf0e10cSrcweir 		*/
118cdf0e10cSrcweir 		inline SocketAddr & SAL_CALL operator= (oslSocketAddr Addr);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 		/**
121cdf0e10cSrcweir 		 */
122cdf0e10cSrcweir 		inline SocketAddr & SAL_CALL operator= (const SocketAddr& Addr);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 		/** Assigns the socket addr without copyconstructing it.
125cdf0e10cSrcweir 			@param nocopy use SAL_NO_COPY
126cdf0e10cSrcweir 		  */
127cdf0e10cSrcweir 		inline SocketAddr & SAL_CALL assign( oslSocketAddr Addr, __osl_socket_NoCopy nocopy );
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 		/** Returns true if the underlying handle is identical to the Addr handle.
130cdf0e10cSrcweir 		 */
131cdf0e10cSrcweir 		inline sal_Bool SAL_CALL operator== (oslSocketAddr Addr) const;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 		/** Returns true if the underlying handle is identical to the Addr handle.
134cdf0e10cSrcweir 		 */
135cdf0e10cSrcweir 		inline sal_Bool SAL_CALL operator== (const SocketAddr & Addr) const;
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 		/** Returns the underlying SocketAddr handle without copyconstructing it.
138cdf0e10cSrcweir 		 */
139cdf0e10cSrcweir 		inline oslSocketAddr SAL_CALL getHandle() const;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 		/** Get the hostname for the local interface.
142cdf0e10cSrcweir 			@param after the call *pResult contains osl_Socket_Ok on success or
143cdf0e10cSrcweir 			       an error on failure.
144cdf0e10cSrcweir 			@return the hostname
145cdf0e10cSrcweir 		*/
146cdf0e10cSrcweir 		static inline ::rtl::OUString SAL_CALL getLocalHostname( oslSocketResult *pResult = 0);
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 		/** Tries to find an address for a host.
149cdf0e10cSrcweir 			@see osl_resolveHostname()
150cdf0e10cSrcweir 			@return A new created socket-address or 0 if the name could not be found.
151cdf0e10cSrcweir 		*/
152cdf0e10cSrcweir 		static inline void SAL_CALL resolveHostname(
153cdf0e10cSrcweir 			const ::rtl::OUString & strHostName , SocketAddr & Addr );
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 		/**
156cdf0e10cSrcweir 		   Tries to find the port associated with the given service/protocol-
157cdf0e10cSrcweir 		   pair (e.g. "ftp"/"tcp").
158cdf0e10cSrcweir 		   @return the port number in host-byte order or <code>OSL_INVALID_PORT</code>
159cdf0e10cSrcweir 		   if no service/protocol pair could be found.
160cdf0e10cSrcweir 		*/
161cdf0e10cSrcweir 		static inline sal_Int32 SAL_CALL getServicePort(
162cdf0e10cSrcweir 			const ::rtl::OUString& strServiceName,
163cdf0e10cSrcweir 			const ::rtl::OUString & strProtocolName= ::rtl::OUString::createFromAscii( "tcp" ) );
164cdf0e10cSrcweir 	};
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	class Socket
168cdf0e10cSrcweir 	{
169cdf0e10cSrcweir 	protected:
170cdf0e10cSrcweir 		oslSocket m_handle;
171cdf0e10cSrcweir 	protected:
172cdf0e10cSrcweir 		/** Creates a socket. Note it's protected.
173cdf0e10cSrcweir 			@param Type
174cdf0e10cSrcweir 			@param Family
175cdf0e10cSrcweir 			@param Protocol
176cdf0e10cSrcweir 		*/
177cdf0e10cSrcweir 		inline Socket(oslSocketType Type,
178cdf0e10cSrcweir 					  oslAddrFamily Family = osl_Socket_FamilyInet,
179cdf0e10cSrcweir 					  oslProtocol   Protocol = osl_Socket_ProtocolIp);
180cdf0e10cSrcweir 	public:
181cdf0e10cSrcweir 		inline Socket( );
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 		inline Socket( const Socket & socket );
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 		inline Socket( oslSocket socketHandle );
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 		/** The instance takes over the handle's ownership without acquiring the
188cdf0e10cSrcweir 			handle, but releases it within the dtor.
189cdf0e10cSrcweir 			@param noacquire use SAL_NO_ACQUIRE
190cdf0e10cSrcweir 		 */
191cdf0e10cSrcweir 		inline Socket( oslSocket socketHandle, __sal_NoAcquire noacquire );
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 		/** Destructor. Releases the underlying handle
194cdf0e10cSrcweir 		 */
195cdf0e10cSrcweir 		inline ~Socket();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 		/** Assignment operator. If socket was already created, the old one will
198cdf0e10cSrcweir 			be discarded.
199cdf0e10cSrcweir 		*/
200cdf0e10cSrcweir 		inline Socket& SAL_CALL operator= ( oslSocket socketHandle);
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 		/** Assignment operator. If socket was already created, the old one will
203cdf0e10cSrcweir 			be discarded.
204cdf0e10cSrcweir 		*/
205cdf0e10cSrcweir 		inline Socket& SAL_CALL operator= (const Socket& sock);
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 		/**
208cdf0e10cSrcweir 		   @return <code>sal_True</code>, when the underlying handle of both
209cdf0e10cSrcweir 		                 Socket instances are identical, <code>sal_False</code> otherwise.
210cdf0e10cSrcweir 		 */
211cdf0e10cSrcweir 		inline sal_Bool SAL_CALL operator==( const Socket& rSocket ) const ;
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 		/**
214cdf0e10cSrcweir 		   @return <code>sal_True</code>, when the underlying handle of both
215cdf0e10cSrcweir 		                 Socket instances are identical, <code>sal_False</code> otherwise.
216cdf0e10cSrcweir 		 */
217cdf0e10cSrcweir 		inline sal_Bool SAL_CALL operator==( const oslSocket socketHandle ) const;
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 		/** Closes a definite or both directions of the bidirectional stream.
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 		   @param Direction
222cdf0e10cSrcweir 		   @see osl_shutdownSocket()
223cdf0e10cSrcweir 		 */
224cdf0e10cSrcweir 		inline void SAL_CALL shutdown( oslSocketDirection Direction = osl_Socket_DirReadWrite );
225cdf0e10cSrcweir 
226cdf0e10cSrcweir 		/** Closes a socket.
227cdf0e10cSrcweir 			Note that closing a socket is identical to shutdown( osl_Socket_DirReadWrite ),
228cdf0e10cSrcweir 			as the operating system distinguish both cases, both functions or offered in this API.
229cdf0e10cSrcweir 			@see osl_closeSocket()
230cdf0e10cSrcweir 		 */
231cdf0e10cSrcweir 		inline void SAL_CALL close();
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 		/** Retrieves the address of the local interface of this socket.
234cdf0e10cSrcweir 			@param Addr [out] receives the address.
235cdf0e10cSrcweir 			@see osl_getLocalAddrOfSocket()
236cdf0e10cSrcweir 		*/
237cdf0e10cSrcweir 		inline void SAL_CALL getLocalAddr( SocketAddr &Addr ) const;
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 		/** Get the local port of the socket. Usually used after bind().
240cdf0e10cSrcweir 			@return the port number or OSL_INVALID_PORT on errors.
241cdf0e10cSrcweir 		*/
242cdf0e10cSrcweir 		inline sal_Int32	SAL_CALL getLocalPort() const;
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 		/** Get the hostname for the local interface.
245cdf0e10cSrcweir 			@return the hostname or an empty string ("").
246cdf0e10cSrcweir 		*/
247cdf0e10cSrcweir 		inline ::rtl::OUString SAL_CALL getLocalHost() const;
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 		/** Retrieves the address of the remote host of this socket.
250cdf0e10cSrcweir 			@param Addr [out] receives the address.
251cdf0e10cSrcweir 		*/
252cdf0e10cSrcweir 		inline void SAL_CALL getPeerAddr( SocketAddr & Addr) const;
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 		/** Get the remote port of the socket.
255cdf0e10cSrcweir 			@return the port number or OSL_INVALID_PORT on errors.
256cdf0e10cSrcweir 		*/
257cdf0e10cSrcweir 		inline sal_Int32	SAL_CALL getPeerPort() const;
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 		/** Get the hostname for the remote interface.
260cdf0e10cSrcweir 			@return the hostname or an empty string ("").
261cdf0e10cSrcweir 		*/
262cdf0e10cSrcweir 		inline ::rtl::OUString SAL_CALL getPeerHost() const;
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 		/** Binds the socket to the specified (local) interface.
265cdf0e10cSrcweir 			@param LocalInterface Address of the Interface
266cdf0e10cSrcweir 			@return True if bind was successful.
267cdf0e10cSrcweir 		*/
268cdf0e10cSrcweir 		inline sal_Bool SAL_CALL bind(const SocketAddr& LocalInterface);
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 		/** Checks if read operations will block.
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 			You can specify a timeout-value in seconds/nanoseconds that denotes
273cdf0e10cSrcweir 			how the operation will block if the Socket is not ready.
274cdf0e10cSrcweir 			@return <code>sal_True</code> if read operations (recv, recvFrom, accept) on the Socket
275cdf0e10cSrcweir 			will NOT block; <code>sal_False</code> if it would block or if an error occured.
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 			@param pTimeout if 0, the operation will block without a timeout. Otherwise
278cdf0e10cSrcweir 			the specified amout of time.
279cdf0e10cSrcweir 		*/
280cdf0e10cSrcweir 		inline sal_Bool	SAL_CALL isRecvReady(const TimeValue *pTimeout = 0) const;
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 		/** Checks if send operations will block.
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 			You can specify a timeout-value in seconds/nanoseconds that denotes
285cdf0e10cSrcweir 			how the operation will block if the Socket is not ready.
286cdf0e10cSrcweir 			@return <code>sal_True</code> if send operations (send, sendTo) on the Socket
287cdf0e10cSrcweir 			will NOT block; <code>sal_False</code> if it would block or if an error occured.
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 			@param pTimeout if 0, the operation will block without a timeout. Otherwise
290cdf0e10cSrcweir 			the specified amout of time.
291cdf0e10cSrcweir 		*/
292cdf0e10cSrcweir 		inline sal_Bool	SAL_CALL isSendReady(const TimeValue *pTimeout = 0) const;
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 		/** Checks if a request for out-of-band data will block.
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 			You can specify a timeout-value in seconds/nanoseconds that denotes
298cdf0e10cSrcweir 			how the operation will block if the Socket has no pending OOB data.
299cdf0e10cSrcweir 
300cdf0e10cSrcweir 			@return <code>sal_True</code> if OOB-request operations (recv with appropriate flags)
301cdf0e10cSrcweir 			on the Socket will NOT block; <code>sal_False</code> if it would block or if
302cdf0e10cSrcweir 			an error occured.
303cdf0e10cSrcweir 
304cdf0e10cSrcweir 			@param pTimeout if 0, the operation will block without a timeout. Otherwise
305cdf0e10cSrcweir 			the specified amout of time.
306cdf0e10cSrcweir 		*/
307cdf0e10cSrcweir 		inline sal_Bool	SAL_CALL isExceptionPending(const TimeValue *pTimeout = 0) const;
308cdf0e10cSrcweir 
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 		/** Queries the socket for its type.
311cdf0e10cSrcweir 	        @return one of:
312cdf0e10cSrcweir 			<ul>
313cdf0e10cSrcweir 			<li> <code>osl_Socket_TypeStream</code>
314cdf0e10cSrcweir 			<li> <code>osl_Socket_TypeDgram</code>
315cdf0e10cSrcweir 			<li> <code>osl_Socket_TypeRaw</code>
316cdf0e10cSrcweir 			<li> <code>osl_Socket_TypeRdm</code>
317cdf0e10cSrcweir 			<li> <code>osl_Socket_TypeSeqPacket</code>
318cdf0e10cSrcweir 			<li> <code>osl_invalid_SocketType</code>, if an error occured
319cdf0e10cSrcweir 			</ul>
320cdf0e10cSrcweir 		*/
321cdf0e10cSrcweir 		inline oslSocketType	SAL_CALL getType() const;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 		/** Retrieves option-attributes associated with the socket.
324cdf0e10cSrcweir 			@param Option The attribute to query.
325cdf0e10cSrcweir 			Valid values (depending on the Level) are:
326cdf0e10cSrcweir 			<ul>
327cdf0e10cSrcweir 			<li> <code>osl_Socket_Option_Debug</code><br>
328cdf0e10cSrcweir 			     (sal_Bool) Socket debug flag 1 = enabled, 0 = disabled.
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 			<li> <code>osl_Socket_OptionAcceptConn</code><br>
331cdf0e10cSrcweir 			<li> <code>osl_Socket_OptionReuseAddr</code><br>
332cdf0e10cSrcweir 			  (sal_Bool) Allows the socket to be bound to an address that is
333cdf0e10cSrcweir 			  already in use.
334cdf0e10cSrcweir 			  1 = multiple bound allowed, 0 = no multiple bounds allowed
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 			<li><code>osl_Socket_OptionKeepAlive</code><br>
337cdf0e10cSrcweir 			   (sal_Bool) Keepalive packets are sent by the underlying socket.
338cdf0e10cSrcweir 			   1 = enabled, 0 = disabled
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 			<li><code>osl_Socket_OptionDontRoute</code><br>
341cdf0e10cSrcweir 			   (sal_Bool) Do not route: send directly to interface.
342cdf0e10cSrcweir            	   1 = do not route , 0 = routing possible
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 			<li><code>osl_Socket_OptionBroadcast</code><br>
345cdf0e10cSrcweir 			   (sal_Bool) Transmission of broadcast messages are allowed on the socket.
346cdf0e10cSrcweir 			   1 = transmission allowed, 0 = transmission disallowed
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 			<li><code>osl_Socket_OptionUseLoopback</code><br>
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 			<li><code>osl_Socket_OptionLinger</code><br>
351cdf0e10cSrcweir 			   (linger) Linger on close if unsent data is present.
352cdf0e10cSrcweir 			   linger has two members: l_onoff, l_linger
353cdf0e10cSrcweir 			   l_onoff = 0 is off, l_onoff > 0 and l_linger= timeout in seconds.
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 			<li><code>osl_Socket_OptionOOBinLine</code><br>
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 			<li><code>osl_Socket_OptionSndBuf</code><br>
359cdf0e10cSrcweir 			  (sal_Int32) Size of the send buffer in bytes. Data is sent after
360cdf0e10cSrcweir 			  SndTimeo or when the buffer is full. This allows faster writing
361cdf0e10cSrcweir 			  to the socket.
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 			<li><code>osl_Socket_OptionRcvBuf</code><br>
364cdf0e10cSrcweir 			  (sal_Int32) Size of the receive buffer in bytes. Data is sent after
365cdf0e10cSrcweir 			  SndTimeo or when the buffer is full. This allows faster writing
366cdf0e10cSrcweir 			  to the socket and larger packet sizes.
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 			<li><code>osl_Socket_OptionSndLowat</code><br>
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 			<li><code>osl_Socket_OptionRcvLowat</code><br>
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 			<li><code>osl_Socket_OptionSndTimeo</code><br>
373cdf0e10cSrcweir 			  (sal_Int32) Data is sent after this timeout. This allows gathering
374cdf0e10cSrcweir 			  of data to send larger packages but increases latency times.
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 			<li><code>osl_Socket_OptionRcvTimeo</code><br>
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 			<li><code>osl_Socket_OptionError</code><br>
379cdf0e10cSrcweir 			<li><code>osl_Socket_OptionType</code><br>
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 			<li><code>osl_Socket_OptionTcpNoDelay</code><br>
382cdf0e10cSrcweir 			  Disables the Nagle algorithm for send coalescing. (Do not
383cdf0e10cSrcweir 			  collect data until a packet is full, instead send immediatly.
384cdf0e10cSrcweir 			  This increases network traffic but might improve latency-times.)
385cdf0e10cSrcweir 			  1 = disables the algorithm, 0 = keeps it enabled.
386cdf0e10cSrcweir 			</ul>
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 			  If not above mentioned otherwise, the options are only valid for
389cdf0e10cSrcweir 			  level <code>osl_Socket_LevelSocket</code>.
390cdf0e10cSrcweir 			@param pBuffer The Buffer will be filled with the attribute.
391cdf0e10cSrcweir 
392cdf0e10cSrcweir 			@param BufferSize The size of pBuffer.
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 			@param Level The option level.
395cdf0e10cSrcweir 
396cdf0e10cSrcweir 			Valid values are:
397cdf0e10cSrcweir 			<ul>
398cdf0e10cSrcweir 			<li><code>osl_Socket_LevelSocket</code> : Socket Level
399cdf0e10cSrcweir 			<li><code>osl_Socket_LevelTcp</code>    : Level of Transmission Control Protocol
400cdf0e10cSrcweir 			</ul>
401cdf0e10cSrcweir 			@return The size of the attribute copied into pBuffer or -1 if an error
402cdf0e10cSrcweir 			occured.
403cdf0e10cSrcweir 		*/
404cdf0e10cSrcweir 		inline sal_Int32 SAL_CALL getOption(
405cdf0e10cSrcweir 			oslSocketOption Option,
406cdf0e10cSrcweir 			void* pBuffer,
407cdf0e10cSrcweir 			sal_uInt32 BufferLen,
408cdf0e10cSrcweir 			oslSocketOptionLevel Level= osl_Socket_LevelSocket) const;
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 		/** Sets the sockets attributes.
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 			@param Option denotes the option to modify.
413cdf0e10cSrcweir 			Valid values (depending on the Level) are:
414cdf0e10cSrcweir 			<ul>
415cdf0e10cSrcweir 			<li> osl_Socket_Option_Debug
416cdf0e10cSrcweir 			<li> osl_Socket_OptionAcceptConn
417cdf0e10cSrcweir 			<li> osl_Socket_OptionReuseAddr
418cdf0e10cSrcweir 			<li> osl_Socket_OptionKeepAlive
419cdf0e10cSrcweir 			<li> osl_Socket_OptionDontRoute
420cdf0e10cSrcweir 			<li> osl_Socket_OptionBroadcast
421cdf0e10cSrcweir 			<li> osl_Socket_OptionUseLoopback
422cdf0e10cSrcweir 			<li> osl_Socket_OptionLinger
423cdf0e10cSrcweir 			<li> osl_Socket_OptionOOBinLine
424cdf0e10cSrcweir 			<li> osl_Socket_OptionSndBuf
425cdf0e10cSrcweir 			<li> osl_Socket_OptionRcvBuf
426cdf0e10cSrcweir 			<li> osl_Socket_OptionSndLowat
427cdf0e10cSrcweir 			<li> osl_Socket_OptionRcvLowat
428cdf0e10cSrcweir 			<li> osl_Socket_OptionSndTimeo
429cdf0e10cSrcweir 			<li> osl_Socket_OptionRcvTimeo
430cdf0e10cSrcweir 			<li> osl_Socket_OptionError
431cdf0e10cSrcweir 			<li> osl_Socket_OptionType
432cdf0e10cSrcweir 			<li> osl_Socket_OptionTcpNoDelay
433cdf0e10cSrcweir 			</ul>
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 			If not above mentioned otherwise, the options are only valid for
436cdf0e10cSrcweir 			level osl_Socket_LevelSocket.
437cdf0e10cSrcweir 
438cdf0e10cSrcweir 			@param pBuffer Pointer to a Buffer which contains the attribute-value.
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 			@param BufferSize contains the length of the Buffer.
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 			@param Level selects the level for which an option should be changed.
443cdf0e10cSrcweir 			Valid values are:
444cdf0e10cSrcweir 			<ul>
445cdf0e10cSrcweir 			<li> osl_Socket_evel_Socket : Socket Level
446cdf0e10cSrcweir 			<li> osl_Socket_Level_Tcp   : Level of Transmission Control Protocol
447cdf0e10cSrcweir 			</ul>
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 			@return True if the option could be changed.
450cdf0e10cSrcweir 		*/
451cdf0e10cSrcweir 		inline sal_Bool SAL_CALL setOption( oslSocketOption Option,
452cdf0e10cSrcweir 											void* pBuffer,
453cdf0e10cSrcweir 											sal_uInt32 BufferLen,
454cdf0e10cSrcweir 											oslSocketOptionLevel Level= osl_Socket_LevelSocket ) const;
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 		/** Convenience function for setting sal_Bool and sal_Int32 option values.
457cdf0e10cSrcweir 			@see setOption()
458cdf0e10cSrcweir 		 */
459cdf0e10cSrcweir 		inline sal_Bool setOption( oslSocketOption option, sal_Int32 nValue  );
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 		/** Convenience function for retrieving sal_Bool and sal_Int32 option values.
462cdf0e10cSrcweir 			@see setOption()
463cdf0e10cSrcweir 		 */
464cdf0e10cSrcweir 		inline sal_Int32 getOption( oslSocketOption option ) const;
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 		/** Enables/disables non-blocking mode of the socket.
467cdf0e10cSrcweir 			@param bNonBlockingMode If <code>sal_True</code>, blocking mode will be switched off
468cdf0e10cSrcweir 				   If <code>sal_False</code>, the socket will become a blocking
469cdf0e10cSrcweir 				   socket (which is the default behaviour of a socket).
470cdf0e10cSrcweir 			@return <code>sal_True</code> if mode could be set.
471cdf0e10cSrcweir 		*/
472cdf0e10cSrcweir 		inline sal_Bool SAL_CALL enableNonBlockingMode( sal_Bool bNonBlockingMode);
473cdf0e10cSrcweir 
474cdf0e10cSrcweir 		/** Query blocking mode of the socket.
475cdf0e10cSrcweir 			@return <code>sal_True</code> if non-blocking mode is set.
476cdf0e10cSrcweir 		*/
477cdf0e10cSrcweir 		inline sal_Bool SAL_CALL isNonBlockingMode() const;
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 
480cdf0e10cSrcweir 		/** clears the error status
481cdf0e10cSrcweir 		*/
482cdf0e10cSrcweir 		inline void	SAL_CALL clearError() const;
483cdf0e10cSrcweir 
484cdf0e10cSrcweir         /** returns a constant decribing the last error for the socket system.
485cdf0e10cSrcweir 
486cdf0e10cSrcweir 			@return osl_Socket_E_NONE if no error occured, invalid_SocketError if
487cdf0e10cSrcweir 			an unknown (unmapped) error occured, otherwise an enum describing the
488cdf0e10cSrcweir 			error.
489cdf0e10cSrcweir 			@see osl_getLastSocketError()
490cdf0e10cSrcweir 		*/
491cdf0e10cSrcweir 		inline oslSocketError getError() const;
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 		/** Builds a string with the last error-message for the socket.
494cdf0e10cSrcweir 		 */
495cdf0e10cSrcweir 		inline ::rtl::OUString getErrorAsString( ) const;
496cdf0e10cSrcweir 
497cdf0e10cSrcweir 		/** Returns the underlying handle unacquired  (The caller must acquire it to keep it).
498cdf0e10cSrcweir 		 */
499cdf0e10cSrcweir 		inline oslSocket getHandle() const;
500cdf0e10cSrcweir 	};
501cdf0e10cSrcweir 
502cdf0e10cSrcweir 
503cdf0e10cSrcweir 	class StreamSocket : public Socket
504cdf0e10cSrcweir 	{
505cdf0e10cSrcweir 	public:
506cdf0e10cSrcweir 		/** Creates a socket.
507cdf0e10cSrcweir 			@param Type For some protocols it might be desirable to
508cdf0e10cSrcweir 			use a different type than <code>osl_Socket_TypeStream</code>
509cdf0e10cSrcweir 			(like <code>osl_Socket_TypeSeqPacket</code>).
510cdf0e10cSrcweir 			Therefore this parameter is not hidden.
511cdf0e10cSrcweir 		*/
512cdf0e10cSrcweir   		inline StreamSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
513cdf0e10cSrcweir 							oslProtocol	Protocol = osl_Socket_ProtocolIp,
514cdf0e10cSrcweir 							oslSocketType	Type = osl_Socket_TypeStream);
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 		inline StreamSocket( const StreamSocket & );
517cdf0e10cSrcweir 
518cdf0e10cSrcweir 		inline StreamSocket( oslSocket Socket , __sal_NoAcquire noacquire );
519cdf0e10cSrcweir 
520cdf0e10cSrcweir 		inline StreamSocket( oslSocket Socket );
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 		/** Retrieves n bytes from the stream and copies them into pBuffer.
523cdf0e10cSrcweir 			The method avoids incomplete reads due to packet boundaries and is thus
524cdf0e10cSrcweir 			blocking.
525cdf0e10cSrcweir 			@param pBuffer receives the read data. pBuffer must be large enough
526cdf0e10cSrcweir 			to hold n bytes.
527cdf0e10cSrcweir 			@param n the number of bytes to read.
528cdf0e10cSrcweir 			@return	the number of read bytes. The number will only be smaller than
529cdf0e10cSrcweir 			n if an exceptional condition (e.g. connection closed) occurs.
530cdf0e10cSrcweir 		*/
531cdf0e10cSrcweir 		inline sal_Int32 SAL_CALL read(void* pBuffer, sal_uInt32 n);
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 		/** Writes n bytes from pBuffer to the stream. The method avoids
534cdf0e10cSrcweir 			incomplete writes due to packet boundaries and is thus blocking.
535cdf0e10cSrcweir 			@param pBuffer contains the data to be written.
536cdf0e10cSrcweir 			@param n the number of bytes to write.
537cdf0e10cSrcweir 			@return the number of written bytes. The number will only be smaller than
538cdf0e10cSrcweir 			n if an exceptional condition (e.g. connection closed) occurs.
539cdf0e10cSrcweir 		*/
540cdf0e10cSrcweir 		inline sal_Int32 SAL_CALL write(const void* pBuffer, sal_uInt32 n);
541cdf0e10cSrcweir 
542cdf0e10cSrcweir 
543cdf0e10cSrcweir 		/** Tries to receive BytesToRead data from the connected socket,
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 			@param pBuffer [out] Points to a buffer that will be filled with the received
546cdf0e10cSrcweir 			data. pBuffer must have at least have a size of BytesToRead.
547cdf0e10cSrcweir 			@param BytesToRead [in] The number of bytes to read.
548cdf0e10cSrcweir 			@param Flag [in] Modifier for the call. Valid values are:
549cdf0e10cSrcweir 
550cdf0e10cSrcweir 			<ul>
551cdf0e10cSrcweir 			<li><code>osl_Socket_MsgNormal</code>
552cdf0e10cSrcweir 			<li><code>osl_Socket_MsgOOB</code>
553cdf0e10cSrcweir 			<li><code>osl_Socket_MsgPeek</code>
554cdf0e10cSrcweir 			<li><code>osl_Socket_MsgDontRoute</code>
555cdf0e10cSrcweir 			<li><code>osl_Socket_MsgMaxIOVLen</code>
556cdf0e10cSrcweir 			</ul>
557cdf0e10cSrcweir 			@return the number of received bytes, which may be less than BytesToRead.
558cdf0e10cSrcweir 		*/
559cdf0e10cSrcweir 		inline sal_Int32 SAL_CALL recv(void* pBuffer,
560cdf0e10cSrcweir 									   sal_uInt32 BytesToRead,
561cdf0e10cSrcweir 									   oslSocketMsgFlag flags= osl_Socket_MsgNormal);
562cdf0e10cSrcweir 
563cdf0e10cSrcweir 		/** Tries to send BytesToSend data to the connected socket.
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 			@param pBuffer [in] Points to a buffer that contains the send-data.
566cdf0e10cSrcweir 			@param BytesToSend [in] The number of bytes to send. pBuffer must have at least
567cdf0e10cSrcweir 			this size.
568cdf0e10cSrcweir 			@param Flag [in] Modifier for the call. Valid values are:
569cdf0e10cSrcweir 			<ul>
570cdf0e10cSrcweir 			<li><code>osl_Socket_MsgNormal</code>
571cdf0e10cSrcweir 			<li><code>osl_Socket_MsgOOB</code>
572cdf0e10cSrcweir 			<li><code>osl_Socket_MsgPeek</code>
573cdf0e10cSrcweir 			<li><code>osl_Socket_MsgDontRoute</code>
574cdf0e10cSrcweir 			<li><code>osl_Socket_MsgMaxIOVLen</code>
575cdf0e10cSrcweir 			</ul>
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 			@return the number of transfered bytes. It may be less than BytesToSend.
578cdf0e10cSrcweir 		*/
579cdf0e10cSrcweir 		sal_Int32 SAL_CALL send(const void* pBuffer,
580cdf0e10cSrcweir 								sal_uInt32 BytesToSend,
581cdf0e10cSrcweir 								oslSocketMsgFlag= osl_Socket_MsgNormal);
582cdf0e10cSrcweir 	};
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 	class ConnectorSocket : public StreamSocket
585cdf0e10cSrcweir 	{
586cdf0e10cSrcweir 	public:
587cdf0e10cSrcweir 		/** Creates a socket that can connect to a (remote) host.
588cdf0e10cSrcweir 			@param Type For some protocols it might be desirable to
589cdf0e10cSrcweir 			use a different type than sock_stream <code>osl_Socket_TypeSeqPacket</code>
590cdf0e10cSrcweir 			(like <code>osl_Socket_TypeSeqPacket</code>).
591cdf0e10cSrcweir 			Therefore we do not hide this parameter here.
592cdf0e10cSrcweir 		*/
593cdf0e10cSrcweir   		ConnectorSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
594cdf0e10cSrcweir 						oslProtocol	Protocol = osl_Socket_ProtocolIp,
595cdf0e10cSrcweir 						oslSocketType	Type = osl_Socket_TypeStream);
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 		/** Connects the socket to a (remote) host.
599cdf0e10cSrcweir 			@param TargetHost The address of the target.
600cdf0e10cSrcweir 			@param pTimeOut The timeout for blocking. If 0, a default system dependent timeout
601cdf0e10cSrcweir 			                us used.
602cdf0e10cSrcweir 			@return <code> osl_Socket_Ok</code> if connected successfully,
603cdf0e10cSrcweir 			<code>osl_Socket_TimedOut</code> on timeout,
604cdf0e10cSrcweir 			<code>osl_Socket_Interrupted</code> if unblocked forcefully (by osl::Socket::close()),
605cdf0e10cSrcweir 			<code>osl_Socket_Error</code> if connect failed.
606cdf0e10cSrcweir 		*/
607cdf0e10cSrcweir 		oslSocketResult SAL_CALL connect(const SocketAddr& TargetHost, const TimeValue* pTimeout = 0);
608cdf0e10cSrcweir 	};
609cdf0e10cSrcweir 
610cdf0e10cSrcweir 	/** Allows to accept socket connections.
611cdf0e10cSrcweir 	 */
612cdf0e10cSrcweir 	class AcceptorSocket : public Socket
613cdf0e10cSrcweir 	{
614cdf0e10cSrcweir 	public:
615cdf0e10cSrcweir 		inline AcceptorSocket(oslAddrFamily Family = osl_Socket_FamilyInet,
616cdf0e10cSrcweir 							  oslProtocol	Protocol = osl_Socket_ProtocolIp,
617cdf0e10cSrcweir 							  oslSocketType	Type = osl_Socket_TypeStream);
618cdf0e10cSrcweir 
619cdf0e10cSrcweir 		/** Prepare a socket for the accept-call. The socket must have been
620cdf0e10cSrcweir 			bound before to the local address.
621cdf0e10cSrcweir 			@param MaxPendingConnections The maximum number of pending
622cdf0e10cSrcweir 			connections (waiting to be accepted) on this socket. If you use
623cdf0e10cSrcweir 			-1, a system default value is used.
624cdf0e10cSrcweir 			@return <code>sal_True</code> if call was successful.
625cdf0e10cSrcweir 		*/
626cdf0e10cSrcweir 		inline sal_Bool SAL_CALL listen(sal_Int32 MaxPendingConnections= -1);
627cdf0e10cSrcweir 
628cdf0e10cSrcweir 		/** Accepts incoming connections on the socket. You must
629cdf0e10cSrcweir 			precede this call with osl::Socket::bind() and listen().
630cdf0e10cSrcweir 			@param Connection receives the incoming connection.
631cdf0e10cSrcweir 			@return <code>osl_Socket_Ok</code>, if a connection has been accepted,
632cdf0e10cSrcweir 			<code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
633cdf0e10cSrcweir 			<code>osl_Socket_Error</code> on errors.
634cdf0e10cSrcweir 		*/
635cdf0e10cSrcweir 		inline oslSocketResult SAL_CALL acceptConnection( StreamSocket& Connection);
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 		/** Accepts incoming connections on the socket. You must
638cdf0e10cSrcweir 			precede this call with osl::Socket::bind() and listen().
639cdf0e10cSrcweir 			@param PeerAddr receives the address of the connecting entity
640cdf0e10cSrcweir 			(your communication	partner).
641cdf0e10cSrcweir 			@param Connection receives the incoming connection.
642cdf0e10cSrcweir 			@return <code>osl_Socket_Ok</code>, if a connection has been accepted,
643cdf0e10cSrcweir 			<code>osl_Socket_TimedOut</code>, if m_RecvTimeout milliseconds passed without connect,
644cdf0e10cSrcweir 			<code>osl_Socket_Error</code> on errors.
645cdf0e10cSrcweir 		*/
646cdf0e10cSrcweir 		inline oslSocketResult SAL_CALL acceptConnection( StreamSocket&	Connection, SocketAddr & PeerAddr);
647cdf0e10cSrcweir 	};
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 
650cdf0e10cSrcweir 
651cdf0e10cSrcweir     /** A connectionless socket to send and receive datagrams.
652cdf0e10cSrcweir 	 */
653cdf0e10cSrcweir 	class DatagramSocket : public Socket
654cdf0e10cSrcweir 	{
655cdf0e10cSrcweir 	public:
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 		/** Creates a datagram socket.
658cdf0e10cSrcweir 			@param Type is sock_dgram by default.
659cdf0e10cSrcweir 		*/
660cdf0e10cSrcweir 		inline DatagramSocket(oslAddrFamily Family= osl_Socket_FamilyInet,
661cdf0e10cSrcweir 							  oslProtocol	Protocol= osl_Socket_ProtocolIp,
662cdf0e10cSrcweir 							  oslSocketType	Type= osl_Socket_TypeDgram);
663cdf0e10cSrcweir 
664cdf0e10cSrcweir 		/** Tries to receives BufferSize data from the socket, if no error occurs.
665cdf0e10cSrcweir 
666cdf0e10cSrcweir 			@param pSenderAddr [out] You must provide pointer to a SocketAddr.
667cdf0e10cSrcweir 			It will be	filled with the address of the datagrams sender.
668cdf0e10cSrcweir 			If pSenderAddr is 0, it is ignored.
669cdf0e10cSrcweir 			@param pBuffer [out] Points to a buffer that will be filled with the received
670cdf0e10cSrcweir 			datagram.
671cdf0e10cSrcweir 			@param BufferSize [in] The size of pBuffer.
672cdf0e10cSrcweir 			@param Flag [in] Modifier for the call. Valid values are:
673cdf0e10cSrcweir 			<ul>
674cdf0e10cSrcweir 			<li><code>osl_Socket_MsgNormal</code>
675cdf0e10cSrcweir 			<li><code>osl_Socket_MsgOOB</code>
676cdf0e10cSrcweir 			<li><code>osl_Socket_MsgPeek</code>
677cdf0e10cSrcweir 			<li><code>osl_Socket_MsgDontRoute</code>
678cdf0e10cSrcweir 			<li><code>osl_Socket_MsgMaxIOVLen</code>
679cdf0e10cSrcweir 			</ul>
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 			@return the number of received bytes.
682cdf0e10cSrcweir 		*/
683cdf0e10cSrcweir 		inline sal_Int32 SAL_CALL recvFrom(void*  pBuffer,
684cdf0e10cSrcweir 										   sal_uInt32 BufferSize,
685cdf0e10cSrcweir 										   SocketAddr* pSenderAddr= 0,
686cdf0e10cSrcweir 										   oslSocketMsgFlag Flag= osl_Socket_MsgNormal);
687cdf0e10cSrcweir 
688cdf0e10cSrcweir 		/** Tries to send one datagram with BytesToSend size to the given ReceiverAddr.
689cdf0e10cSrcweir 			Since there is only send one packet, the function doesn't care about
690cdf0e10cSrcweir 			packet boundaries.
691cdf0e10cSrcweir 
692cdf0e10cSrcweir 			@param ReceiverAddr [in] A SocketAddr that contains
693cdf0e10cSrcweir 			the destination address for this send.
694cdf0e10cSrcweir 
695cdf0e10cSrcweir 			@param pBuffer [in] Points to a buffer that contains the send-data.
696cdf0e10cSrcweir 			@param BufferSize [in] The number of bytes to send. pBuffer must have at least
697cdf0e10cSrcweir 			this size.
698cdf0e10cSrcweir 			@param Flag [in] Modifier for the call. Valid values are:
699cdf0e10cSrcweir 
700cdf0e10cSrcweir 			<ul>
701cdf0e10cSrcweir 			<li><code>osl_Socket_MsgNormal</code>
702cdf0e10cSrcweir 			<li><code>osl_Socket_MsgOOB</code>
703cdf0e10cSrcweir 			<li><code>osl_Socket_MsgPeek</code>
704cdf0e10cSrcweir 			<li><code>osl_Socket_MsgDontRoute</code>
705cdf0e10cSrcweir 			<li><code>osl_Socket_MsgMaxIOVLen</code>
706cdf0e10cSrcweir 			</ul>
707cdf0e10cSrcweir 
708cdf0e10cSrcweir 			@return the number of transfered bytes.
709cdf0e10cSrcweir 		*/
710cdf0e10cSrcweir 		inline sal_Int32	SAL_CALL sendTo( const SocketAddr& ReceiverAddr,
711cdf0e10cSrcweir 											 const void* pBuffer,
712cdf0e10cSrcweir 											 sal_uInt32 BufferSize,
713cdf0e10cSrcweir 											 oslSocketMsgFlag Flag= osl_Socket_MsgNormal);
714cdf0e10cSrcweir 	};
715cdf0e10cSrcweir 
716cdf0e10cSrcweir }
717cdf0e10cSrcweir 
718cdf0e10cSrcweir #endif
719