CR - License Manager support added to Producer

"Bruce Johnson" <[email protected]>
Newsgroups gmane.comp.multimedia.helix.devel
Message-ID <[email protected]>
Synopsis

========

 

Implementation of license manager for Producer

 

Branches: HEAD, PRODUCER_13_0_RN

 

Description

===========

 

* Implemented licensing validation for producer

 

Testing Performed

=================

 

* used license file to verify license validation

 

Platforms Tested: win32-i386-vc7

Build verified: win32-i386-vc7

_______________________________________________
Helix-client-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
jobfactory_cpp.txt (text/plain, 773 B)
Index: client/encodesvc/engine/encsession/jobfactory.cpp
===================================================================
RCS file: /cvsroot/client/encodesvc/engine/encsession/jobfactory.cpp,v
retrieving revision 1.7
diff -u -r1.7 jobfactory.cpp
--- client/encodesvc/engine/encsession/jobfactory.cpp	22 May 2009 10:24:41 -0000	1.7
+++ client/encodesvc/engine/encsession/jobfactory.cpp	6 Jun 2009 17:30:23 -0000
@@ -444,6 +444,7 @@
         IsEqualIID(CLSID_IHXTDestinationEnumerator, riid)    ||
         IsEqualIID(CLSID_IHXTCodecInfoManager, riid)         ||
         IsEqualIID(CLSID_IHXTCaptureDeviceInfoManager, riid) ||
+        IsEqualIID(CLSID_IHXTLicenseManager, riid)	 ||
         IsEqualIID(CLSID_IHXTEncodingJob, riid))
     {
         res = HXR_UNEXPECTED;
encoding_service_plugin_cpp.txt (text/plain, 1.3 KB)
Index: client/encodesvc/engine/encsession/encoding_service_plugin.cpp
===================================================================
RCS file: /cvsroot/client/encodesvc/engine/encsession/encoding_service_plugin.cpp,v
retrieving revision 1.5
diff -u -r1.5 encoding_service_plugin.cpp
--- client/encodesvc/engine/encsession/encoding_service_plugin.cpp	22 May 2009 10:24:41 -0000	1.5
+++ client/encodesvc/engine/encsession/encoding_service_plugin.cpp	6 Jun 2009 17:30:22 -0000
@@ -82,6 +82,7 @@
 #include "hxencodesvc.h"
 #include "chxrecordengine.h"
 #include "hxtlogutil.h"
+#include "licensemanager.h"
 
 #ifdef _DEBUG
 #undef HX_THIS_FILE             
@@ -128,6 +129,7 @@
     CLSID_IHXTCaptureDeviceInfoManager,
     CLSID_IHXTEncodingJob,
     CLSID_IHXRecordEngine,
+	CLSID_IHXTLicenseManager,
     GUID_NULL
 };
 
@@ -434,6 +436,14 @@
         // Create the record engine object
         retVal = CHXRecordEngine::CreateRecordEngine(&rpUnknown);
     }
+    else if (IsEqualCLSID(rclsid, CLSID_IHXTLicenseManager))
+    {
+        // Clear the flag saying we need to AddRef()
+        bNeedAddRef = FALSE;
+        // Create the record engine object
+        CHXTLicenseManager::GetInstance();
+		retVal = HXR_OK;
+    }
     else
     {
         retVal = HXR_NOINTERFACE;
encodingjob_cpp.txt (text/plain, 1.5 KB)
Index: client/encodesvc/engine/encsession/encodingjob.cpp
===================================================================
RCS file: /cvsroot/client/encodesvc/engine/encsession/encodingjob.cpp,v
retrieving revision 1.8
diff -u -r1.8 encodingjob.cpp
--- client/encodesvc/engine/encsession/encodingjob.cpp	22 May 2009 10:24:41 -0000	1.8
+++ client/encodesvc/engine/encsession/encodingjob.cpp	6 Jun 2009 17:30:22 -0000
@@ -73,6 +73,7 @@
 #include "hxteventobject.h"
 
 #include "jobserial.h"
+#include "licensemanager.h"
 
 #include "dllpath.h"
 
@@ -165,7 +166,7 @@
 	
 	res = m_spScheduler->StartScheduler();
     }
-    
+
     HX_ASSERT(SUCCEEDED(res));
 }
 
@@ -282,6 +283,15 @@
     // Lock exclusive access to member varibles
     m_mutEncodingJob.Lock();
     
