setup-os400.h 11 KB

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