setup-os400.h 6.4 KB

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