+	// Validate license
+	CHXTLicenseManager *pLicenseManager = CHXTLicenseManager::GetInstance();
+	if (pLicenseManager == NULL || pLicenseManager->PerformLicenseValidation() != HXR_OK)
+	{
+		HX_ASSERT(FALSE);
+		res = HXR_NOT_LICENSED;
+		HXTLOG_APPROVED(LC_APP_ERROR, FA_SDK_CONFIG, "License validation failed");
+	}
+	 
     // Validate state
     if (!m_spFactory)
     {
@@ -1152,7 +1162,6 @@
     {				
 	res = HXR_OK; // XXXLY - Move this to base class?
     }
-    
     else
     {
 	res = HXR_S_NOT_HANDLED;
@@ -1966,7 +1975,7 @@
 STDMETHODIMP CHXTEncodingJob::ReadFromFile(const char* szPathname, BOOL bForceInitialization/*=FALSE*/, IHXTPropertyBag** ppInitErrorBag/*=NULL*/)
 {
     HX_RESULT res = HXR_OK;
-    
+
     //these shouldnt be used for now
     //HX_ASSERT( ppInitErrorBag==NULL );
encsession_umakefil.txt (text/plain, 686 B)
Index: client/encodesvc/engine/encsession/Umakefil
===================================================================
RCS file: /cvsroot/client/encodesvc/engine/encsession/Umakefil,v
retrieving revision 1.7
diff -u -r1.7 Umakefil
--- client/encodesvc/engine/encsession/Umakefil	22 May 2009 10:34:04 -0000	1.7
+++ client/encodesvc/engine/encsession/Umakefil	6 Jun 2009 17:30:22 -0000
@@ -109,6 +109,7 @@
                    "inputgroup.cpp",
                    "inputpargroup.cpp",
                    "inputseqgroup.cpp",
+                   "licensemanager.cpp"
                    "outputdest.cpp",
                    "prefilter.cpp", 
                    "prefiltermanager.cpp",
ihxtencodingjob_h.txt (text/plain, 1.8 KB)
Index: client/encodesvc/include/ihxtencodingjob.h
===================================================================
RCS file: /cvsroot/client/encodesvc/include/ihxtencodingjob.h,v
retrieving revision 1.6
diff -u -r1.6 ihxtencodingjob.h
--- client/encodesvc/include/ihxtencodingjob.h	26 May 2009 19:36:46 -0000	1.6
+++ client/encodesvc/include/ihxtencodingjob.h	6 Jun 2009 17:30:24 -0000
@@ -80,6 +80,7 @@
 _INTERFACE IHXTInputStream;
 _INTERFACE IHXTCodecUpdater;
 _INTERFACE IHXSourceHandler;
+_INTERFACE IHXTLicenseManager;
 
 
 
@@ -249,7 +250,7 @@
  *
  *	Properties (see ihxtconstants.h for further details):
  *
- *	kPropObjectName - Descriptive name of object instance
+ *  kPropObjectName - Descriptive name of object instance
  *	kPropEnableTwoPass - Enables two-pass encoding
  */
 
@@ -1418,6 +1419,49 @@
 //$ EndPrivate.
 
 
+/****************************************************************************
+ *
+ *  Interface:
+ *
+ *  IHXTLicenseManager
+ *
+ *  Purpose:
+ *
+ *  This provides an interface for license validation
+ *
+ *  {5d979e05-5c7f-4922-9b24-60d432efc5d9}
+ *
+ *
+ */
+
+// {5d979e05-5c7f-4922-9b24-60d432efc5d9}
+DEFINE_GUID(IID_IHXTLicenseManager, 
+0x5d979e05, 0x5c7f, 0x4922, 0x9b, 0x24, 0x60, 0xd4, 0x32, 0xef, 0xc5, 0xd9);
+
+/* We want to be able to create this object from the common class factory */
+#define CLSID_IHXTLicenseManager IID_IHXTLicenseManager
+
+#undef  INTERFACE
+#define INTERFACE   IHXTLicenseManager
+
+DECLARE_INTERFACE_(IHXTLicenseManager, IUnknown)
+{
+    /******
+    	Set the license directory where license files can be found
+    *******/
+    STDMETHOD(SetLicenseFileDirectory)(THIS_ const char *pDirectory) PURE;
+
+    /******
+    	Validate licenses
+    *******/
+    STDMETHOD(PerformLicenseValidation)(THIS) PURE;
+
+};
+
+//$ Private.
+HXT_MAKE_SMART_PTR(IHXTLicenseManager)
+//$ EndPrivate.
+
licensemanager.cpp (text/plain, 3.3 KB)
/* ***** BEGIN LICENSE BLOCK *****
 *
 * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
 *
 * The contents of this file, and the files included with this file,
 * are subject to the current version of the RealNetworks Public
 * Source License (the "RPSL") available at
 * http://www.helixcommunity.org/content/rpsl unless you have licensed
 * the file under the current version of the RealNetworks Community
 * Source License (the "RCSL") available at
 * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
 * will apply. You may also obtain the license terms directly from
 * RealNetworks.  You may not use this file except in compliance with
 * the RPSL or, if you have a valid RCSL with RealNetworks applicable
 * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
 * the rights, obligations and limitations governing use of the
 * contents of the file.
 *
 * Alternatively, the contents of this file may be used under the
 * terms of the GNU General Public License Version 2 (the
 * "GPL") in which case the provisions of the GPL are applicable
 * instead of those above. If you wish to allow use of your version of
 * this file only under the terms of the GPL, and not to allow others
 * to use your version of this file under the terms of either the RPSL
 * or RCSL, indicate your decision by deleting the provisions above
 * and replace them with the notice and other provisions required by
 * the GPL. If you do not delete the provisions above, a recipient may
 * use your version of this file under the terms of any one of the
 * RPSL, the RCSL or the GPL.
 *
 * This file is part of the Helix DNA Technology. RealNetworks is the
 * developer of the Original Code and owns the copyrights in the
 * portions it created.
 *
 * This file, and the files included with this file, is distributed
 * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
 * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
 * ENJOYMENT OR NON-INFRINGEMENT.
 *
 * Technology Compatibility Kit Test Suite(s) Location:
 *    http://www.helixcommunity.org/content/tck
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** */


#include "hxtypes.h"
#include "licensemanager.h"

#ifdef _DEBUG
#undef HX_THIS_FILE		
static char HX_THIS_FILE[] = __FILE__;
#endif

// Implements basic IUnknown functionality
BEGIN_INTERFACE_LIST(CHXTLicenseManager)
    INTERFACE_LIST_ENTRY(IID_IHXTLicenseManager, IHXTLicenseManager)
END_INTERFACE_LIST

CHXTLicenseManager *s_pLicenseManager = NULL;

CHXTLicenseManager* CHXTLicenseManager::GetInstance()
{
    if ( !s_pLicenseManager )
    {
        s_pLicenseManager = new CHXTLicenseManager();
        HX_ASSERT( s_pLicenseManager );
    }

    return s_pLicenseManager;
}

CHXTLicenseManager::CHXTLicenseManager() 
{
}

CHXTLicenseManager::~CHXTLicenseManager()
{
    // clear singleton
    if ( s_pLicenseManager )
    {
        s_pLicenseManager = NULL;
    }   
}

STDMETHODIMP 
CHXTLicenseManager::SetLicenseFileDirectory(const char *pDirectory)
{
    HX_RESULT res = HXR_OK;

	return res;
}

//
// License Key Validation API
//
// Note: This validates but does NOT parse the license.
//

STDMETHODIMP 
CHXTLicenseManager::PerformLicenseValidation()
{
    return HXR_OK;
}
licensemanager.h (text/plain, 3 KB)
/* ***** BEGIN LICENSE BLOCK *****
 *
 * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
 *
 * The contents of this file, and the files included with this file,
 * are subject to the current version of the RealNetworks Public
 * Source License (the "RPSL") available at
 * http://www.helixcommunity.org/content/rpsl unless you have licensed
 * the file under the current version of the RealNetworks Community
 * Source License (the "RCSL") available at
 * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
 * will apply. You may also obtain the license terms directly from
 * RealNetworks.  You may not use this file except in compliance with
 * the RPSL or, if you have a valid RCSL with RealNetworks applicable
 * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
 * the rights, obligations and limitations governing use of the
 * contents of the file.
 *
 * Alternatively, the contents of this file may be used under the
 * terms of the GNU General Public License Version 2 (the
 * "GPL") in which case the provisions of the GPL are applicable
 * instead of those above. If you wish to allow use of your version of
 * this file only under the terms of the GPL, and not to allow others
 * to use your version of this file under the terms of either the RPSL
 * or RCSL, indicate your decision by deleting the provisions above
 * and replace them with the notice and other provisions required by
 * the GPL. If you do not delete the provisions above, a recipient may
 * use your version of this file under the terms of any one of the
 * RPSL, the RCSL or the GPL.
 *
 * This file is part of the Helix DNA Technology. RealNetworks is the
 * developer of the Original Code and owns the copyrights in the
 * portions it created.
 *
 * This file, and the files included with this file, is distributed
 * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
 * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
 * ENJOYMENT OR NON-INFRINGEMENT.
 *
 * Technology Compatibility Kit Test Suite(s) Location:
 *    http://www.helixcommunity.org/content/tck
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** */


#ifndef _LICENSEMANAGER_H
#define _LICENSEMANAGER_H

#include "hxcom.h"
#include "hxccf.h"
#include "unkimp.h"
#include "ihxpckts.h"
#include "hxtsmartpointer.h"
#include "ihxtencodingjob.h"

using namespace std;


class CHXTLicenseManager : public CUnknownIMP
                        , public IHXTLicenseManager
{
    //
    // singleton implmentation
    //

	DECLARE_UNKNOWN(CHXTLicenseManager)	
public:
    // singleton implementation
    static CHXTLicenseManager* GetInstance();

	CHXTLicenseManager();

    //
    // License Key Validation API
    //

	STDMETHOD(SetLicenseFileDirectory)(THIS_ const char *pDirectory);
    STDMETHOD(PerformLicenseValidation)(THIS);
private:
	virtual ~CHXTLicenseManager();

	char *m_pDirectory;
};


#endif // _LICENSEMANAGER_H
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.