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