2
0

setup-os400.h 10 KB

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