bump product version to 4.1.6.2
[LibreOffice.git] / xmlsecurity / source / xmlsec / nss / xsec_nss.cxx
blob53bea6485672e2c16708d6da599199af343d8fef
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>
22 #include <stdio.h>
24 #include <osl/mutex.hxx>
25 #include <osl/thread.h>
26 #include <cppuhelper/factory.hxx>
27 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
29 #include "seinitializer_nssimpl.hxx"
30 #include "xmlsignature_nssimpl.hxx"
31 #include "xmlencryption_nssimpl.hxx"
32 #include "xmlsecuritycontext_nssimpl.hxx"
33 #include "securityenvironment_nssimpl.hxx"
35 using namespace ::rtl;
36 using namespace ::cppu;
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::lang;
39 using namespace ::com::sun::star::registry;
41 extern "C"
44 void* SAL_CALL nss_component_getFactory( const sal_Char* pImplName , void* pServiceManager , void* /*pRegistryKey*/ )
46 void* pRet = 0;
47 Reference< XSingleServiceFactory > xFactory ;
49 if( pImplName != NULL && pServiceManager != NULL )
51 #ifdef XMLSEC_CRYPTO_NSS
52 if( SEInitializer_NssImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
54 xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
55 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
56 OUString::createFromAscii( pImplName ),
57 SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) );
59 else if( XMLSignature_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
61 xFactory = XMLSignature_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
63 else if( XMLSecurityContext_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
65 xFactory = XMLSecurityContext_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
67 else if( SecurityEnvironment_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
69 xFactory = SecurityEnvironment_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
71 else if( XMLEncryption_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
73 xFactory = XMLEncryption_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
75 #else
76 if( ONSSInitializer_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
78 xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
79 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
80 OUString::createFromAscii( pImplName ),
81 ONSSInitializer_createInstance, ONSSInitializer_getSupportedServiceNames() ) );
83 #endif
86 if( xFactory.is() ) {
87 xFactory->acquire() ;
88 pRet = xFactory.get() ;
91 return pRet ;
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */