licentivo-launch 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +35 -0
  4. data/ext/launch_native/extconf.rb +28 -0
  5. data/lib/licentivo_launch/vendor/licentivo.rb +262 -0
  6. data/lib/licentivo_launch.rb +352 -0
  7. data/vendor/LICENSE +21 -0
  8. data/vendor/NOTICE +17 -0
  9. data/vendor/VERSION +1 -0
  10. data/vendor/c/app.c +33 -0
  11. data/vendor/c/demo.c +77 -0
  12. data/vendor/c/feature_tasks.h +72 -0
  13. data/vendor/c/licentivo.c +382 -0
  14. data/vendor/c/licentivo.h +67 -0
  15. data/vendor/c/quickstart.c +51 -0
  16. data/vendor/c/test_vectors.c +4 -0
  17. data/vendor/c/vendor/Monocypher-LICENCE.md +173 -0
  18. data/vendor/c/vendor/cJSON-LICENSE +20 -0
  19. data/vendor/c/vendor/cJSON.c +3191 -0
  20. data/vendor/c/vendor/cJSON.h +306 -0
  21. data/vendor/c/vendor/monocypher-ed25519.c +500 -0
  22. data/vendor/c/vendor/monocypher-ed25519.h +140 -0
  23. data/vendor/c/vendor/monocypher.c +2956 -0
  24. data/vendor/c/vendor/monocypher.h +321 -0
  25. data/vendor/curl/COPYING.txt +22 -0
  26. data/vendor/curl/bin/libcurl-x64.dll +0 -0
  27. data/vendor/curl/include/brotli/decode.h +409 -0
  28. data/vendor/curl/include/brotli/encode.h +505 -0
  29. data/vendor/curl/include/brotli/port.h +302 -0
  30. data/vendor/curl/include/brotli/shared_dictionary.h +100 -0
  31. data/vendor/curl/include/brotli/types.h +83 -0
  32. data/vendor/curl/include/curl/curl.h +3374 -0
  33. data/vendor/curl/include/curl/curlver.h +77 -0
  34. data/vendor/curl/include/curl/easy.h +123 -0
  35. data/vendor/curl/include/curl/header.h +74 -0
  36. data/vendor/curl/include/curl/mprintf.h +85 -0
  37. data/vendor/curl/include/curl/multi.h +561 -0
  38. data/vendor/curl/include/curl/options.h +70 -0
  39. data/vendor/curl/include/curl/stdcheaders.h +35 -0
  40. data/vendor/curl/include/curl/system.h +399 -0
  41. data/vendor/curl/include/curl/typecheck-gcc.h +964 -0
  42. data/vendor/curl/include/curl/urlapi.h +156 -0
  43. data/vendor/curl/include/curl/websockets.h +98 -0
  44. data/vendor/curl/include/libpsl.h +207 -0
  45. data/vendor/curl/include/libssh2.h +1516 -0
  46. data/vendor/curl/include/libssh2_publickey.h +128 -0
  47. data/vendor/curl/include/libssh2_sftp.h +382 -0
  48. data/vendor/curl/include/nghttp2/nghttp2.h +6878 -0
  49. data/vendor/curl/include/nghttp2/nghttp2ver.h +42 -0
  50. data/vendor/curl/include/nghttp3/nghttp3.h +3704 -0
  51. data/vendor/curl/include/nghttp3/version.h +46 -0
  52. data/vendor/curl/include/ngtcp2/ngtcp2.h +7485 -0
  53. data/vendor/curl/include/ngtcp2/ngtcp2_crypto.h +1071 -0
  54. data/vendor/curl/include/ngtcp2/ngtcp2_crypto_quictls.h +147 -0
  55. data/vendor/curl/include/ngtcp2/version.h +51 -0
  56. data/vendor/curl/include/openssl/aes.h +120 -0
  57. data/vendor/curl/include/openssl/asn1.h +1121 -0
  58. data/vendor/curl/include/openssl/asn1t.h +996 -0
  59. data/vendor/curl/include/openssl/bio.h +716 -0
  60. data/vendor/curl/include/openssl/blowfish.h +106 -0
  61. data/vendor/curl/include/openssl/bn.h +480 -0
  62. data/vendor/curl/include/openssl/buffer.h +102 -0
  63. data/vendor/curl/include/openssl/camellia.h +121 -0
  64. data/vendor/curl/include/openssl/cast.h +99 -0
  65. data/vendor/curl/include/openssl/chacha.h +54 -0
  66. data/vendor/curl/include/openssl/cmac.h +81 -0
  67. data/vendor/curl/include/openssl/cms.h +541 -0
  68. data/vendor/curl/include/openssl/comp.h +7 -0
  69. data/vendor/curl/include/openssl/conf.h +189 -0
  70. data/vendor/curl/include/openssl/crypto.h +458 -0
  71. data/vendor/curl/include/openssl/ct.h +567 -0
  72. data/vendor/curl/include/openssl/curve25519.h +104 -0
  73. data/vendor/curl/include/openssl/des.h +215 -0
  74. data/vendor/curl/include/openssl/dh.h +245 -0
  75. data/vendor/curl/include/openssl/dsa.h +263 -0
  76. data/vendor/curl/include/openssl/dtls1.h +107 -0
  77. data/vendor/curl/include/openssl/ec.h +675 -0
  78. data/vendor/curl/include/openssl/ecdh.h +6 -0
  79. data/vendor/curl/include/openssl/ecdsa.h +6 -0
  80. data/vendor/curl/include/openssl/engine.h +215 -0
  81. data/vendor/curl/include/openssl/err.h +325 -0
  82. data/vendor/curl/include/openssl/evp.h +1288 -0
  83. data/vendor/curl/include/openssl/hkdf.h +65 -0
  84. data/vendor/curl/include/openssl/hmac.h +101 -0
  85. data/vendor/curl/include/openssl/idea.h +99 -0
  86. data/vendor/curl/include/openssl/kdf.h +137 -0
  87. data/vendor/curl/include/openssl/lhash.h +179 -0
  88. data/vendor/curl/include/openssl/md4.h +105 -0
  89. data/vendor/curl/include/openssl/md5.h +99 -0
  90. data/vendor/curl/include/openssl/mlkem.h +236 -0
  91. data/vendor/curl/include/openssl/modes.h +118 -0
  92. data/vendor/curl/include/openssl/obj_mac.h +4646 -0
  93. data/vendor/curl/include/openssl/objects.h +137 -0
  94. data/vendor/curl/include/openssl/ocsp.h +484 -0
  95. data/vendor/curl/include/openssl/opensslconf.h +16 -0
  96. data/vendor/curl/include/openssl/opensslfeatures.h +153 -0
  97. data/vendor/curl/include/openssl/opensslv.h +18 -0
  98. data/vendor/curl/include/openssl/ossl_typ.h +196 -0
  99. data/vendor/curl/include/openssl/pem.h +542 -0
  100. data/vendor/curl/include/openssl/pkcs12.h +284 -0
  101. data/vendor/curl/include/openssl/pkcs7.h +523 -0
  102. data/vendor/curl/include/openssl/poly1305.h +45 -0
  103. data/vendor/curl/include/openssl/posix_time.h +54 -0
  104. data/vendor/curl/include/openssl/rand.h +118 -0
  105. data/vendor/curl/include/openssl/rc2.h +101 -0
  106. data/vendor/curl/include/openssl/rc4.h +88 -0
  107. data/vendor/curl/include/openssl/ripemd.h +107 -0
  108. data/vendor/curl/include/openssl/rsa.h +603 -0
  109. data/vendor/curl/include/openssl/safestack.h +1739 -0
  110. data/vendor/curl/include/openssl/sha.h +190 -0
  111. data/vendor/curl/include/openssl/sm3.h +49 -0
  112. data/vendor/curl/include/openssl/sm4.h +47 -0
  113. data/vendor/curl/include/openssl/srtp.h +148 -0
  114. data/vendor/curl/include/openssl/ssl.h +2336 -0
  115. data/vendor/curl/include/openssl/ssl3.h +441 -0
  116. data/vendor/curl/include/openssl/stack.h +99 -0
  117. data/vendor/curl/include/openssl/tls1.h +764 -0
  118. data/vendor/curl/include/openssl/ts.h +660 -0
  119. data/vendor/curl/include/openssl/txt_db.h +112 -0
  120. data/vendor/curl/include/openssl/ui.h +397 -0
  121. data/vendor/curl/include/openssl/x509.h +1037 -0
  122. data/vendor/curl/include/openssl/x509_vfy.h +464 -0
  123. data/vendor/curl/include/openssl/x509v3.h +1039 -0
  124. data/vendor/curl/include/zconf.h +206 -0
  125. data/vendor/curl/include/zdict.h +481 -0
  126. data/vendor/curl/include/zlib.h +1859 -0
  127. data/vendor/curl/include/zlib_name_mangling.h +8 -0
  128. data/vendor/curl/include/zstd.h +3198 -0
  129. data/vendor/curl/include/zstd_errors.h +107 -0
  130. data/vendor/curl/lib/libcurl.dll.a +0 -0
  131. data/vendor/curl/licenses/brotli/LICENSE.txt +19 -0
  132. data/vendor/curl/licenses/certdata/LICENSE.url +2 -0
  133. data/vendor/curl/licenses/libpsl/COPYING.txt +20 -0
  134. data/vendor/curl/licenses/libressl/COPYING.txt +133 -0
  135. data/vendor/curl/licenses/libssh2/COPYING.txt +43 -0
  136. data/vendor/curl/licenses/nghttp2/COPYING.txt +23 -0
  137. data/vendor/curl/licenses/nghttp3/COPYING.txt +22 -0
  138. data/vendor/curl/licenses/ngtcp2/COPYING.txt +22 -0
  139. data/vendor/curl/licenses/psl/LICENSE.txt +373 -0
  140. data/vendor/curl/licenses/trurl/COPYING.txt +22 -0
  141. data/vendor/curl/licenses/zlibng/LICENSE.md +19 -0
  142. data/vendor/curl/licenses/zstd/LICENSE.txt +30 -0
  143. metadata +205 -0
