• 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) 1998 - 2014, 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 http://curl.haxx.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  ***************************************************************************/
24 
25 
26 /* OS/400 netdb.h does not define NI_MAXHOST. */
27 #define NI_MAXHOST      1025
28 
29 /* OS/400 netdb.h does not define NI_MAXSERV. */
30 #define NI_MAXSERV      32
31 
32 /* No OS/400 header file defines u_int32_t. */
33 typedef unsigned long   u_int32_t;
34 
35 
36 /* System API wrapper prototypes & definitions to support ASCII parameters. */
37 
38 #include <sys/socket.h>
39 #include <netdb.h>
40 #include <gskssl.h>
41 #include <qsoasync.h>
42 #include <gssapi.h>
43 
44 extern int      Curl_getaddrinfo_a(const char * nodename,
45                                    const char * servname,
46                                    const struct addrinfo * hints,
47                                    struct addrinfo * * res);
48 #define getaddrinfo             Curl_getaddrinfo_a
49 
50 
51 extern int      Curl_getnameinfo_a(const struct sockaddr * sa,
52                                    curl_socklen_t salen,
53                                    char * nodename, curl_socklen_t nodenamelen,
54                                    char * servname, curl_socklen_t servnamelen,
55                                    int flags);
56 #define getnameinfo             Curl_getnameinfo_a
57 
58 
59 /* GSKit wrappers. */
60 
61 extern int      Curl_gsk_environment_open(gsk_handle * my_env_handle);
62 #define gsk_environment_open    Curl_gsk_environment_open
63 
64 extern int      Curl_gsk_secure_soc_open(gsk_handle my_env_handle,
65                                          gsk_handle * my_session_handle);
66 #define gsk_secure_soc_open     Curl_gsk_secure_soc_open
67 
68 extern int      Curl_gsk_environment_close(gsk_handle * my_env_handle);
69 #define gsk_environment_close   Curl_gsk_environment_close
70 
71 extern int      Curl_gsk_secure_soc_close(gsk_handle * my_session_handle);
72 #define gsk_secure_soc_close    Curl_gsk_secure_soc_close
73 
74 extern int      Curl_gsk_environment_init(gsk_handle my_env_handle);
75 #define gsk_environment_init    Curl_gsk_environment_init
76 
77 extern int      Curl_gsk_secure_soc_init(gsk_handle my_session_handle);
78 #define gsk_secure_soc_init     Curl_gsk_secure_soc_init
79 
80 extern int      Curl_gsk_attribute_set_buffer_a(gsk_handle my_gsk_handle,
81                                                 GSK_BUF_ID bufID,
82                                                 const char * buffer,
83                                                 int bufSize);
84 #define gsk_attribute_set_buffer        Curl_gsk_attribute_set_buffer_a
85 
86 extern int      Curl_gsk_attribute_set_enum(gsk_handle my_gsk_handle,
87                                             GSK_ENUM_ID enumID,
88                                             GSK_ENUM_VALUE enumValue);
89 #define gsk_attribute_set_enum  Curl_gsk_attribute_set_enum
90 
91 extern int      Curl_gsk_attribute_set_numeric_value(gsk_handle my_gsk_handle,
92                                                      GSK_NUM_ID numID,
93                                                      int numValue);
94 #define gsk_attribute_set_numeric_value Curl_gsk_attribute_set_numeric_value
95 
96 extern int      Curl_gsk_attribute_set_callback(gsk_handle my_gsk_handle,
97                                                 GSK_CALLBACK_ID callBackID,
98                                                 void * callBackAreaPtr);
99 #define gsk_attribute_set_callback      Curl_gsk_attribute_set_callback
100 
101 extern int      Curl_gsk_attribute_get_buffer_a(gsk_handle my_gsk_handle,
102                                                 GSK_BUF_ID bufID,
103                                                 const char * * buffer,
104                                                 int * bufSize);
105 #define gsk_attribute_get_buffer        Curl_gsk_attribute_get_buffer_a
106 
107 extern int      Curl_gsk_attribute_get_enum(gsk_handle my_gsk_handle,
108                                             GSK_ENUM_ID enumID,
109                                             GSK_ENUM_VALUE * enumValue);
110 #define gsk_attribute_get_enum  Curl_gsk_attribute_get_enum
111 
112 extern int      Curl_gsk_attribute_get_numeric_value(gsk_handle my_gsk_handle,
113                                                      GSK_NUM_ID numID,
114                                                      int * numValue);
115 #define gsk_attribute_get_numeric_value Curl_gsk_attribute_get_numeric_value
116 
117 extern int      Curl_gsk_attribute_get_cert_info(gsk_handle my_gsk_handle,
118                                  GSK_CERT_ID certID,
119                                  const gsk_cert_data_elem * * certDataElem,
120                                  int * certDataElementCount);
121 #define gsk_attribute_get_cert_info     Curl_gsk_attribute_get_cert_info
122 
123 extern int      Curl_gsk_secure_soc_misc(gsk_handle my_session_handle,
124                                          GSK_MISC_ID miscID);
125 #define gsk_secure_soc_misc     Curl_gsk_secure_soc_misc
126 
127 extern int      Curl_gsk_secure_soc_read(gsk_handle my_session_handle,
128                                          char * readBuffer,
129                                          int readBufSize, int * amtRead);
130 #define gsk_secure_soc_read     Curl_gsk_secure_soc_read
131 
132 extern int      Curl_gsk_secure_soc_write(gsk_handle my_session_handle,
133                                           char * writeBuffer,
134                                           int writeBufSize, int * amtWritten);
135 #define gsk_secure_soc_write    Curl_gsk_secure_soc_write
136 
137 extern const char *     Curl_gsk_strerror_a(int gsk_return_value);
138 #define gsk_strerror    Curl_gsk_strerror_a
139 
140 extern int      Curl_gsk_secure_soc_startInit(gsk_handle my_session_handle,
141                                       int IOCompletionPort,
142                                       Qso_OverlappedIO_t * communicationsArea);
143 #define gsk_secure_soc_startInit        Curl_gsk_secure_soc_startInit
144 
145 
146 /* GSSAPI wrappers. */
147 
148 extern OM_uint32 Curl_gss_import_name_a(OM_uint32 * minor_status,
149                                         gss_buffer_t in_name,
150                                         gss_OID in_name_type,
151                                         gss_name_t * out_name);
152 #define gss_import_name         Curl_gss_import_name_a
153 
154 
155 extern OM_uint32 Curl_gss_display_status_a(OM_uint32 * minor_status,
156                                            OM_uint32 status_value,
157                                            int status_type, gss_OID mech_type,
158                                            gss_msg_ctx_t * message_context,
159                                            gss_buffer_t status_string);
160 #define gss_display_status      Curl_gss_display_status_a
161 
162 
163 extern OM_uint32 Curl_gss_init_sec_context_a(OM_uint32 * minor_status,
164                                              gss_cred_id_t cred_handle,
165                                              gss_ctx_id_t * context_handle,
166                                              gss_name_t target_name,
167                                              gss_OID mech_type,
168                                              gss_flags_t req_flags,
169                                              OM_uint32 time_req,
170                                              gss_channel_bindings_t
171                                              input_chan_bindings,
172                                              gss_buffer_t input_token,
173                                              gss_OID * actual_mech_type,
174                                              gss_buffer_t output_token,
175                                              gss_flags_t * ret_flags,
176                                              OM_uint32 * time_rec);
177 #define gss_init_sec_context    Curl_gss_init_sec_context_a
178 
179 
180 extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status,
181                                                gss_ctx_id_t * context_handle,
182                                                gss_buffer_t output_token);
183 #define gss_delete_sec_context  Curl_gss_delete_sec_context_a
184 
185 
186 /* LDAP wrappers. */
187 
188 #define BerValue                struct berval
189 
190 #define ldap_url_parse          ldap_url_parse_utf8
191 #define ldap_init               Curl_ldap_init_a
192 #define ldap_simple_bind_s      Curl_ldap_simple_bind_s_a
193 #define ldap_search_s           Curl_ldap_search_s_a
194 #define ldap_get_values_len     Curl_ldap_get_values_len_a
195 #define ldap_err2string         Curl_ldap_err2string_a
196 #define ldap_get_dn             Curl_ldap_get_dn_a
197 #define ldap_first_attribute    Curl_ldap_first_attribute_a
198 #define ldap_next_attribute     Curl_ldap_next_attribute_a
199 
200 /* Some socket functions must be wrapped to process textual addresses
201    like AF_UNIX. */
202 
203 extern int Curl_os400_connect(int sd, struct sockaddr * destaddr, int addrlen);
204 extern int Curl_os400_bind(int sd, struct sockaddr * localaddr, int addrlen);
205 extern int Curl_os400_sendto(int sd, char * buffer, int buflen, int flags,
206             struct sockaddr * dstaddr, int addrlen);
207 extern int Curl_os400_recvfrom(int sd, char * buffer, int buflen, int flags,
208                                 struct sockaddr * fromaddr, int * addrlen);
209 
210 #define connect                 Curl_os400_connect
211 #define bind                    Curl_os400_bind
212 #define sendto                  Curl_os400_sendto
213 #define recvfrom                Curl_os400_recvfrom
214 
215 #ifdef HAVE_LIBZ
216 #define zlibVersion             Curl_os400_zlibVersion
217 #define inflateInit_            Curl_os400_inflateInit_
218 #define inflateInit2_           Curl_os400_inflateInit2_
219 #define inflate                 Curl_os400_inflate
220 #define inflateEnd              Curl_os400_inflateEnd
221 #endif
222 
223 #endif /* HEADER_CURL_SETUP_OS400_H */
224