Jan Möbius committed Aug 05, 2009 1 /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 2 3 * * * OpenFlipper *  Martin Schultz committed Jul 16, 2015 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38  * Copyright (c) 2001-2015, RWTH-Aachen University * * Department of Computer Graphics and Multimedia * * All rights reserved. * * www.openflipper.org * * * *---------------------------------------------------------------------------* * This file is part of OpenFlipper. * *---------------------------------------------------------------------------* * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions * * are met: * * * * 1. Redistributions of source code must retain the above copyright notice, * * this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. Neither the name of the copyright holder nor the names of its * * contributors may be used to endorse or promote products derived from * * this software without specific prior written permission. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *  Jan Möbius committed Nov 25, 2010 39 * *  Jan Möbius committed Aug 05, 2009 40 41 \*===========================================================================*/  Jan Möbius committed Jan 09, 2019 42   Jan Möbius committed Jul 27, 2009 43 44 45 46  #ifndef LICENSEMANAGER_HH #define LICENSEMANAGER_HH  Jan Möbius committed Jul 28, 2009 47 48 #include  Jan Möbius committed Mar 16, 2011 49 50 51 52 53 54 /** \file LicenseManager.hh * * This interface is used to add copy protection to plugins. \ref securityInterfacePage * */  Jan Möbius committed May 05, 2011 55 56 57 58 59 /* The salt file has to be provided for each plugin. It can be the same for all plugins. See example for details on how this file has to be setup */ #include "salt.hh"  Jan Möbius committed Mar 16, 2011 60 61 62 63 64 65 66 67 /** \brief License management base class * * See \ref securityInterfacePage for Details on how to use it. * * The class is used by plugins to integrate license management. It will check the license, * generate license requests and prevent the plugin from loading if an invalid license or no license * is found. */  Jan Möbius committed Jan 05, 2011 68 class LicenseManager : public QObject, SecurityInterface {  Jan Möbius committed Jul 27, 2009 69 70 71 72 73 74 75 76 77 78 79  Q_OBJECT Q_INTERFACES(SecurityInterface) public: virtual ~LicenseManager(); LicenseManager(); public :  Jan Möbius committed Jul 28, 2009 80  /** This function is overloaded and will not allow to unblock signals  Jan Möbius committed Mar 16, 2011 81  if the plugin is not authenticated.  Jan Möbius committed Jul 28, 2009 82  */  Jan Möbius committed Jul 27, 2009 83  void blockSignals( bool _state);  Jan Möbius committed Jul 28, 2009 84   Jan Möbius committed Mar 16, 2011 85  /** Return if the plugin has successfully passed the authentication.  Jan Möbius committed Jul 28, 2009 86  */  Jan Möbius committed Jul 27, 2009 87 88 89  bool authenticated(); public slots:  Jan Möbius committed Jul 28, 2009 90  /** Call this function for plugin authentication. If it returns true,  Jan Möbius committed Mar 16, 2011 91  the authentication has been successful. Otherwise the core will  Jan Möbius committed Jul 28, 2009 92 93  stop loading the plugin. Additionally the plugin will make itself unusable by not allowing any signal slot connections.  Jan Möbius committed Mar 16, 2011 94   Jan Möbius committed Jul 28, 2009 95  */  Jan Möbius committed Jan 05, 2011 96 97  bool authenticate();  Jan Möbius committed Mar 16, 2011 98 99  /** if authenticate returns false, this string will contain the license information required * to generate a license request and the error that caused the failure.  Jan Möbius committed Jan 05, 2011 100 101  */ QString licenseError();  Jan Möbius committed Jul 27, 2009 102 103  private:  Daniel Gotzen committed Nov 17, 2015 104 105 106 107  bool timestampOk();  Jan Möbius committed Jul 28, 2009 108  /** This is used to get the plugins Name from derived classes  Jan Möbius committed Mar 16, 2011 109  The plugin name is the usual name of the plugin  Jan Möbius committed Jul 28, 2009 110 111  */ virtual QString name() = 0;  Jan Möbius committed Jul 27, 2009 112   Jan Möbius committed Jul 28, 2009 113  /** This function is special to the LicenseManager. It is used to  Jan Möbius committed Mar 16, 2011 114  find the plugin when checking its hash value.  Jan Möbius committed Jul 28, 2009 115  */  Jan Möbius committed Jul 27, 2009 116 117  virtual QString pluginFileName();  Jan Möbius committed Mar 16, 2011 118  /// This flag is true if authentication was successful  Jan Möbius committed Jul 28, 2009 119  bool authenticated_;  Jan Möbius committed Jan 05, 2011 120 121 122  /// License information string QString authstring_;  Jan Möbius committed Jul 28, 2009 123   Jan Möbius committed Jul 27, 2009 124 125  protected :  Jan Möbius committed Jul 28, 2009 126 127 128 129  /** This function is overloaded in the security interface. If the plugin is not authenticated, all connections will be automatically removed again. */  Jan Möbius committed Mar 16, 2011 130  void connectNotify ( const char * signal );  Jan Möbius committed Jul 27, 2009 131 132 133  };  Jan Möbius committed Mar 16, 2011 134 #endif // LICENSEMANAGER_HH