Squash  0.7.0
license.h
1 /* Copyright (c) 2015 The Squash Authors
2  *
3  * Permission is hereby granted, free of charge, to any person
4  * obtaining a copy of this software and associated documentation
5  * files (the "Software"), to deal in the Software without
6  * restriction, including without limitation the rights to use, copy,
7  * modify, merge, publish, distribute, sublicense, and/or sell copies
8  * of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be
12  * included in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  * Authors:
24  * Evan Nemerson <evan@nemerson.com>
25  */
26 
27 #ifndef SQUASH_LICENSE_H
28 #define SQUASH_LICENSE_H
29 
30 #if !defined (SQUASH_H_INSIDE) && !defined (SQUASH_COMPILATION)
31 #error "Only <squash/squash.h> can be included directly."
32 #endif
33 
34 #include <stdio.h>
35 
36 SQUASH_BEGIN_DECLS
37 
38 typedef enum {
39  SQUASH_LICENSE_UNKNOWN = 0,
40 
41  SQUASH_LICENSE_PERMISSIVE = 0x01 << 24,
42  SQUASH_LICENSE_STRONG_COPYLEFT = 0x02 << 24,
43  SQUASH_LICENSE_WEAK_COPYLEFT = 0x04 << 24,
44  SQUASH_LICENSE_PROPRIETARY = 0x08 << 24,
45  SQUASH_LICENSE_TYPE_MASK = 0xff << 24,
46 
47  SQUASH_LICENSE_COPYLEFT_INCOMPATIBLE = 0x01 << 16,
48  SQUASH_LICENSE_OR_GREATER = 0x02 << 16,
49  SQUASH_LICENSE_FLAGS_MASK = 0xff << 16,
50 
51  SQUASH_LICENSE_PUBLIC_DOMAIN = SQUASH_LICENSE_PERMISSIVE | 0x01,
52  SQUASH_LICENSE_BSD2 = SQUASH_LICENSE_PERMISSIVE | 0x02,
53  SQUASH_LICENSE_BSD3 = SQUASH_LICENSE_PERMISSIVE | 0x03,
54  SQUASH_LICENSE_BSD4 = SQUASH_LICENSE_PERMISSIVE | 0x04 | SQUASH_LICENSE_COPYLEFT_INCOMPATIBLE,
55  SQUASH_LICENSE_MIT = SQUASH_LICENSE_PERMISSIVE | 0x05,
56  SQUASH_LICENSE_ZLIB = SQUASH_LICENSE_PERMISSIVE | 0x06,
57  SQUASH_LICENSE_WTFPL = SQUASH_LICENSE_PERMISSIVE | 0x07,
58  SQUASH_LICENSE_X11 = SQUASH_LICENSE_PERMISSIVE | 0x08,
59  SQUASH_LICENSE_APACHE = SQUASH_LICENSE_PERMISSIVE | 0x09,
60  SQUASH_LICENSE_APACHE2 = SQUASH_LICENSE_PERMISSIVE | 0x0a,
61  SQUASH_LICENSE_CDDL = SQUASH_LICENSE_PERMISSIVE | 0x0b | SQUASH_LICENSE_COPYLEFT_INCOMPATIBLE,
62  SQUASH_LICENSE_MSPL = SQUASH_LICENSE_PERMISSIVE | 0x0c | SQUASH_LICENSE_COPYLEFT_INCOMPATIBLE,
63 
64  SQUASH_LICENSE_MPL = SQUASH_LICENSE_WEAK_COPYLEFT | 0x01,
65  SQUASH_LICENSE_LGPL2P1 = SQUASH_LICENSE_WEAK_COPYLEFT | 0x02,
66  SQUASH_LICENSE_LGPL2P1_PLUS = SQUASH_LICENSE_LGPL2P1 | SQUASH_LICENSE_OR_GREATER,
67  SQUASH_LICENSE_LGPL3 = SQUASH_LICENSE_WEAK_COPYLEFT | 0x03,
68  SQUASH_LICENSE_LGPL3_PLUS = SQUASH_LICENSE_LGPL3 | SQUASH_LICENSE_OR_GREATER,
69 
70  SQUASH_LICENSE_GPL1 = SQUASH_LICENSE_STRONG_COPYLEFT | 0x01,
71  SQUASH_LICENSE_GPL1_PLUS = SQUASH_LICENSE_GPL1 | SQUASH_LICENSE_OR_GREATER,
72  SQUASH_LICENSE_GPL2 = SQUASH_LICENSE_STRONG_COPYLEFT | 0x02,
73  SQUASH_LICENSE_GPL2_PLUS = SQUASH_LICENSE_GPL2 | SQUASH_LICENSE_OR_GREATER,
74  SQUASH_LICENSE_GPL3 = SQUASH_LICENSE_STRONG_COPYLEFT | 0x03,
75  SQUASH_LICENSE_GPL3_PLUS = SQUASH_LICENSE_GPL3 | SQUASH_LICENSE_OR_GREATER,
76 } SquashLicense;
77 
78 SQUASH_API SquashLicense squash_license_from_string (const char* license);
79 SQUASH_API const char* squash_license_to_string (SquashLicense license);
80 
81 SQUASH_END_DECLS
82 
83 #endif /* SQUASH_LICENSE_H */