setup-os400.h 10 KB

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