geom_gate userland utility improvements
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

170 lines
7.5 KiB

  1. Implementation notes:
  2. This is a true OS/400 implementation, not a PASE implementation (for PASE,
  3. use AIX implementation).
  4. It uses ASCII as internal character set. This has been accomplished using the
  5. QADRT library and include files, a C and system procedures ASCII wrapper
  6. library. See IBM QADRT description for more information.
  7. This results in libssh2 being an ASCII library: any function string
  8. argument is taken/returned in ASCII and a C/C++ calling program built around
  9. QADRT may use libssh2 functions as on any other platform.
  10. QADRT does not define ASCII wrappers for all C/system procedures: an
  11. additional module (os400sys.c) define some more of them, that are used by
  12. libssh2 and that QADRT left out.
  13. Since standard library entry points expect and return ASCII character strings,
  14. additional procedures are provided for string transcoding (see below). No
  15. wrappers to standard procedures are provided: however, nested calls to
  16. transcoding procedures may be used.
  17. Crypto API is provided by the IBM QC3 API library. It supports RSA, but not DSA.
  18. Standard compilation environment does support neither autotools nor make;
  19. in fact, very few common utilities are available. As a consequence, the
  20. libssh2_config.h has been coded manually and the compilation scripts are
  21. a set of shell scripts stored in subdirectory os400.
  22. The test environment is currently not supported on OS/400.
  23. Compiling on OS/400:
  24. These instructions target people who knows about OS/400, compiling, IFS and
  25. archive extraction. Do not ask questions about these subjects if you're not
  26. familiar with.
  27. _ As a prerequisite, QADRT development environment must be installed.
  28. _ Install the libssh2 sources directory in IFS.
  29. _ Enter shell (QSH)
  30. _ Change current directory to the libssh2 sources installation directory
  31. _ Change current directory to os400
  32. _ Edit file iniscript.sh. You may want to change tunable configuration
  33. parameters, like debug info generation, optimisation level, listing option,
  34. target library, zlib availability and location, etc.
  35. _ Copy any file in the current directory to makelog (i.e.:
  36. cp initscript.sh makelog): this is intended to create the makelog file with
  37. an ASCII CCSID!
  38. _ Enter the command "sh make.sh > makelog 2>&1'
  39. _ Examine the makelog file to check for compilation errors.
  40. Leaving file initscript.sh unchanged, this will produce the following OS/400
  41. objects:
  42. _ Library LIBSSH2. All other objects will be stored in this library.
  43. _ Modules for all libssh2 units.
  44. _ Binding directory LIBSSH2_A, to be used at calling program link time for
  45. statically binding the modules (specify BNDSRVPGM(QADRTTS) when creating a
  46. program using LIBSSH2_A. Also give access to the zlib BNDDIR/SRVPGM if
  47. libssh2 is compiled with zlib).
  48. _ Service program LIBSSH2.<soname>, where <soname> is extracted from the
  49. src/Makefile.am VERSION variable. To be used at calling program run-time
  50. when this program has dynamically bound libssh2 at link time.
  51. _ Binding directory LIBSSH2. To be used to dynamically bind libssh2 when
  52. linking a calling program.
  53. _ Source file H. It contains all the include members needed to compile a C/C++
  54. module using libssh2.
  55. _ LIBSSH2, SSH2_PKEY, SSH2_SFTP members in file H. These are the C/C++ header
  56. files. Original fames have been mangled to fit member name allowed syntax.
  57. _ Source file LIBSSH2RPG. It contains all the ILE/RPG /INCLUDE members
  58. needed to compile an ILE/RPG program calling libssh2 procedures.
  59. _ LIBSSH2, SSH2_PKEY, SSH2_SFTP members in file LIBSSH2RPG. These are
  60. ILE/RPG translations of the corresponding C header files.
  61. Special programming consideration:
  62. QADRT being used, the following points must be considered:
  63. _ If static binding is used, service program QADRTTS must be linked too.
  64. _ Likewise, if libssh2 has been compiled with zlib support, access to the
  65. zlib objects must be provided at link time.
  66. _ The EBCDIC CCSID used by QADRT is 37 by default, NOT THE JOB'S CCSID. If
  67. another EBCDIC CCSID is required, it must be set via a locale through a call
  68. to setlocale_a (QADRT's setlocale() ASCII wrapper) with category LC_ALL or
  69. LC_CTYPE, or by setting environment variable QADRT_ENV_LOCALE to the locale
  70. object path before executing the program.
  71. _ Do not use original source include files unless you know what you are doing.
  72. Use the installed members instead (in /QSYS.LIB/LIBSSH2.LIB/H.FILE).
  73. String transcoding support:
  74. To help passing arbitrarily encoded string arguments and/or receiving string
  75. values from/to the libssh2 API, three non-standard additional procedures are
  76. provided. They use a session pointer and a "string cache" pointer.
  77. Each time a string is transcoded, it is cached in the given cache. It is
  78. the responsibility of the caller to release the cache when its associted strings
  79. are no longer needed. These procedures and the string cache type are defined
  80. in a new libssh2_ccsid.h header file.
  81. To create a string cache, use:
  82. #include <libssh2_ccsid.h>
  83. libssh2_string_cache * cache = NULL;
  84. To release all strings in a cache, call:
  85. libssh2_release_string_cache(session, &cache);
  86. The transcoding procedures are:
  87. char * libssh2_from_ccsid(LIBSSH2_SESSION *session,
  88. libssh2_string_cache **cache,
  89. unsigned short ccsid,
  90. const char *string, ssize_t inlen,
  91. size_t *outlen);
  92. char * libssh2_to_ccsid(LIBSSH2_SESSION *session,
  93. libssh2_string_cache **cache,
  94. unsigned short ccsid,
  95. const char *string, ssize_t inlen,
  96. size_t *outlen);
  97. where:
  98. session is a libssh2 session used for memory allocation.
  99. cache is the address of a string cache.
  100. ccsid is the external (i.e.: non libssh2) coded character set id.
  101. 65535 means no conversion and 0 means the current job's CCSID.
  102. string is the string to convert.
  103. inlen is the source string length in bytes: set to -1 if
  104. null-terminated.
  105. outlen if not NULL, is the address of a variable that will receive
  106. the transcoded string length upon return.
  107. libssh2_from_ccsid() transcodes the string from the given CCSID to libssh2
  108. internal encoding (UTF-8). It is intended to be used to convert API input
  109. parameters.
  110. libssh2_to_ccsid() transcodes the string from libssh2 internal encoding
  111. (UTF-8) to the given CCSID. This has been implemented to get standard API
  112. string results in a program's native encoding.
  113. Both these functions return a pointer to the null-terminated converted string,
  114. or NULL if an error occurred. In addition, the variable pointed by outlen
  115. receives the effective byte length of the (cached) translated string, or -1
  116. in case of error.
  117. ILE/RPG support:
  118. Since 95% of the OS/400 programmers use ILE/RPG exclusively, a definition
  119. /INCLUDE member is provided for this language. To include libssh2
  120. definitions in an ILE/RPG module, line
  121. h bnddir('LIBSSH2/LIBSSH2')
  122. must figure in the program header, and line
  123. d/include libssh2/libssh2rpg,libssh2
  124. in the global data section of the module's source code.
  125. If required, members ssh2_sftp, ssh2_pkey and ssh2_ccsid may also be included.
  126. For IFS source compilations, include members are located in directory
  127. /libssh2/include/libssh2rpg and have their original names retained.
  128. ILE/RPG lacks a serious macro preprocessor, thus C macros requiring this
  129. feature have not been translated. However, function-like C macros have been
  130. implemented as procedures and therefore supported in ILE/RPG.