1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <osl/pipe.hxx> 29 #include <osl/socket.hxx> 30 #include <rtl/unload.h> 31 32 #include <com/sun/star/connection/XConnection.hpp> 33 34 namespace io_acceptor { 35 36 extern rtl_StandardModuleCount g_moduleCount; 37 38 class PipeAcceptor 39 { 40 public: 41 PipeAcceptor( const ::rtl::OUString &sPipeName , const ::rtl::OUString &sConnectionDescription ); 42 43 void init(); 44 ::com::sun::star::uno::Reference < ::com::sun::star::connection::XConnection > accept( ); 45 46 void stopAccepting(); 47 48 ::osl::Mutex m_mutex; 49 ::osl::Pipe m_pipe; 50 ::rtl::OUString m_sPipeName; 51 ::rtl::OUString m_sConnectionDescription; 52 sal_Bool m_bClosed; 53 }; 54 55 class SocketAcceptor 56 { 57 public: 58 SocketAcceptor( const ::rtl::OUString & sSocketName , 59 sal_uInt16 nPort, 60 sal_Bool bTcpNoDelay, 61 const ::rtl::OUString &sConnectionDescription ); 62 63 void init(); 64 ::com::sun::star::uno::Reference < ::com::sun::star::connection::XConnection > accept(); 65 66 void stopAccepting(); 67 68 ::osl::SocketAddr m_addr; 69 ::osl::AcceptorSocket m_socket; 70 ::rtl::OUString m_sSocketName; 71 ::rtl::OUString m_sConnectionDescription; 72 sal_uInt16 m_nPort; 73 sal_Bool m_bTcpNoDelay; 74 sal_Bool m_bClosed; 75 }; 76 77 } 78 79