Bump version to 6.0-36
[LibreOffice.git] / xmlsecurity / source / xmlsec / nss / xsec_nss.cxx
blob9e424a4e5d797230c48e75c415754d4d74066083
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <sal/config.h>
23 #include <osl/thread.h>
24 #include <cppuhelper/factory.hxx>
25 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
27 #include "seinitializer_nssimpl.hxx"
28 #include "xmlsignature_nssimpl.hxx"
29 #include "xmlsecuritycontext_nssimpl.hxx"
30 #include <xsec_xmlsec.hxx>
31 #include "securityenvironment_nssimpl.hxx"
33 using namespace ::cppu;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::lang;
36 using namespace ::com::sun::star::registry;
38 extern "C"
41 void* SAL_CALL nss_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ )
43 void* pRet = nullptr;
44 Reference< XSingleServiceFactory > xFactory ;
46 if( pImplName != nullptr && pServiceManager != nullptr )
48 #ifdef XMLSEC_CRYPTO_NSS
49 if( SEInitializer_NssImpl_getImplementationName().equalsAscii( pImplName ) )
51 xFactory.set( createSingleFactory(
52 static_cast< XMultiServiceFactory * >( pServiceManager ),
53 OUString::createFromAscii( pImplName ),
54 SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) );
56 else if( XMLSignature_NssImpl::impl_getImplementationName().equalsAscii( pImplName ) )
58 xFactory = XMLSignature_NssImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
60 else if( XMLSecurityContext_NssImpl::impl_getImplementationName().equalsAscii( pImplName ) )
62 xFactory = XMLSecurityContext_NssImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
64 else if( SecurityEnvironment_NssImpl::impl_getImplementationName().equalsAscii( pImplName ) )
66 xFactory = SecurityEnvironment_NssImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
68 #else
69 if( ONSSInitializer_getImplementationName().equalsAscii( pImplName ) )
71 xFactory.set( createSingleFactory(
72 static_cast< XMultiServiceFactory * >( pServiceManager ),
73 OUString::createFromAscii( pImplName ),
74 ONSSInitializer_createInstance, ONSSInitializer_getSupportedServiceNames() ) );
76 #endif
79 if( xFactory.is() ) {
80 xFactory->acquire() ;
81 pRet = xFactory.get() ;
84 return pRet ;
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */