/src/samba/third_party/heimdal/lib/roken/roken.h.in
Line | Count | Source |
1 | | /* -*- C -*- */ |
2 | | /* |
3 | | * Copyright (c) 1995-2017 Kungliga Tekniska Högskolan |
4 | | * (Royal Institute of Technology, Stockholm, Sweden). |
5 | | * All rights reserved. |
6 | | * |
7 | | * Redistribution and use in source and binary forms, with or without |
8 | | * modification, are permitted provided that the following conditions |
9 | | * are met: |
10 | | * |
11 | | * 1. Redistributions of source code must retain the above copyright |
12 | | * notice, this list of conditions and the following disclaimer. |
13 | | * |
14 | | * 2. Redistributions in binary form must reproduce the above copyright |
15 | | * notice, this list of conditions and the following disclaimer in the |
16 | | * documentation and/or other materials provided with the distribution. |
17 | | * |
18 | | * 3. Neither the name of the Institute nor the names of its contributors |
19 | | * may be used to endorse or promote products derived from this software |
20 | | * without specific prior written permission. |
21 | | * |
22 | | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND |
23 | | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
24 | | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
25 | | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE |
26 | | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
27 | | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
28 | | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
29 | | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
30 | | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
31 | | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | | * SUCH DAMAGE. |
33 | | */ |
34 | | |
35 | | # if defined(_WIN32) && _MSC_VER >= 1400 |
36 | | /* _CRT_RAND_S must be defined before including stdlib.h */ |
37 | | # define _CRT_RAND_S |
38 | | # define HAVE_WIN32_RAND_S 1 |
39 | | # endif |
40 | | |
41 | | #include <stdio.h> |
42 | | #include <stdlib.h> |
43 | | #include <stdarg.h> |
44 | | #ifdef HAVE_STDINT_H |
45 | | #include <stdint.h> |
46 | | #endif |
47 | | #include <string.h> |
48 | | #include <limits.h> |
49 | | #include <signal.h> |
50 | | |
51 | | #ifdef HAVE_UTIL_H |
52 | | #include <util.h> |
53 | | #endif |
54 | | |
55 | | # ifndef ROKEN_LIB_FUNCTION |
56 | | # ifdef _WIN32 |
57 | | # ifdef ROKEN_LIB_DYNAMIC |
58 | | # define ROKEN_LIB_FUNCTION __declspec(dllimport) |
59 | | # else |
60 | | # define ROKEN_LIB_FUNCTION |
61 | | # endif |
62 | | # else |
63 | | # define ROKEN_LIB_FUNCTION |
64 | | # endif |
65 | | # endif |
66 | | |
67 | | # ifndef ROKEN_LIB_NORETURN_FUNCTION |
68 | | # ifdef _WIN32 |
69 | | # ifdef ROKEN_LIB_DYNAMIC |
70 | | # define ROKEN_LIB_NORETURN_FUNCTION __declspec(dllimport noreturn) |
71 | | # else |
72 | | # define ROKEN_LIB_NORETURN_FUNCTION __declspec(noreturn) |
73 | | # endif |
74 | | # else |
75 | | # define ROKEN_LIB_NORETURN_FUNCTION |
76 | | # endif |
77 | | # endif |
78 | | |
79 | | # ifndef ROKEN_LIB_CALL |
80 | | # ifdef _WIN32 |
81 | | # define ROKEN_LIB_CALL __cdecl |
82 | | # else |
83 | | # define ROKEN_LIB_CALL |
84 | | # endif |
85 | | # endif |
86 | | |
87 | | # ifndef ROKEN_LIB_VARIABLE |
88 | | # ifdef _WIN32 |
89 | | # ifdef ROKEN_LIB_DYNAMIC |
90 | | # define ROKEN_LIB_VARIABLE __declspec(dllimport) |
91 | | # else |
92 | | # define ROKEN_LIB_VARIABLE |
93 | | # endif |
94 | | # else |
95 | | # define ROKEN_LIB_VARIABLE |
96 | | # endif |
97 | | # endif |
98 | | |
99 | | #if !defined(__has_extension) |
100 | | #define __has_extension(x) 0 |
101 | | #endif |
102 | | |
103 | | #ifndef ROKEN_REQUIRE_GNUC |
104 | | #define ROKEN_REQUIRE_GNUC(m,n,p) \ |
105 | | (((__GNUC__ * 10000) + (__GNUC_MINOR__ * 100) + __GNUC_PATCHLEVEL__) >= \ |
106 | | (((m) * 10000) + ((n) * 100) + (p))) |
107 | | #endif |
108 | | |
109 | | #ifndef ROKEN_DEPRECATED |
110 | | #if __has_extension(deprecated) || ROKEN_REQUIRE_GNUC(3,1,0) |
111 | | #define ROKEN_DEPRECATED __attribute__ ((__deprecated__)) |
112 | | #elif defined(_MSC_VER) && (_MSC_VER>1200) |
113 | | #define ROKEN_DEPRECATED __declspec(deprecated) |
114 | | #else |
115 | | #define ROKEN_DEPRECATED |
116 | | #endif |
117 | | #endif |
118 | | |
119 | | #ifndef ROKEN_PRINTF_ATTRIBUTE |
120 | | #if __has_extension(format) || ROKEN_REQUIRE_GNUC(3,1,0) |
121 | | #define ROKEN_PRINTF_ATTRIBUTE(x) __attribute__ ((__format__ x)) |
122 | | #else |
123 | | #define ROKEN_PRINTF_ATTRIBUTE(x) |
124 | | #endif |
125 | | #endif |
126 | | |
127 | | #ifndef ROKEN_NORETURN_ATTRIBUTE |
128 | | #if __has_extension(noreturn) || ROKEN_REQUIRE_GNUC(3,1,0) |
129 | | #define ROKEN_NORETURN_ATTRIBUTE __attribute__ ((__noreturn__)) |
130 | | #else |
131 | | #define ROKEN_NORETURN_ATTRIBUTE |
132 | | #endif |
133 | | #endif |
134 | | |
135 | | #ifndef ROKEN_UNUSED_ATTRIBUTE |
136 | | #if __has_extension(unused) || ROKEN_REQUIRE_GNUC(3,1,0) |
137 | | #define ROKEN_UNUSED_ATTRIBUTE __attribute__ ((__unused__)) |
138 | | #else |
139 | | #define ROKEN_UNUSED_ATTRIBUTE |
140 | | #endif |
141 | | #endif |
142 | | |
143 | | #ifndef ROKEN_WARN_UNUSED_RESULT_ATTRIBUTE |
144 | | #if __has_extension(warn_unused_result) || ROKEN_REQUIRE_GNUC(3,3,0) |
145 | | #define ROKEN_WARN_UNUSED_RESULT_ATTRIBUTE __attribute__ ((__warn_unused_result__)) |
146 | | #else |
147 | | #define ROKEN_WARN_UNUSED_RESULT_ATTRIBUTE |
148 | | #endif |
149 | | #endif |
150 | | |
151 | | #ifdef HAVE_WINSOCK |
152 | | /* Declarations for Microsoft Windows */ |
153 | | |
154 | | #include <winsock2.h> |
155 | | #include <ws2tcpip.h> |
156 | | |
157 | | /* |
158 | | * error codes for inet_ntop/inet_pton |
159 | | */ |
160 | | typedef SOCKET rk_socket_t; |
161 | | |
162 | | #define rk_closesocket(x) closesocket(x) |
163 | | #define rk_INVALID_SOCKET INVALID_SOCKET |
164 | | #define rk_IS_BAD_SOCKET(s) ((s) == INVALID_SOCKET) |
165 | | #define rk_IS_SOCKET_ERROR(rv) ((rv) == SOCKET_ERROR) |
166 | | #define rk_SOCK_ERRNO WSAGetLastError() |
167 | | |
168 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_SOCK_IOCTL(SOCKET s, long cmd, int * argp); |
169 | | |
170 | | #define rk_SOCK_INIT() rk_WSAStartup() |
171 | | #define rk_SOCK_EXIT() rk_WSACleanup() |
172 | | |
173 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSAStartup(void); |
174 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSACleanup(void); |
175 | | |
176 | | #else /* not WinSock */ |
177 | | |
178 | | typedef int rk_socket_t; |
179 | | |
180 | 0 | #define rk_closesocket(x) close(x) |
181 | 0 | #define rk_SOCK_IOCTL(s,c,a) ioctl((s),(c),(a)) |
182 | 0 | #define rk_IS_BAD_SOCKET(s) ((s) < 0) |
183 | 0 | #define rk_IS_SOCKET_ERROR(rv) ((rv) < 0) |
184 | 0 | #define rk_SOCK_ERRNO errno |
185 | 0 | #define rk_INVALID_SOCKET (-1) |
186 | | |
187 | 0 | static inline ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_SOCK_INIT(void) { |
188 | 0 | return 0; |
189 | 0 | } Unexecuted instantiation: ca.c:rk_SOCK_INIT Unexecuted instantiation: cert.c:rk_SOCK_INIT Unexecuted instantiation: cms.c:rk_SOCK_INIT Unexecuted instantiation: collector.c:rk_SOCK_INIT Unexecuted instantiation: crypto.c:rk_SOCK_INIT Unexecuted instantiation: crypto-ec.c:rk_SOCK_INIT Unexecuted instantiation: error.c:rk_SOCK_INIT Unexecuted instantiation: env.c:rk_SOCK_INIT Unexecuted instantiation: file.c:rk_SOCK_INIT Unexecuted instantiation: keyset.c:rk_SOCK_INIT Unexecuted instantiation: ks_dir.c:rk_SOCK_INIT Unexecuted instantiation: ks_file.c:rk_SOCK_INIT Unexecuted instantiation: ks_keychain.c:rk_SOCK_INIT Unexecuted instantiation: ks_mem.c:rk_SOCK_INIT Unexecuted instantiation: ks_null.c:rk_SOCK_INIT Unexecuted instantiation: ks_p11.c:rk_SOCK_INIT Unexecuted instantiation: ks_p12.c:rk_SOCK_INIT Unexecuted instantiation: lock.c:rk_SOCK_INIT Unexecuted instantiation: name.c:rk_SOCK_INIT Unexecuted instantiation: peer.c:rk_SOCK_INIT Unexecuted instantiation: print.c:rk_SOCK_INIT Unexecuted instantiation: req.c:rk_SOCK_INIT Unexecuted instantiation: revoke.c:rk_SOCK_INIT Unexecuted instantiation: sel.c:rk_SOCK_INIT Unexecuted instantiation: sel-gram.tab.c:rk_SOCK_INIT Unexecuted instantiation: stringprep.c:rk_SOCK_INIT Unexecuted instantiation: errorlist.c:rk_SOCK_INIT Unexecuted instantiation: errorlist_table.c:rk_SOCK_INIT Unexecuted instantiation: normalize.c:rk_SOCK_INIT Unexecuted instantiation: combining.c:rk_SOCK_INIT Unexecuted instantiation: utf8.c:rk_SOCK_INIT Unexecuted instantiation: bidi.c:rk_SOCK_INIT Unexecuted instantiation: ldap.c:rk_SOCK_INIT Unexecuted instantiation: map.c:rk_SOCK_INIT Unexecuted instantiation: map_table.c:rk_SOCK_INIT Unexecuted instantiation: array.c:rk_SOCK_INIT Unexecuted instantiation: bool.c:rk_SOCK_INIT Unexecuted instantiation: bsearch.c:rk_SOCK_INIT Unexecuted instantiation: data.c:rk_SOCK_INIT Unexecuted instantiation: db.c:rk_SOCK_INIT Unexecuted instantiation: dict.c:rk_SOCK_INIT Unexecuted instantiation: heimbase.c:rk_SOCK_INIT Unexecuted instantiation: string.c:rk_SOCK_INIT Unexecuted instantiation: number.c:rk_SOCK_INIT Unexecuted instantiation: null.c:rk_SOCK_INIT Unexecuted instantiation: json.c:rk_SOCK_INIT Unexecuted instantiation: config_file.c:rk_SOCK_INIT Unexecuted instantiation: context.c:rk_SOCK_INIT Unexecuted instantiation: error_string.c:rk_SOCK_INIT Unexecuted instantiation: expand_path.c:rk_SOCK_INIT Unexecuted instantiation: log.c:rk_SOCK_INIT Unexecuted instantiation: plugin.c:rk_SOCK_INIT Unexecuted instantiation: warn.c:rk_SOCK_INIT Unexecuted instantiation: acache.c:rk_SOCK_INIT Unexecuted instantiation: add_et_list.c:rk_SOCK_INIT Unexecuted instantiation: addr_families.c:rk_SOCK_INIT Unexecuted instantiation: appdefault.c:rk_SOCK_INIT Unexecuted instantiation: asn1_glue.c:rk_SOCK_INIT Unexecuted instantiation: auth_context.c:rk_SOCK_INIT Unexecuted instantiation: authdata.c:rk_SOCK_INIT Unexecuted instantiation: build_ap_req.c:rk_SOCK_INIT Unexecuted instantiation: build_auth.c:rk_SOCK_INIT Unexecuted instantiation: cache.c:rk_SOCK_INIT Unexecuted instantiation: changepw.c:rk_SOCK_INIT Unexecuted instantiation: codec.c:rk_SOCK_INIT Unexecuted instantiation: constants.c:rk_SOCK_INIT Unexecuted instantiation: convert_creds.c:rk_SOCK_INIT Unexecuted instantiation: copy_host_realm.c:rk_SOCK_INIT Unexecuted instantiation: crc.c:rk_SOCK_INIT Unexecuted instantiation: creds.c:rk_SOCK_INIT Unexecuted instantiation: crypto-aes-sha1.c:rk_SOCK_INIT Unexecuted instantiation: crypto-aes-sha2.c:rk_SOCK_INIT Unexecuted instantiation: crypto-algs.c:rk_SOCK_INIT Unexecuted instantiation: crypto-arcfour.c:rk_SOCK_INIT Unexecuted instantiation: crypto-des3.c:rk_SOCK_INIT Unexecuted instantiation: crypto-des.c:rk_SOCK_INIT Unexecuted instantiation: crypto-des-common.c:rk_SOCK_INIT Unexecuted instantiation: crypto-evp.c:rk_SOCK_INIT Unexecuted instantiation: crypto-null.c:rk_SOCK_INIT Unexecuted instantiation: crypto-pk.c:rk_SOCK_INIT Unexecuted instantiation: crypto-rand.c:rk_SOCK_INIT Unexecuted instantiation: dcache.c:rk_SOCK_INIT Unexecuted instantiation: db_plugin.c:rk_SOCK_INIT Unexecuted instantiation: deprecated.c:rk_SOCK_INIT Unexecuted instantiation: eai_to_heim_errno.c:rk_SOCK_INIT Unexecuted instantiation: enomem.c:rk_SOCK_INIT Unexecuted instantiation: expand_hostname.c:rk_SOCK_INIT Unexecuted instantiation: fast.c:rk_SOCK_INIT Unexecuted instantiation: fcache.c:rk_SOCK_INIT Unexecuted instantiation: free.c:rk_SOCK_INIT Unexecuted instantiation: free_host_realm.c:rk_SOCK_INIT Unexecuted instantiation: generate_seq_number.c:rk_SOCK_INIT Unexecuted instantiation: generate_subkey.c:rk_SOCK_INIT Unexecuted instantiation: get_addrs.c:rk_SOCK_INIT Unexecuted instantiation: get_cred.c:rk_SOCK_INIT Unexecuted instantiation: get_default_principal.c:rk_SOCK_INIT Unexecuted instantiation: get_default_realm.c:rk_SOCK_INIT Unexecuted instantiation: get_for_creds.c:rk_SOCK_INIT Unexecuted instantiation: get_host_realm.c:rk_SOCK_INIT Unexecuted instantiation: get_in_tkt.c:rk_SOCK_INIT Unexecuted instantiation: get_port.c:rk_SOCK_INIT Unexecuted instantiation: init_creds.c:rk_SOCK_INIT Unexecuted instantiation: init_creds_pw.c:rk_SOCK_INIT Unexecuted instantiation: kcm.c:rk_SOCK_INIT Unexecuted instantiation: keyblock.c:rk_SOCK_INIT Unexecuted instantiation: keytab.c:rk_SOCK_INIT Unexecuted instantiation: keytab_any.c:rk_SOCK_INIT Unexecuted instantiation: keytab_file.c:rk_SOCK_INIT Unexecuted instantiation: keytab_memory.c:rk_SOCK_INIT Unexecuted instantiation: keytab_keyfile.c:rk_SOCK_INIT Unexecuted instantiation: krbhst.c:rk_SOCK_INIT Unexecuted instantiation: krcache.c:rk_SOCK_INIT Unexecuted instantiation: mcache.c:rk_SOCK_INIT Unexecuted instantiation: misc.c:rk_SOCK_INIT Unexecuted instantiation: mk_error.c:rk_SOCK_INIT Unexecuted instantiation: mk_priv.c:rk_SOCK_INIT Unexecuted instantiation: mk_rep.c:rk_SOCK_INIT Unexecuted instantiation: mk_req.c:rk_SOCK_INIT Unexecuted instantiation: mk_req_ext.c:rk_SOCK_INIT Unexecuted instantiation: mit_glue.c:rk_SOCK_INIT Unexecuted instantiation: net_read.c:rk_SOCK_INIT Unexecuted instantiation: net_write.c:rk_SOCK_INIT Unexecuted instantiation: n-fold.c:rk_SOCK_INIT Unexecuted instantiation: padata.c:rk_SOCK_INIT Unexecuted instantiation: pkinit.c:rk_SOCK_INIT Unexecuted instantiation: pkinit-ec.c:rk_SOCK_INIT Unexecuted instantiation: principal.c:rk_SOCK_INIT Unexecuted instantiation: prog_setup.c:rk_SOCK_INIT Unexecuted instantiation: pac.c:rk_SOCK_INIT Unexecuted instantiation: pcache.c:rk_SOCK_INIT Unexecuted instantiation: prompter_posix.c:rk_SOCK_INIT Unexecuted instantiation: rd_cred.c:rk_SOCK_INIT Unexecuted instantiation: rd_error.c:rk_SOCK_INIT Unexecuted instantiation: rd_priv.c:rk_SOCK_INIT Unexecuted instantiation: rd_rep.c:rk_SOCK_INIT Unexecuted instantiation: rd_req.c:rk_SOCK_INIT Unexecuted instantiation: replay.c:rk_SOCK_INIT Unexecuted instantiation: salt.c:rk_SOCK_INIT Unexecuted instantiation: salt-aes-sha1.c:rk_SOCK_INIT Unexecuted instantiation: salt-aes-sha2.c:rk_SOCK_INIT Unexecuted instantiation: salt-arcfour.c:rk_SOCK_INIT Unexecuted instantiation: salt-des3.c:rk_SOCK_INIT Unexecuted instantiation: salt-des.c:rk_SOCK_INIT Unexecuted instantiation: send_to_kdc.c:rk_SOCK_INIT Unexecuted instantiation: set_default_realm.c:rk_SOCK_INIT Unexecuted instantiation: store.c:rk_SOCK_INIT Unexecuted instantiation: store-int.c:rk_SOCK_INIT Unexecuted instantiation: store_emem.c:rk_SOCK_INIT Unexecuted instantiation: store_fd.c:rk_SOCK_INIT Unexecuted instantiation: store_mem.c:rk_SOCK_INIT Unexecuted instantiation: store_stdio.c:rk_SOCK_INIT Unexecuted instantiation: ticket.c:rk_SOCK_INIT Unexecuted instantiation: time.c:rk_SOCK_INIT Unexecuted instantiation: transited.c:rk_SOCK_INIT Unexecuted instantiation: version.c:rk_SOCK_INIT Unexecuted instantiation: sp800-108-kdf.c:rk_SOCK_INIT Unexecuted instantiation: aname_to_localname.c:rk_SOCK_INIT Unexecuted instantiation: kuserok.c:rk_SOCK_INIT Unexecuted instantiation: kx509.c:rk_SOCK_INIT Unexecuted instantiation: mk_cred.c:rk_SOCK_INIT Unexecuted instantiation: krb5-glue.c:rk_SOCK_INIT Unexecuted instantiation: com_err.c:rk_SOCK_INIT Unexecuted instantiation: init_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: external.c:rk_SOCK_INIT Unexecuted instantiation: compat.c:rk_SOCK_INIT Unexecuted instantiation: context_stubs.c:rk_SOCK_INIT Unexecuted instantiation: context_storage.c:rk_SOCK_INIT Unexecuted instantiation: accept_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: negoex_ctx.c:rk_SOCK_INIT Unexecuted instantiation: negoex_util.c:rk_SOCK_INIT Unexecuted instantiation: copy_ccache.c:rk_SOCK_INIT Unexecuted instantiation: delete_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: duplicate_cred.c:rk_SOCK_INIT Unexecuted instantiation: context_time.c:rk_SOCK_INIT Unexecuted instantiation: init.c:rk_SOCK_INIT Unexecuted instantiation: address_to_krb5addr.c:rk_SOCK_INIT Unexecuted instantiation: get_mic.c:rk_SOCK_INIT Unexecuted instantiation: inquire_context.c:rk_SOCK_INIT Unexecuted instantiation: add_cred.c:rk_SOCK_INIT Unexecuted instantiation: inquire_cred.c:rk_SOCK_INIT Unexecuted instantiation: inquire_cred_by_oid.c:rk_SOCK_INIT Unexecuted instantiation: inquire_cred_by_mech.c:rk_SOCK_INIT Unexecuted instantiation: inquire_mechs_for_name.c:rk_SOCK_INIT Unexecuted instantiation: inquire_names_for_mech.c:rk_SOCK_INIT Unexecuted instantiation: indicate_mechs.c:rk_SOCK_INIT Unexecuted instantiation: inquire_sec_context_by_oid.c:rk_SOCK_INIT Unexecuted instantiation: name_attrs.c:rk_SOCK_INIT Unexecuted instantiation: export_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: import_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: duplicate_name.c:rk_SOCK_INIT Unexecuted instantiation: import_name.c:rk_SOCK_INIT Unexecuted instantiation: compare_name.c:rk_SOCK_INIT Unexecuted instantiation: export_name.c:rk_SOCK_INIT Unexecuted instantiation: canonicalize_name.c:rk_SOCK_INIT Unexecuted instantiation: unwrap.c:rk_SOCK_INIT Unexecuted instantiation: wrap.c:rk_SOCK_INIT Unexecuted instantiation: release_name.c:rk_SOCK_INIT Unexecuted instantiation: cfx.c:rk_SOCK_INIT Unexecuted instantiation: 8003.c:rk_SOCK_INIT Unexecuted instantiation: arcfour.c:rk_SOCK_INIT Unexecuted instantiation: encapsulate.c:rk_SOCK_INIT Unexecuted instantiation: display_name.c:rk_SOCK_INIT Unexecuted instantiation: sequence.c:rk_SOCK_INIT Unexecuted instantiation: display_status.c:rk_SOCK_INIT Unexecuted instantiation: release_buffer.c:rk_SOCK_INIT Unexecuted instantiation: ccache_name.c:rk_SOCK_INIT Unexecuted instantiation: acquire_cred.c:rk_SOCK_INIT Unexecuted instantiation: release_cred.c:rk_SOCK_INIT Unexecuted instantiation: store_cred.c:rk_SOCK_INIT Unexecuted instantiation: set_cred_option.c:rk_SOCK_INIT Unexecuted instantiation: decapsulate.c:rk_SOCK_INIT Unexecuted instantiation: verify_mic.c:rk_SOCK_INIT Unexecuted instantiation: set_sec_context_option.c:rk_SOCK_INIT Unexecuted instantiation: process_context_token.c:rk_SOCK_INIT Unexecuted instantiation: prf.c:rk_SOCK_INIT Unexecuted instantiation: aeap.c:rk_SOCK_INIT Unexecuted instantiation: pname_to_uid.c:rk_SOCK_INIT Unexecuted instantiation: authorize_localname.c:rk_SOCK_INIT Unexecuted instantiation: cred.c:rk_SOCK_INIT Unexecuted instantiation: gss_krb5.c:rk_SOCK_INIT Unexecuted instantiation: gss_mech_switch.c:rk_SOCK_INIT Unexecuted instantiation: gss_process_context_token.c:rk_SOCK_INIT Unexecuted instantiation: gss_buffer_set.c:rk_SOCK_INIT Unexecuted instantiation: gss_aeap.c:rk_SOCK_INIT Unexecuted instantiation: gss_add_cred.c:rk_SOCK_INIT Unexecuted instantiation: gss_add_cred_from.c:rk_SOCK_INIT Unexecuted instantiation: gss_acquire_cred_from.c:rk_SOCK_INIT Unexecuted instantiation: gss_cred.c:rk_SOCK_INIT Unexecuted instantiation: gss_store_cred_into.c:rk_SOCK_INIT Unexecuted instantiation: gss_add_oid_set_member.c:rk_SOCK_INIT Unexecuted instantiation: gss_compare_name.c:rk_SOCK_INIT Unexecuted instantiation: gss_release_oid_set.c:rk_SOCK_INIT Unexecuted instantiation: gss_create_empty_oid_set.c:rk_SOCK_INIT Unexecuted instantiation: gss_duplicate_oid_set.c:rk_SOCK_INIT Unexecuted instantiation: gss_decapsulate_token.c:rk_SOCK_INIT Unexecuted instantiation: gss_inquire_cred_by_oid.c:rk_SOCK_INIT Unexecuted instantiation: gss_canonicalize_name.c:rk_SOCK_INIT Unexecuted instantiation: gss_inquire_sec_context_by_oid.c:rk_SOCK_INIT Unexecuted instantiation: gss_inquire_names_for_mech.c:rk_SOCK_INIT Unexecuted instantiation: gss_inquire_mechs_for_name.c:rk_SOCK_INIT Unexecuted instantiation: gss_wrap_size_limit.c:rk_SOCK_INIT Unexecuted instantiation: gss_names.c:rk_SOCK_INIT Unexecuted instantiation: gss_verify.c:rk_SOCK_INIT Unexecuted instantiation: gss_display_name.c:rk_SOCK_INIT Unexecuted instantiation: gss_duplicate_oid.c:rk_SOCK_INIT Unexecuted instantiation: gss_duplicate_cred.c:rk_SOCK_INIT Unexecuted instantiation: gss_display_status.c:rk_SOCK_INIT Unexecuted instantiation: gss_release_buffer.c:rk_SOCK_INIT Unexecuted instantiation: gss_release_oid.c:rk_SOCK_INIT Unexecuted instantiation: gss_test_oid_set_member.c:rk_SOCK_INIT Unexecuted instantiation: gss_release_cred.c:rk_SOCK_INIT Unexecuted instantiation: gss_set_sec_context_option.c:rk_SOCK_INIT Unexecuted instantiation: gss_export_name.c:rk_SOCK_INIT Unexecuted instantiation: gss_seal.c:rk_SOCK_INIT Unexecuted instantiation: gss_acquire_cred.c:rk_SOCK_INIT Unexecuted instantiation: gss_unseal.c:rk_SOCK_INIT Unexecuted instantiation: gss_verify_mic.c:rk_SOCK_INIT Unexecuted instantiation: gss_accept_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: gss_inquire_cred_by_mech.c:rk_SOCK_INIT Unexecuted instantiation: gss_indicate_mechs.c:rk_SOCK_INIT Unexecuted instantiation: gss_get_neg_mechs.c:rk_SOCK_INIT Unexecuted instantiation: gss_delete_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: gss_sign.c:rk_SOCK_INIT Unexecuted instantiation: gss_utils.c:rk_SOCK_INIT Unexecuted instantiation: gss_init_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: gss_oid_equal.c:rk_SOCK_INIT Unexecuted instantiation: gss_oid.c:rk_SOCK_INIT Unexecuted instantiation: gss_oid_to_str.c:rk_SOCK_INIT Unexecuted instantiation: gss_mo.c:rk_SOCK_INIT Unexecuted instantiation: gss_context_time.c:rk_SOCK_INIT Unexecuted instantiation: gss_encapsulate_token.c:rk_SOCK_INIT Unexecuted instantiation: gss_get_mic.c:rk_SOCK_INIT Unexecuted instantiation: gss_import_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: gss_inquire_cred.c:rk_SOCK_INIT Unexecuted instantiation: gss_wrap.c:rk_SOCK_INIT Unexecuted instantiation: gss_import_name.c:rk_SOCK_INIT Unexecuted instantiation: gss_duplicate_name.c:rk_SOCK_INIT Unexecuted instantiation: gss_unwrap.c:rk_SOCK_INIT Unexecuted instantiation: gss_export_sec_context.c:rk_SOCK_INIT Unexecuted instantiation: gss_export_name_composite.c:rk_SOCK_INIT Unexecuted instantiation: gss_inquire_context.c:rk_SOCK_INIT Unexecuted instantiation: gss_release_name.c:rk_SOCK_INIT Unexecuted instantiation: gss_set_cred_option.c:rk_SOCK_INIT Unexecuted instantiation: gss_pseudo_random.c:rk_SOCK_INIT Unexecuted instantiation: gss_authorize_localname.c:rk_SOCK_INIT Unexecuted instantiation: gss_get_name_attribute.c:rk_SOCK_INIT Unexecuted instantiation: gssspi_exchange_meta_data.c:rk_SOCK_INIT Unexecuted instantiation: gssspi_query_mechanism_info.c:rk_SOCK_INIT Unexecuted instantiation: gssspi_query_meta_data.c:rk_SOCK_INIT Unexecuted instantiation: base64.c:rk_SOCK_INIT Unexecuted instantiation: ct.c:rk_SOCK_INIT Unexecuted instantiation: hex.c:rk_SOCK_INIT Unexecuted instantiation: bswap.c:rk_SOCK_INIT Unexecuted instantiation: dumpdata.c:rk_SOCK_INIT Unexecuted instantiation: emalloc.c:rk_SOCK_INIT Unexecuted instantiation: ecalloc.c:rk_SOCK_INIT Unexecuted instantiation: getarg.c:rk_SOCK_INIT Unexecuted instantiation: getauxval.c:rk_SOCK_INIT Unexecuted instantiation: get_window_size.c:rk_SOCK_INIT Unexecuted instantiation: getdtablesize.c:rk_SOCK_INIT Unexecuted instantiation: issuid.c:rk_SOCK_INIT Unexecuted instantiation: parse_time.c:rk_SOCK_INIT Unexecuted instantiation: parse_units.c:rk_SOCK_INIT Unexecuted instantiation: vis.c:rk_SOCK_INIT Unexecuted instantiation: strlwr.c:rk_SOCK_INIT Unexecuted instantiation: strsep_copy.c:rk_SOCK_INIT Unexecuted instantiation: strsep.c:rk_SOCK_INIT Unexecuted instantiation: strupr.c:rk_SOCK_INIT Unexecuted instantiation: strpool.c:rk_SOCK_INIT Unexecuted instantiation: estrdup.c:rk_SOCK_INIT Unexecuted instantiation: erealloc.c:rk_SOCK_INIT Unexecuted instantiation: secure_getenv.c:rk_SOCK_INIT Unexecuted instantiation: simple_exec.c:rk_SOCK_INIT Unexecuted instantiation: strcollect.c:rk_SOCK_INIT Unexecuted instantiation: rtbl.c:rk_SOCK_INIT Unexecuted instantiation: rand.c:rk_SOCK_INIT Unexecuted instantiation: cloexec.c:rk_SOCK_INIT Unexecuted instantiation: clz.c:rk_SOCK_INIT Unexecuted instantiation: xfree.c:rk_SOCK_INIT Unexecuted instantiation: timeval.c:rk_SOCK_INIT Unexecuted instantiation: mergesort.c:rk_SOCK_INIT Unexecuted instantiation: mergesort_r.c:rk_SOCK_INIT Unexecuted instantiation: replace.c:rk_SOCK_INIT Unexecuted instantiation: resolve.c:rk_SOCK_INIT Unexecuted instantiation: socket.c:rk_SOCK_INIT Unexecuted instantiation: roken_gethostby.c:rk_SOCK_INIT Unexecuted instantiation: mkostemp.c:rk_SOCK_INIT Unexecuted instantiation: getuserinfo.c:rk_SOCK_INIT Unexecuted instantiation: memset_s.c:rk_SOCK_INIT Unexecuted instantiation: der_get.c:rk_SOCK_INIT Unexecuted instantiation: der_put.c:rk_SOCK_INIT Unexecuted instantiation: der_free.c:rk_SOCK_INIT Unexecuted instantiation: der_format.c:rk_SOCK_INIT Unexecuted instantiation: der_length.c:rk_SOCK_INIT Unexecuted instantiation: der_copy.c:rk_SOCK_INIT Unexecuted instantiation: der_cmp.c:rk_SOCK_INIT Unexecuted instantiation: der_print.c:rk_SOCK_INIT Unexecuted instantiation: extra.c:rk_SOCK_INIT Unexecuted instantiation: timegm.c:rk_SOCK_INIT Unexecuted instantiation: template.c:rk_SOCK_INIT Unexecuted instantiation: oid_resolution.c:rk_SOCK_INIT Unexecuted instantiation: aes.c:rk_SOCK_INIT Unexecuted instantiation: bn.c:rk_SOCK_INIT Unexecuted instantiation: dh.c:rk_SOCK_INIT Unexecuted instantiation: dh-ltm.c:rk_SOCK_INIT Unexecuted instantiation: des.c:rk_SOCK_INIT Unexecuted instantiation: dsa.c:rk_SOCK_INIT Unexecuted instantiation: engine.c:rk_SOCK_INIT Unexecuted instantiation: md4.c:rk_SOCK_INIT Unexecuted instantiation: md5.c:rk_SOCK_INIT Unexecuted instantiation: rsa.c:rk_SOCK_INIT Unexecuted instantiation: rsa-ltm.c:rk_SOCK_INIT Unexecuted instantiation: rc2.c:rk_SOCK_INIT Unexecuted instantiation: rc4.c:rk_SOCK_INIT Unexecuted instantiation: rijndael-alg-fst.c:rk_SOCK_INIT Unexecuted instantiation: rnd_keys.c:rk_SOCK_INIT Unexecuted instantiation: sha.c:rk_SOCK_INIT Unexecuted instantiation: sha256.c:rk_SOCK_INIT Unexecuted instantiation: sha512.c:rk_SOCK_INIT Unexecuted instantiation: ui.c:rk_SOCK_INIT Unexecuted instantiation: evp.c:rk_SOCK_INIT Unexecuted instantiation: evp-hcrypto.c:rk_SOCK_INIT Unexecuted instantiation: pkcs5.c:rk_SOCK_INIT Unexecuted instantiation: pkcs12.c:rk_SOCK_INIT Unexecuted instantiation: rand-unix.c:rk_SOCK_INIT Unexecuted instantiation: rand-fortuna.c:rk_SOCK_INIT Unexecuted instantiation: rand-timer.c:rk_SOCK_INIT Unexecuted instantiation: hmac.c:rk_SOCK_INIT Unexecuted instantiation: camellia.c:rk_SOCK_INIT Unexecuted instantiation: camellia-ntt.c:rk_SOCK_INIT Unexecuted instantiation: common.c:rk_SOCK_INIT Unexecuted instantiation: validate.c:rk_SOCK_INIT Unexecuted instantiation: krb5_init_context.c:rk_SOCK_INIT Unexecuted instantiation: client.c:rk_SOCK_INIT |
190 | | |
191 | 0 | #define rk_SOCK_EXIT() do { } while(0) |
192 | | |
193 | | #endif /* WinSock */ |
194 | | |
195 | | #ifndef IN_LOOPBACKNET |
196 | | #define IN_LOOPBACKNET 127 |
197 | | #endif |
198 | | |
199 | | #ifdef _MSC_VER |
200 | | #ifndef HAVE_STDINT_H |
201 | | #include <intsafe.h> |
202 | | #endif |
203 | | |
204 | | /* Declarations for Microsoft Visual C runtime on Windows */ |
205 | | |
206 | | #include<process.h> |
207 | | |
208 | | #include<io.h> |
209 | | |
210 | | #ifndef __BIT_TYPES_DEFINED__ |
211 | | #define __BIT_TYPES_DEFINED__ |
212 | | |
213 | | typedef __int8 int8_t; |
214 | | typedef __int16 int16_t; |
215 | | typedef __int32 int32_t; |
216 | | typedef __int64 int64_t; |
217 | | typedef unsigned __int8 uint8_t; |
218 | | typedef unsigned __int16 uint16_t; |
219 | | typedef unsigned __int32 uint32_t; |
220 | | typedef unsigned __int64 uint64_t; |
221 | | typedef uint8_t u_int8_t; |
222 | | typedef uint16_t u_int16_t; |
223 | | typedef uint32_t u_int32_t; |
224 | | typedef uint64_t u_int64_t; |
225 | | |
226 | | #endif /* __BIT_TYPES_DEFINED__ */ |
227 | | |
228 | | #define UNREACHABLE(x) x |
229 | | #define UNUSED_ARGUMENT(x) ((void) x) |
230 | | |
231 | | #define RETSIGTYPE void |
232 | | |
233 | | #define VOID_RETSIGTYPE 1 |
234 | | |
235 | | #ifdef VOID_RETSIGTYPE |
236 | | #define SIGRETURN(x) return |
237 | | #else |
238 | | #define SIGRETURN(x) return (RETSIGTYPE)(x) |
239 | | #endif |
240 | | |
241 | | #ifndef CPP_ONLY |
242 | | |
243 | | typedef int pid_t; |
244 | | |
245 | | typedef unsigned int gid_t; |
246 | | |
247 | | typedef unsigned int uid_t; |
248 | | |
249 | | typedef unsigned short mode_t; |
250 | | |
251 | | #endif |
252 | | |
253 | | #ifndef __cplusplus |
254 | | #define inline __inline |
255 | | #endif |
256 | | |
257 | | #else |
258 | | |
259 | | #define UNREACHABLE(x) |
260 | | #define UNUSED_ARGUMENT(x) |
261 | | |
262 | | #endif |
263 | | |
264 | | #ifdef _AIX |
265 | | struct ether_addr; |
266 | | struct sockaddr_dl; |
267 | | #endif |
268 | | #ifdef HAVE_SYS_PARAM_H |
269 | | #include <sys/param.h> |
270 | | #endif |
271 | | #ifdef HAVE_INTTYPES_H |
272 | | #include <inttypes.h> |
273 | | #endif |
274 | | #ifdef HAVE_SYS_TYPES_H |
275 | | #include <sys/types.h> |
276 | | #endif |
277 | | #ifdef HAVE_SYS_ERRNO_H |
278 | | #include <sys/errno.h> |
279 | | #endif |
280 | | #ifdef HAVE_SYS_BITYPES_H |
281 | | #include <sys/bitypes.h> |
282 | | #endif |
283 | | #ifdef HAVE_BIND_BITYPES_H |
284 | | #include <bind/bitypes.h> |
285 | | #endif |
286 | | #ifdef HAVE_NETINET_IN6_MACHTYPES_H |
287 | | #include <netinet/in6_machtypes.h> |
288 | | #endif |
289 | | #ifdef HAVE_UNISTD_H |
290 | | #include <unistd.h> |
291 | | #endif |
292 | | #ifdef HAVE_SYS_SOCKET_H |
293 | | #include <sys/socket.h> |
294 | | #endif |
295 | | #ifdef HAVE_SYS_UIO_H |
296 | | #include <sys/uio.h> |
297 | | #endif |
298 | | #ifdef HAVE_GRP_H |
299 | | #include <grp.h> |
300 | | #endif |
301 | | #ifdef HAVE_SYS_STAT_H |
302 | | #include <sys/stat.h> |
303 | | #endif |
304 | | #ifdef HAVE_NETINET_IN_H |
305 | | #include <netinet/in.h> |
306 | | #endif |
307 | | #ifdef HAVE_NETINET_IN6_H |
308 | | #include <netinet/in6.h> |
309 | | #endif |
310 | | #ifdef HAVE_NETINET6_IN6_H |
311 | | #include <netinet6/in6.h> |
312 | | #endif |
313 | | #ifdef HAVE_ARPA_INET_H |
314 | | #include <arpa/inet.h> |
315 | | #endif |
316 | | #ifdef HAVE_NETDB_H |
317 | | #include <netdb.h> |
318 | | #endif |
319 | | #ifdef HAVE_ARPA_NAMESER_H |
320 | | #include <arpa/nameser.h> |
321 | | #endif |
322 | | #ifdef HAVE_RESOLV_H |
323 | | #include <resolv.h> |
324 | | #endif |
325 | | #ifdef HAVE_SYSLOG_H |
326 | | #include <syslog.h> |
327 | | #endif |
328 | | #ifdef HAVE_FCNTL_H |
329 | | #include <fcntl.h> |
330 | | #endif |
331 | | #ifdef HAVE_ERRNO_H |
332 | | #include <errno.h> |
333 | | #endif |
334 | | #include <err.h> |
335 | | #ifdef HAVE_TERMIOS_H |
336 | | #include <termios.h> |
337 | | #endif |
338 | | #ifdef HAVE_SYS_IOCTL_H |
339 | | #include <sys/ioctl.h> |
340 | | #endif |
341 | | #ifdef TIME_WITH_SYS_TIME |
342 | | #include <sys/time.h> |
343 | | #include <time.h> |
344 | | #elif defined(HAVE_SYS_TIME_H) |
345 | | #include <sys/time.h> |
346 | | #else |
347 | | #include <time.h> |
348 | | #endif |
349 | | |
350 | | #ifdef HAVE_PATHS_H |
351 | | #include <paths.h> |
352 | | #endif |
353 | | |
354 | | #ifdef HAVE_DLFCN_H |
355 | | #include <dlfcn.h> |
356 | | #endif |
357 | | |
358 | | #ifdef HAVE_DIRENT_H |
359 | | #include <dirent.h> |
360 | | #endif |
361 | | |
362 | | #ifdef WIN32 |
363 | | #include <direct.h> |
364 | | #endif |
365 | | |
366 | | #ifdef BACKSLASH_PATH_DELIM |
367 | | #define rk_PATH_DELIM '\\' |
368 | | #endif |
369 | | |
370 | | #ifndef HAVE_SSIZE_T |
371 | | #ifndef SSIZE_T_DEFINED |
372 | | #ifdef ssize_t |
373 | | #undef ssize_t |
374 | | #endif |
375 | | #ifdef _WIN64 |
376 | | typedef __int64 ssize_t; |
377 | | #else |
378 | | typedef int ssize_t; |
379 | | #endif |
380 | | #define SSIZE_T_DEFINED |
381 | | #endif /* SSIZE_T_DEFINED */ |
382 | | #endif /* HAVE_SSIZE_T */ |
383 | | |
384 | | #include <roken-common.h> |
385 | | |
386 | | ROKEN_CPP_START |
387 | | |
388 | | #ifdef HAVE_UINTPTR_T |
389 | 0 | #define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x)) |
390 | | #else |
391 | | #define rk_UNCONST(x) ((void *)(unsigned long)(const void *)(x)) |
392 | | #endif |
393 | | |
394 | | #if !defined(HAVE_SETSID) && defined(HAVE__SETSID) |
395 | | #define setsid _setsid |
396 | | #endif |
397 | | |
398 | | #ifdef _MSC_VER |
399 | | /* Additional macros for Visual C/C++ runtime */ |
400 | | |
401 | | #define close _close |
402 | | |
403 | | #define getpid _getpid |
404 | | |
405 | | #define open _open |
406 | | |
407 | | #define chdir _chdir |
408 | | |
409 | | #define fsync _commit |
410 | | |
411 | | #define _PIPE_BUFFER_SZ 8192 |
412 | | #define pipe(fds) _pipe((fds), _PIPE_BUFFER_SZ, O_BINARY); |
413 | | |
414 | | #define ftruncate(fd, sz) _chsize((fd), (sz)) |
415 | | |
416 | | #if !defined(HAVE_UCRT) |
417 | | #define snprintf rk_snprintf |
418 | | #define vsnprintf rk_vsnprintf |
419 | | #define vasnprintf rk_vasnprintf |
420 | | #define vasprintf rk_vasprintf |
421 | | #define asnprintf rk_asnprintf |
422 | | #define asprintf rk_asprintf |
423 | | |
424 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
425 | | rk_snprintf (char *str, size_t sz, const char *format, ...); |
426 | | |
427 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
428 | | rk_asprintf (char **ret, const char *format, ...); |
429 | | |
430 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
431 | | rk_asnprintf (char **ret, size_t max_sz, const char *format, ...); |
432 | | |
433 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
434 | | rk_vasprintf (char **ret, const char *format, va_list args); |
435 | | |
436 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
437 | | rk_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args); |
438 | | |
439 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
440 | | rk_vsnprintf (char *str, size_t sz, const char *format, va_list args); |
441 | | #endif /* !defined(HAVE_UCRT) */ |
442 | | |
443 | | /* missing stat.h predicates */ |
444 | | |
445 | | #define S_ISREG(m) (((m) & _S_IFREG) == _S_IFREG) |
446 | | |
447 | | #define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR) |
448 | | |
449 | | #define S_ISCHR(m) (((m) & _S_IFCHR) == _S_IFCHR) |
450 | | |
451 | | #define S_ISFIFO(m) (((m) & _S_IFIFO) == _S_IFIFO) |
452 | | |
453 | | /* The following are not implemented: |
454 | | |
455 | | S_ISLNK(m) |
456 | | S_ISSOCK(m) |
457 | | S_ISBLK(m) |
458 | | */ |
459 | | |
460 | | /* The following symbolic constants are provided for rk_mkdir mode */ |
461 | | |
462 | | #define S_IRWXU 00700 /* user (file owner) has read, write and execute permission */ |
463 | | #define S_IRUSR 00400 /* user has read permission */ |
464 | | #define S_IWUSR 00200 /* user has write permission */ |
465 | | #define S_IXUSR 00100 /* user has execute permission */ |
466 | | #define S_IRWXG 00070 /* group has read, write and execute permission */ |
467 | | #define S_IRGRP 00040 /* group has read permission */ |
468 | | #define S_IWGRP 00020 /* group has write permission */ |
469 | | #define S_IXGRP 00010 /* group has execute permission */ |
470 | | #define S_IRWXO 00007 /* others have read, write and execute permission */ |
471 | | #define S_IROTH 00004 /* others have read permission */ |
472 | | #define S_IWOTH 00002 /* others have write permission */ |
473 | | #define S_IXOTH 00001 /* others have execute permission */ |
474 | | |
475 | | #if !defined(ROKEN_NO_DEFINE_ALLOCATORS) |
476 | | /* Ensure that a common memory allocator is used by all */ |
477 | | #define calloc rk_calloc |
478 | | #define free rk_free |
479 | | #define malloc rk_malloc |
480 | | #define realloc rk_realloc |
481 | | #define strdup rk_strdup |
482 | | #define wcsdup rk_wcsdup |
483 | | #endif |
484 | | |
485 | | ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL |
486 | | rk_calloc(size_t, size_t); |
487 | | |
488 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL |
489 | | rk_free(void *); |
490 | | |
491 | | ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL |
492 | | rk_malloc(size_t); |
493 | | |
494 | | ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL |
495 | | rk_realloc(void *, size_t); |
496 | | |
497 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
498 | | rk_strdup(const char *); |
499 | | |
500 | | ROKEN_LIB_FUNCTION unsigned short * ROKEN_LIB_CALL |
501 | | rk_wcsdup(const unsigned short *); |
502 | | |
503 | | #endif /* _MSC_VER */ |
504 | | |
505 | | #ifndef HAVE_MEMMEM |
506 | | #define memmem rk_smemmem |
507 | | ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL memmem(const void *, size_t, const void *, size_t); |
508 | | #endif |
509 | | |
510 | | #ifdef HAVE_WINSOCK |
511 | | |
512 | | /* While we are at it, define WinSock specific scatter gather socket |
513 | | I/O. */ |
514 | | |
515 | | #define iovec _WSABUF |
516 | | #define iov_base buf |
517 | | #define iov_len len |
518 | | |
519 | | struct msghdr { |
520 | | void *msg_name; |
521 | | socklen_t msg_namelen; |
522 | | struct iovec *msg_iov; |
523 | | size_t msg_iovlen; |
524 | | void *msg_control; |
525 | | socklen_t msg_controllen; |
526 | | int msg_flags; |
527 | | }; |
528 | | |
529 | | #define sendmsg sendmsg_w32 |
530 | | |
531 | | ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL |
532 | | sendmsg_w32(rk_socket_t s, const struct msghdr * msg, int flags); |
533 | | |
534 | | #endif /* HAVE_WINSOCK */ |
535 | | |
536 | | #ifndef HAVE_PUTENV |
537 | | #define putenv rk_putenv |
538 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL putenv(const char *); |
539 | | #endif |
540 | | |
541 | | #if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO) |
542 | | #ifndef HAVE_SETENV |
543 | | #define setenv rk_setenv |
544 | | #endif |
545 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setenv(const char *, const char *, int); |
546 | | #endif |
547 | | |
548 | | #if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO) |
549 | | #ifndef HAVE_UNSETENV |
550 | | #define unsetenv rk_unsetenv |
551 | | #endif |
552 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL unsetenv(const char *); |
553 | | #endif |
554 | | |
555 | | #if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO) |
556 | | #ifndef HAVE_GETUSERSHELL |
557 | | #define getusershell rk_getusershell |
558 | | #define endusershell rk_endusershell |
559 | | #endif |
560 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL getusershell(void); |
561 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL endusershell(void); |
562 | | #endif |
563 | | |
564 | | #if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO) |
565 | | #ifndef HAVE_SNPRINTF |
566 | | #define snprintf rk_snprintf |
567 | | #endif |
568 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
569 | | rk_snprintf (char *, size_t, const char *, ...) |
570 | | ROKEN_PRINTF_ATTRIBUTE((__printf__, 3, 4)); |
571 | | #endif |
572 | | |
573 | | #if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO) |
574 | | #ifndef HAVE_VSNPRINTF |
575 | | #define vsnprintf rk_vsnprintf |
576 | | #endif |
577 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
578 | | rk_vsnprintf (char *, size_t, const char *, va_list) |
579 | | ROKEN_PRINTF_ATTRIBUTE((__printf__, 3, 0)); |
580 | | #endif |
581 | | |
582 | | #if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO) |
583 | | #ifndef HAVE_ASPRINTF |
584 | | #define asprintf rk_asprintf |
585 | | #endif |
586 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
587 | | rk_asprintf (char **, const char *, ...) |
588 | | ROKEN_PRINTF_ATTRIBUTE((__printf__, 2, 3)); |
589 | | #endif |
590 | | |
591 | | #if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO) |
592 | | #ifndef HAVE_VASPRINTF |
593 | | #define vasprintf rk_vasprintf |
594 | | #endif |
595 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
596 | | rk_vasprintf (char **, const char *, va_list) |
597 | | ROKEN_PRINTF_ATTRIBUTE((__printf__, 2, 0)); |
598 | | #endif |
599 | | |
600 | | #if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO) |
601 | | #ifndef HAVE_ASNPRINTF |
602 | | #define asnprintf rk_asnprintf |
603 | | #endif |
604 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
605 | | rk_asnprintf (char **, size_t, const char *, ...) |
606 | | ROKEN_PRINTF_ATTRIBUTE((__printf__, 3, 4)); |
607 | | #endif |
608 | | |
609 | | #if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO) |
610 | | #ifndef HAVE_VASNPRINTF |
611 | | #define vasnprintf rk_vasnprintf |
612 | | #endif |
613 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
614 | | vasnprintf (char **, size_t, const char *, va_list) |
615 | | ROKEN_PRINTF_ATTRIBUTE((__printf__, 3, 0)); |
616 | | #endif |
617 | | |
618 | | #if !defined(HAVE_EVASPRINTF) || defined(NEED_EVASPRINTF_PROTO) |
619 | | #define evasprintf rk_evasprintf |
620 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
621 | | rk_evasprintf(const char *format, va_list args); |
622 | | #endif |
623 | | |
624 | | #if !defined(HAVE_EASPRINTF) || defined(NEED_EASPRINTF_PROTO) |
625 | | #define easprintf rk_easprintf |
626 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
627 | | rk_easprintf(const char *format, ...); |
628 | | #endif |
629 | | |
630 | | #ifndef HAVE_STRDUP |
631 | | #define strdup rk_strdup |
632 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strdup(const char *); |
633 | | #endif |
634 | | |
635 | | #if !defined(HAVE_STRNDUP) || defined(NEED_STRNDUP_PROTO) |
636 | | #ifndef HAVE_STRNDUP |
637 | | #define strndup rk_strndup |
638 | | #endif |
639 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strndup(const char *, size_t); |
640 | | #endif |
641 | | |
642 | | #ifndef HAVE_STRLWR |
643 | 0 | #define strlwr rk_strlwr |
644 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strlwr(char *); |
645 | | #endif |
646 | | |
647 | | #ifndef HAVE_STRNLEN |
648 | | #define strnlen rk_strnlen |
649 | | ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strnlen(const char*, size_t); |
650 | | #endif |
651 | | |
652 | | #if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO) |
653 | | #ifndef HAVE_STRSEP |
654 | | #define strsep rk_strsep |
655 | | #endif |
656 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strsep(char**, const char*); |
657 | | #endif |
658 | | |
659 | | #if !defined(HAVE_STRSEP_COPY) || defined(NEED_STRSEP_COPY_PROTO) |
660 | | #ifndef HAVE_STRSEP_COPY |
661 | 0 | #define strsep_copy rk_strsep_copy |
662 | | #endif |
663 | | ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL strsep_copy(const char**, const char*, char*, size_t); |
664 | | #endif |
665 | | |
666 | | #ifndef HAVE_STRCASECMP |
667 | | #define strcasecmp rk_strcasecmp |
668 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strcasecmp(const char *, const char *); |
669 | | #endif |
670 | | |
671 | | #ifdef NEED_FCLOSE_PROTO |
672 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fclose(FILE *); |
673 | | #endif |
674 | | |
675 | | #ifdef NEED_STRTOK_R_PROTO |
676 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strtok_r(char *, const char *, char **); |
677 | | #endif |
678 | | |
679 | | #ifndef HAVE_STRUPR |
680 | 0 | #define strupr rk_strupr |
681 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strupr(char *); |
682 | | #endif |
683 | | |
684 | | #ifndef HAVE_STRLCPY |
685 | | #define strlcpy rk_strlcpy |
686 | | ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *, const char *, size_t); |
687 | | #endif |
688 | | |
689 | | #ifndef HAVE_STRLCAT |
690 | | #define strlcat rk_strlcat |
691 | | ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcat (char *, const char *, size_t); |
692 | | #endif |
693 | | |
694 | | #ifndef HAVE_GETDTABLESIZE |
695 | | #define getdtablesize rk_getdtablesize |
696 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void); |
697 | | #endif |
698 | | |
699 | | #if !defined(HAVE_STRERROR) && !defined(strerror) |
700 | | #define strerror rk_strerror |
701 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int); |
702 | | #endif |
703 | | |
704 | | #if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R)) |
705 | | int ROKEN_LIB_FUNCTION rk_strerror_r(int, char *, size_t); |
706 | | #else |
707 | 0 | #define rk_strerror_r strerror_r |
708 | | #endif |
709 | | |
710 | | #if !defined(HAVE_HSTRERROR) || defined(NEED_HSTRERROR_PROTO) |
711 | | #ifndef HAVE_HSTRERROR |
712 | | #define hstrerror rk_hstrerror |
713 | | #endif |
714 | | /* This causes a fatal error under Psoriasis */ |
715 | | #ifndef SunOS |
716 | | ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL hstrerror(int); |
717 | | #endif |
718 | | #endif |
719 | | |
720 | | #if !HAVE_DECL_H_ERRNO |
721 | | extern int h_errno; |
722 | | #endif |
723 | | |
724 | | #if !defined(HAVE_INET_ATON) || defined(NEED_INET_ATON_PROTO) |
725 | | #ifndef HAVE_INET_ATON |
726 | | #define inet_aton rk_inet_aton |
727 | | #endif |
728 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL inet_aton(const char *, struct in_addr *); |
729 | | #endif |
730 | | |
731 | | #ifndef HAVE_INET_NTOP |
732 | | #define inet_ntop rk_inet_ntop |
733 | | ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL |
734 | | inet_ntop(int af, const void *src, char *dst, size_t size); |
735 | | #endif |
736 | | |
737 | | #ifndef HAVE_INET_PTON |
738 | | #define inet_pton rk_inet_pton |
739 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
740 | | inet_pton(int, const char *, void *); |
741 | | #endif |
742 | | |
743 | | #ifndef HAVE_GETCWD |
744 | | #define getcwd rk_getcwd |
745 | | ROKEN_LIB_FUNCTION char* ROKEN_LIB_CALL getcwd(char *, size_t); |
746 | | #endif |
747 | | |
748 | | #ifdef HAVE_PWD_H |
749 | | #include <pwd.h> |
750 | | #endif |
751 | | |
752 | | #ifndef HAVE_SETEUID |
753 | | #define seteuid rk_seteuid |
754 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL seteuid(uid_t); |
755 | | #endif |
756 | | |
757 | | #ifndef HAVE_SETEGID |
758 | | #define setegid rk_setegid |
759 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setegid(gid_t); |
760 | | #endif |
761 | | |
762 | | #ifndef HAVE_LSTAT |
763 | | #define lstat rk_lstat |
764 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL lstat(const char *, struct stat *); |
765 | | #endif |
766 | | |
767 | | #if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO) |
768 | | #ifndef HAVE_MKSTEMP |
769 | | #define mkstemp rk_mkstemp |
770 | | #endif |
771 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL mkstemp(char *); |
772 | | #endif |
773 | | |
774 | | #ifndef HAVE_MKOSTEMP |
775 | | #define mkostemp rk_mkostemp |
776 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL mkostemp(char *, int); |
777 | | #endif |
778 | | |
779 | | #ifndef HAVE_MKDTEMP |
780 | | #define mkdtemp rk_mkdtemp |
781 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL mkdtemp(char *); |
782 | | #endif |
783 | | |
784 | | #ifndef HAVE_INITGROUPS |
785 | | #define initgroups rk_initgroups |
786 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL initgroups(const char *, gid_t); |
787 | | #endif |
788 | | |
789 | | #ifndef HAVE_FCHOWN |
790 | | #define fchown rk_fchown |
791 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fchown(int, uid_t, gid_t); |
792 | | #endif |
793 | | |
794 | | #ifdef RENAME_DOES_NOT_UNLINK |
795 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_rename(const char *, const char *); |
796 | | #else |
797 | 0 | #define rk_rename(__rk_rn_from,__rk_rn_to) rename(__rk_rn_from,__rk_rn_to) |
798 | | #endif |
799 | | |
800 | | #ifdef WIN32 |
801 | | #define mkdir rk_mkdir |
802 | | #else |
803 | 0 | #define rk_mkdir(__rk_rn_name, __rk_rn_mode) mkdir(__rk_rn_name,__rk_rn_mode) |
804 | | #endif |
805 | | |
806 | | |
807 | | #if !defined(HAVE_DAEMON) || defined(NEED_DAEMON_PROTO) |
808 | | #ifndef HAVE_DAEMON |
809 | | #define daemon rk_daemon |
810 | | #endif |
811 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL daemon(int, int); |
812 | | #endif |
813 | | |
814 | | #ifndef HAVE_CHOWN |
815 | | #define chown rk_chown |
816 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL chown(const char *, uid_t, gid_t); |
817 | | #endif |
818 | | |
819 | | #ifndef HAVE_RCMD |
820 | | #define rcmd rk_rcmd |
821 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
822 | | rcmd(char **, unsigned short, const char *, |
823 | | const char *, const char *, int *); |
824 | | #endif |
825 | | |
826 | | #if !defined(HAVE_INNETGR) || defined(NEED_INNETGR_PROTO) |
827 | | #ifndef HAVE_INNETGR |
828 | | #define innetgr rk_innetgr |
829 | | #endif |
830 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL innetgr(const char*, const char*, |
831 | | const char*, const char*); |
832 | | #endif |
833 | | |
834 | | #if !defined(HAVE_GETHOSTNAME) || defined(NEED_GETHOSTNAME_PROTO) |
835 | | #ifndef HAVE_GETHOSTNAME |
836 | | #define gethostname rk_gethostname |
837 | | #endif |
838 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL gethostname(char *, int); |
839 | | #endif |
840 | | |
841 | | #ifndef HAVE_WRITEV |
842 | | #define writev rk_writev |
843 | | ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL |
844 | | writev(int, const struct iovec *, int); |
845 | | #endif |
846 | | |
847 | | #ifndef HAVE_READV |
848 | | #define readv rk_readv |
849 | | ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL |
850 | | readv(int, const struct iovec *, int); |
851 | | #endif |
852 | | |
853 | | #ifdef NO_PIDFILES |
854 | | #define rk_pidfile(x) ((void) 0) |
855 | | #else |
856 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_pidfile (const char*); |
857 | | #endif |
858 | | |
859 | | #ifndef HAVE_BSWAP64 |
860 | 0 | #define bswap64 rk_bswap64 |
861 | | ROKEN_LIB_FUNCTION uint64_t ROKEN_LIB_CALL bswap64(uint64_t); |
862 | | #endif |
863 | | |
864 | | #ifndef HAVE_BSWAP32 |
865 | 0 | #define bswap32 rk_bswap32 |
866 | | ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL bswap32(unsigned int); |
867 | | #endif |
868 | | |
869 | | #ifndef HAVE_BSWAP16 |
870 | 0 | #define bswap16 rk_bswap16 |
871 | | ROKEN_LIB_FUNCTION unsigned short ROKEN_LIB_CALL bswap16(unsigned short); |
872 | | #endif |
873 | | |
874 | | #ifndef HAVE_FLOCK |
875 | | #ifndef LOCK_SH |
876 | | #define LOCK_SH 1 /* Shared lock */ |
877 | | #endif |
878 | | #ifndef LOCK_EX |
879 | | #define LOCK_EX 2 /* Exclusive lock */ |
880 | | #endif |
881 | | #ifndef LOCK_NB |
882 | | #define LOCK_NB 4 /* Don't block when locking */ |
883 | | #endif |
884 | | #ifndef LOCK_UN |
885 | | #define LOCK_UN 8 /* Unlock */ |
886 | | #endif |
887 | | |
888 | | #define flock(_x,_y) rk_flock(_x,_y) |
889 | | int rk_flock(int fd, int operation); |
890 | | #endif /* HAVE_FLOCK */ |
891 | | |
892 | | #ifndef HAVE_DIRFD |
893 | | #ifdef HAVE_DIR_DD_FD |
894 | | #define dirfd(x) ((x)->dd_fd) |
895 | | #elif defined(HAVE_DIR_D_FD) |
896 | | #define dirfd(x) ((x)->d_fd) |
897 | | #else |
898 | | #ifndef _WIN32 /* Windows code never calls dirfd */ |
899 | | #error Missing dirfd() and ->dd_fd and ->d_fd |
900 | | #endif |
901 | | #endif |
902 | | #endif |
903 | | |
904 | | ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL tm2time (struct tm, int); |
905 | | |
906 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_concat (char *, size_t, ...); |
907 | | |
908 | | ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_mconcat (char **, size_t, ...); |
909 | | |
910 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_vconcat (char *, size_t, va_list); |
911 | | |
912 | | ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL |
913 | | roken_vmconcat (char **, size_t, va_list); |
914 | | |
915 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_detach_prep(int, char **, char *); |
916 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL roken_detach_finish(const char *, int); |
917 | | |
918 | | ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL |
919 | | net_write (rk_socket_t, const void *, size_t); |
920 | | |
921 | | ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL |
922 | | net_read (rk_socket_t, void *, size_t); |
923 | | |
924 | | ROKEN_LIB_FUNCTION unsigned long ROKEN_LIB_CALL |
925 | | rk_getauxval(unsigned long); |
926 | | |
927 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
928 | | issuid(void); |
929 | | |
930 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
931 | | rk_secure_getenv(const char *); |
932 | | |
933 | | #ifndef HAVE_SECURE_GETENV |
934 | | #undef secure_getenv |
935 | | #define secure_getenv(e) rk_secure_getenv(e) |
936 | | #endif |
937 | | |
938 | | #ifndef HAVE_STRUCT_WINSIZE |
939 | | struct winsize { |
940 | | unsigned short ws_row, ws_col; |
941 | | unsigned short ws_xpixel, ws_ypixel; |
942 | | }; |
943 | | #endif |
944 | | |
945 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, int *, int *); |
946 | | |
947 | | #ifndef HAVE_VSYSLOG |
948 | | #define vsyslog rk_vsyslog |
949 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vsyslog(int, const char *, va_list); |
950 | | #endif |
951 | | |
952 | | #ifndef HAVE_GETOPT |
953 | | #define getopt rk_getopt |
954 | | #define optarg rk_optarg |
955 | | #define optind rk_optind |
956 | | #define opterr rk_opterr |
957 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
958 | | getopt(int nargc, char * const *nargv, const char *ostr); |
959 | | #endif |
960 | | |
961 | | #if !HAVE_DECL_OPTARG |
962 | | ROKEN_LIB_VARIABLE extern char *optarg; |
963 | | #endif |
964 | | #if !HAVE_DECL_OPTIND |
965 | | ROKEN_LIB_VARIABLE extern int optind; |
966 | | #endif |
967 | | #if !HAVE_DECL_OPTERR |
968 | | ROKEN_LIB_VARIABLE extern int opterr; |
969 | | #endif |
970 | | |
971 | | #ifndef HAVE_GETIPNODEBYNAME |
972 | | #define getipnodebyname rk_getipnodebyname |
973 | | #endif |
974 | | ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL |
975 | | rk_getipnodebyname(const char *, int, int, int *); |
976 | | |
977 | | #ifndef HAVE_GETIPNODEBYADDR |
978 | | #define getipnodebyaddr rk_getipnodebyaddr |
979 | | #endif |
980 | | ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL |
981 | | rk_getipnodebyaddr(const void *, size_t, int, int *); |
982 | | |
983 | | #ifndef HAVE_FREEHOSTENT |
984 | | #define freehostent rk_freehostent |
985 | | #endif |
986 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL |
987 | | rk_freehostent(struct hostent *); |
988 | | |
989 | | #ifndef HAVE_COPYHOSTENT |
990 | | #define copyhostent rk_copyhostent |
991 | | #endif |
992 | | ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL |
993 | | rk_copyhostent(const struct hostent *); |
994 | | |
995 | | #ifndef HAVE_SOCKLEN_T |
996 | | typedef int socklen_t; |
997 | | #endif |
998 | | |
999 | | #ifndef HAVE_STRUCT_SOCKADDR_STORAGE |
1000 | | |
1001 | | #ifndef HAVE_SA_FAMILY_T |
1002 | | typedef unsigned short sa_family_t; |
1003 | | #endif |
1004 | | |
1005 | | #ifdef HAVE_IPV6 |
1006 | | #define _SS_MAXSIZE sizeof(struct sockaddr_in6) |
1007 | | #else |
1008 | | #define _SS_MAXSIZE sizeof(struct sockaddr_in) |
1009 | | #endif |
1010 | | |
1011 | | #define _SS_ALIGNSIZE sizeof(unsigned long) |
1012 | | |
1013 | | #if HAVE_STRUCT_SOCKADDR_SA_LEN |
1014 | | |
1015 | | typedef unsigned char roken_sa_family_t; |
1016 | | |
1017 | | #define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t) - sizeof(unsigned char)) % _SS_ALIGNSIZE) |
1018 | | #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + sizeof(unsigned char) + _SS_PAD1SIZE + _SS_ALIGNSIZE)) |
1019 | | |
1020 | | struct sockaddr_storage { |
1021 | | unsigned char ss_len; |
1022 | | roken_sa_family_t ss_family; |
1023 | | char __ss_pad1[_SS_PAD1SIZE]; |
1024 | | unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1]; |
1025 | | }; |
1026 | | |
1027 | | #else /* !HAVE_STRUCT_SOCKADDR_SA_LEN */ |
1028 | | |
1029 | | typedef unsigned short roken_sa_family_t; |
1030 | | |
1031 | | #define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t)) % _SS_ALIGNSIZE) |
1032 | | #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE)) |
1033 | | |
1034 | | struct sockaddr_storage { |
1035 | | roken_sa_family_t ss_family; |
1036 | | char __ss_pad1[_SS_PAD1SIZE]; |
1037 | | unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1]; |
1038 | | }; |
1039 | | |
1040 | | #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */ |
1041 | | |
1042 | | #endif /* HAVE_STRUCT_SOCKADDR_STORAGE */ |
1043 | | |
1044 | | #ifndef HAVE_STRUCT_ADDRINFO |
1045 | | struct addrinfo { |
1046 | | int ai_flags; |
1047 | | int ai_family; |
1048 | | int ai_socktype; |
1049 | | int ai_protocol; |
1050 | | size_t ai_addrlen; |
1051 | | char *ai_canonname; |
1052 | | struct sockaddr *ai_addr; |
1053 | | struct addrinfo *ai_next; |
1054 | | }; |
1055 | | #endif |
1056 | | |
1057 | | #ifndef HAVE_GETADDRINFO |
1058 | | #define getaddrinfo rk_getaddrinfo |
1059 | | #endif |
1060 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1061 | | rk_getaddrinfo(const char *, |
1062 | | const char *, |
1063 | | const struct addrinfo *, |
1064 | | struct addrinfo **); |
1065 | | |
1066 | | #ifndef HAVE_GETNAMEINFO |
1067 | | #define getnameinfo rk_getnameinfo |
1068 | | #endif |
1069 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1070 | | rk_getnameinfo(const struct sockaddr *, socklen_t, |
1071 | | char *, size_t, |
1072 | | char *, size_t, |
1073 | | int); |
1074 | | |
1075 | | #ifndef HAVE_FREEADDRINFO |
1076 | | #define freeaddrinfo rk_freeaddrinfo |
1077 | | #endif |
1078 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL |
1079 | | rk_freeaddrinfo(struct addrinfo *); |
1080 | | |
1081 | | #ifndef HAVE_GAI_STRERROR |
1082 | | #define gai_strerror rk_gai_strerror |
1083 | | ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL |
1084 | | gai_strerror(int); |
1085 | | #endif |
1086 | | |
1087 | | #ifdef NO_SLEEP |
1088 | | |
1089 | | ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL |
1090 | | sleep(unsigned int seconds); |
1091 | | |
1092 | | ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL |
1093 | | usleep(unsigned int useconds); |
1094 | | |
1095 | | #endif |
1096 | | |
1097 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1098 | | getnameinfo_verified(const struct sockaddr *, socklen_t, |
1099 | | char *, size_t, |
1100 | | char *, size_t, |
1101 | | int); |
1102 | | |
1103 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1104 | | roken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); |
1105 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1106 | | roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **); |
1107 | | |
1108 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
1109 | | roken_get_homedir(char *, size_t); |
1110 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
1111 | | roken_get_appdatadir(char *, size_t); |
1112 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
1113 | | roken_get_username(char *, size_t); |
1114 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
1115 | | roken_get_loginname(char *, size_t); |
1116 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
1117 | | roken_get_shell(char *, size_t); |
1118 | | |
1119 | | #ifndef HAVE_STRFTIME |
1120 | | #define strftime rk_strftime |
1121 | | ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL |
1122 | | strftime (char *, size_t, const char *, const struct tm *); |
1123 | | #endif |
1124 | | |
1125 | | #ifndef HAVE_STRPTIME |
1126 | | #define strptime rk_strptime |
1127 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
1128 | | strptime (const char *, const char *, struct tm *); |
1129 | | #endif |
1130 | | |
1131 | | #ifndef HAVE_GETTIMEOFDAY |
1132 | | #define gettimeofday rk_gettimeofday |
1133 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1134 | | gettimeofday (struct timeval *, void *); |
1135 | | #endif |
1136 | | |
1137 | | #ifndef HAVE_EMALLOC |
1138 | 0 | #define emalloc rk_emalloc |
1139 | | ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL emalloc (size_t); |
1140 | | #endif |
1141 | | #ifndef HAVE_ECALLOC |
1142 | | #define ecalloc rk_ecalloc |
1143 | | ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL ecalloc(size_t, size_t); |
1144 | | #endif |
1145 | | #ifndef HAVE_EREALLOC |
1146 | 0 | #define erealloc rk_erealloc |
1147 | | ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL erealloc (void *, size_t); |
1148 | | #endif |
1149 | | #ifndef HAVE_ESTRDUP |
1150 | 0 | #define estrdup rk_estrdup |
1151 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL estrdup (const char *); |
1152 | | #endif |
1153 | | |
1154 | | /* |
1155 | | * kludges and such |
1156 | | */ |
1157 | | |
1158 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1159 | | roken_gethostby_setup(const char*, const char*); |
1160 | | ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL |
1161 | | roken_gethostbyname(const char*); |
1162 | | ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL |
1163 | | roken_gethostbyaddr(const void*, size_t, int); |
1164 | | |
1165 | | #ifdef GETSERVBYNAME_PROTO_COMPATIBLE |
1166 | 0 | #define roken_getservbyname(x,y) getservbyname(x,y) |
1167 | | #else |
1168 | | #define roken_getservbyname(x,y) getservbyname((char *)x, (char *)y) |
1169 | | #endif |
1170 | | |
1171 | | #ifdef OPENLOG_PROTO_COMPATIBLE |
1172 | 0 | #define roken_openlog(a,b,c) openlog(a,b,c) |
1173 | | #else |
1174 | | #define roken_openlog(a,b,c) openlog((char *)a,b,c) |
1175 | | #endif |
1176 | | |
1177 | | #ifdef GETSOCKNAME_PROTO_COMPATIBLE |
1178 | | #define roken_getsockname(a,b,c) getsockname(a,b,c) |
1179 | | #else |
1180 | | #define roken_getsockname(a,b,c) getsockname(a, b, (void*)c) |
1181 | | #endif |
1182 | | |
1183 | | #ifndef HAVE_SETPROGNAME |
1184 | 0 | #define setprogname rk_setprogname |
1185 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL setprogname(const char *); |
1186 | | #endif |
1187 | | |
1188 | | #ifndef HAVE_GETPROGNAME |
1189 | | #define getprogname rk_getprogname |
1190 | | ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void); |
1191 | | #endif |
1192 | | |
1193 | | #if !defined(HAVE_SETPROGNAME) && !defined(HAVE_GETPROGNAME) && !HAVE_DECL___PROGNAME |
1194 | | extern const char *__progname; |
1195 | | #endif |
1196 | | |
1197 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL |
1198 | | mini_inetd_addrinfo (struct addrinfo*, rk_socket_t *); |
1199 | | |
1200 | | ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL |
1201 | | mini_inetd (int, rk_socket_t *); |
1202 | | |
1203 | | #ifndef HAVE_LOCALTIME_R |
1204 | | #define localtime_r rk_localtime_r |
1205 | | ROKEN_LIB_FUNCTION struct tm * ROKEN_LIB_CALL |
1206 | | localtime_r(const time_t *, struct tm *); |
1207 | | #endif |
1208 | | |
1209 | | #if !defined(HAVE_STRTOLL) || defined(NEED_STRTOLL_PROTO) |
1210 | | #ifndef HAVE_STRTOLL |
1211 | | #define strtoll rk_strtoll |
1212 | | #endif |
1213 | | ROKEN_LIB_FUNCTION long long ROKEN_LIB_CALL |
1214 | | strtoll(const char * nptr, char ** endptr, int base); |
1215 | | #endif |
1216 | | |
1217 | | #if !defined(HAVE_STRTOULL) || defined(NEED_STRTOULL_PROTO) |
1218 | | #ifndef HAVE_STRTOULL |
1219 | | #define strtoull rk_strtoull |
1220 | | #endif |
1221 | | ROKEN_LIB_FUNCTION unsigned long long ROKEN_LIB_CALL |
1222 | | strtoull(const char * nptr, char ** endptr, int base); |
1223 | | #endif |
1224 | | |
1225 | | #if !defined(HAVE_STRSVIS) || defined(NEED_STRSVIS_PROTO) |
1226 | | #ifndef HAVE_STRSVIS |
1227 | | #define strsvis rk_strsvis |
1228 | | #endif |
1229 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1230 | | strsvis(char *, const char *, int, const char *); |
1231 | | #endif |
1232 | | |
1233 | | #if !defined(HAVE_STRSVISX) || defined(NEED_STRSVISX_PROTO) |
1234 | | #ifndef HAVE_STRSVISX |
1235 | | #define strsvisx rk_strsvisx |
1236 | | #endif |
1237 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1238 | | strsvisx(char *, const char *, size_t, int, const char *); |
1239 | | #endif |
1240 | | |
1241 | | #if !defined(HAVE_STRUNVIS) || defined(NEED_STRUNVIS_PROTO) |
1242 | | #ifndef HAVE_STRUNVIS |
1243 | | #define strunvis rk_strunvis |
1244 | | #endif |
1245 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1246 | | strunvis(char *, const char *); |
1247 | | #endif |
1248 | | |
1249 | | #if !defined(HAVE_STRVIS) || defined(NEED_STRVIS_PROTO) |
1250 | | #ifndef HAVE_STRVIS |
1251 | | #define strvis rk_strvis |
1252 | | #endif |
1253 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1254 | | strvis(char *, const char *, int); |
1255 | | #endif |
1256 | | |
1257 | | #if !defined(HAVE_STRVISX) || defined(NEED_STRVISX_PROTO) |
1258 | | #ifndef HAVE_STRVISX |
1259 | | #define strvisx rk_strvisx |
1260 | | #endif |
1261 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1262 | | strvisx(char *, const char *, size_t, int); |
1263 | | #endif |
1264 | | |
1265 | | #if !defined(HAVE_SVIS) || defined(NEED_SVIS_PROTO) |
1266 | | #ifndef HAVE_SVIS |
1267 | | #define svis rk_svis |
1268 | | #endif |
1269 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
1270 | | svis(char *, int, int, int, const char *); |
1271 | | #endif |
1272 | | |
1273 | | #if !defined(HAVE_UNVIS) || defined(NEED_UNVIS_PROTO) |
1274 | | #ifndef HAVE_UNVIS |
1275 | | #define unvis rk_unvis |
1276 | | #endif |
1277 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1278 | | unvis(char *, int, int *, int); |
1279 | | #endif |
1280 | | |
1281 | | #if !defined(HAVE_VIS) || defined(NEED_VIS_PROTO) |
1282 | | #ifndef HAVE_VIS |
1283 | | #define vis rk_vis |
1284 | | #endif |
1285 | | ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL |
1286 | | vis(char *, int, int, int); |
1287 | | #endif |
1288 | | |
1289 | | #if !defined(HAVE_CLOSEFROM) |
1290 | | #define closefrom rk_closefrom |
1291 | | #endif |
1292 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1293 | | rk_closefrom(int); |
1294 | | |
1295 | | #if !defined(HAVE_TIMEGM) |
1296 | | #define timegm rk_timegm |
1297 | | ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL |
1298 | | rk_timegm(struct tm *tm); |
1299 | | #endif |
1300 | | |
1301 | | #ifdef NEED_QSORT |
1302 | | #define qsort rk_qsort |
1303 | | void |
1304 | | rk_qsort(void *, size_t, size_t, int (*)(const void *, const void *)); |
1305 | | #endif |
1306 | | |
1307 | | #if !defined(HAVE_MERGESORT) |
1308 | | #define mergesort rk_mergesort |
1309 | | int |
1310 | | mergesort(void *base, size_t nel, size_t width, |
1311 | | int (*compar)(const void *, const void *)); |
1312 | | #endif |
1313 | | |
1314 | | #if !defined(HAVE_MERGESORT_R) |
1315 | 0 | #define mergesort_r rk_mergesort_r |
1316 | | int |
1317 | | mergesort_r(void *base, size_t nel, size_t width, |
1318 | | int (*compar)(const void *, const void *, void *), void *thunk); |
1319 | | #endif |
1320 | | |
1321 | | #ifndef HAVE_MEMSET_S |
1322 | 0 | #define memset_s rk_memset_s |
1323 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL memset_s(void *s, size_t smax, |
1324 | | int c, size_t n); |
1325 | | #endif |
1326 | | |
1327 | | #if defined(HAVE_ARC4RANDOM) |
1328 | | # define rk_random() arc4random() |
1329 | | #elif defined(HAVE_RANDOM) |
1330 | 0 | # define rk_random() random() |
1331 | | #else |
1332 | | # ifdef HAVE_WIN32_RAND_S |
1333 | | ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL |
1334 | | rk_random(void); |
1335 | | # else |
1336 | | # define rk_random() rand() |
1337 | | # endif |
1338 | | #endif |
1339 | | |
1340 | | #ifndef HAVE_TDELETE |
1341 | | #define tdelete(a,b,c) rk_tdelete(a,b,c) |
1342 | | #endif |
1343 | | #ifndef HAVE_TFIND |
1344 | | #define tfind(a,b,c) rk_tfind(a,b,c) |
1345 | | #endif |
1346 | | #ifndef HAVE_TSEARCH |
1347 | | #define tsearch(a,b,c) rk_tsearch(a,b,c) |
1348 | | #endif |
1349 | | #ifndef HAVE_TWALK |
1350 | | #define twalk(a,b) rk_twalk(a,b) |
1351 | | #endif |
1352 | | |
1353 | | #if defined(__linux__) && defined(SOCK_CLOEXEC) && !defined(SOCKET_WRAPPER_REPLACE) && !defined(__SOCKET_WRAPPER_H__) |
1354 | | #undef socket |
1355 | 0 | #define socket(_fam,_type,_prot) rk_socket(_fam,_type,_prot) |
1356 | | int ROKEN_LIB_FUNCTION rk_socket(int, int, int); |
1357 | | #endif |
1358 | | |
1359 | | /* Microsoft VC 2010 POSIX definitions */ |
1360 | | #ifndef EAFNOSUPPORT |
1361 | | #define EAFNOSUPPORT 102 |
1362 | | #endif |
1363 | | #ifndef EINPROGRESS |
1364 | | #define EINPROGRESS 112 |
1365 | | #endif |
1366 | | #ifndef ELOOP |
1367 | | #define ELOOP 114 |
1368 | | #endif |
1369 | | #ifndef ENOTSOCK |
1370 | | #define ENOTSOCK 128 |
1371 | | #endif |
1372 | | #ifndef ENOTSUP |
1373 | | #define ENOTSUP 129 |
1374 | | #endif |
1375 | | #ifndef EOVERFLOW |
1376 | | #define EOVERFLOW 132 |
1377 | | #endif |
1378 | | #ifndef ETIMEDOUT |
1379 | | #define ETIMEDOUT 138 |
1380 | | #endif |
1381 | | #ifndef EWOULDBLOCK |
1382 | | #define EWOULDBLOCK 140 |
1383 | | #endif |
1384 | | |
1385 | | #ifdef WIN32 |
1386 | | ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL |
1387 | | win32_getLibraryVersion(const char *libname, char **outname, char **outversion); |
1388 | | #endif |
1389 | | |
1390 | | #ifdef SOCKET_WRAPPER_REPLACE |
1391 | | #include <socket_wrapper.h> |
1392 | | #endif |
1393 | | |
1394 | | ROKEN_CPP_END |