4 * Author: Lukas Zeller (luz@synthesis.ch)
6 * Serial number generator and checker
8 * Copyright (c) 2003-2009 by Synthesis AG (www.synthesis.ch)
10 * 2003-02-11 : luz : created
17 #include "generic_types.h"
28 #define SYSER_VARIANT_UNKNOWN 0
29 #define SYSER_VARIANT_STD 1
30 #define SYSER_VARIANT_PRO 2
31 #define SYSER_VARIANT_CUSTOM 3
32 #define SYSER_VARIANT_DEMO 10
36 #define SYSER_EXTRA_ID_NONE 0
37 #define SYSER_EXTRA_ID_PROTO 1
38 #define SYSER_EXTRA_ID_DBG 2
40 #define SYSER_EXTRA_ID_GOOSYNC 10 // Toffa.com Goosync special version
41 #define SYSER_EXTRA_ID_FONELINK 11 // novamedia FoneLink special version
42 #define SYSER_EXTRA_ID_SOOCIAL 12 // soocial.com special version
49 // - universal codes for all PDA clients = pocketPC codes
50 #define SYSER_PRODCODE_CLIENT_PDA_STD 2 // this is the former PocketPC STD code (most widespread)
51 #define SYSER_PRODCODE_CLIENT_PDA_PRO 5 // this is the former PocketPC PRO code (most widespread)
53 // Old platform specific PDA codes (still valid, but no longer required)
55 #define SYSER_PRODCODE_CLIENT_PALM_STD 1 // for PalmOS
56 #define SYSER_PRODCODE_CLIENT_PPC_STD 2 // for PocketPC
57 #define SYSER_PRODCODE_CLIENT_PALMPPC_STD 3 // combined for PPC and PalmOS
59 #define SYSER_PRODCODE_CLIENT_PALM_PRO 4 // for PalmOS
60 #define SYSER_PRODCODE_CLIENT_PPC_PRO 5 // for PocketPC
61 #define SYSER_PRODCODE_CLIENT_PALMPPC_PRO 6 // combined for PPC and PalmOS
63 #define SYSER_PRODCODE_CLIENT_SYMBIAN_STD 18
64 #define SYSER_PRODCODE_CLIENT_SYMBIAN_PRO 19
66 #define SYSER_PRODCODE_CLIENT_MSSMP_STD 13 // for Microsoft SmartPhone (2003)
67 #define SYSER_PRODCODE_CLIENT_MSSMP_PRO 14 // for Microsoft SmartPhone (2003)
71 #define SYSER_PRODCODE_CLIENT_ODBC_STD_WIN32 7 // Win32 ODBC PRO
72 #define SYSER_PRODCODE_CLIENT_ODBC_STD_MACOSX 8 // for Mac OS X
73 #define SYSER_PRODCODE_CLIENT_ODBC_STD_LINUX 9 // for Linux
75 #define SYSER_PRODCODE_CLIENT_ODBC_PRO_WIN32 10 // Win32 ODBC PRO
76 #define SYSER_PRODCODE_CLIENT_ODBC_PRO_MACOSX 11 // for Mac OS X
77 #define SYSER_PRODCODE_CLIENT_ODBC_PRO_LINUX 12 // for Linux
81 #define SYSER_PRODCODE_CLIENT_DEMO 15 // Demo Client (Text only)
84 #define SYSER_PRODCODE_CLIENT_OUTLOOK_STD 16 // Outlook Client STD
85 #define SYSER_PRODCODE_CLIENT_OUTLOOK_PRO 17 // Outlook Client PRO (with email)
88 #define SYSER_PRODCODE_CLIENT_LIB_WIN32 18 // Win32 ODBC PRO
89 #define SYSER_PRODCODE_CLIENT_LIB_MACOSX 19 // for Mac OS X
90 #define SYSER_PRODCODE_CLIENT_LIB_LINUX 20 // for Linux
91 #define SYSER_PRODCODE_CLIENT_LIB_SYMBIAN 21 // for Symbian
92 #define SYSER_PRODCODE_CLIENT_LIB_WM 22 // for Windows Mobile
93 #define SYSER_PRODCODE_CLIENT_LIB_PALM 23 // for PALMOS
94 #define SYSER_PRODCODE_CLIENT_LIB_IPHONEOS 28 // iPhone OS
95 #define SYSER_PRODCODE_CLIENT_LIB_ANDROID 40 // Android
98 #define SYSER_PRODCODE_CLIENT_LIB_ALL 24 // ALL Platforms
99 #define SYSER_PRODCODE_CLIENT_LIB_MOBILE 25 // ALL Mobile Platforms
100 #define SYSER_PRODCODE_CLIENT_LIB_DESK 26 // ALL Desktop Platforms
102 #define SYSER_PRODCODE_CLIENT_LIB_DEMO 27 // All DEMO Libraries
105 // - Server product flags (no flags -> only XPT version allowed)
106 #define SYSER_PRODFLAG_CLIENT_DMU 0x01 // DMU enabled
111 // - Server Libraries
112 #define SYSER_PRODCODE_SERVER_LIB_WIN32 39 // Win32 ODBC PRO
113 #define SYSER_PRODCODE_SERVER_LIB_MACOSX 29 // for Mac OS X
114 #define SYSER_PRODCODE_SERVER_LIB_LINUX 30 // for Linux
115 #define SYSER_PRODCODE_SERVER_LIB_SYMBIAN 31 // for Symbian
116 #define SYSER_PRODCODE_SERVER_LIB_WM 32 // for Windows Mobile
117 #define SYSER_PRODCODE_SERVER_LIB_PALM 33 // for PALMOS
118 #define SYSER_PRODCODE_SERVER_LIB_IPHONEOS 38 // iPhone OS
119 #define SYSER_PRODCODE_SERVER_LIB_ANDROID 41 // Android
122 #define SYSER_PRODCODE_SERVER_LIB_ALL 34 // ALL Platforms
123 #define SYSER_PRODCODE_SERVER_LIB_MOBILE 35 // ALL Mobile Platforms
124 #define SYSER_PRODCODE_SERVER_LIB_DESK 36 // ALL Desktop Platforms
126 #define SYSER_PRODCODE_SERVER_LIB_DEMO 37 // All DEMO Libraries
129 #define SYSER_PRODCODE_SERVER_DEMO 50 // Demo Server (Text only)
131 #define SYSER_PRODCODE_SERVER_STD 51 // STD Server (with ODBC)
132 #define SYSER_PRODCODE_SERVER_PRO 52 // PRO Server (with ODBC)
134 #define SYSER_PRODCODE_SERVER_XML2GO 53 // xml2go Server (with ODBC and XML2GO)
136 // - Server product flags (no ISAPI or APACHE flags -> only XPT version allowed)
137 #define SYSER_PRODFLAG_SERVER_ISAPI 0x01 // ISAPI version
138 #define SYSER_PRODFLAG_SERVER_APACHE 0x02 // Apache version
139 #define SYSER_PRODFLAG_SERVER_SDKAPI 0x04 // external DB API plugins allowed
142 // special flag: if set, time code in license does not specify when temporary
143 // license expires, but for up to what release date (hard-coded into the binary)
144 // this code is valid. This allows to issue time unlimited licenses that will allow
145 // be used with new releases only up to a defined time period after issuing.
146 // If set, the duration bits (encoded absolute month) are no longer the
147 // expiry date, but the max release date supported.
148 // If this bit is set in SYSER_NEEDED_PRODUCT_FLAGS, this means that the
149 // license must either have the bit set, too, or the license must be a
150 // time limited license. Only licenses limited neither in time nor in release
151 // date will be rejected.
152 #define SYSER_PRODFLAG_MAXRELDATE 0x80
156 #define SYSER_LTYP_STANDARD 0 // standard license, nothing special
157 #define SYSER_LTYP_SYN_REG 1 // requires activation at synthesis
158 #define SYSER_LTYP_S2G_REG 2 // requires activation at space2go
161 // registration checking URLs
162 #define SYSER_SYN_REG_HOST "www.synthesis.ch"
163 #define SYSER_SYN_REG_DOC "/reg/"
164 #define SYSER_S2G_REG_HOST "sync.space2go.com"
165 #define SYSER_S2G_REG_DOC "/reg/"
167 // update checking URL
168 #define SYSER_SYN_UDC_HOST "www.synthesis.ch"
169 #define SYSER_SYN_UDC_DOC "/udc/"
176 // size of serial number
177 #define SYSER_SERIALNUM_SIZE 20 // 4*4 chars, plus 3 dashes, plus one terminator = 16+3+1 = 20
178 #define SYSER_SERIALNUM_MANGLED_SIZE 17 // dashes are optimized away, so 4*4+1 = 17
179 // max size of "name" string (only that much will be stored and tested)
180 #define SYSER_NAMESTRING_MAX 80 // should be enough for name and email
184 #define SYSER_CRC32_SEED ((uInt32)4119203362LL) // phone Tiefenau :-)
186 #define SYSER_CRC32_SEED 4119203362 // phone Tiefenau :-)
189 // make sure we don't ever include the generator into a product
190 #ifndef SYSYNC_VERSION_MAJOR
193 void generateSySerial(
194 char *outbuf, // must be able to receive SYSER_SERIALNUM_SIZE chars (including terminator)
195 uInt8 productflags, uInt16 productcode, uInt8 licensetype, uInt16 quantity, uInt8 duration,
202 #if defined SYSER_REGISTRATION || !defined(SYSYNC_VERSION_MAJOR)
204 bool getSySerialInfo(
206 uInt8 &productflags, uInt16 &productcode, uInt8 &licensetype, uInt16 &quantity, uInt8 &duration,
207 uInt32 &crc, uInt32 &infocrc,
211 #endif // SYSER_REGISTRATION
214 uInt32 addToCrc(uInt32 aCRC, uInt8 aByte);
215 uInt32 addNameToCRC(uInt32 aCRC, const char *aName, bool aMangled=false, uInt16 aMaxChars=32000);
219 } // namespace sysync