1*6236dae4SAndroid Build Coastguard Worker 2*6236dae4SAndroid Build Coastguard WorkerImplementation notes: 3*6236dae4SAndroid Build Coastguard Worker 4*6236dae4SAndroid Build Coastguard Worker This is a true OS/400 ILE implementation, not a PASE implementation (for 5*6236dae4SAndroid Build Coastguard WorkerPASE, use AIX implementation). 6*6236dae4SAndroid Build Coastguard Worker 7*6236dae4SAndroid Build Coastguard Worker The biggest problem with OS/400 is EBCDIC. Libcurl implements an internal 8*6236dae4SAndroid Build Coastguard Workerconversion mechanism, but it has been designed for computers that have a 9*6236dae4SAndroid Build Coastguard Workersingle native character set. OS/400 default native character set varies 10*6236dae4SAndroid Build Coastguard Workerdepending on the country for which it has been localized. And more, a job 11*6236dae4SAndroid Build Coastguard Workermay dynamically alter its "native" character set. 12*6236dae4SAndroid Build Coastguard Worker Several characters that do not have fixed code in EBCDIC variants are 13*6236dae4SAndroid Build Coastguard Workerused in libcurl strings. As a consequence, using the existing conversion 14*6236dae4SAndroid Build Coastguard Workermechanism would have lead in a localized binary library - not portable across 15*6236dae4SAndroid Build Coastguard Workercountries. 16*6236dae4SAndroid Build Coastguard Worker For this reason, and because libcurl was originally designed for ASCII based 17*6236dae4SAndroid Build Coastguard Workeroperating systems, the current OS/400 implementation uses ASCII as internal 18*6236dae4SAndroid Build Coastguard Workercharacter set. This has been accomplished using the QADRT library and 19*6236dae4SAndroid Build Coastguard Workerinclude files, a C and system procedures ASCII wrapper library. See IBM QADRT 20*6236dae4SAndroid Build Coastguard Workerdescription for more information. 21*6236dae4SAndroid Build Coastguard Worker This then results in libcurl being an ASCII library: any function string 22*6236dae4SAndroid Build Coastguard Workerargument is taken/returned in ASCII and a C/C++ calling program built around 23*6236dae4SAndroid Build Coastguard WorkerQADRT may use libcurl functions as on any other platform. 24*6236dae4SAndroid Build Coastguard Worker QADRT does not define ASCII wrappers for all C/system procedures: the 25*6236dae4SAndroid Build Coastguard WorkerOS/400 configuration header file and an additional module (os400sys.c) define 26*6236dae4SAndroid Build Coastguard Workersome more of them, that are used by libcurl and that QADRT left out. 27*6236dae4SAndroid Build Coastguard Worker To support all the different variants of EBCDIC, non-standard wrapper 28*6236dae4SAndroid Build Coastguard Workerprocedures have been added to libcurl on OS/400: they provide an additional 29*6236dae4SAndroid Build Coastguard WorkerCCSID (numeric Coded Character Set ID specific to OS/400) parameter for each 30*6236dae4SAndroid Build Coastguard Workerstring argument. Callback procedures arguments giving access to strings are 31*6236dae4SAndroid Build Coastguard WorkerNOT converted, so text gathered this way is (probably !) ASCII. 32*6236dae4SAndroid Build Coastguard Worker 33*6236dae4SAndroid Build Coastguard Worker Another OS/400 problem comes from the fact that the last fixed argument of a 34*6236dae4SAndroid Build Coastguard Workervararg procedure may not be of type char, unsigned char, short or unsigned 35*6236dae4SAndroid Build Coastguard Workershort. Enums that are internally implemented by the C compiler as one of these 36*6236dae4SAndroid Build Coastguard Workertypes are also forbidden. Libcurl uses enums as vararg procedure tagfields... 37*6236dae4SAndroid Build Coastguard WorkerHappily, there is a pragma forcing enums to type "int". The original libcurl 38*6236dae4SAndroid Build Coastguard Workerheader files are thus altered during build process to use this pragma, in 39*6236dae4SAndroid Build Coastguard Workerorder to force libcurl enums of being type int (the pragma disposition in use 40*6236dae4SAndroid Build Coastguard Workerbefore inclusion is restored before resuming the including unit compilation). 41*6236dae4SAndroid Build Coastguard Worker 42*6236dae4SAndroid Build Coastguard Worker Non-standard EBCDIC wrapper prototypes are defined in an additional header 43*6236dae4SAndroid Build Coastguard Workerfile: ccsidcurl.h. These should be self-explanatory to an OS/400-aware 44*6236dae4SAndroid Build Coastguard Workerdesigner. CCSID 0 can be used to select the current job's CCSID. 45*6236dae4SAndroid Build Coastguard Worker Wrapper procedures with variable arguments are described below: 46*6236dae4SAndroid Build Coastguard Worker 47*6236dae4SAndroid Build Coastguard Worker_ curl_easy_setopt_ccsid() 48*6236dae4SAndroid Build Coastguard Worker Variable arguments are a string pointer and a CCSID (unsigned int) for 49*6236dae4SAndroid Build Coastguard Workeroptions: 50*6236dae4SAndroid Build Coastguard Worker CURLOPT_ABSTRACT_UNIX_SOCKET 51*6236dae4SAndroid Build Coastguard Worker CURLOPT_ACCEPT_ENCODING 52*6236dae4SAndroid Build Coastguard Worker CURLOPT_ALTSVC 53*6236dae4SAndroid Build Coastguard Worker CURLOPT_AWS_SIGV4 54*6236dae4SAndroid Build Coastguard Worker CURLOPT_CAINFO 55*6236dae4SAndroid Build Coastguard Worker CURLOPT_CAPATH 56*6236dae4SAndroid Build Coastguard Worker CURLOPT_COOKIE 57*6236dae4SAndroid Build Coastguard Worker CURLOPT_COOKIEFILE 58*6236dae4SAndroid Build Coastguard Worker CURLOPT_COOKIEJAR 59*6236dae4SAndroid Build Coastguard Worker CURLOPT_COOKIELIST 60*6236dae4SAndroid Build Coastguard Worker CURLOPT_CRLFILE 61*6236dae4SAndroid Build Coastguard Worker CURLOPT_CUSTOMREQUEST 62*6236dae4SAndroid Build Coastguard Worker CURLOPT_DEFAULT_PROTOCOL 63*6236dae4SAndroid Build Coastguard Worker CURLOPT_DNS_INTERFACE 64*6236dae4SAndroid Build Coastguard Worker CURLOPT_DNS_LOCAL_IP4 65*6236dae4SAndroid Build Coastguard Worker CURLOPT_DNS_LOCAL_IP6 66*6236dae4SAndroid Build Coastguard Worker CURLOPT_DNS_SERVERS 67*6236dae4SAndroid Build Coastguard Worker CURLOPT_DOH_URL 68*6236dae4SAndroid Build Coastguard Worker CURLOPT_EGDSOCKET 69*6236dae4SAndroid Build Coastguard Worker CURLOPT_FTPPORT 70*6236dae4SAndroid Build Coastguard Worker CURLOPT_FTP_ACCOUNT 71*6236dae4SAndroid Build Coastguard Worker CURLOPT_FTP_ALTERNATIVE_TO_USER 72*6236dae4SAndroid Build Coastguard Worker CURLOPT_HAPROXY_CLIENT_IP 73*6236dae4SAndroid Build Coastguard Worker CURLOPT_HSTS 74*6236dae4SAndroid Build Coastguard Worker CURLOPT_INTERFACE 75*6236dae4SAndroid Build Coastguard Worker CURLOPT_ISSUERCERT 76*6236dae4SAndroid Build Coastguard Worker CURLOPT_KEYPASSWD 77*6236dae4SAndroid Build Coastguard Worker CURLOPT_KRBLEVEL 78*6236dae4SAndroid Build Coastguard Worker CURLOPT_LOGIN_OPTIONS 79*6236dae4SAndroid Build Coastguard Worker CURLOPT_MAIL_AUTH 80*6236dae4SAndroid Build Coastguard Worker CURLOPT_MAIL_FROM 81*6236dae4SAndroid Build Coastguard Worker CURLOPT_NETRC_FILE 82*6236dae4SAndroid Build Coastguard Worker CURLOPT_NOPROXY 83*6236dae4SAndroid Build Coastguard Worker CURLOPT_PASSWORD 84*6236dae4SAndroid Build Coastguard Worker CURLOPT_PINNEDPUBLICKEY 85*6236dae4SAndroid Build Coastguard Worker CURLOPT_PRE_PROXY 86*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROTOCOLS_STR 87*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY 88*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXYPASSWORD 89*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXYUSERNAME 90*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXYUSERPWD 91*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_CAINFO 92*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_CAPATH 93*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_CRLFILE 94*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_ISSUERCERT 95*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_KEYPASSWD 96*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_PINNEDPUBLICKEY 97*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_SERVICE_NAME 98*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_SSLCERT 99*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_SSLCERTTYPE 100*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_SSLKEY 101*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_SSLKEYTYPE 102*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_SSL_CIPHER_LIST 103*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_TLS13_CIPHERS 104*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_TLSAUTH_PASSWORD 105*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_TLSAUTH_TYPE 106*6236dae4SAndroid Build Coastguard Worker CURLOPT_PROXY_TLSAUTH_USERNAME 107*6236dae4SAndroid Build Coastguard Worker CURLOPT_RANDOM_FILE 108*6236dae4SAndroid Build Coastguard Worker CURLOPT_RANGE 109*6236dae4SAndroid Build Coastguard Worker CURLOPT_REDIR_PROTOCOLS_STR 110*6236dae4SAndroid Build Coastguard Worker CURLOPT_REFERER 111*6236dae4SAndroid Build Coastguard Worker CURLOPT_REQUEST_TARGET 112*6236dae4SAndroid Build Coastguard Worker CURLOPT_RTSP_SESSION_ID 113*6236dae4SAndroid Build Coastguard Worker CURLOPT_RTSP_STREAM_URI 114*6236dae4SAndroid Build Coastguard Worker CURLOPT_RTSP_TRANSPORT 115*6236dae4SAndroid Build Coastguard Worker CURLOPT_SASL_AUTHZID 116*6236dae4SAndroid Build Coastguard Worker CURLOPT_SERVICE_NAME 117*6236dae4SAndroid Build Coastguard Worker CURLOPT_SOCKS5_GSSAPI_SERVICE 118*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 119*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256 120*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSH_KNOWNHOSTS 121*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSH_PRIVATE_KEYFILE 122*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSH_PUBLIC_KEYFILE 123*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSLCERT 124*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSLCERTTYPE 125*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSLENGINE 126*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSLKEY 127*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSLKEYTYPE 128*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSL_CIPHER_LIST 129*6236dae4SAndroid Build Coastguard Worker CURLOPT_SSL_EC_CURVES 130*6236dae4SAndroid Build Coastguard Worker CURLOPT_TLS13_CIPHERS 131*6236dae4SAndroid Build Coastguard Worker CURLOPT_TLSAUTH_PASSWORD 132*6236dae4SAndroid Build Coastguard Worker CURLOPT_TLSAUTH_TYPE 133*6236dae4SAndroid Build Coastguard Worker CURLOPT_TLSAUTH_USERNAME 134*6236dae4SAndroid Build Coastguard Worker CURLOPT_UNIX_SOCKET_PATH 135*6236dae4SAndroid Build Coastguard Worker CURLOPT_URL 136*6236dae4SAndroid Build Coastguard Worker CURLOPT_USERAGENT 137*6236dae4SAndroid Build Coastguard Worker CURLOPT_USERNAME 138*6236dae4SAndroid Build Coastguard Worker CURLOPT_USERPWD 139*6236dae4SAndroid Build Coastguard Worker CURLOPT_XOAUTH2_BEARER 140*6236dae4SAndroid Build Coastguard Worker All blob options are also supported. 141*6236dae4SAndroid Build Coastguard Worker In all other cases, it ignores the ccsid parameter and behaves as 142*6236dae4SAndroid Build Coastguard Workercurl_easy_setopt(). 143*6236dae4SAndroid Build Coastguard Worker Note that CURLOPT_ERRORBUFFER is not in the list above, since it gives the 144*6236dae4SAndroid Build Coastguard Workeraddress of an (empty) character buffer, not the address of a string. 145*6236dae4SAndroid Build Coastguard WorkerCURLOPT_POSTFIELDS stores the address of static binary data (of type void *) 146*6236dae4SAndroid Build Coastguard Workerand thus is not converted. If CURLOPT_COPYPOSTFIELDS is issued after 147*6236dae4SAndroid Build Coastguard WorkerCURLOPT_POSTFIELDSIZE != -1, the data size is adjusted according to the 148*6236dae4SAndroid Build Coastguard WorkerCCSID conversion result length. 149*6236dae4SAndroid Build Coastguard Worker 150*6236dae4SAndroid Build Coastguard Worker_ curl_formadd_ccsid() 151*6236dae4SAndroid Build Coastguard Worker In the variable argument list, string pointers should be followed by a (long) 152*6236dae4SAndroid Build Coastguard WorkerCCSID for the following options: 153*6236dae4SAndroid Build Coastguard Worker CURLFORM_BUFFER 154*6236dae4SAndroid Build Coastguard Worker CURLFORM_CONTENTTYPE 155*6236dae4SAndroid Build Coastguard Worker CURLFORM_COPYCONTENTS 156*6236dae4SAndroid Build Coastguard Worker CURLFORM_COPYNAME 157*6236dae4SAndroid Build Coastguard Worker CURLFORM_FILE 158*6236dae4SAndroid Build Coastguard Worker CURLFORM_FILECONTENT 159*6236dae4SAndroid Build Coastguard Worker CURLFORM_FILENAME 160*6236dae4SAndroid Build Coastguard Worker CURLFORM_PTRNAME 161*6236dae4SAndroid Build Coastguard Worker If taken from an argument array, an additional array entry must follow each 162*6236dae4SAndroid Build Coastguard Workerentry containing one of the above option. This additional entry holds the CCSID 163*6236dae4SAndroid Build Coastguard Workerin its value field, and the option field is meaningless. 164*6236dae4SAndroid Build Coastguard Worker It is not possible to have a string pointer and its CCSID across a function 165*6236dae4SAndroid Build Coastguard Workerparameter/array boundary. 166*6236dae4SAndroid Build Coastguard Worker Please note that CURLFORM_PTRCONTENTS and CURLFORM_BUFFERPTR are considered 167*6236dae4SAndroid Build Coastguard Workerunconvertible strings and thus are NOT followed by a CCSID. 168*6236dae4SAndroid Build Coastguard Worker 169*6236dae4SAndroid Build Coastguard Worker_ curl_easy_getinfo_ccsid() 170*6236dae4SAndroid Build Coastguard Worker The following options are followed by a 'char * *' and a CCSID. Unlike 171*6236dae4SAndroid Build Coastguard Workercurl_easy_getinfo(), the value returned in the pointer should be released with 172*6236dae4SAndroid Build Coastguard Workercurl_free() after use: 173*6236dae4SAndroid Build Coastguard Worker CURLINFO_CONTENT_TYPE 174*6236dae4SAndroid Build Coastguard Worker CURLINFO_EFFECTIVE_URL 175*6236dae4SAndroid Build Coastguard Worker CURLINFO_FTP_ENTRY_PATH 176*6236dae4SAndroid Build Coastguard Worker CURLINFO_LOCAL_IP 177*6236dae4SAndroid Build Coastguard Worker CURLINFO_PRIMARY_IP 178*6236dae4SAndroid Build Coastguard Worker CURLINFO_REDIRECT_URL 179*6236dae4SAndroid Build Coastguard Worker CURLINFO_REFERER 180*6236dae4SAndroid Build Coastguard Worker CURLINFO_RTSP_SESSION_ID 181*6236dae4SAndroid Build Coastguard Worker CURLINFO_SCHEME 182*6236dae4SAndroid Build Coastguard Worker Likewise, the following options are followed by a struct curl_slist * * and a 183*6236dae4SAndroid Build Coastguard WorkerCCSID. 184*6236dae4SAndroid Build Coastguard Worker CURLINFO_COOKIELIST 185*6236dae4SAndroid Build Coastguard Worker CURLINFO_SSL_ENGINES 186*6236dae4SAndroid Build Coastguard WorkerLists returned should be released with curl_slist_free_all() after use. 187*6236dae4SAndroid Build Coastguard Worker Option CURLINFO_CERTINFO is followed by a struct curl_certinfo * * and a 188*6236dae4SAndroid Build Coastguard WorkerCCSID. Returned structures should be freed with curl_certinfo_free_all() 189*6236dae4SAndroid Build Coastguard Workerafter use. 190*6236dae4SAndroid Build Coastguard Worker Other options are processed like in curl_easy_getinfo(). 191*6236dae4SAndroid Build Coastguard Worker 192*6236dae4SAndroid Build Coastguard Worker_ curl_easy_strerror_ccsid(), curl_multi_strerror_ccsid(), 193*6236dae4SAndroid Build Coastguard Workercurl_share_strerror_ccsid() and curl_url_strerror_ccsid() work as their 194*6236dae4SAndroid Build Coastguard Workernon-ccsid version and return a string encoded in the additional ccsid 195*6236dae4SAndroid Build Coastguard Workerparameter. These strings belong to libcurl and may not be freed by the caller. 196*6236dae4SAndroid Build Coastguard WorkerA subsequent call to the same procedure in the same thread invalidates the 197*6236dae4SAndroid Build Coastguard Workerprevious result. 198*6236dae4SAndroid Build Coastguard Worker 199*6236dae4SAndroid Build Coastguard Worker_ curl_pushheader_bynum_cssid() and curl_pushheader_byname_ccsid() 200*6236dae4SAndroid Build Coastguard Worker Although the prototypes are self-explanatory, the returned string pointer 201*6236dae4SAndroid Build Coastguard Workershould be released with curl_free() after use, as opposite to the non-ccsid 202*6236dae4SAndroid Build Coastguard Workerversions of these procedures. 203*6236dae4SAndroid Build Coastguard Worker Please note that HTTP2 is not (yet) implemented on OS/400, thus these 204*6236dae4SAndroid Build Coastguard Workerfunctions will always return NULL. 205*6236dae4SAndroid Build Coastguard Worker 206*6236dae4SAndroid Build Coastguard Worker_ curl_easy_option_by_name_ccsid() returns a pointer to an untranslated option 207*6236dae4SAndroid Build Coastguard Workermetadata structure. As each curl_easyoption structure holds the option name in 208*6236dae4SAndroid Build Coastguard WorkerASCII, the curl_easy_option_get_name_ccsid() function allows getting it in any 209*6236dae4SAndroid Build Coastguard Workersupported ccsid. However the caller should release the returned pointer with 210*6236dae4SAndroid Build Coastguard Workercurl_free() after use. 211*6236dae4SAndroid Build Coastguard Worker 212*6236dae4SAndroid Build Coastguard Worker_ curl_easy_header_ccsid() works as its non-CCSID counterpart but requires an 213*6236dae4SAndroid Build Coastguard Workeradditional ccsid parameter specifying the name parameter encoding. The output 214*6236dae4SAndroid Build Coastguard Workerhout parameter is kept in libcurl's encoding and should not be altered. 215*6236dae4SAndroid Build Coastguard Worker 216*6236dae4SAndroid Build Coastguard Worker_ curl_from_ccsid() and curl_to_ccsid() are string encoding conversion 217*6236dae4SAndroid Build Coastguard Workerfunctions between ASCII (latin1) and the given CCSID. The first parameter is 218*6236dae4SAndroid Build Coastguard Workerthe source string, the second is the CCSID and the returned value is a pointer 219*6236dae4SAndroid Build Coastguard Workerto the dynamically allocated string. These functions do not impact on Curl's 220*6236dae4SAndroid Build Coastguard Workerbehavior and are only provided for user convenience. After use, returned values 221*6236dae4SAndroid Build Coastguard Workermust be released with curl_free(). 222*6236dae4SAndroid Build Coastguard Worker 223*6236dae4SAndroid Build Coastguard Worker 224*6236dae4SAndroid Build Coastguard Worker Standard compilation environment does support neither autotools nor make; 225*6236dae4SAndroid Build Coastguard Workerin fact, very few common utilities are available. As a consequence, the 226*6236dae4SAndroid Build Coastguard Workerconfig-os400.h has been coded manually and the compilation scripts are 227*6236dae4SAndroid Build Coastguard Workera set of shell scripts stored in subdirectory packages/OS400. 228*6236dae4SAndroid Build Coastguard Worker 229*6236dae4SAndroid Build Coastguard Worker The test environment is currently not supported on OS/400. 230*6236dae4SAndroid Build Coastguard Worker 231*6236dae4SAndroid Build Coastguard Worker 232*6236dae4SAndroid Build Coastguard WorkerProtocols currently implemented on OS/400: 233*6236dae4SAndroid Build Coastguard Worker_ DICT 234*6236dae4SAndroid Build Coastguard Worker_ FILE 235*6236dae4SAndroid Build Coastguard Worker_ FTP 236*6236dae4SAndroid Build Coastguard Worker_ FTPS 237*6236dae4SAndroid Build Coastguard Worker_ FTP with secure transmission 238*6236dae4SAndroid Build Coastguard Worker_ GOPHER 239*6236dae4SAndroid Build Coastguard Worker_ HTTP 240*6236dae4SAndroid Build Coastguard Worker_ HTTPS 241*6236dae4SAndroid Build Coastguard Worker_ IMAP 242*6236dae4SAndroid Build Coastguard Worker_ IMAPS 243*6236dae4SAndroid Build Coastguard Worker_ IMAP with secure transmission 244*6236dae4SAndroid Build Coastguard Worker_ LDAP 245*6236dae4SAndroid Build Coastguard Worker_ POP3 246*6236dae4SAndroid Build Coastguard Worker_ POP3S 247*6236dae4SAndroid Build Coastguard Worker_ POP3 with secure transmission 248*6236dae4SAndroid Build Coastguard Worker_ RTSP 249*6236dae4SAndroid Build Coastguard Worker_ SCP if libssh2 is enabled 250*6236dae4SAndroid Build Coastguard Worker_ SFTP if libssh2 is enabled 251*6236dae4SAndroid Build Coastguard Worker_ SMTP 252*6236dae4SAndroid Build Coastguard Worker_ SMTPS 253*6236dae4SAndroid Build Coastguard Worker_ SMTP with secure transmission 254*6236dae4SAndroid Build Coastguard Worker_ TELNET 255*6236dae4SAndroid Build Coastguard Worker_ TFTP 256*6236dae4SAndroid Build Coastguard Worker 257*6236dae4SAndroid Build Coastguard Worker 258*6236dae4SAndroid Build Coastguard Worker 259*6236dae4SAndroid Build Coastguard WorkerCompiling on OS/400: 260*6236dae4SAndroid Build Coastguard Worker 261*6236dae4SAndroid Build Coastguard Worker These instructions targets people who knows about OS/400, compiling, IFS and 262*6236dae4SAndroid Build Coastguard Workerarchive extraction. Do not ask questions about these subjects if you're not 263*6236dae4SAndroid Build Coastguard Workerfamiliar with. 264*6236dae4SAndroid Build Coastguard Worker 265*6236dae4SAndroid Build Coastguard Worker_ As a prerequisite, QADRT development environment must be installed. 266*6236dae4SAndroid Build Coastguard Worker For more information on downloading and installing the QADRT development kit, 267*6236dae4SAndroid Build Coastguard Worker please see https://www.ibm.com/support/pages/node/6258183 268*6236dae4SAndroid Build Coastguard Worker_ If data compression has to be supported, ZLIB development environment must 269*6236dae4SAndroid Build Coastguard Worker be installed. 270*6236dae4SAndroid Build Coastguard Worker_ Likewise, if SCP and SFTP protocols have to be compiled in, LIBSSH2 271*6236dae4SAndroid Build Coastguard Worker developent environment must be installed. 272*6236dae4SAndroid Build Coastguard Worker_ Install the curl source directory in IFS. Do NOT install it in the 273*6236dae4SAndroid Build Coastguard Worker installation target directory (which defaults to /curl). 274*6236dae4SAndroid Build Coastguard Worker_ Enter Qshell (QSH, not PASE) 275*6236dae4SAndroid Build Coastguard Worker_ Change current directory to the curl installation directory 276*6236dae4SAndroid Build Coastguard Worker_ Change current directory to ./packages/OS400 277*6236dae4SAndroid Build Coastguard Worker- If you want to change the default configuration parameters like debug info 278*6236dae4SAndroid Build Coastguard Worker generation, optimization level, listing option, target library, ZLIB/LIBSSH2 279*6236dae4SAndroid Build Coastguard Worker availability and location, etc., copy file config400.default to 280*6236dae4SAndroid Build Coastguard Worker config400.override and edit the latter. Do not edit the original default file 281*6236dae4SAndroid Build Coastguard Worker as it might be overwritten by a subsequent source installation. 282*6236dae4SAndroid Build Coastguard Worker_ Copy any file in the current directory to makelog (i.e.: 283*6236dae4SAndroid Build Coastguard Worker cp initscript.sh makelog): this is intended to create the makelog file with 284*6236dae4SAndroid Build Coastguard Worker an ASCII CCSID! 285*6236dae4SAndroid Build Coastguard Worker_ Enter the command "sh makefile.sh > makelog 2>&1" 286*6236dae4SAndroid Build Coastguard Worker_ Examine the makelog file to check for compilation errors. CZM0383 warnings on 287*6236dae4SAndroid Build Coastguard Worker C or system standard API come from QADRT inlining and can safely be ignored. 288*6236dae4SAndroid Build Coastguard Worker 289*6236dae4SAndroid Build Coastguard Worker Without configuration parameters override, this will produce the following 290*6236dae4SAndroid Build Coastguard WorkerOS/400 objects: 291*6236dae4SAndroid Build Coastguard Worker_ Library CURL. All other objects will be stored in this library. 292*6236dae4SAndroid Build Coastguard Worker_ Modules for all libcurl units. 293*6236dae4SAndroid Build Coastguard Worker_ Binding directory CURL_A, to be used at calling program link time for 294*6236dae4SAndroid Build Coastguard Worker statically binding the modules (specify BNDSRVPGM(QADRTTS QGLDCLNT QGLDBRDR) 295*6236dae4SAndroid Build Coastguard Worker when creating a program using CURL_A). 296*6236dae4SAndroid Build Coastguard Worker_ Service program CURL.<soname>, where <soname> is extracted from the 297*6236dae4SAndroid Build Coastguard Worker lib/Makefile.am VERSION variable. To be used at calling program run-time 298*6236dae4SAndroid Build Coastguard Worker when this program has dynamically bound curl at link time. 299*6236dae4SAndroid Build Coastguard Worker_ Binding directory CURL. To be used to dynamically bind libcurl when linking a 300*6236dae4SAndroid Build Coastguard Worker calling program. 301*6236dae4SAndroid Build Coastguard Worker- CLI tool bound program CURL. 302*6236dae4SAndroid Build Coastguard Worker- CLI command CURL. 303*6236dae4SAndroid Build Coastguard Worker_ Source file H. It contains all the include members needed to compile a C/C++ 304*6236dae4SAndroid Build Coastguard Worker module using libcurl, and an ILE/RPG /copy member for support in this 305*6236dae4SAndroid Build Coastguard Worker language. 306*6236dae4SAndroid Build Coastguard Worker_ Standard C/C++ libcurl include members in file H. 307*6236dae4SAndroid Build Coastguard Worker_ CCSIDCURL member in file H. This defines the non-standard EBCDIC wrappers for 308*6236dae4SAndroid Build Coastguard Worker C and C++. 309*6236dae4SAndroid Build Coastguard Worker_ CURL.INC member in file H. This defines everything needed by an ILE/RPG 310*6236dae4SAndroid Build Coastguard Worker program using libcurl. 311*6236dae4SAndroid Build Coastguard Worker_ IFS directory /curl/include/curl containing the C header files for IFS source 312*6236dae4SAndroid Build Coastguard Worker C/C++ compilation and curl.inc.rpgle for IFS source ILE/RPG compilation. 313*6236dae4SAndroid Build Coastguard Worker- IFS link /curl/bin/curl to CLI tool program. 314*6236dae4SAndroid Build Coastguard Worker 315*6236dae4SAndroid Build Coastguard Worker 316*6236dae4SAndroid Build Coastguard WorkerSpecial programming consideration: 317*6236dae4SAndroid Build Coastguard Worker 318*6236dae4SAndroid Build Coastguard WorkerQADRT being used, the following points must be considered: 319*6236dae4SAndroid Build Coastguard Worker_ If static binding is used, service program QADRTTS must be linked too. 320*6236dae4SAndroid Build Coastguard Worker_ The EBCDIC CCSID used by QADRT is 37 by default, NOT THE JOB'S CCSID. If 321*6236dae4SAndroid Build Coastguard Worker another EBCDIC CCSID is required, it must be set via a locale through a call 322*6236dae4SAndroid Build Coastguard Worker to setlocale_a (QADRT's setlocale() ASCII wrapper) with category LC_ALL or 323*6236dae4SAndroid Build Coastguard Worker LC_CTYPE, or by setting environment variable QADRT_ENV_LOCALE to the locale 324*6236dae4SAndroid Build Coastguard Worker object path before executing the program. 325*6236dae4SAndroid Build Coastguard Worker_ Do not use original source include files unless you know what you are doing. 326*6236dae4SAndroid Build Coastguard Worker Use the installed members instead (in /QSYS.LIB/CURL.LIB/H.FILE and 327*6236dae4SAndroid Build Coastguard Worker /curl/include/curl). 328*6236dae4SAndroid Build Coastguard Worker 329*6236dae4SAndroid Build Coastguard Worker 330*6236dae4SAndroid Build Coastguard Worker 331*6236dae4SAndroid Build Coastguard WorkerILE/RPG support: 332*6236dae4SAndroid Build Coastguard Worker 333*6236dae4SAndroid Build Coastguard Worker Since most of the ILE OS/400 programmers use ILE/RPG exclusively, a 334*6236dae4SAndroid Build Coastguard Workerdefinition /INCLUDE member is provided for this language. To include all 335*6236dae4SAndroid Build Coastguard Workerlibcurl definitions in an ILE/RPG module, line 336*6236dae4SAndroid Build Coastguard Worker 337*6236dae4SAndroid Build Coastguard Worker h bnddir('CURL/CURL') 338*6236dae4SAndroid Build Coastguard Worker 339*6236dae4SAndroid Build Coastguard Workermust figure in the program header, and line 340*6236dae4SAndroid Build Coastguard Worker 341*6236dae4SAndroid Build Coastguard Worker d/include curl/h,curl.inc 342*6236dae4SAndroid Build Coastguard Worker 343*6236dae4SAndroid Build Coastguard Workerin the global data section of the module's source code. 344*6236dae4SAndroid Build Coastguard Worker 345*6236dae4SAndroid Build Coastguard Worker No vararg procedure support exists in ILE/RPG: for this reason, the following 346*6236dae4SAndroid Build Coastguard Workerconsiderations apply: 347*6236dae4SAndroid Build Coastguard Worker_ Procedures curl_easy_setopt_long(), curl_easy_setopt_object(), 348*6236dae4SAndroid Build Coastguard Worker curl_easy_setopt_function(), curl_easy_setopt_offset() and 349*6236dae4SAndroid Build Coastguard Worker curl_easy_setopt_blob() are all alias prototypes to curl_easy_setopt(), but 350*6236dae4SAndroid Build Coastguard Worker with different parameter lists. 351*6236dae4SAndroid Build Coastguard Worker_ Procedures curl_easy_getinfo_string(), curl_easy_getinfo_long(), 352*6236dae4SAndroid Build Coastguard Worker curl_easy_getinfo_double(), curl_easy_getinfo_slist(), 353*6236dae4SAndroid Build Coastguard Worker curl_easy_getinfo_ptr(), curl_easy_getinfo_socket() and 354*6236dae4SAndroid Build Coastguard Worker curl_easy_getinfo_off_t() are all alias prototypes to curl_easy_getinfo(), 355*6236dae4SAndroid Build Coastguard Worker but with different parameter lists. 356*6236dae4SAndroid Build Coastguard Worker_ Procedures curl_multi_setopt_long(), curl_multi_setopt_object(), 357*6236dae4SAndroid Build Coastguard Worker curl_multi_setopt_function() and curl_multi_setopt_offset() are all alias 358*6236dae4SAndroid Build Coastguard Worker prototypes to curl_multi_setopt(), but with different parameter lists. 359*6236dae4SAndroid Build Coastguard Worker_ Procedures curl_share_setopt_int(), curl_share_setopt_ptr() and 360*6236dae4SAndroid Build Coastguard Worker curl_share_setopt_proc() are all alias prototypes to curl_share_setopt, 361*6236dae4SAndroid Build Coastguard Worker but with different parameter lists. 362*6236dae4SAndroid Build Coastguard Worker_ Procedure curl_easy_setopt_blob_ccsid() is an alias of 363*6236dae4SAndroid Build Coastguard Worker curl_easy_setopt_ccsid() supporting blob encoding conversion. 364*6236dae4SAndroid Build Coastguard Worker_ The prototype of procedure curl_formadd() allows specifying a pointer option 365*6236dae4SAndroid Build Coastguard Worker and the CURLFORM_END option. This makes possible to use an option array 366*6236dae4SAndroid Build Coastguard Worker without any additional definition. If some specific incompatible argument 367*6236dae4SAndroid Build Coastguard Worker list is used in the ILE/RPG program, the latter must define a specialised 368*6236dae4SAndroid Build Coastguard Worker alias. The same applies to curl_formadd_ccsid() too. 369*6236dae4SAndroid Build Coastguard Worker_ Since V7R4M0, procedure overloading is used to emulate limited "vararg-like" 370*6236dae4SAndroid Build Coastguard Worker definitions of curl_easy_setopt(), curl_multi_setopt(), curl_share_setopt() 371*6236dae4SAndroid Build Coastguard Worker and curl_easy_getinfo(). Blob and CCSID alternatives are NOT included in 372*6236dae4SAndroid Build Coastguard Worker overloading. 373*6236dae4SAndroid Build Coastguard Worker 374*6236dae4SAndroid Build Coastguard Worker Since RPG cannot cast a long to a pointer, procedure curl_form_long_value() 375*6236dae4SAndroid Build Coastguard Workeris provided for that purpose: this allows storing a long value in the 376*6236dae4SAndroid Build Coastguard Workercurl_forms array. Please note the form API is deprecated and the MIME API 377*6236dae4SAndroid Build Coastguard Workershould be used instead. 378*6236dae4SAndroid Build Coastguard Worker 379*6236dae4SAndroid Build Coastguard Worker 380*6236dae4SAndroid Build Coastguard WorkerCLI tool: 381*6236dae4SAndroid Build Coastguard Worker 382*6236dae4SAndroid Build Coastguard Worker The build system provides it as a bound program, an IFS link to it and a 383*6236dae4SAndroid Build Coastguard Workersimple CL command. The latter however is not able to provide a different 384*6236dae4SAndroid Build Coastguard Workerparameter for each option since there are too many of those; instead, 385*6236dae4SAndroid Build Coastguard Workerparameters are entered in a single field subject to quoting and escaping, in 386*6236dae4SAndroid Build Coastguard Workerthe same form as expected by the standard CLI program. 387*6236dae4SAndroid Build Coastguard Worker Care must be taken about the program output encoding: by default, it is sent 388*6236dae4SAndroid Build Coastguard Workerto the standard output and is thus subject to transcoding. It is therefore 389*6236dae4SAndroid Build Coastguard Workerrecommended to use option "--output" to redirect output to a specific IFS file. 390*6236dae4SAndroid Build Coastguard WorkerSimilar problems may occur about the standard input encoding. 391