1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
13 * Szabo, Janos Zoltan – initial implementation
15 ******************************************************************************/
21 /* Initial features */
22 #define FEATURE_TTCN3 0x1u
23 #define FEATURE_CODEGEN 0x2u
24 #define FEATURE_TPGEN 0x4u
25 #define FEATURE_SINGLE 0x8u
26 #define FEATURE_MCTR 0x10u
27 #define FEATURE_HC 0x20u
28 #define FEATURE_LOGFORMAT 0x40u
29 /* Added in 1.2.pl0 */
30 #define FEATURE_ASN1 0x80u
31 #define FEATURE_RAW 0x100u
32 #define FEATURE_BER 0x200u
33 #define FEATURE_PER 0x400u
34 /* Added in 1.5.pl7 */
35 #define FEATURE_GUI 0x800u // deprecated mctr GUI was removed
36 /* Added in 1.5.pl8 */
37 #define FEATURE_TEXT 0x1000u
38 /* Added in 1.8.pl0 */
39 #define FEATURE_XER 0x2000u
41 /* Limitation types */
42 #define LIMIT_HOST 0x1
43 #define LIMIT_USER 0x2
45 /* Limit for expiration warning in days */
46 #define EXPIRY_WARNING 14
48 /* Where to send the license.
50 * The values 1,2,3 work as either an enumeration or a bit field. */
51 #define SENDTO_LICENSEE 1
52 #define SENDTO_CONTACT 2
55 /** "Cooked" license information suitable for processing. */
58 unsigned int unique_id
;
59 char *licensee_name
, *licensee_email
,
60 *licensee_company
, *licensee_department
;
61 char *contact_name
, *contact_email
;
63 time_t valid_from
, valid_until
;
64 unsigned long int host_id
;
66 unsigned int from_major
, from_minor
, from_patchlevel
,
67 to_major
, to_minor
, to_patchlevel
;
68 unsigned int feature_list
, limitation_type
;
69 unsigned int max_ptcs
;
72 /** Raw license information.
74 * The license file is a Base64-encode of a BER-encoded version of this structure.
76 * @note Modifying this structure will render it incompatible with
77 * previous versions of Titan (the size of the structure is checked) */
79 unsigned char unique_id
[4];
80 char licensee_name
[48], licensee_email
[48],
81 licensee_company
[48], licensee_department
[16];
82 unsigned char valid_from
[4], valid_until
[4];
83 unsigned char host_id
[4];
85 unsigned char from_major
[4], from_minor
[4], from_patchlevel
[4],
86 to_major
[4], to_minor
[4], to_patchlevel
[4];
87 unsigned char feature_list
[4], limitation_type
[4];
88 unsigned char max_ptcs
[4];
89 unsigned char dsa_signature
[48];
96 /** Load license information.
98 * Loads license information from the file specified in the
99 * \c TTCN3_LICENSE_FILE environment variable.
101 * Calls \c load_license_from_file()
103 * @param [out] lptr pointer to license data */
104 void load_license(license_struct
*lptr
);
106 /** Load license information from a specified file.
107 * @param [out] lptr pointer to license data
108 * @param [in] file_name string containing the license file name */
109 void load_license_from_file(license_struct
*lptr
, const char *file_name
);
112 * @param [in] lptr pointer to license data */
113 void free_license(license_struct
*lptr
);
115 /** Check if the license allows the use of the product.
117 * Verifies that we are within the license period, that the host or user
118 * restriction is satisfied, and the program version is within the limits
119 * allowed by the license.
121 * If the license is about to expire in less than \c EXPIRY_WARNING days,
122 * a warning is printed.
124 * If a check fails, function returns 0.
126 * @param [in] lptr pointer to license information
127 * @return 1 if the license is valid, 0 if invalid. */
128 int verify_license(const license_struct
*lptr
);
130 /** Check if the license allows the use of a certain feature.
132 * @param lptr pointer to license information
133 * @param feature feature to check. It should be one of the FEATURE_ macros.
134 * @return nonzero if feature is enabled, 0 if disabled. */
135 unsigned int check_feature(const license_struct
*lptr
, unsigned int feature
);
137 /** Print the details of the supplied license information
139 * @param [in] lptr pointer to license information */
140 void print_license(const license_struct
*lptr
);
142 /** Print information about the license used by the program.
144 * The license is loaded from the file specified by the \c TTCN3_LICENSE_FILE
145 * environment variable.
147 * This function terminates the program if the license is not valid. */
148 void print_license_info(void);
150 void init_openssl(void);
151 void free_openssl(void);
153 const char * openssl_version_str(void);
155 #if defined(WIN32) || defined(INTERIX)
156 long gethostid(void);
This page took 0.036407 seconds and 5 git commands to generate.