xref: /aoo41x/main/io/source/acceptor/acceptor.hxx (revision 36cac86c)
1*36cac86cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*36cac86cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*36cac86cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*36cac86cSAndrew Rist  * distributed with this work for additional information
6*36cac86cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*36cac86cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*36cac86cSAndrew Rist  * "License"); you may not use this file except in compliance
9*36cac86cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*36cac86cSAndrew Rist  *
11*36cac86cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*36cac86cSAndrew Rist  *
13*36cac86cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*36cac86cSAndrew Rist  * software distributed under the License is distributed on an
15*36cac86cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*36cac86cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*36cac86cSAndrew Rist  * specific language governing permissions and limitations
18*36cac86cSAndrew Rist  * under the License.
19*36cac86cSAndrew Rist  *
20*36cac86cSAndrew Rist  *************************************************************/
21*36cac86cSAndrew Rist 
22*36cac86cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <osl/pipe.hxx>
25cdf0e10cSrcweir #include <osl/socket.hxx>
26cdf0e10cSrcweir #include <rtl/unload.h>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <com/sun/star/connection/XConnection.hpp>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir namespace io_acceptor {
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 	extern rtl_StandardModuleCount g_moduleCount;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 	class PipeAcceptor
35cdf0e10cSrcweir 	{
36cdf0e10cSrcweir 	public:
37cdf0e10cSrcweir 		PipeAcceptor( const ::rtl::OUString &sPipeName , const ::rtl::OUString &sConnectionDescription );
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 		void init();
40cdf0e10cSrcweir 		::com::sun::star::uno::Reference < ::com::sun::star::connection::XConnection >  accept(  );
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 		void stopAccepting();
43cdf0e10cSrcweir 
44cdf0e10cSrcweir         ::osl::Mutex m_mutex;
45cdf0e10cSrcweir 		::osl::Pipe m_pipe;
46cdf0e10cSrcweir 		::rtl::OUString m_sPipeName;
47cdf0e10cSrcweir 		::rtl::OUString m_sConnectionDescription;
48cdf0e10cSrcweir 		sal_Bool m_bClosed;
49cdf0e10cSrcweir 	};
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	class SocketAcceptor
52cdf0e10cSrcweir 	{
53cdf0e10cSrcweir 	public:
54cdf0e10cSrcweir 		SocketAcceptor( const ::rtl::OUString & sSocketName ,
55cdf0e10cSrcweir 						sal_uInt16 nPort,
56cdf0e10cSrcweir 						sal_Bool bTcpNoDelay,
57cdf0e10cSrcweir 						const ::rtl::OUString &sConnectionDescription );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 		void init();
60cdf0e10cSrcweir 		::com::sun::star::uno::Reference < ::com::sun::star::connection::XConnection > accept();
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 		void stopAccepting();
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 		::osl::SocketAddr m_addr;
65cdf0e10cSrcweir 		::osl::AcceptorSocket m_socket;
66cdf0e10cSrcweir 		::rtl::OUString m_sSocketName;
67cdf0e10cSrcweir 		::rtl::OUString m_sConnectionDescription;
68cdf0e10cSrcweir 		sal_uInt16 m_nPort;
69cdf0e10cSrcweir 		sal_Bool m_bTcpNoDelay;
70cdf0e10cSrcweir 		sal_Bool m_bClosed;
71cdf0e10cSrcweir 	};
72cdf0e10cSrcweir 
73cdf0e10cSrcweir }
74cdf0e10cSrcweir 
75