setup-os400.h 6.1 KB

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