@@ -0,0 +1,156 @@
1
+ #ifndef CURLINC_URLAPI_H
2
+ #define CURLINC_URLAPI_H
3
+ /***************************************************************************
4
+ * _ _ ____ _
5
+ * Project ___| | | | _ \| |
6
+ * / __| | | | |_) | |
7
+ * | (__| |_| | _ <| |___
8
+ * \___|\___/|_| \_\_____|
9
+ *
10
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
11
+ *
12
+ * This software is licensed as described in the file COPYING, which
13
+ * you should have received as part of this distribution. The terms
14
+ * are also available at https://curl.se/docs/copyright.html.
15
+ *
16
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17
+ * copies of the Software, and permit persons to whom the Software is
18
+ * furnished to do so, under the terms of the COPYING file.
19
+ *
20
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
+ * KIND, either express or implied.
22
+ *
23
+ * SPDX-License-Identifier: curl
24
+ *
25
+ ***************************************************************************/
26
+
27
+ #include "curl.h"
28
+
29
+ #ifdef __cplusplus
30
+ extern "C" {
31
+ #endif
32
+
33
+ /* the error codes for the URL API */
34
+ typedef enum {
35
+ CURLUE_OK,
36
+ CURLUE_BAD_HANDLE, /* 1 */
37
+ CURLUE_BAD_PARTPOINTER, /* 2 */
38
+ CURLUE_MALFORMED_INPUT, /* 3 */
39
+ CURLUE_BAD_PORT_NUMBER, /* 4 */
40
+ CURLUE_UNSUPPORTED_SCHEME, /* 5 */
41
+ CURLUE_URLDECODE, /* 6 */
42
+ CURLUE_OUT_OF_MEMORY, /* 7 */
43
+ CURLUE_USER_NOT_ALLOWED, /* 8 */
44
+ CURLUE_UNKNOWN_PART, /* 9 */
45
+ CURLUE_NO_SCHEME, /* 10 */
46
+ CURLUE_NO_USER, /* 11 */
47
+ CURLUE_NO_PASSWORD, /* 12 */
48
+ CURLUE_NO_OPTIONS, /* 13 */
49
+ CURLUE_NO_HOST, /* 14 */
50
+ CURLUE_NO_PORT, /* 15 */
51
+ CURLUE_NO_QUERY, /* 16 */
52
+ CURLUE_NO_FRAGMENT, /* 17 */
53
+ CURLUE_NO_ZONEID, /* 18 */
54
+ CURLUE_BAD_FILE_URL, /* 19 */
55
+ CURLUE_BAD_FRAGMENT, /* 20 */
56
+ CURLUE_BAD_HOSTNAME, /* 21 */
57
+ CURLUE_BAD_IPV6, /* 22 */
58
+ CURLUE_BAD_LOGIN, /* 23 */
59
+ CURLUE_BAD_PASSWORD, /* 24 */
60
+ CURLUE_BAD_PATH, /* 25 */
61
+ CURLUE_BAD_QUERY, /* 26 */
62
+ CURLUE_BAD_SCHEME, /* 27 */
63
+ CURLUE_BAD_SLASHES, /* 28 */
64
+ CURLUE_BAD_USER, /* 29 */
65
+ CURLUE_LACKS_IDN, /* 30 */
66
+ CURLUE_TOO_LARGE, /* 31 */
67
+ CURLUE_BACKSLASH, /* 32 */
68
+ CURLUE_LAST
69
+ } CURLUcode;
70
+
71
+ typedef enum {
72
+ CURLUPART_URL,
73
+ CURLUPART_SCHEME,
74
+ CURLUPART_USER,
75
+ CURLUPART_PASSWORD,
76
+ CURLUPART_OPTIONS,
77
+ CURLUPART_HOST,
78
+ CURLUPART_PORT,
79
+ CURLUPART_PATH,
80
+ CURLUPART_QUERY,
81
+ CURLUPART_FRAGMENT,
82
+ CURLUPART_ZONEID /* added in 7.65.0 */
83
+ } CURLUPart;
84
+
85
+ #define CURLU_DEFAULT_PORT (1 << 0) /* return default port number */
86
+ #define CURLU_NO_DEFAULT_PORT (1 << 1) /* act as if no port number was set,
87
+ if the port number matches the
88
+ default for the scheme */
89
+ #define CURLU_DEFAULT_SCHEME (1 << 2) /* return default scheme if
90
+ missing */
91
+ #define CURLU_NON_SUPPORT_SCHEME (1 << 3) /* allow non-supported scheme */
92
+ #define CURLU_PATH_AS_IS (1 << 4) /* leave dot sequences */
93
+ #define CURLU_DISALLOW_USER (1 << 5) /* no user+password allowed */
94
+ #define CURLU_URLDECODE (1 << 6) /* URL decode on get */
95
+ #define CURLU_URLENCODE (1 << 7) /* URL encode on set */
96
+ #define CURLU_APPENDQUERY (1 << 8) /* append a form style part */
97
+ #define CURLU_GUESS_SCHEME (1 << 9) /* legacy curl-style guessing */
98
+ #define CURLU_NO_AUTHORITY (1 << 10) /* Allow empty authority when the
99
+ scheme is unknown. */
100
+ #define CURLU_ALLOW_SPACE (1 << 11) /* Allow spaces in the URL */
101
+ #define CURLU_PUNYCODE (1 << 12) /* get the hostname in punycode */
102
+ #define CURLU_PUNY2IDN (1 << 13) /* punycode => IDN conversion */
103
+ #define CURLU_GET_EMPTY (1 << 14) /* allow empty queries and fragments
104
+ when extracting the URL or the
105
+ components */
106
+ #define CURLU_NO_GUESS_SCHEME (1 << 15) /* for get, do not accept a guess */
107
+
108
+ typedef struct Curl_URL CURLU;
109
+
110
+ /*
111
+ * curl_url() creates a new CURLU handle and returns a pointer to it.
112
+ * Must be freed with curl_url_cleanup().
113
+ */
114
+ CURL_EXTERN CURLU *curl_url(void);
115
+
116
+ /*
117
+ * curl_url_cleanup() frees the CURLU handle and related resources used for
118
+ * the URL parsing. It does not free strings previously returned with the URL
119
+ * API.
120
+ */
121
+ CURL_EXTERN void curl_url_cleanup(CURLU *u);
122
+
123
+ /*
124
+ * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
125
+ * handle must also be freed with curl_url_cleanup().
126
+ */
127
+ CURL_EXTERN CURLU *curl_url_dup(const CURLU *in);
128
+
129
+ /*
130
+ * curl_url_get() extracts a specific part of the URL from a CURLU
131
+ * handle. Returns error code. The returned pointer MUST be freed with
132
+ * curl_free() afterwards.
133
+ */
134
+ CURL_EXTERN CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
135
+ char **part, unsigned int flags);
136
+
137
+ /*
138
+ * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns
139
+ * error code. The passed in string is copied. Passing a NULL instead of
140
+ * a part string, clears that part.
141
+ */
142
+ CURL_EXTERN CURLUcode curl_url_set(CURLU *u, CURLUPart what,
143
+ const char *part, unsigned int flags);
144
+
145
+ /*
146
+ * curl_url_strerror() turns a CURLUcode value into the equivalent human
147
+ * readable error string. This is useful for printing meaningful error
148
+ * messages.
149
+ */
150
+ CURL_EXTERN const char *curl_url_strerror(CURLUcode error);
151
+
152
+ #ifdef __cplusplus
153
+ } /* end of extern "C" */
154
+ #endif
155
+
156
+ #endif /* CURLINC_URLAPI_H */
@@ -0,0 +1,98 @@
1
+ #ifndef CURLINC_WEBSOCKETS_H
2
+ #define CURLINC_WEBSOCKETS_H
3
+ /***************************************************************************
4
+ * _ _ ____ _
5
+ * Project ___| | | | _ \| |
6
+ * / __| | | | |_) | |
7
+ * | (__| |_| | _ <| |___
8
+ * \___|\___/|_| \_\_____|
9
+ *
10
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
11
+ *
12
+ * This software is licensed as described in the file COPYING, which
13
+ * you should have received as part of this distribution. The terms
14
+ * are also available at https://curl.se/docs/copyright.html.
15
+ *
16
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17
+ * copies of the Software, and permit persons to whom the Software is
18
+ * furnished to do so, under the terms of the COPYING file.
19
+ *
20
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
+ * KIND, either express or implied.
22
+ *
23
+ * SPDX-License-Identifier: curl
24
+ *
25
+ ***************************************************************************/
26
+
27
+ #ifdef __cplusplus
28
+ extern "C" {
29
+ #endif
30
+
31
+ struct curl_ws_frame {
32
+ int age; /* zero */
33
+ int flags; /* See the CURLWS_* defines */
34
+ curl_off_t offset; /* the offset of this data into the frame */
35
+ curl_off_t bytesleft; /* number of pending bytes left of the payload */
36
+ size_t len; /* size of the current data chunk */
37
+ };
38
+
39
+ /* flag bits */
40
+ #define CURLWS_TEXT (1 << 0)
41
+ #define CURLWS_BINARY (1 << 1)
42
+ #define CURLWS_CONT (1 << 2)
43
+ #define CURLWS_CLOSE (1 << 3)
44
+ #define CURLWS_PING (1 << 4)
45
+ #define CURLWS_OFFSET (1 << 5)
46
+
47
+ /*
48
+ * NAME curl_ws_recv()
49
+ *
50
+ * DESCRIPTION
51
+ *
52
+ * Receives data from the websocket connection. Use after successful
53
+ * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
54
+ */
55
+ CURL_EXTERN CURLcode curl_ws_recv(CURL *curl, void *buffer, size_t buflen,
56
+ size_t *recv,
57
+ const struct curl_ws_frame **metap);
58
+
59
+ /* flags for curl_ws_send() */
60
+ #define CURLWS_PONG (1 << 6)
61
+
62
+ /*
63
+ * NAME curl_ws_send()
64
+ *
65
+ * DESCRIPTION
66
+ *
67
+ * Sends data over the websocket connection. Use after successful
68
+ * curl_easy_perform() with CURLOPT_CONNECT_ONLY option.
69
+ */
70
+ CURL_EXTERN CURLcode curl_ws_send(CURL *curl, const void *buffer_arg,
71
+ size_t buflen, size_t *sent,
72
+ curl_off_t fragsize,
73
+ unsigned int flags);
74
+
75
+ /*
76
+ * NAME curl_ws_start_frame()
77
+ *
78
+ * DESCRIPTION
79
+ *
80
+ * Buffers a websocket frame header with the given flags and length.
81
+ * Errors when a previous frame is not complete, e.g. not all its
82
+ * payload has been added.
83
+ */
84
+ CURL_EXTERN CURLcode curl_ws_start_frame(CURL *curl,
85
+ unsigned int flags,
86
+ curl_off_t frame_len);
87
+
88
+ /* bits for the CURLOPT_WS_OPTIONS bitmask: */
89
+ #define CURLWS_RAW_MODE (1L << 0)
90
+ #define CURLWS_NOAUTOPONG (1L << 1)
91
+
92
+ CURL_EXTERN const struct curl_ws_frame *curl_ws_meta(CURL *curl);
93
+
94
+ #ifdef __cplusplus
95
+ }
96
+ #endif
97
+
98
+ #endif /* CURLINC_WEBSOCKETS_H */
@@ -0,0 +1,207 @@
1
+ /*
2
+ * Copyright (C) 2014-2026 Tim Rühsen and Libpsl Contributors.
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a
5
+ * copy of this software and associated documentation files (the "Software"),
6
+ * to deal in the Software without restriction, including without limitation
7
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
+ * and/or sell copies of the Software, and to permit persons to whom the
9
+ * Software is furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
+ * DEALINGS IN THE SOFTWARE.
21
+ *
22
+ * This file is part of libpsl.
23
+ *
24
+ * Header file for libpsl library routines
25
+ *
26
+ */
27
+
28
+ #ifndef LIBPSL_LIBPSL_H
29
+ #define LIBPSL_LIBPSL_H
30
+
31
+ #include <stdio.h>
32
+ #include <time.h>
33
+
34
+ #define PSL_VERSION "0.23.3"
35
+ #define PSL_VERSION_MAJOR 0
36
+ #define PSL_VERSION_MINOR 23
37
+ #define PSL_VERSION_PATCH 3
38
+ #define PSL_VERSION_NUMBER 0x001703
39
+
40
+ /* support clang's __has_declspec_attribute attribute */
41
+ #ifndef __has_declspec_attribute
42
+ # define __has_declspec_attribute(x) 0
43
+ #endif
44
+
45
+ #ifndef PSL_API
46
+ #if defined BUILDING_PSL && HAVE_VISIBILITY
47
+ # define PSL_API __attribute__ ((__visibility__("default")))
48
+ #elif defined BUILDING_PSL && (defined _MSC_VER || __has_declspec_attribute(dllexport)) && !defined PSL_STATIC
49
+ # define PSL_API __declspec(dllexport)
50
+ #elif (defined _MSC_VER || __has_declspec_attribute(dllimport)) && !defined PSL_STATIC
51
+ # define PSL_API __declspec(dllimport)
52
+ #else
53
+ # define PSL_API
54
+ #endif
55
+ #endif
56
+
57
+ #ifdef __cplusplus
58
+ extern "C" {
59
+ #endif
60
+
61
+ /* types for psl_is_public_suffix2() */
62
+ #define PSL_TYPE_ICANN (1<<0)
63
+ #define PSL_TYPE_PRIVATE (1<<1)
64
+ #define PSL_TYPE_NO_STAR_RULE (1<<2)
65
+ #define PSL_TYPE_ANY (PSL_TYPE_ICANN | PSL_TYPE_PRIVATE)
66
+
67
+ /**
68
+ * psl_error_t:
69
+ * @PSL_SUCCESS: Successful return.
70
+ * @PSL_ERR_INVALID_ARG: Invalid argument.
71
+ * @PSL_ERR_CONVERTER: Failed to open libicu utf-16 converter.
72
+ * @PSL_ERR_TO_UTF16: Failed to convert to utf-16.
73
+ * @PSL_ERR_TO_LOWER: Failed to convert utf-16 to lowercase.
74
+ * @PSL_ERR_TO_UTF8: Failed to convert utf-16 to utf-8.
75
+ * @PSL_ERR_NO_MEM: Failed to allocate memory.
76
+ *
77
+ * Return codes for PSL functions.
78
+ * Negative return codes mean failure.
79
+ * Positive values are reserved for non-error return codes.
80
+ */
81
+ typedef enum {
82
+ PSL_SUCCESS = 0,
83
+ PSL_ERR_INVALID_ARG = -1,
84
+ PSL_ERR_CONVERTER = -2, /* failed to open libicu utf-16 converter */
85
+ PSL_ERR_TO_UTF16 = -3, /* failed to convert to utf-16 */
86
+ PSL_ERR_TO_LOWER = -4, /* failed to convert utf-16 to lowercase */
87
+ PSL_ERR_TO_UTF8 = -5, /* failed to convert utf-16 to utf-8 */
88
+ PSL_ERR_NO_MEM = -6 /* failed to allocate memory */
89
+ } psl_error_t;
90
+
91
+ typedef struct psl_ctx_st psl_ctx_t;
92
+
93
+ /* frees PSL context */
94
+ PSL_API
95
+ void
96
+ psl_free(psl_ctx_t *psl);
97
+
98
+ /* frees memory allocated by libpsl routines */
99
+ PSL_API
100
+ void
101
+ psl_free_string(char *str);
102
+
103
+ /* loads PSL data from file */
104
+ PSL_API
105
+ psl_ctx_t *
106
+ psl_load_file(const char *fname);
107
+
108
+ /* loads PSL data from FILE pointer */
109
+ PSL_API
110
+ psl_ctx_t *
111
+ psl_load_fp(FILE *fp);
112
+
113
+ /* retrieves builtin PSL data */
114
+ PSL_API
115
+ const psl_ctx_t *
116
+ psl_builtin(void);
117
+
118
+ /* retrieves most recent PSL data */
119
+ PSL_API
120
+ psl_ctx_t *
121
+ psl_latest(const char *fname);
122
+
123
+ /* checks whether domain is a public suffix or not */
124
+ PSL_API
125
+ int
126
+ psl_is_public_suffix(const psl_ctx_t *psl, const char *domain);
127
+
128
+ /* checks whether domain is a public suffix regarding the type or not */
129
+ PSL_API
130
+ int
131
+ psl_is_public_suffix2(const psl_ctx_t *psl, const char *domain, int type);
132
+
133
+ /* checks whether cookie_domain is acceptable for domain or not */
134
+ PSL_API
135
+ int
136
+ psl_is_cookie_domain_acceptable(const psl_ctx_t *psl, const char *hostname, const char *cookie_domain);
137
+
138
+ /* returns the longest not registrable domain within 'domain' or NULL if none found */
139
+ PSL_API
140
+ const char *
141
+ psl_unregistrable_domain(const psl_ctx_t *psl, const char *domain);
142
+
143
+ /* returns the shortest possible registrable domain part or NULL if domain is not registrable at all */
144
+ PSL_API
145
+ const char *
146
+ psl_registrable_domain(const psl_ctx_t *psl, const char *domain);
147
+
148
+ /* convert a string into lowercase UTF-8 */
149
+ PSL_API
150
+ psl_error_t
151
+ psl_str_to_utf8lower(const char *str, const char *encoding, const char *locale, char **lower);
152
+
153
+ /* does not include exceptions */
154
+ PSL_API
155
+ int
156
+ psl_suffix_count(const psl_ctx_t *psl);
157
+
158
+ /* just counts exceptions */
159
+ PSL_API
160
+ int
161
+ psl_suffix_exception_count(const psl_ctx_t *psl);
162
+
163
+ /* just counts wildcards */
164
+ PSL_API
165
+ int
166
+ psl_suffix_wildcard_count(const psl_ctx_t *psl);
167
+
168
+ /* returns mtime of PSL source file */
169
+ PSL_API
170
+ time_t
171
+ psl_builtin_file_time(void);
172
+
173
+ /* returns SHA1 checksum (hex-encoded, lowercase) of PSL source file */
174
+ PSL_API
175
+ const char *
176
+ psl_builtin_sha1sum(void);
177
+
178
+ /* returns file name of PSL source file */
179
+ PSL_API
180
+ const char *
181
+ psl_builtin_filename(void);
182
+
183
+ /* returns name of distribution PSL data file */
184
+ PSL_API
185
+ const char *
186
+ psl_dist_filename(void);
187
+
188
+ /* returns library version string */
189
+ PSL_API
190
+ const char *
191
+ psl_get_version(void);
192
+
193
+ /* checks library version number */
194
+ PSL_API
195
+ int
196
+ psl_check_version_number(int version);
197
+
198
+ /* returns whether the built-in data is outdated or not */
199
+ PSL_API
200
+ int
201
+ psl_builtin_outdated(void);
202
+
203
+ #ifdef __cplusplus
204
+ }
205
+ #endif
206
+
207
+ #endif /* LIBPSL_LIBPSL_H */