• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef HEADER_CURL_SETUP_OS400_H
2 #define HEADER_CURL_SETUP_OS400_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 
28 /* OS/400 netdb.h does not define NI_MAXHOST. */
29 #define NI_MAXHOST      1025
30 
31 /* OS/400 netdb.h does not define NI_MAXSERV. */
32 #define NI_MAXSERV      32
33 
34 /* No OS/400 header file defines u_int32_t. */
35 typedef unsigned long   u_int32_t;
36 
37 /* OS/400 has no idea of a tty! */
38 #define isatty(fd)      0
39 
40 
41 /* System API wrapper prototypes & definitions to support ASCII parameters. */
42 
43 #include <sys/socket.h>
44 #include <netdb.h>
45 #include <gskssl.h>
46 #include <qsoasync.h>
47 #include <gssapi.h>
48 
49 extern int Curl_getaddrinfo_a(const char *nodename,
50                               const char *servname,
51                               const struct addrinfo *hints,
52                               struct addrinfo **res);
53 #define getaddrinfo             Curl_getaddrinfo_a
54 
55 /* Note socklen_t must be used as this is declared before curl_socklen_t */
56 extern int Curl_getnameinfo_a(const struct sockaddr *sa,
57                               socklen_t salen,
58                               char *nodename, socklen_t nodenamelen,
59                               char *servname, socklen_t servnamelen,
60                               int flags);
61 #define getnameinfo             Curl_getnameinfo_a
62 
63 /* GSSAPI wrappers. */
64 
65 extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status,
66                                         gss_buffer_t in_name,
67                                         gss_OID in_name_type,
68                                         gss_name_t * out_name);
69 #define gss_import_name         Curl_gss_import_name_a
70 
71 
72 extern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status,
73                                            OM_uint32 status_value,
74                                            int status_type, gss_OID mech_type,
75                                            gss_msg_ctx_t * message_context,
76                                            gss_buffer_t status_string);
77 #define gss_display_status      Curl_gss_display_status_a
78 
79 
80 extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
81                                              gss_cred_id_t cred_handle,
82                                              gss_ctx_id_t * context_handle,
83                                              gss_name_t target_name,
84                                              gss_OID mech_type,
85                                              gss_flags_t req_flags,
86                                              OM_uint32 time_req,
87                                              gss_channel_bindings_t
88                                              input_chan_bindings,
89                                              gss_buffer_t input_token,
90                                              gss_OID * actual_mech_type,
91                                              gss_buffer_t output_token,
92                                              gss_flags_t * ret_flags,
93                                              OM_uint32 * time_rec);
94 #define gss_init_sec_context    Curl_gss_init_sec_context_a
95 
96 
97 extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status,
98                                                gss_ctx_id_t * context_handle,
99                                                gss_buffer_t output_token);
100 #define gss_delete_sec_context  Curl_gss_delete_sec_context_a
101 
102 
103 /* LDAP wrappers. */
104 
105 #define BerValue                struct berval
106 
107 #define ldap_url_parse          ldap_url_parse_utf8
108 #define ldap_init               Curl_ldap_init_a
109 #define ldap_simple_bind_s      Curl_ldap_simple_bind_s_a
110 #define ldap_search_s           Curl_ldap_search_s_a
111 #define ldap_get_values_len     Curl_ldap_get_values_len_a
112 #define ldap_err2string         Curl_ldap_err2string_a
113 #define ldap_get_dn             Curl_ldap_get_dn_a
114 #define ldap_first_attribute    Curl_ldap_first_attribute_a
115 #define ldap_next_attribute     Curl_ldap_next_attribute_a
116 
117 /* Some socket functions must be wrapped to process textual addresses
118    like AF_UNIX. */
119 
120 extern int Curl_os400_connect(int sd, struct sockaddr *destaddr, int addrlen);
121 extern int Curl_os400_bind(int sd, struct sockaddr *localaddr, int addrlen);
122 extern int Curl_os400_sendto(int sd, char *buffer, int buflen, int flags,
123                              const struct sockaddr *dstaddr, int addrlen);
124 extern int Curl_os400_recvfrom(int sd, char *buffer, int buflen, int flags,
125                                struct sockaddr *fromaddr, int *addrlen);
126 extern int Curl_os400_getpeername(int sd, struct sockaddr *addr, int *addrlen);
127 extern int Curl_os400_getsockname(int sd, struct sockaddr *addr, int *addrlen);
128 
129 #define connect                 Curl_os400_connect
130 #define bind                    Curl_os400_bind
131 #define sendto                  Curl_os400_sendto
132 #define recvfrom                Curl_os400_recvfrom
133 #define getpeername             Curl_os400_getpeername
134 #define getsockname             Curl_os400_getsockname
135 
136 #ifdef HAVE_LIBZ
137 #define zlibVersion             Curl_os400_zlibVersion
138 #define inflateInit_            Curl_os400_inflateInit_
139 #define inflateInit2_           Curl_os400_inflateInit2_
140 #define inflate                 Curl_os400_inflate
141 #define inflateEnd              Curl_os400_inflateEnd
142 #endif
143 
144 #endif /* HEADER_CURL_SETUP_OS400_H */
145