初始提交:terminalX 可运行态(M0/M1/M1.5 已真机验证)
- M0: libghostty SSH 终端(渲染/输入/连接)+ 白屏修复(OutputGate) + 会话状态机/自动重连 - M1: tsnet 用户态组网 + SSH-over-tsnet(fd 桥),shell 级真机验证;R5(Go+gvisor+C+++Swift 同进程) retire - M1.5: tmux -CC 原生 tab(MVP) - 结构: packages/(TXCore·TXTransport), apps/TerminalX, vendor/(libghostty-spm/libssh2/mbedtls/tsnet-bridge), artifacts/ - 文档: CLAUDE.md + docs/HANDOFF.md(新会话入口) - 环境: 认证代理→依赖 vendor 本地化;Go 在 ~/.local/go;仅模拟器/未签名 - 待续: M2 mosh, tmux 多 pane, M4 安全(host key/SE) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
182
vendor/libssh2/os400/README400
vendored
Normal file
182
vendor/libssh2/os400/README400
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
|
||||
Implementation notes:
|
||||
|
||||
This is a true OS/400 implementation, not a PASE implementation (for PASE,
|
||||
use AIX implementation).
|
||||
|
||||
It uses ASCII as internal character set. This has been accomplished using the
|
||||
QADRT library and include files, a C and system procedures ASCII wrapper
|
||||
library. See IBM QADRT description for more information.
|
||||
This results in libssh2 being an ASCII library: any function string
|
||||
argument is taken/returned in ASCII and a C/C++ calling program built around
|
||||
QADRT may use libssh2 functions as on any other platform.
|
||||
QADRT does not define ASCII wrappers for all C/system procedures: an
|
||||
additional module (os400sys.c) define some more of them, that are used by
|
||||
libssh2 and that QADRT left out.
|
||||
Since standard library entry points expect and return ASCII character strings,
|
||||
additional procedures are provided for string transcoding (see below). No
|
||||
wrappers to standard procedures are provided: however, nested calls to
|
||||
transcoding procedures may be used.
|
||||
|
||||
Crypto API is provided by the IBM QC3 API library. It supports RSA and EC,
|
||||
but not DSA.
|
||||
|
||||
|
||||
Standard compilation environment does support neither autotools nor make;
|
||||
in fact, very few common utilities are available. As a consequence, the
|
||||
libssh2_config.h has been coded manually and the compilation scripts are
|
||||
a set of shell scripts stored in subdirectory os400.
|
||||
|
||||
The test environment is currently not supported on OS/400.
|
||||
|
||||
|
||||
|
||||
Compiling on OS/400:
|
||||
|
||||
These instructions target people who knows about OS/400, compiling, IFS and
|
||||
archive extraction. Do not ask questions about these subjects if you're not
|
||||
familiar with.
|
||||
|
||||
_ As a prerequisite, QADRT development environment >= 20211112 must be
|
||||
installed.
|
||||
For more information on downloading and installing the QADRT development kit,
|
||||
please see https://www.ibm.com/support/pages/node/6258183
|
||||
_ If data compression has to be supported, ZLIB development environment must
|
||||
be installed.
|
||||
_ Install the libssh2 sources directory in IFS. Do NOT install it in the
|
||||
installation target directory (which defaults to /libssh2).
|
||||
_ Enter shell (QSH). You may need to change the LANG environment variable
|
||||
to be in phase with the libssh2 source files CCSID.
|
||||
_ Change current directory to the libssh2 sources installation directory
|
||||
_ Change current directory to os400
|
||||
- If you want to change the default configuration parameters like debug info
|
||||
generation, optimization level, listing option, target library, zlib
|
||||
availability and location, etc., copy file config400.default to
|
||||
config400.override and edit the latter. Do not edit the original default file
|
||||
as it might be overwritten by a subsequent source installation.
|
||||
_ Copy any file in the current directory to makelog (i.e.:
|
||||
cp initscript.sh makelog): this is intended to create the makelog file with
|
||||
an ASCII CCSID!
|
||||
_ Enter the command "sh make.sh > makelog 2>&1'
|
||||
_ Examine the makelog file to check for compilation errors.
|
||||
|
||||
Without configuration parameters override, this will produce the following
|
||||
OS/400 objects:
|
||||
_ Library LIBSSH2. All other objects will be stored in this library.
|
||||
_ Modules for all libssh2 units.
|
||||
_ Binding directory LIBSSH2_A, to be used at calling program link time for
|
||||
statically binding the modules (specify BNDSRVPGM(QADRTTS) when creating a
|
||||
program using LIBSSH2_A. Also give access to the zlib BNDDIR/SRVPGM if
|
||||
libssh2 is compiled with zlib).
|
||||
_ Service program LIBSSH2.<soname>, where <soname> is extracted from the
|
||||
src/Makefile.am VERSION variable. To be used at calling program run-time
|
||||
when this program has dynamically bound libssh2 at link time.
|
||||
_ Binding directory LIBSSH2. To be used to dynamically bind libssh2 when
|
||||
linking a calling program.
|
||||
_ Source file H. It contains all the include members needed to compile a C/C++
|
||||
module using libssh2.
|
||||
_ LIBSSH2, SSH2_PKEY, SSH2_SFTP members in file H. These are the C/C++ header
|
||||
files. Original fames have been mangled to fit member name allowed syntax.
|
||||
_ Source file LIBSSH2RPG. It contains all the ILE/RPG /INCLUDE members
|
||||
needed to compile an ILE/RPG program calling libssh2 procedures.
|
||||
_ LIBSSH2, SSH2_PKEY, SSH2_SFTP members in file LIBSSH2RPG. These are
|
||||
ILE/RPG translations of the corresponding C header files.
|
||||
|
||||
|
||||
|
||||
Special programming consideration:
|
||||
|
||||
QADRT being used, the following points must be considered:
|
||||
_ If static binding is used, service program QADRTTS must be linked too.
|
||||
_ Likewise, if libssh2 has been compiled with zlib support, access to the
|
||||
zlib objects must be provided at link time.
|
||||
_ The EBCDIC CCSID used by QADRT is 37 by default, NOT THE JOB'S CCSID. If
|
||||
another EBCDIC CCSID is required, it must be set via a locale through a call
|
||||
to setlocale_a (QADRT's setlocale() ASCII wrapper) with category LC_ALL or
|
||||
LC_CTYPE, or by setting environment variable QADRT_ENV_LOCALE to the locale
|
||||
object path before executing the program.
|
||||
_ Do not use original source include files unless you know what you are doing.
|
||||
Use the installed members instead (in /QSYS.LIB/LIBSSH2.LIB/H.FILE).
|
||||
|
||||
|
||||
|
||||
String transcoding support:
|
||||
|
||||
To help passing arbitrarily encoded string arguments and/or receiving string
|
||||
values from/to the libssh2 API, three non-standard additional procedures are
|
||||
provided. They use a session pointer and a "string cache" pointer.
|
||||
Each time a string is transcoded, it is cached in the given cache. It is
|
||||
the responsibility of the caller to release the cache when its associated
|
||||
strings are no longer needed. These procedures and the string cache type are
|
||||
defined in a new libssh2_ccsid.h header file.
|
||||
To create a string cache, use:
|
||||
|
||||
#include <libssh2_ccsid.h>
|
||||
libssh2_string_cache * cache = NULL;
|
||||
|
||||
To release all strings in a cache, call:
|
||||
|
||||
libssh2_release_string_cache(session, &cache);
|
||||
|
||||
The transcoding procedures are:
|
||||
|
||||
char * libssh2_from_ccsid(LIBSSH2_SESSION *session,
|
||||
libssh2_string_cache **cache,
|
||||
unsigned short ccsid,
|
||||
const char *string, ssize_t inlen,
|
||||
size_t *outlen);
|
||||
char * libssh2_to_ccsid(LIBSSH2_SESSION *session,
|
||||
libssh2_string_cache **cache,
|
||||
unsigned short ccsid,
|
||||
const char *string, ssize_t inlen,
|
||||
size_t *outlen);
|
||||
|
||||
where:
|
||||
session is a libssh2 session used for memory allocation or NULL for
|
||||
global allocation scheme.
|
||||
cache is the address of a string cache.
|
||||
ccsid is the external (i.e.: non libssh2) coded character set id.
|
||||
65535 means no conversion and 0 means the current job's CCSID.
|
||||
string is the string to convert.
|
||||
inlen is the source string length in bytes: set to -1 if
|
||||
null-terminated.
|
||||
outlen if not NULL, is the address of a variable that will receive
|
||||
the transcoded string length upon return.
|
||||
|
||||
libssh2_from_ccsid() transcodes the string from the given CCSID to libssh2
|
||||
internal encoding (UTF-8). It is intended to be used to convert API input
|
||||
parameters.
|
||||
libssh2_to_ccsid() transcodes the string from libssh2 internal encoding
|
||||
(UTF-8) to the given CCSID. This has been implemented to get standard API
|
||||
string results in a program's native encoding.
|
||||
|
||||
Both these functions return a pointer to the null-terminated converted string,
|
||||
or NULL if an error occurred. In addition, the variable pointed by outlen
|
||||
receives the effective byte length of the (cached) translated string, or -1
|
||||
in case of error.
|
||||
|
||||
Please take care to never mix different sessions into the same cache.
|
||||
|
||||
|
||||
|
||||
ILE/RPG support:
|
||||
|
||||
Since 95% of the OS/400 programmers use ILE/RPG exclusively, a definition
|
||||
/INCLUDE member is provided for this language. To include libssh2
|
||||
definitions in an ILE/RPG module, line
|
||||
|
||||
h bnddir('LIBSSH2/LIBSSH2')
|
||||
|
||||
must figure in the program header, and line
|
||||
|
||||
d/include libssh2/libssh2rpg,libssh2
|
||||
|
||||
in the global data section of the module's source code.
|
||||
If required, members ssh2_sftp, ssh2_pkey and ssh2_ccsid may also be included.
|
||||
|
||||
For IFS source compilations, include members are located in directory
|
||||
/libssh2/include/libssh2rpg and have their original names retained.
|
||||
|
||||
ILE/RPG lacks a serious macro preprocessor, thus C macros requiring this
|
||||
feature have not been translated. However, function-like C macros have been
|
||||
implemented as procedures and therefore supported in ILE/RPG.
|
||||
260
vendor/libssh2/os400/ccsid.c
vendored
Normal file
260
vendor/libssh2/os400/ccsid.c
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/* Character encoding wrappers. */
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
#include "libssh2_ccsid.h"
|
||||
|
||||
#include <qtqiconv.h>
|
||||
#include <iconv.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
#define CCSID_UTF8 1208
|
||||
#define CCSID_UTF16BE 13488
|
||||
#define STRING_GRANULE 256
|
||||
#define MAX_CHAR_SIZE 4
|
||||
|
||||
#define OFFSET_OF(t, f) ((size_t) ((char *) &((t *) 0)->f - (char *) 0))
|
||||
|
||||
#define ALLOC(s, sz) ((s)? LIBSSH2_ALLOC((s), (sz)): malloc(sz))
|
||||
#define REALLOC(s, p, sz) ((s)? LIBSSH2_REALLOC((s), (p), (sz)): \
|
||||
realloc((p), (sz)))
|
||||
#define FREE(s, p) ((s)? LIBSSH2_FREE((s), (p)): free(p))
|
||||
|
||||
|
||||
struct _libssh2_string_cache {
|
||||
libssh2_string_cache * next;
|
||||
char string[1];
|
||||
};
|
||||
|
||||
|
||||
static const QtqCode_T utf8code = { CCSID_UTF8 };
|
||||
|
||||
|
||||
static ssize_t
|
||||
terminator_size(unsigned short ccsid)
|
||||
{
|
||||
QtqCode_T outcode;
|
||||
iconv_t cd;
|
||||
char *inp;
|
||||
char *outp;
|
||||
size_t ilen;
|
||||
size_t olen;
|
||||
char buf[MAX_CHAR_SIZE];
|
||||
|
||||
/* Return the null-terminator size for the given CCSID. */
|
||||
|
||||
/* Fast check usual CCSIDs. */
|
||||
switch(ccsid) {
|
||||
case CCSID_UTF8:
|
||||
case 0: /* Job CCSID is SBCS EBCDIC. */
|
||||
return 1;
|
||||
case CCSID_UTF16BE:
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Convert an UTF-8 NUL to the target CCSID: use the converted size as
|
||||
result. */
|
||||
memset((void *) &outcode, 0, sizeof(outcode));
|
||||
outcode.CCSID = ccsid;
|
||||
cd = QtqIconvOpen(&outcode, (QtqCode_T *) &utf8code);
|
||||
if(cd.return_value == -1)
|
||||
return -1;
|
||||
inp = "";
|
||||
ilen = 1;
|
||||
outp = buf;
|
||||
olen = sizeof(buf);
|
||||
iconv(cd, &inp, &ilen, &outp, &olen);
|
||||
iconv_close(cd);
|
||||
olen = sizeof(buf - olen);
|
||||
return olen ? olen : -1;
|
||||
}
|
||||
|
||||
static char *
|
||||
convert_ccsid(LIBSSH2_SESSION *session, libssh2_string_cache **cache,
|
||||
unsigned short outccsid, unsigned short inccsid,
|
||||
const char *instring, ssize_t inlen, size_t *outlen)
|
||||
{
|
||||
char *inp;
|
||||
char *outp;
|
||||
size_t olen;
|
||||
size_t ilen;
|
||||
size_t buflen;
|
||||
size_t curlen;
|
||||
ssize_t termsize;
|
||||
int i;
|
||||
char *dst;
|
||||
libssh2_string_cache *outstring;
|
||||
QtqCode_T incode;
|
||||
QtqCode_T outcode;
|
||||
iconv_t cd;
|
||||
|
||||
if(!instring) {
|
||||
if(outlen)
|
||||
*outlen = 0;
|
||||
return NULL;
|
||||
}
|
||||
if(outlen)
|
||||
*outlen = -1;
|
||||
if(!cache)
|
||||
return NULL;
|
||||
|
||||
/* Get terminator size. */
|
||||
termsize = terminator_size(outccsid);
|
||||
if(termsize < 0)
|
||||
return NULL;
|
||||
|
||||
/* Prepare conversion parameters. */
|
||||
memset((void *) &incode, 0, sizeof(incode));
|
||||
memset((void *) &outcode, 0, sizeof(outcode));
|
||||
incode.CCSID = inccsid;
|
||||
outcode.CCSID = outccsid;
|
||||
curlen = OFFSET_OF(libssh2_string_cache, string);
|
||||
inp = (char *) instring;
|
||||
ilen = inlen;
|
||||
buflen = inlen + curlen;
|
||||
if(inlen < 0) {
|
||||
incode.length_option = 1;
|
||||
buflen = STRING_GRANULE;
|
||||
ilen = 0;
|
||||
}
|
||||
|
||||
/* Allocate output string buffer and open conversion descriptor. */
|
||||
dst = ALLOC(session, buflen + termsize);
|
||||
if(!dst)
|
||||
return NULL;
|
||||
cd = QtqIconvOpen(&outcode, &incode);
|
||||
if(cd.return_value == -1) {
|
||||
FREE(session, dst);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Convert string. */
|
||||
for(;;) {
|
||||
outp = dst + curlen;
|
||||
olen = buflen - curlen;
|
||||
i = iconv(cd, &inp, &ilen, &outp, &olen);
|
||||
if(inlen < 0 && olen == buflen - curlen) {
|
||||
/* Special case: converted 0-length (sub)strings do not store the
|
||||
terminator. */
|
||||
if(termsize) {
|
||||
memset(outp, 0, termsize);
|
||||
olen -= termsize;
|
||||
}
|
||||
}
|
||||
curlen = buflen - olen;
|
||||
if(i >= 0 || errno != E2BIG)
|
||||
break;
|
||||
/* Must expand buffer. */
|
||||
buflen += STRING_GRANULE;
|
||||
outp = REALLOC(session, dst, buflen + termsize);
|
||||
if(!outp)
|
||||
break;
|
||||
dst = outp;
|
||||
}
|
||||
|
||||
iconv_close(cd);
|
||||
|
||||
/* Check for error. */
|
||||
if(i < 0 || !outp) {
|
||||
FREE(session, dst);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Process terminator. */
|
||||
if(inlen < 0)
|
||||
curlen -= termsize;
|
||||
else if(termsize)
|
||||
memset(dst + curlen, 0, termsize);
|
||||
|
||||
/* Shorten buffer if possible. */
|
||||
if(curlen < buflen)
|
||||
dst = REALLOC(session, dst, curlen + termsize);
|
||||
|
||||
/* Link to cache. */
|
||||
outstring = (libssh2_string_cache *) dst;
|
||||
outstring->next = *cache;
|
||||
*cache = outstring;
|
||||
|
||||
/* Return length if required. */
|
||||
if(outlen)
|
||||
*outlen = curlen - OFFSET_OF(libssh2_string_cache, string);
|
||||
|
||||
return outstring->string;
|
||||
}
|
||||
|
||||
LIBSSH2_API char *
|
||||
libssh2_from_ccsid(LIBSSH2_SESSION *session, libssh2_string_cache **cache,
|
||||
unsigned short ccsid, const char *string, ssize_t inlen,
|
||||
size_t *outlen)
|
||||
{
|
||||
return convert_ccsid(session, cache,
|
||||
CCSID_UTF8, ccsid, string, inlen, outlen);
|
||||
}
|
||||
|
||||
LIBSSH2_API char *
|
||||
libssh2_to_ccsid(LIBSSH2_SESSION *session, libssh2_string_cache **cache,
|
||||
unsigned short ccsid, const char *string, ssize_t inlen,
|
||||
size_t *outlen)
|
||||
{
|
||||
return convert_ccsid(session, cache,
|
||||
ccsid, CCSID_UTF8, string, inlen, outlen);
|
||||
}
|
||||
|
||||
LIBSSH2_API void
|
||||
libssh2_release_string_cache(LIBSSH2_SESSION *session,
|
||||
libssh2_string_cache **cache)
|
||||
{
|
||||
libssh2_string_cache *p;
|
||||
|
||||
if(cache)
|
||||
while((p = *cache)) {
|
||||
*cache = p->next;
|
||||
FREE(session, (char *) p);
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: set expandtab ts=4 sw=4: */
|
||||
28
vendor/libssh2/os400/config400.default
vendored
Normal file
28
vendor/libssh2/os400/config400.default
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
################################################################################
|
||||
|
||||
# Tunable configuration parameters.
|
||||
|
||||
setenv TARGETLIB 'LIBSSH2' # Target OS/400 program library.
|
||||
setenv STATBNDDIR 'LIBSSH2_A' # Static binding directory.
|
||||
setenv DYNBNDDIR 'LIBSSH2' # Dynamic binding directory.
|
||||
setenv SRVPGM "LIBSSH2.${SONAME}" # Service program.
|
||||
setenv TGTCCSID '500' # Target CCSID of objects.
|
||||
setenv DEBUG '*ALL' # Debug level.
|
||||
setenv OPTIMIZE '10' # Optimisation level
|
||||
setenv OUTPUT '*NONE' # Compilation output option.
|
||||
setenv TGTRLS '*CURRENT' # Target OS release.
|
||||
setenv IFSDIR '/libssh2' # Installation IFS directory.
|
||||
setenv QADRTDIR '/QIBM/ProdData/qadrt' # QADRT IFS directory.
|
||||
|
||||
setenv WITH_MD5 'yes' # enable MD5 support.
|
||||
|
||||
# Define ZLIB availability and locations.
|
||||
|
||||
setenv WITH_ZLIB 0 # Define to 1 to enable.
|
||||
setenv ZLIB_INCLUDE '/zlib/include' # ZLIB include IFS directory.
|
||||
setenv ZLIB_LIB 'ZLIB' # ZLIB library.
|
||||
setenv ZLIB_BNDDIR 'ZLIB_A' # ZLIB binding directory.
|
||||
52
vendor/libssh2/os400/include/alloca.h
vendored
Normal file
52
vendor/libssh2/os400/include/alloca.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_ALLOCA_H
|
||||
#define LIBSSH2_ALLOCA_H
|
||||
|
||||
/* alloca() emulation. */
|
||||
|
||||
#include <modasa.mih>
|
||||
|
||||
#define alloca(n) _MODASA(n)
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set expandtab ts=4 sw=4: */
|
||||
60
vendor/libssh2/os400/include/assert.h
vendored
Normal file
60
vendor/libssh2/os400/include/assert.h
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_ASSERT_H
|
||||
#define LIBSSH2_ASSERT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Ascii assert() macro. */
|
||||
|
||||
#ifndef NDEBUG
|
||||
#pragma convert(819)
|
||||
|
||||
#define assert(expr) ((expr)? ((void) 0): (fprintf(stderr, \
|
||||
"Assertion failed: %s in file %s line %u. Aborting\n", \
|
||||
#expr, __FILE__, __LINE__), abort()))
|
||||
#else
|
||||
#define assert(expr) ((void) 0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* vim: set expandtab ts=4 sw=4: */
|
||||
77
vendor/libssh2/os400/include/sys/socket.h
vendored
Normal file
77
vendor/libssh2/os400/include/sys/socket.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_SYS_SOCKET_H
|
||||
#define LIBSSH2_SYS_SOCKET_H
|
||||
|
||||
/*
|
||||
* <sys/socket.h> wrapper.
|
||||
* Redefines connect().
|
||||
*/
|
||||
|
||||
#include <qadrt.h>
|
||||
|
||||
#ifndef _QADRT_LT
|
||||
# define _QADRT_LT <
|
||||
#endif
|
||||
#ifndef _QADRT_GT
|
||||
# define _QADRT_GT >
|
||||
#endif
|
||||
|
||||
#ifdef QADRT_SYSINC
|
||||
# include _QADRT_LT QADRT_SYSINC/sys/socket.h _QADRT_GT
|
||||
#elif __ILEC400_TGTVRM__ >= 710
|
||||
# include_next <sys/socket.h>
|
||||
#elif !defined(__SRCSTMF__)
|
||||
# include <QSYSINC/sys/socket>
|
||||
#else
|
||||
# include </QIBM/include/sys/socket.h>
|
||||
#endif
|
||||
|
||||
extern int _libssh2_os400_connect(int sd,
|
||||
struct sockaddr *destaddr, int addrlen);
|
||||
|
||||
#ifndef LIBSSH2_DISABLE_QADRT_EXT
|
||||
#define connect(sd, addr, len) _libssh2_os400_connect((sd), (addr), (len))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set expandtab ts=4 sw=4: */
|
||||
232
vendor/libssh2/os400/initscript.sh
vendored
Executable file
232
vendor/libssh2/os400/initscript.sh
vendored
Executable file
@@ -0,0 +1,232 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
setenv()
|
||||
|
||||
{
|
||||
# Define and export.
|
||||
|
||||
eval "${1}=${2}"
|
||||
export "${1?}"
|
||||
}
|
||||
|
||||
|
||||
case "${SCRIPTDIR}" in
|
||||
/*) ;;
|
||||
*) SCRIPTDIR="$(pwd)/${SCRIPTDIR}"
|
||||
esac
|
||||
|
||||
while true
|
||||
do case "${SCRIPTDIR}" in
|
||||
*/.) SCRIPTDIR="${SCRIPTDIR%/.}";;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
|
||||
# The script directory is supposed to be in $TOPDIR/os400.
|
||||
|
||||
TOPDIR=$(dirname "${SCRIPTDIR}")
|
||||
export SCRIPTDIR TOPDIR
|
||||
|
||||
# Extract the SONAME from the library makefile.
|
||||
|
||||
SONAME=$(sed -e '/^VERSION=/!d' \
|
||||
-e 's/^.* \([0-9]*\):.*$/\1/' -e 'q' \
|
||||
< "${TOPDIR}/src/Makefile.am")
|
||||
export SONAME
|
||||
|
||||
# Get OS/400 configuration parameters.
|
||||
|
||||
. "${SCRIPTDIR}/config400.default"
|
||||
if [ -f "${SCRIPTDIR}/config400.override" ]
|
||||
then . "${SCRIPTDIR}/config400.override"
|
||||
fi
|
||||
|
||||
# Need to get the version definitions.
|
||||
|
||||
LIBSSH2_VERSION=$(grep '^#define *LIBSSH2_VERSION ' \
|
||||
"${TOPDIR}/include/libssh2.h" |
|
||||
sed 's/.*"\(.*\)".*/\1/')
|
||||
LIBSSH2_VERSION_MAJOR=$(grep '^#define *LIBSSH2_VERSION_MAJOR ' \
|
||||
"${TOPDIR}/include/libssh2.h" |
|
||||
sed 's/^#define *LIBSSH2_VERSION_MAJOR *\([^ ]*\).*/\1/')
|
||||
LIBSSH2_VERSION_MINOR=$(grep '^#define *LIBSSH2_VERSION_MINOR ' \
|
||||
"${TOPDIR}/include/libssh2.h" |
|
||||
sed 's/^#define *LIBSSH2_VERSION_MINOR *\([^ ]*\).*/\1/')
|
||||
LIBSSH2_VERSION_PATCH=$(grep '^#define *LIBSSH2_VERSION_PATCH ' \
|
||||
"${TOPDIR}/include/libssh2.h" |
|
||||
sed 's/^#define *LIBSSH2_VERSION_PATCH *\([^ ]*\).*/\1/')
|
||||
LIBSSH2_VERSION_NUM=$(grep '^#define *LIBSSH2_VERSION_NUM ' \
|
||||
"${TOPDIR}/include/libssh2.h" |
|
||||
sed 's/^#define *LIBSSH2_VERSION_NUM *0x\([^ ]*\).*/\1/')
|
||||
LIBSSH2_TIMESTAMP=$(grep '^#define *LIBSSH2_TIMESTAMP ' \
|
||||
"${TOPDIR}/include/libssh2.h" |
|
||||
sed 's/.*"\(.*\)".*/\1/')
|
||||
export LIBSSH2_VERSION
|
||||
export LIBSSH2_VERSION_MAJOR LIBSSH2_VERSION_MINOR LIBSSH2_VERSION_PATCH
|
||||
export LIBSSH2_VERSION_NUM LIBSSH2_TIMESTAMP
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# OS/400 specific definitions.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB"
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Procedures.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
# action_needed dest [src]
|
||||
#
|
||||
# dest is an object to build
|
||||
# if specified, src is an object on which dest depends.
|
||||
#
|
||||
# exit 0 (succeeds) if some action has to be taken, else 1.
|
||||
|
||||
action_needed()
|
||||
|
||||
{
|
||||
[ ! -e "${1}" ] && return 0
|
||||
[ -n "${2}" ] || return 1
|
||||
# shellcheck disable=SC3013
|
||||
[ "${1}" -ot "${2}" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
# canonicalize_path path
|
||||
#
|
||||
# Return canonicalized path as:
|
||||
# - Absolute
|
||||
# - No . or .. component.
|
||||
|
||||
canonicalize_path()
|
||||
|
||||
{
|
||||
if expr "${1}" : '^/' > /dev/null
|
||||
then P="${1}"
|
||||
else P="$(pwd)/${1}"
|
||||
fi
|
||||
|
||||
R=
|
||||
IFSSAVE="${IFS}"
|
||||
IFS="/"
|
||||
|
||||
for C in ${P}
|
||||
do IFS="${IFSSAVE}"
|
||||
case "${C}" in
|
||||
.) ;;
|
||||
..) R="$(expr "${R}" : '^\(.*/\)..*')"
|
||||
;;
|
||||
?*) R="${R}${C}/"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
IFS="${IFSSAVE}"
|
||||
echo "/$(expr "${R}" : '^\(.*\)/')"
|
||||
}
|
||||
|
||||
|
||||
# make_module module_name source_name [additional_definitions]
|
||||
#
|
||||
# Compile source name into ASCII module if needed.
|
||||
# As side effect, append the module name to variable MODULES.
|
||||
# Set LINK to "YES" if the module has been compiled.
|
||||
|
||||
make_module()
|
||||
|
||||
{
|
||||
MODULES="${MODULES} ${1}"
|
||||
MODIFSNAME="${LIBIFSNAME}/${1}.MODULE"
|
||||
action_needed "${MODIFSNAME}" "${2}" || return 0;
|
||||
SRCDIR="$(dirname "$(canonicalize_path "${2}")")"
|
||||
|
||||
# #pragma convert has to be in the source file itself, i.e.
|
||||
# putting it in an include file makes it only active
|
||||
# for that include file.
|
||||
# Thus we build a temporary file with the pragma prepended to
|
||||
# the source file and we compile that temporary file.
|
||||
|
||||
{
|
||||
echo "#line 1 \"${2}\""
|
||||
echo "#pragma convert(819)"
|
||||
echo "#line 1"
|
||||
cat "${2}"
|
||||
} > __tmpsrcf.c
|
||||
CMD="CRTCMOD MODULE(${TARGETLIB}/${1}) SRCSTMF('__tmpsrcf.c')"
|
||||
# CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST *SHOWINC *SHOWSYS)"
|
||||
CMD="${CMD} SYSIFCOPT(*IFS64IO) OPTION(*INCDIRFIRST)"
|
||||
CMD="${CMD} LOCALETYPE(*LOCALE) FLAG(10)"
|
||||
CMD="${CMD} INCDIR('${TOPDIR}/os400/include'"
|
||||
CMD="${CMD} '${QADRTDIR}/include' '${TOPDIR}/include'"
|
||||
CMD="${CMD} '${TOPDIR}/os400' '${SRCDIR}'"
|
||||
|
||||
if [ "${WITH_ZLIB}" != "0" ]
|
||||
then CMD="${CMD} '${ZLIB_INCLUDE}'"
|
||||
fi
|
||||
|
||||
CMD="${CMD} ${INCLUDES})"
|
||||
CMD="${CMD} TGTCCSID(${TGTCCSID}) TGTRLS(${TGTRLS})"
|
||||
CMD="${CMD} OUTPUT(${OUTPUT})"
|
||||
CMD="${CMD} OPTIMIZE(${OPTIMIZE})"
|
||||
CMD="${CMD} DBGVIEW(${DEBUG})"
|
||||
|
||||
DEFINES="${3}"
|
||||
|
||||
if [ "${WITH_ZLIB}" != "0" ]
|
||||
then DEFINES="${DEFINES} LIBSSH2_HAVE_ZLIB"
|
||||
fi
|
||||
|
||||
if [ "${WITH_MD5}" != 'yes' ]
|
||||
then DEFINES="${DEFINES} LIBSSH2_NO_MD5"
|
||||
fi
|
||||
|
||||
if [ -n "${DEFINES}" ]
|
||||
then CMD="${CMD} DEFINE(${DEFINES})"
|
||||
fi
|
||||
|
||||
system "${CMD}"
|
||||
rm -f __tmpsrcf.c
|
||||
# shellcheck disable=SC2034
|
||||
LINK=YES
|
||||
}
|
||||
|
||||
|
||||
# Determine DB2 object name from IFS name.
|
||||
|
||||
db2_name()
|
||||
|
||||
{
|
||||
if [ "${2}" = 'nomangle' ]
|
||||
then basename "${1}" |
|
||||
tr 'a-z-' 'A-Z_' |
|
||||
sed -e 's/\..*//;s/^\(.\).*\(.........\)$/\1\2/'
|
||||
else basename "${1}" |
|
||||
tr 'a-z-' 'A-Z_' |
|
||||
sed -e 's/\..*//;s/^LIBSSH2_/SSH2_/' \
|
||||
-e 's/^\(.\).*\(.........\)$/\1\2/' \
|
||||
-e 's/^SPUBLICKEY$/SSH2_PKEY/'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Copy stream replacing version info.
|
||||
|
||||
versioned_copy()
|
||||
|
||||
{
|
||||
sed -e "s/@LIBSSH2_VERSION@/${LIBSSH2_VERSION}/g" \
|
||||
-e "s/@LIBSSH2_VERSION_MAJOR@/${LIBSSH2_VERSION_MAJOR}/g" \
|
||||
-e "s/@LIBSSH2_VERSION_MINOR@/${LIBSSH2_VERSION_MINOR}/g" \
|
||||
-e "s/@LIBSSH2_VERSION_PATCH@/${LIBSSH2_VERSION_PATCH}/g" \
|
||||
-e "s/@LIBSSH2_VERSION_NUM@/${LIBSSH2_VERSION_NUM}/g" \
|
||||
-e "s/@LIBSSH2_TIMESTAMP@/${LIBSSH2_TIMESTAMP}/g"
|
||||
}
|
||||
65
vendor/libssh2/os400/libssh2_ccsid.h
vendored
Normal file
65
vendor/libssh2/os400/libssh2_ccsid.h
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/* CCSID conversion support. */
|
||||
|
||||
#ifndef LIBSSH2_CCSID_H_
|
||||
#define LIBSSH2_CCSID_H_
|
||||
|
||||
#include "libssh2.h"
|
||||
|
||||
typedef struct _libssh2_string_cache libssh2_string_cache;
|
||||
|
||||
|
||||
LIBSSH2_API char *
|
||||
libssh2_from_ccsid(LIBSSH2_SESSION *session, libssh2_string_cache **cache,
|
||||
unsigned short ccsid, const char *string, ssize_t inlen,
|
||||
size_t *outlen);
|
||||
LIBSSH2_API char *
|
||||
libssh2_to_ccsid(LIBSSH2_SESSION *session, libssh2_string_cache **cache,
|
||||
unsigned short ccsid, const char *string, ssize_t inlen,
|
||||
size_t *outlen);
|
||||
LIBSSH2_API void
|
||||
libssh2_release_string_cache(LIBSSH2_SESSION *session,
|
||||
libssh2_string_cache **cache);
|
||||
|
||||
#endif
|
||||
|
||||
/* vim: set expandtab ts=4 sw=4: */
|
||||
215
vendor/libssh2/os400/libssh2_config.h
vendored
Normal file
215
vendor/libssh2/os400/libssh2_config.h
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_CONFIG_H
|
||||
#define LIBSSH2_CONFIG_H
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
|
||||
systems. This function is required for `alloca.c' support on those systems.
|
||||
*/
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Define to 1 if using `alloca.c'. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Define to 1 if you have `alloca', as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
|
||||
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#define HAVE_ALLOCA_H 1
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
|
||||
/* use FIONBIO for non-blocking sockets */
|
||||
#undef HAVE_FIONBIO
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* use Ioctlsocket() for non-blocking sockets */
|
||||
#undef HAVE_IOCTLSOCKET_CASE
|
||||
|
||||
/* Define if you have the gcrypt library. */
|
||||
#undef HAVE_LIBGCRYPT
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* use O_NONBLOCK for non-blocking sockets */
|
||||
#define HAVE_O_NONBLOCK 1
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define to 1 if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* use SO_NONBLOCK for non-blocking sockets */
|
||||
#undef HAVE_SO_NONBLOCK
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#define HAVE_STDIO_H 1
|
||||
|
||||
/* Define to 1 if you have the `strtoll' function. */
|
||||
#define HAVE_STRTOLL 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
||||
#define HAVE_SYS_UIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/un.h> header file. */
|
||||
#define HAVE_SYS_UN_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* to make a symbol visible */
|
||||
#undef LIBSSH2_API
|
||||
|
||||
/* Compile in zlib support */
|
||||
/* #undef LIBSSH2_HAVE_ZLIB */
|
||||
|
||||
/* Use libgcrypt */
|
||||
#undef LIBSSH2_LIBGCRYPT
|
||||
|
||||
/* Use OpenSSL */
|
||||
#undef LIBSSH2_OPENSSL
|
||||
|
||||
/* Use Windows CNG */
|
||||
#undef LIBSSH2_WINCNG
|
||||
|
||||
/* Use OS/400 Qc3 */
|
||||
#define LIBSSH2_OS400QC3
|
||||
|
||||
/* Use our platform-specific local implementation:
|
||||
_libssh2_os400_snprintf */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
|
||||
#undef NEED_REENTRANT
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libssh2"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "libssh2-devel@lists.haxx.se"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libssh2"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libssh2 -"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libssh2"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "-"
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at runtime.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "-"
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#define WORDS_BIGENDIAN 1
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#undef _LARGE_FILES
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
|
||||
#ifndef LIBSSH2_DISABLE_QADRT_EXT
|
||||
/* Remap zlib procedures to ASCII versions. */
|
||||
#pragma map(inflateInit_, "_libssh2_os400_inflateInit_")
|
||||
#pragma map(deflateInit_, "_libssh2_os400_deflateInit_")
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* vim: set expandtab ts=4 sw=4: */
|
||||
1962
vendor/libssh2/os400/libssh2rpg/libssh2.rpgle.in
vendored
Normal file
1962
vendor/libssh2/os400/libssh2rpg/libssh2.rpgle.in
vendored
Normal file
File diff suppressed because it is too large
Load Diff
71
vendor/libssh2/os400/libssh2rpg/libssh2_ccsid.rpgle.in
vendored
Normal file
71
vendor/libssh2/os400/libssh2rpg/libssh2_ccsid.rpgle.in
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/if not defined(LIBSSH2_CCSID_H_)
|
||||
/define LIBSSH2_CCSID_H_
|
||||
|
||||
/include "libssh2rpg/libssh2"
|
||||
|
||||
d libssh2_from_ccsid...
|
||||
d pr * extproc('libssh2_from_ccsid') char *
|
||||
d session * value LIBSSH2_SESSION *
|
||||
d cache * libssh2_string_cache
|
||||
d *(*)
|
||||
d ccsid value like(libssh2_Cushort)
|
||||
d string * value options(*string) const char *
|
||||
d inlen value like(libssh2_Cssize_t)
|
||||
d outlen like(libssh2_Csize_t) options(*omit)
|
||||
|
||||
d libssh2_to_ccsid...
|
||||
d pr * extproc('libssh2_to_ccsid') char *
|
||||
d session * value LIBSSH2_SESSION *
|
||||
d cache * libssh2_string_cache
|
||||
d *(*)
|
||||
d ccsid value like(libssh2_Cushort)
|
||||
d string * value options(*string) const char *
|
||||
d inlen value like(libssh2_Cssize_t)
|
||||
d outlen like(libssh2_Csize_t) options(*omit)
|
||||
|
||||
d libssh2_release_string_cache...
|
||||
d pr extproc(
|
||||
d 'libssh2_release_string_cache')
|
||||
d session * value LIBSSH2_SESSION *
|
||||
d cache * libssh2_string_cache
|
||||
d *(*)
|
||||
|
||||
/endif LIBSSH2_CCSID_H_
|
||||
143
vendor/libssh2/os400/libssh2rpg/libssh2_publickey.rpgle
vendored
Normal file
143
vendor/libssh2/os400/libssh2rpg/libssh2_publickey.rpgle
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
|
||||
* Note: This include file is only needed for using the
|
||||
* publickey SUBSYSTEM which is not the same as publickey
|
||||
* authentication. For authentication you only need libssh2.h
|
||||
*
|
||||
* For more information on the publickey subsystem,
|
||||
* refer to IETF draft: secsh-publickey
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/if not defined(LIBSSH2_PUBLICKEY_H_)
|
||||
/define LIBSSH2_PUBLICKEY_H_
|
||||
|
||||
/include "libssh2rpg/libssh2"
|
||||
|
||||
d libssh2_publickey_attribute...
|
||||
d ds based(######typedef######)
|
||||
d align qualified
|
||||
d name * const char *
|
||||
d name_len like(libssh2_Culong)
|
||||
d value * const char *
|
||||
d value_len like(libssh2_Culong)
|
||||
d mandatory like(libssh2_Cchar)
|
||||
|
||||
d libssh2_publickey_list...
|
||||
d ds based(######typedef######)
|
||||
d align qualified
|
||||
d name * const char *
|
||||
d name_len like(libssh2_Culong)
|
||||
d blob * const uns char *
|
||||
d blob_len like(libssh2_Culong)
|
||||
d num_attrs like(libssh2_Culong)
|
||||
d attrs * libssh2_publickey...
|
||||
d attribute *
|
||||
|
||||
* Publickey Subsystem.
|
||||
d libssh2_publickey_init...
|
||||
d pr * extproc('libssh2_publickey_init') LIBSSH2_PUBLICKEY *
|
||||
d session * value LIBSSH2_SESSION *
|
||||
|
||||
d libssh2_publickey_add_ex...
|
||||
d pr extproc('libssh2_publickey_add_ex')
|
||||
d like(libssh2_Cint)
|
||||
d pkey * value LIBSSH2_PUBLICKEY *
|
||||
d name * value options(*string) const uns char *
|
||||
d name_len value like(libssh2_Culong)
|
||||
d blob * value options(*string) const uns char *
|
||||
d blob_len value like(libssh2_Culong)
|
||||
d overwrite value like(libssh2_Cchar)
|
||||
d num_attrs value like(libssh2_Culong)
|
||||
d attrs likeds(libssh2_publickey_attribute)
|
||||
d dim(1000)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_publickey_add...
|
||||
d pr extproc('libssh2_publickey_add')
|
||||
d like(libssh2_Cint)
|
||||
d pkey * value LIBSSH2_PUBLICKEY *
|
||||
d name * value options(*string) const unsigned char
|
||||
d *
|
||||
d blob * value options(*string) const unsigned char
|
||||
d *
|
||||
d blob_len value like(libssh2_Culong)
|
||||
d overwrite value like(libssh2_Cchar)
|
||||
d num_attrs value like(libssh2_Culong)
|
||||
d attrs likeds(libssh2_publickey_attribute)
|
||||
d dim(1000)
|
||||
|
||||
d libssh2_publickey_remove_ex...
|
||||
d pr extproc(
|
||||
d 'libssh2_publickey_remove_ex')
|
||||
d like(libssh2_Cint)
|
||||
d pkey * value LIBSSH2_PUBLICKEY *
|
||||
d name * value options(*string) const uns char *
|
||||
d name_len value like(libssh2_Culong)
|
||||
d blob * value options(*string) const uns char *
|
||||
d blob_len value like(libssh2_Culong)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_publickey_remove...
|
||||
d pr extproc('libssh2_publickey_remove')
|
||||
d like(libssh2_Cint)
|
||||
d pkey * value LIBSSH2_PUBLICKEY *
|
||||
d name * value options(*string) const uns char *
|
||||
d blob * value options(*string) const uns char *
|
||||
d blob_len value like(libssh2_Culong)
|
||||
|
||||
d libssh2_publickey_list_fetch...
|
||||
d pr extproc(
|
||||
d 'libssh2_publickey_list_fetch')
|
||||
d like(libssh2_Cint)
|
||||
d pkey * value LIBSSH2_PUBLICKEY *
|
||||
d num_keys * value unsigned long *
|
||||
d pkey_list * libssh2_publickey...
|
||||
d _list *(*)
|
||||
|
||||
d libssh2_publickey_list_free...
|
||||
d pr extproc(
|
||||
d 'libssh2_publickey_list_free')
|
||||
d pkey * value LIBSSH2_PUBLICKEY *
|
||||
d pkey_list likeds(libssh2_publickey_list)
|
||||
|
||||
d libssh2_publickey_shutdown...
|
||||
d pr extproc('libssh2_publickey_shutdown')
|
||||
d like(libssh2_Cint)
|
||||
d pkey * value LIBSSH2_PUBLICKEY *
|
||||
|
||||
/endif LIBSSH2_PUBLICKEY_H_
|
||||
644
vendor/libssh2/os400/libssh2rpg/libssh2_sftp.rpgle
vendored
Normal file
644
vendor/libssh2/os400/libssh2rpg/libssh2_sftp.rpgle
vendored
Normal file
@@ -0,0 +1,644 @@
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/if not defined(LIBSSH2_SFTP_H_)
|
||||
/define LIBSSH2_SFTP_H_
|
||||
|
||||
/include "libssh2rpg/libssh2"
|
||||
|
||||
* Note: Version 6 was documented at the time of writing
|
||||
* However it was marked as "DO NOT IMPLEMENT" due to pending changes
|
||||
*
|
||||
* Let's start with Version 3 (The version found in OpenSSH) and go from
|
||||
* there.
|
||||
d LIBSSH2_SFTP_VERSION...
|
||||
d c 3
|
||||
|
||||
* Flags for open_ex().
|
||||
d LIBSSH2_SFTP_OPENFILE...
|
||||
d c 0
|
||||
d LIBSSH2_SFTP_OPENDIR...
|
||||
d c 1
|
||||
|
||||
* Flags for rename_ex().
|
||||
d LIBSSH2_SFTP_RENAME_OVERWRITE...
|
||||
d c X'00000001'
|
||||
d LIBSSH2_SFTP_RENAME_ATOMIC...
|
||||
d c X'00000002'
|
||||
d LIBSSH2_SFTP_RENAME_NATIVE...
|
||||
d c X'00000004'
|
||||
|
||||
* Flags for stat_ex().
|
||||
d LIBSSH2_SFTP_STAT...
|
||||
d c 0
|
||||
d LIBSSH2_SFTP_LSTAT...
|
||||
d c 1
|
||||
d LIBSSH2_SFTP_SETSTAT...
|
||||
d c 2
|
||||
|
||||
* Flags for symlink_ex().
|
||||
d LIBSSH2_SFTP_SYMLINK...
|
||||
d c 0
|
||||
d LIBSSH2_SFTP_READLINK...
|
||||
d c 1
|
||||
d LIBSSH2_SFTP_REALPATH...
|
||||
d c 2
|
||||
|
||||
* Flags for sftp_mkdir()
|
||||
d LIBSSH2_SFTP_DEFAULT_MODE...
|
||||
d c -1
|
||||
|
||||
* SFTP attribute flag bits.
|
||||
d LIBSSH2_SFTP_ATTR_SIZE...
|
||||
d c X'00000001'
|
||||
d LIBSSH2_SFTP_ATTR_UIDGID...
|
||||
d c X'00000002'
|
||||
d LIBSSH2_SFTP_ATTR_PERMISSIONS...
|
||||
d c X'00000004'
|
||||
d LIBSSH2_SFTP_ATTR_ACMODTIME...
|
||||
d c X'00000008'
|
||||
d LIBSSH2_SFTP_ATTR_EXTENDED...
|
||||
d c X'80000000'
|
||||
|
||||
* SFTP statvfs flag bits.
|
||||
d LIBSSH2_SFTP_ST_RDONLY...
|
||||
d c X'00000001'
|
||||
d LIBSSH2_SFTP_ST_NOSUID...
|
||||
d c X'00000002'
|
||||
|
||||
d LIBSSH2_SFTP_ATTRIBUTES...
|
||||
d ds based(######typedef######)
|
||||
d align qualified
|
||||
* If flags & ATTR_* bit is set, then the value in this struct will be
|
||||
* meaningful Otherwise it should be ignored.
|
||||
d flags like(libssh2_Culong)
|
||||
d filesize like(libssh2_uint64_t)
|
||||
d uid like(libssh2_Culong)
|
||||
d gid like(libssh2_Culong)
|
||||
d permissions like(libssh2_Culong)
|
||||
d atime like(libssh2_Culong)
|
||||
d mtime like(libssh2_Culong)
|
||||
|
||||
d #LIBSSH2_SFTP_STATVFS...
|
||||
d ds based(######typedef######)
|
||||
d align qualified
|
||||
d f_bsize like(libssh2_uint64_t) Filesys block size
|
||||
d f_frsize like(libssh2_uint64_t) Fragment size
|
||||
d f_blocks like(libssh2_uint64_t) FS size in f_frsize
|
||||
d f_bfree like(libssh2_uint64_t) Free blocks
|
||||
d f_bavail like(libssh2_uint64_t) Free blks f. nonroot
|
||||
d f_files like(libssh2_uint64_t) Inodes
|
||||
d f_ffree like(libssh2_uint64_t) Free inodes
|
||||
d f_favail like(libssh2_uint64_t) Free inds f. nonroot
|
||||
d f_fsid like(libssh2_uint64_t) File system ID
|
||||
d f_flag like(libssh2_uint64_t) Mount flags
|
||||
d f_namemax like(libssh2_uint64_t) Max filename length
|
||||
|
||||
* SFTP filetypes.
|
||||
d LIBSSH2_SFTP_TYPE_REGULAR...
|
||||
d c 1
|
||||
d LIBSSH2_SFTP_TYPE_DIRECTORY...
|
||||
d c 2
|
||||
d LIBSSH2_SFTP_TYPE_SYMLINK...
|
||||
d c 3
|
||||
d LIBSSH2_SFTP_TYPE_SPECIAL...
|
||||
d c 4
|
||||
d LIBSSH2_SFTP_TYPE_UNKNOWN...
|
||||
d c 5
|
||||
d LIBSSH2_SFTP_TYPE_SOCKET...
|
||||
d c 6
|
||||
d LIBSSH2_SFTP_TYPE_CHAR_DEVICE...
|
||||
d c 7
|
||||
d LIBSSH2_SFTP_TYPE_BLOCK_DEVICE...
|
||||
d c 8
|
||||
d LIBSSH2_SFTP_TYPE_FIFO...
|
||||
d c 9
|
||||
|
||||
* Reproduce the POSIX file modes here for systems that are not POSIX
|
||||
* compliant.
|
||||
*
|
||||
* These is used in "permissions" of "struct _LIBSSH2_SFTP_ATTRIBUTES"
|
||||
|
||||
* File type.
|
||||
d LIBSSH2_SFTP_S_IFMT... type of file mask
|
||||
d c X'F000'
|
||||
d LIBSSH2_SFTP_S_IFIFO... named pipe (fifo)
|
||||
d c X'1000'
|
||||
d LIBSSH2_SFTP_S_IFCHR... character special
|
||||
d c X'2000'
|
||||
d LIBSSH2_SFTP_S_IFDIR... directory
|
||||
d c X'4000'
|
||||
d LIBSSH2_SFTP_S_IFBLK... block special
|
||||
d c X'6000'
|
||||
d LIBSSH2_SFTP_S_IFREG... regular
|
||||
d c X'8000'
|
||||
d LIBSSH2_SFTP_S_IFLNK... symbolic link
|
||||
d c X'A000'
|
||||
d LIBSSH2_SFTP_S_IFSOCK... socket
|
||||
d c X'C000'
|
||||
|
||||
* File mode.
|
||||
* Read, write, execute/search by owner.
|
||||
d LIBSSH2_SFTP_S_IRWXU... RWX mask for owner
|
||||
d c X'01C0'
|
||||
d LIBSSH2_SFTP_S_IRUSR... R for owner
|
||||
d c X'0100'
|
||||
d LIBSSH2_SFTP_S_IWUSR... W for owner
|
||||
d c X'0080'
|
||||
d LIBSSH2_SFTP_S_IXUSR... X for owner
|
||||
d c X'0040'
|
||||
* Read, write, execute/search by group.
|
||||
d LIBSSH2_SFTP_S_IRWXG... RWX mask for group
|
||||
d c X'0038'
|
||||
d LIBSSH2_SFTP_S_IRGRP... R for group
|
||||
d c X'0020'
|
||||
d LIBSSH2_SFTP_S_IWGRP... W for group
|
||||
d c X'0010'
|
||||
d LIBSSH2_SFTP_S_IXGRP... X for group
|
||||
d c X'0008'
|
||||
* Read, write, execute/search by others.
|
||||
d LIBSSH2_SFTP_S_IRWXO... RWX mask for other
|
||||
d c X'0007'
|
||||
d LIBSSH2_SFTP_S_IROTH... R for other
|
||||
d c X'0004'
|
||||
d LIBSSH2_SFTP_S_IWOTH... W for other
|
||||
d c X'0002'
|
||||
d LIBSSH2_SFTP_S_IXOTH... X for other
|
||||
d c X'0001'
|
||||
|
||||
* C macro implementation.
|
||||
d LIBSSH2_SFTP_S_ISLNK...
|
||||
d pr extproc('LIBSSH2_SFTP_S_ISLNK')
|
||||
d like(libssh2_Cint)
|
||||
d permissions value like(libssh2_Culong)
|
||||
|
||||
* C macro implementation.
|
||||
d LIBSSH2_SFTP_S_ISREG...
|
||||
d pr extproc('LIBSSH2_SFTP_S_ISREG')
|
||||
d like(libssh2_Cint)
|
||||
d permissions value like(libssh2_Culong)
|
||||
|
||||
* C macro implementation.
|
||||
d LIBSSH2_SFTP_S_ISDIR...
|
||||
d pr extproc('LIBSSH2_SFTP_S_ISDIR')
|
||||
d like(libssh2_Cint)
|
||||
d permissions value like(libssh2_Culong)
|
||||
|
||||
* C macro implementation.
|
||||
d LIBSSH2_SFTP_S_ISCHR...
|
||||
d pr extproc('LIBSSH2_SFTP_S_ISCHR')
|
||||
d like(libssh2_Cint)
|
||||
d permissions value like(libssh2_Culong)
|
||||
|
||||
* C macro implementation.
|
||||
d LIBSSH2_SFTP_S_ISBLK...
|
||||
d pr extproc('LIBSSH2_SFTP_S_ISBLK')
|
||||
d like(libssh2_Cint)
|
||||
d permissions value like(libssh2_Culong)
|
||||
|
||||
* C macro implementation.
|
||||
d LIBSSH2_SFTP_S_ISFIFO...
|
||||
d pr extproc('LIBSSH2_SFTP_S_ISFIFO')
|
||||
d like(libssh2_Cint)
|
||||
d permissions value like(libssh2_Culong)
|
||||
|
||||
* C macro implementation.
|
||||
d LIBSSH2_SFTP_S_ISSOCK...
|
||||
d pr extproc('LIBSSH2_SFTP_S_ISSOCK')
|
||||
d like(libssh2_Cint)
|
||||
d permissions value like(libssh2_Culong)
|
||||
|
||||
* SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open())
|
||||
* Danger will robinson... APPEND doesn't have any effect on OpenSSH
|
||||
* servers.
|
||||
d LIBSSH2_FXF_READ...
|
||||
d c X'00000001'
|
||||
d LIBSSH2_FXF_WRITE...
|
||||
d c X'00000002'
|
||||
d LIBSSH2_FXF_APPEND...
|
||||
d c X'00000004'
|
||||
d LIBSSH2_FXF_CREAT...
|
||||
d c X'00000008'
|
||||
d LIBSSH2_FXF_TRUNC...
|
||||
d c X'00000010'
|
||||
d LIBSSH2_FXF_EXCL...
|
||||
d c X'00000020'
|
||||
|
||||
* SFTP Status Codes (returned by libssh2_sftp_last_error()).
|
||||
d LIBSSH2_FX_OK...
|
||||
d c 0
|
||||
d LIBSSH2_FX_EOF...
|
||||
d c 1
|
||||
d LIBSSH2_FX_NO_SUCH_FILE...
|
||||
d c 2
|
||||
d LIBSSH2_FX_PERMISSION_DENIED...
|
||||
d c 3
|
||||
d LIBSSH2_FX_FAILURE...
|
||||
d c 4
|
||||
d LIBSSH2_FX_BAD_MESSAGE...
|
||||
d c 5
|
||||
d LIBSSH2_FX_NO_CONNECTION...
|
||||
d c 6
|
||||
d LIBSSH2_FX_CONNECTION_LOST...
|
||||
d c 7
|
||||
d LIBSSH2_FX_OP_UNSUPPORTED...
|
||||
d c 8
|
||||
d LIBSSH2_FX_INVALID_HANDLE...
|
||||
d c 9
|
||||
d LIBSSH2_FX_NO_SUCH_PATH...
|
||||
d c 10
|
||||
d LIBSSH2_FX_FILE_ALREADY_EXISTS...
|
||||
d c 11
|
||||
d LIBSSH2_FX_WRITE_PROTECT...
|
||||
d c 12
|
||||
d LIBSSH2_FX_NO_MEDIA...
|
||||
d c 13
|
||||
d LIBSSH2_FX_NO_SPACE_ON_FILESYSTEM...
|
||||
d c 14
|
||||
d LIBSSH2_FX_QUOTA_EXCEEDED...
|
||||
d c 15
|
||||
d LIBSSH2_FX_UNKNOWN_PRINCIPAL...
|
||||
d c 16
|
||||
d LIBSSH2_FX_LOCK_CONFLICT...
|
||||
d c 17
|
||||
d LIBSSH2_FX_DIR_NOT_EMPTY...
|
||||
d c 18
|
||||
d LIBSSH2_FX_NOT_A_DIRECTORY...
|
||||
d c 19
|
||||
d LIBSSH2_FX_INVALID_FILENAME...
|
||||
d c 20
|
||||
d LIBSSH2_FX_LINK_LOOP...
|
||||
d c 21
|
||||
|
||||
* Returned by any function that would block during a read/write operation.
|
||||
d LIBSSH2SFTP_EAGAIN...
|
||||
d c -37
|
||||
|
||||
* SFTP API.
|
||||
d libssh2_sftp_init...
|
||||
d pr * extproc('libssh2_sftp_init') LIBSSH2_SFTP *
|
||||
d session * value LIBSSH2_SESSION *
|
||||
|
||||
d libssh2_sftp_shutdown...
|
||||
d pr extproc('libssh2_sftp_shutdown')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
|
||||
d libssh2_sftp_last_error...
|
||||
d pr extproc('libssh2_sftp_last_error')
|
||||
d like(libssh2_Culong)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
|
||||
d libssh2_sftp_get_channel...
|
||||
d pr * extproc('libssh2_sftp_get_channel') LIBSSH2_CHANNEL *
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
|
||||
* File / Directory Ops.
|
||||
d libssh2_sftp_open_ex...
|
||||
d pr * extproc('libssh2_sftp_open_ex') LIBSSH2_SFTP_HANDLE*
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d filename * value options(*string) const char *
|
||||
d filename_len value like(libssh2_Cuint)
|
||||
d flags value like(libssh2_Culong)
|
||||
d mode value like(libssh2_Clong)
|
||||
d open_type value like(libssh2_Cint)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_open...
|
||||
d pr * extproc('libssh2_sftp_open') LIBSSH2_SFTP_HANDLE*
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d filename * value options(*string) const char *
|
||||
d flags value like(libssh2_Culong)
|
||||
d mode value like(libssh2_Clong)
|
||||
|
||||
* C macro libssh2_sftp_opendir implementation.
|
||||
* Renamed to avoid upper/lower case name clash.
|
||||
d libssh2_sftp_open_dir...
|
||||
d pr * extproc('libssh2_sftp_opendir') LIBSSH2_SFTP_HANDLE*
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
|
||||
d libssh2_sftp_open_ex_r...
|
||||
d pr * extproc('libssh2_sftp_open_ex_r') LIBSSH2_SFTP_HANDLE*
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d filename * value options(*string) const char *
|
||||
d filename_len value like(libssh2_Csize_t)
|
||||
d flags value like(libssh2_Culong)
|
||||
d mode value like(libssh2_Clong)
|
||||
d open_type value like(libssh2_Cint)
|
||||
d attrs likeds(LIBSSH2_SFTP_ATTRIBUTES)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_open_r...
|
||||
d pr * extproc('libssh2_sftp_open_r') LIBSSH2_SFTP_HANDLE*
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d filename * value options(*string) const char *
|
||||
d flags value like(libssh2_Culong)
|
||||
d mode value like(libssh2_Clong)
|
||||
d attrs likeds(LIBSSH2_SFTP_ATTRIBUTES)
|
||||
|
||||
d libssh2_sftp_read...
|
||||
d pr extproc('libssh2_sftp_read')
|
||||
d like(libssh2_Cssize_t)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d buffer * value char *
|
||||
d buffer_maxlen value like(libssh2_Csize_t)
|
||||
|
||||
d libssh2_sftp_readdir_ex...
|
||||
d pr extproc('libssh2_sftp_readdir_ex')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d buffer * value char *
|
||||
d buffer_maxlen value like(libssh2_Csize_t)
|
||||
d longentry * value char *
|
||||
d longentry_maxlen...
|
||||
d value like(libssh2_Csize_t)
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_readdir...
|
||||
d pr extproc('libssh2_sftp_readdir')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d buffer * value char *
|
||||
d buffer_maxlen value like(libssh2_Csize_t)
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
|
||||
d libssh2_sftp_write...
|
||||
d pr extproc('libssh2_sftp_write')
|
||||
d like(libssh2_Cssize_t)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d buffer * value options(*string) const char *
|
||||
d count value like(libssh2_Csize_t)
|
||||
|
||||
d libssh2_sftp_fsync...
|
||||
d pr extproc('libssh2_sftp_fsync')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
|
||||
d libssh2_sftp_close_handle...
|
||||
d pr extproc('libssh2_sftp_close_handle')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_close...
|
||||
d pr extproc('libssh2_sftp_close_handle')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_closedir...
|
||||
d pr extproc('libssh2_sftp_close_handle')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
|
||||
d libssh2_sftp_seek...
|
||||
d pr extproc('libssh2_sftp_seek')
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d offset value like(libssh2_Csize_t)
|
||||
|
||||
d libssh2_sftp_seek64...
|
||||
d pr extproc('libssh2_sftp_seek64')
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d offset value like(libssh2_uint64_t)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_rewind...
|
||||
d pr extproc('libssh2_sftp_rewind')
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
|
||||
d libssh2_sftp_tell...
|
||||
d pr extproc('libssh2_sftp_tell')
|
||||
d like(libssh2_Csize_t)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
|
||||
d libssh2_sftp_tell64...
|
||||
d pr extproc('libssh2_sftp_tell64')
|
||||
d like(libssh2_uint64_t)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
|
||||
d libssh2_sftp_fstat_ex...
|
||||
d pr extproc('libssh2_sftp_fstat_ex')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
d setstat value like(libssh2_Cint)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_fstat...
|
||||
d pr extproc('libssh2_sftp_fstat')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_fsetstat...
|
||||
d pr extproc('libssh2_sftp_fsetstat')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
|
||||
* Miscellaneous Ops.
|
||||
d libssh2_sftp_rename_ex...
|
||||
d pr extproc('libssh2_sftp_rename_ex')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d source_filename...
|
||||
d * value options(*string) const char *
|
||||
d source_filename_len...
|
||||
d value like(libssh2_Cuint)
|
||||
d dest_filename * value options(*string) const char *
|
||||
d dest_filename_len...
|
||||
d value like(libssh2_Cuint)
|
||||
d flags value like(libssh2_Clong)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_rename...
|
||||
d pr extproc('libssh2_sftp_rename')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d source_filename...
|
||||
d * value options(*string) const char *
|
||||
d dest_filename * value options(*string) const char *
|
||||
|
||||
d libssh2_sftp_unlink_ex...
|
||||
d pr extproc('libssh2_sftp_unlink_ex')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d filename * value options(*string) const char *
|
||||
d filename_len value like(libssh2_Cuint)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_unlink...
|
||||
d pr extproc('libssh2_sftp_unlink')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d filename * value options(*string) const char *
|
||||
|
||||
d libssh2_sftp_fstatvfs...
|
||||
d pr extproc('libssh2_sftp_fstatvfs')
|
||||
d like(libssh2_Cint)
|
||||
d handle * value LIBSSH2_SFTP_HANDLE*
|
||||
d st * value LIBSSH2_SFTP_STATVFS
|
||||
d *
|
||||
|
||||
d libssh2_sftp_statvfs...
|
||||
d pr extproc('libssh2_sftp_statvfs')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d path_len value like(libssh2_Csize_t)
|
||||
d st * value LIBSSH2_SFTP_STATVFS
|
||||
d *
|
||||
|
||||
d libssh2_sftp_mkdir_ex...
|
||||
d pr extproc('libssh2_sftp_mkdir_ex')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d path_len value like(libssh2_Cuint)
|
||||
d mode value like(libssh2_Clong)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_mkdir...
|
||||
d pr extproc('libssh2_sftp_mkdir')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d mode value like(libssh2_Clong)
|
||||
|
||||
d libssh2_sftp_rmdir_ex...
|
||||
d pr extproc('libssh2_sftp_rmdir_ex')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d path_len value like(libssh2_Cuint)
|
||||
|
||||
* C macro implementation.
|
||||
d libssh2_sftp_rmdir...
|
||||
d pr extproc('libssh2_sftp_rmdir')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
|
||||
d libssh2_sftp_stat_ex...
|
||||
d pr extproc('libssh2_sftp_stat_ex')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d path_len value like(libssh2_Cuint)
|
||||
d stat_type value like(libssh2_Cint)
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
|
||||
* C macro libssh2_sftp_stat implementation.
|
||||
* Renamed to avoid upper/lower case name clash.
|
||||
d libssh2_sftp_get_stat...
|
||||
d pr extproc('libssh2_sftp_stat')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
|
||||
* C macro libssh2_sftp_lstat implementation.
|
||||
* Renamed to avoid upper/lower case name clash.
|
||||
d libssh2_sftp_get_lstat...
|
||||
d pr extproc('libssh2_sftp_lstat')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
|
||||
* C macro libssh2_sftp_setstat implementation.
|
||||
* Renamed to avoid upper/lower case name clash.
|
||||
d libssh2_sftp_set_stat...
|
||||
d pr extproc('libssh2_sftp_setstat')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d attrs * value LIBSSH2_SFTP_...
|
||||
d ATTRIBUTES *
|
||||
|
||||
d libssh2_sftp_symlink_ex...
|
||||
d pr extproc('libssh2_sftp_symlink_ex')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d path_len value like(libssh2_Cuint)
|
||||
d target * value options(*string) char *
|
||||
d target_len value like(libssh2_Cuint)
|
||||
d link_type value like(libssh2_Cint)
|
||||
|
||||
* C macro libssh2_sftp_symlink implementation.
|
||||
* Renamed to avoid upper/lower case name clash.
|
||||
d libssh2_sftp_sym_link...
|
||||
d pr extproc('libssh2_sftp_symlink')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d orig * value options(*string) const char *
|
||||
d linkpath * value options(*string) char *
|
||||
|
||||
* C macro libssh2_sftp_readlink implementation.
|
||||
* Renamed to avoid upper/lower case name clash.
|
||||
d libssh2_sftp_read_link...
|
||||
d pr extproc('libssh2_sftp_readlink')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d target * value char *
|
||||
d maxlen value like(libssh2_Cuint)
|
||||
|
||||
* C macro libssh2_sftp_realpath implementation.
|
||||
* Renamed to avoid upper/lower case name clash.
|
||||
d libssh2_sftp_real_path...
|
||||
d pr extproc('libssh2_sftp_realpath')
|
||||
d like(libssh2_Cint)
|
||||
d sftp * value LIBSSH2_SFTP *
|
||||
d path * value options(*string) const char *
|
||||
d target * value char *
|
||||
d maxlen value like(libssh2_Cuint)
|
||||
|
||||
/endif LIBSSH2_SFTP_H_
|
||||
180
vendor/libssh2/os400/macros.h
vendored
Normal file
180
vendor/libssh2/os400/macros.h
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef LIBSSH2_MACROS_H_
|
||||
#define LIBSSH2_MACROS_H_
|
||||
|
||||
#include "libssh2.h"
|
||||
#include "libssh2_publickey.h"
|
||||
#include "libssh2_sftp.h"
|
||||
|
||||
/*
|
||||
* Dummy prototypes to generate wrapper procedures to C macros.
|
||||
* This is a helper for languages without a clever preprocessor (ILE/RPG).
|
||||
*/
|
||||
|
||||
LIBSSH2_API LIBSSH2_SESSION * libssh2_session_init(void);
|
||||
LIBSSH2_API int libssh2_session_disconnect(LIBSSH2_SESSION *session,
|
||||
const char *description);
|
||||
LIBSSH2_API int libssh2_userauth_password(LIBSSH2_SESSION *session,
|
||||
const char *username,
|
||||
const char *password);
|
||||
LIBSSH2_API int
|
||||
libssh2_userauth_publickey_fromfile(LIBSSH2_SESSION *session,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
const char *privatekey,
|
||||
const char *passphrase);
|
||||
LIBSSH2_API int
|
||||
libssh2_userauth_hostbased_fromfile(LIBSSH2_SESSION *session,
|
||||
const char *username,
|
||||
const char *publickey,
|
||||
const char *privatekey,
|
||||
const char *passphrase,
|
||||
const char *hostname);
|
||||
LIBSSH2_API int
|
||||
libssh2_userauth_keyboard_interactive(LIBSSH2_SESSION* session,
|
||||
const char *username,
|
||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(
|
||||
(*response_callback)));
|
||||
LIBSSH2_API LIBSSH2_CHANNEL *
|
||||
libssh2_channel_open_session(LIBSSH2_SESSION *session);
|
||||
LIBSSH2_API LIBSSH2_CHANNEL *
|
||||
libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host,
|
||||
int port);
|
||||
LIBSSH2_API LIBSSH2_LISTENER *
|
||||
libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port);
|
||||
LIBSSH2_API int
|
||||
libssh2_channel_setenv(LIBSSH2_CHANNEL *channel,
|
||||
const char *varname, const char *value);
|
||||
LIBSSH2_API int
|
||||
libssh2_channel_request_pty(LIBSSH2_CHANNEL *channel, const char *term);
|
||||
LIBSSH2_API int
|
||||
libssh2_channel_request_pty_size(LIBSSH2_CHANNEL *channel,
|
||||
int width, int height);
|
||||
LIBSSH2_API int
|
||||
libssh2_channel_x11_req(LIBSSH2_CHANNEL *channel, int screen_number);
|
||||
LIBSSH2_API int
|
||||
libssh2_channel_signal(LIBSSH2_CHANNEL *channel, const char *signame);
|
||||
LIBSSH2_API int
|
||||
libssh2_channel_shell(LIBSSH2_CHANNEL *channel);
|
||||
LIBSSH2_API int
|
||||
libssh2_channel_exec(LIBSSH2_CHANNEL *channel, const char *command);
|
||||
LIBSSH2_API int
|
||||
libssh2_channel_subsystem(LIBSSH2_CHANNEL *channel, const char *subsystem);
|
||||
LIBSSH2_API ssize_t
|
||||
libssh2_channel_read(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen);
|
||||
LIBSSH2_API ssize_t
|
||||
libssh2_channel_read_stderr(LIBSSH2_CHANNEL *channel,
|
||||
char *buf, size_t buflen);
|
||||
LIBSSH2_API unsigned long
|
||||
libssh2_channel_window_read(LIBSSH2_CHANNEL *channel);
|
||||
LIBSSH2_API ssize_t
|
||||
libssh2_channel_write(LIBSSH2_CHANNEL *channel,
|
||||
const char *buf, size_t buflen);
|
||||
LIBSSH2_API ssize_t
|
||||
libssh2_channel_write_stderr(LIBSSH2_CHANNEL *channel,
|
||||
const char *buf, size_t buflen);
|
||||
LIBSSH2_API unsigned long
|
||||
libssh2_channel_window_write(LIBSSH2_CHANNEL *channel);
|
||||
LIBSSH2_API void
|
||||
libssh2_channel_ignore_extended_data(LIBSSH2_CHANNEL *channel, int ignore);
|
||||
LIBSSH2_API int libssh2_channel_flush(LIBSSH2_CHANNEL *channel);
|
||||
LIBSSH2_API int libssh2_channel_flush_stderr(LIBSSH2_CHANNEL *channel);
|
||||
LIBSSH2_API LIBSSH2_CHANNEL *
|
||||
libssh2_scp_send(LIBSSH2_SESSION *session,
|
||||
const char *path, int mode, libssh2_int64_t size);
|
||||
|
||||
LIBSSH2_API int
|
||||
libssh2_publickey_add(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name,
|
||||
const unsigned char *blob, unsigned long blob_len,
|
||||
char overwrite, unsigned long num_attrs,
|
||||
const libssh2_publickey_attribute attrs[]);
|
||||
LIBSSH2_API int
|
||||
libssh2_publickey_remove(LIBSSH2_PUBLICKEY *pkey, const unsigned char *name,
|
||||
const unsigned char *blob, unsigned long blob_len);
|
||||
|
||||
LIBSSH2_API int LIBSSH2_SFTP_S_ISLNK(unsigned long permissions);
|
||||
LIBSSH2_API int LIBSSH2_SFTP_S_ISREG(unsigned long permissions);
|
||||
LIBSSH2_API int LIBSSH2_SFTP_S_ISDIR(unsigned long permissions);
|
||||
LIBSSH2_API int LIBSSH2_SFTP_S_ISCHR(unsigned long permissions);
|
||||
LIBSSH2_API int LIBSSH2_SFTP_S_ISBLK(unsigned long permissions);
|
||||
LIBSSH2_API int LIBSSH2_SFTP_S_ISFIFO(unsigned long permissions);
|
||||
LIBSSH2_API int LIBSSH2_SFTP_S_ISSOCK(unsigned long permissions);
|
||||
LIBSSH2_API LIBSSH2_SFTP_HANDLE *
|
||||
libssh2_sftp_open(LIBSSH2_SFTP *sftp, const char *filename,
|
||||
unsigned long flags, long mode);
|
||||
LIBSSH2_API LIBSSH2_SFTP_HANDLE *
|
||||
libssh2_sftp_opendir(LIBSSH2_SFTP *sftp, const char *path);
|
||||
LIBSSH2_API LIBSSH2_SFTP_HANDLE *
|
||||
libssh2_sftp_open_r(LIBSSH2_SFTP *sftp, const char *filename,
|
||||
unsigned long flags, long mode,
|
||||
LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
LIBSSH2_API int libssh2_sftp_readdir(LIBSSH2_SFTP_HANDLE *handle,
|
||||
char *buffer, size_t buffer_maxlen,
|
||||
LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
LIBSSH2_API int libssh2_sftp_close(LIBSSH2_SFTP_HANDLE *handle);
|
||||
LIBSSH2_API int libssh2_sftp_closedir(LIBSSH2_SFTP_HANDLE *handle);
|
||||
LIBSSH2_API void libssh2_sftp_rewind(LIBSSH2_SFTP_HANDLE *handle);
|
||||
LIBSSH2_API int libssh2_sftp_fstat(LIBSSH2_SFTP_HANDLE *handle,
|
||||
LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
LIBSSH2_API int libssh2_sftp_fsetstat(LIBSSH2_SFTP_HANDLE *handle,
|
||||
LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
LIBSSH2_API int libssh2_sftp_rename(LIBSSH2_SFTP *sftp,
|
||||
const char *source_filename,
|
||||
const char *dest_filename);
|
||||
LIBSSH2_API int libssh2_sftp_unlink(LIBSSH2_SFTP *sftp, const char *filename);
|
||||
LIBSSH2_API int libssh2_sftp_mkdir(LIBSSH2_SFTP *sftp,
|
||||
const char *path, long mode);
|
||||
LIBSSH2_API int libssh2_sftp_rmdir(LIBSSH2_SFTP *sftp, const char *path);
|
||||
LIBSSH2_API int libssh2_sftp_stat(LIBSSH2_SFTP *sftp, const char *path,
|
||||
LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
LIBSSH2_API int libssh2_sftp_lstat(LIBSSH2_SFTP *sftp, const char *path,
|
||||
LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
LIBSSH2_API int libssh2_sftp_setstat(LIBSSH2_SFTP *sftp, const char *path,
|
||||
LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||
LIBSSH2_API int libssh2_sftp_symlink(LIBSSH2_SFTP *sftp, const char *orig,
|
||||
char *linkpath);
|
||||
LIBSSH2_API int libssh2_sftp_readlink(LIBSSH2_SFTP *sftp, const char *path,
|
||||
char *target, unsigned int maxlen);
|
||||
LIBSSH2_API int libssh2_sftp_realpath(LIBSSH2_SFTP *sftp, const char *path,
|
||||
char *target, unsigned int maxlen);
|
||||
|
||||
#endif
|
||||
58
vendor/libssh2/os400/make-include.sh
vendored
Executable file
58
vendor/libssh2/os400/make-include.sh
vendored
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Installation of the header files in the OS/400 library.
|
||||
#
|
||||
|
||||
SCRIPTDIR=$(dirname "${0}")
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/include" || exit 1
|
||||
|
||||
|
||||
# Create the OS/400 source program file for the header files.
|
||||
|
||||
SRCPF="${LIBIFSNAME}/H.FILE"
|
||||
|
||||
if action_needed "${SRCPF}"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/H) RCDLEN(112)"
|
||||
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libssh2: Header files')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Create the IFS directory for the header files.
|
||||
|
||||
IFSINCLUDE="${IFSDIR}/include"
|
||||
|
||||
if action_needed "${IFSINCLUDE}"
|
||||
then mkdir -p "${IFSINCLUDE}"
|
||||
fi
|
||||
|
||||
|
||||
copy_hfile()
|
||||
|
||||
{
|
||||
destfile="${1}"
|
||||
srcfile="${2}"
|
||||
shift
|
||||
shift
|
||||
sed -e '1i\
|
||||
#pragma datamodel(P128)\
|
||||
' "${@}" -e '$a\
|
||||
#pragma datamodel(pop)\
|
||||
' < "${srcfile}" > "${destfile}"
|
||||
}
|
||||
|
||||
# Copy the header files.
|
||||
|
||||
for HFILE in *.h "${TOPDIR}/os400/libssh2_ccsid.h"
|
||||
do DEST="${SRCPF}/$(db2_name "${HFILE}").MBR"
|
||||
|
||||
if action_needed "${DEST}" "${HFILE}"
|
||||
then copy_hfile "${DEST}" "${HFILE}"
|
||||
IFSDEST="${IFSINCLUDE}/$(basename "${HFILE}")"
|
||||
rm -f "${IFSDEST}"
|
||||
ln -s "${DEST}" "${IFSDEST}"
|
||||
fi
|
||||
done
|
||||
94
vendor/libssh2/os400/make-rpg.sh
vendored
Executable file
94
vendor/libssh2/os400/make-rpg.sh
vendored
Executable file
@@ -0,0 +1,94 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# Installation of the ILE/RPG header files in the OS/400 library.
|
||||
#
|
||||
|
||||
SCRIPTDIR=$(dirname "${0}")
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/os400/libssh2rpg" || exit 1
|
||||
|
||||
|
||||
# Create the OS/400 source program file for the ILE/RPG header files.
|
||||
|
||||
SRCPF="${LIBIFSNAME}/LIBSSH2RPG.FILE"
|
||||
|
||||
if action_needed "${SRCPF}"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBSSH2RPG) RCDLEN(112)"
|
||||
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libssh2: ILE/RPG header files')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Map file names to DB2 name syntax.
|
||||
|
||||
for HFILE in *.rpgle *.rpgle.in
|
||||
do NAME="$(basename "${HFILE}" .in)"
|
||||
VAR="$(basename "${NAME}" .rpgle)"
|
||||
VAL="$(db2_name "${NAME}")"
|
||||
|
||||
eval "VAR_${VAR}=\"${VAL}\""
|
||||
echo "${VAR} s/${VAR}/${VAL}/g"
|
||||
done > tmpsubstfile1
|
||||
|
||||
# Order substitution commands so that a prefix appears after all
|
||||
# file names beginning with the prefix.
|
||||
|
||||
sort -r tmpsubstfile1 | sed 's/^[^ ]*[ ]*//' > tmpsubstfile2
|
||||
|
||||
|
||||
change_include()
|
||||
|
||||
{
|
||||
sed -e '\#^....../include *"libssh2rpg/#{' \
|
||||
-e 's///' \
|
||||
-e 's/".*//' \
|
||||
-f tmpsubstfile2 \
|
||||
-e 's#.*# /include libssh2rpg,&#' \
|
||||
-e '}'
|
||||
}
|
||||
|
||||
|
||||
# Create the IFS directory for the ILE/RPG header files.
|
||||
|
||||
RPGIFSDIR="${IFSDIR}/include/libssh2rpg"
|
||||
|
||||
if action_needed "${RPGIFSDIR}"
|
||||
then mkdir -p "${RPGIFSDIR}"
|
||||
fi
|
||||
|
||||
# Copy the header files to IFS ILE/RPG include directory.
|
||||
# Copy them with include path editing to the DB2 library.
|
||||
|
||||
for HFILE in *.rpgle *.rpgle.in
|
||||
do IFSCMD="cat \"${HFILE}\""
|
||||
DB2CMD="change_include < \"${HFILE}\""
|
||||
IFSFILE="$(basename "${HFILE}" .in)"
|
||||
|
||||
case "${HFILE}" in
|
||||
|
||||
*.in) IFSCMD="${IFSCMD} | versioned_copy"
|
||||
DB2CMD="${DB2CMD} | versioned_copy"
|
||||
;;
|
||||
esac
|
||||
|
||||
IFSDEST="${RPGIFSDIR}/${IFSFILE}"
|
||||
|
||||
if action_needed "${IFSDEST}" "${HFILE}"
|
||||
then eval "${IFSCMD}" > "${IFSDEST}"
|
||||
fi
|
||||
|
||||
eval DB2MBR="\"\${VAR_$(basename "${IFSDEST}" .rpgle)}\""
|
||||
DB2DEST="${SRCPF}/${DB2MBR}.MBR"
|
||||
|
||||
if action_needed "${DB2DEST}" "${HFILE}"
|
||||
then eval "${DB2CMD}" | change_include > tmphdrfile
|
||||
|
||||
# Need to translate to target CCSID.
|
||||
|
||||
CMD="CPY OBJ('$(pwd)/tmphdrfile') TOOBJ('${DB2DEST}')"
|
||||
CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
|
||||
system "${CMD}"
|
||||
fi
|
||||
done
|
||||
212
vendor/libssh2/os400/make-src.sh
vendored
Executable file
212
vendor/libssh2/os400/make-src.sh
vendored
Executable file
@@ -0,0 +1,212 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# libssh2 compilation script for the OS/400.
|
||||
#
|
||||
|
||||
SCRIPTDIR=$(dirname "${0}")
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}/src" || exit 1
|
||||
|
||||
|
||||
# Function to extract external prototypes from header files.
|
||||
# Input: concatenated header files.
|
||||
# Output: external prototypes, one per (long) line.
|
||||
|
||||
extproto()
|
||||
{
|
||||
sed -e 'x;G;s/^\n//;s/\n/ /g' \
|
||||
-e 's#[[:space:]]*/\*[^*]*\(\*\([^/*][^*]*\)\{0,1\}\)*\*/[[:space:]]*##g' \
|
||||
-e 'h' \
|
||||
-e '/\/\*/!{' \
|
||||
-e '/^#/{s/^.*[^\\]$//;h;d' \
|
||||
-e '}' \
|
||||
-e 's/[{}]/;/g;s/\\$//' \
|
||||
-e ':loop1' \
|
||||
-e '/;/{' \
|
||||
-e 's/^[^;]*;//;x;s/;.*//' \
|
||||
-e '/^[[:space:]]*LIBSSH2_API[[:space:]].*(/{' \
|
||||
-e 's/^[[:space:]]*LIBSSH2_API[[:space:]]*//' \
|
||||
-e 's/[[:space:]]*$//' \
|
||||
-e 's/[[:space:]][[:space:]]*/ /g' \
|
||||
-e 'p' \
|
||||
-e '}' \
|
||||
-e 'g;bloop1' \
|
||||
-e '}' \
|
||||
-e '}' \
|
||||
-n
|
||||
}
|
||||
|
||||
# Need to have IFS access to the mih/modasa header file.
|
||||
|
||||
if action_needed modasa.mih '/QSYS.LIB/QSYSINC.LIB/MIH.FILE/MODASA.MBR'
|
||||
then rm -f modasa.mih
|
||||
ln -s '/QSYS.LIB/QSYSINC.LIB/MIH.FILE/MODASA.MBR' modasa.mih
|
||||
fi
|
||||
|
||||
|
||||
# Create and compile the identification source file.
|
||||
|
||||
{
|
||||
echo '#pragma comment(user, "libssh2 version '"${LIBSSH2_VERSION}"'")'
|
||||
echo '#pragma comment(user, __DATE__)'
|
||||
echo '#pragma comment(user, __TIME__)'
|
||||
echo '#pragma comment(copyright, "See COPYING file. OS/400 version by P. Monnerat")'
|
||||
} > os400.c
|
||||
make_module OS400 os400.c
|
||||
LINK= # No need to rebuild service program yet.
|
||||
MODULES=
|
||||
|
||||
|
||||
# Generate the procedures implementing macros.
|
||||
|
||||
if action_needed macros.c "${TOPDIR}/os400/macros.h"
|
||||
then (
|
||||
echo '#include "libssh2_publickey.h"'
|
||||
echo '#include "libssh2_sftp.h"'
|
||||
extproto < "${TOPDIR}/os400/macros.h" |
|
||||
sed -e 'h;s/^[^(]*[ *]\([^ (]*\) *(.*/\1/' \
|
||||
-e 's/.*/#pragma map(_&, "&")/;p' \
|
||||
-e 'g;s/^\([^(]*[ *]\)\([^ (]*\)\( *(.*\)/\1_\2\3 {/;p' \
|
||||
-e 'g;s/^[^(]*(\(.*\))$/,\1,/;s/[^A-Za-z0-9_,]/ /g' \
|
||||
-e 's/ *,/,/g;s/,[^,]* \([^ ,]*\)/,\1/g' \
|
||||
-e 's/ //g;s/^,void,$/,,/' \
|
||||
-e 's/^,\(.*\),$/(\1); }/;s/,/, /g' \
|
||||
-e 'x;s/(.*//;s/ *$//;G;s/\n//g' \
|
||||
-e 's/^void\([ *]\)/\1/;s/^ *//' \
|
||||
-e 's/^[^(]*[ *]\([A-Za-z][A-Za-z0-9_]* *(\)/return \1/' \
|
||||
-e 's/.*/ &/'
|
||||
) > macros.c
|
||||
fi
|
||||
|
||||
# Get source list.
|
||||
|
||||
sed -e ':begin' \
|
||||
-e '/\\$/{' \
|
||||
-e 's/\\$/ /' \
|
||||
-e 'N' \
|
||||
-e 'bbegin' \
|
||||
-e '}' \
|
||||
-e 's/\n//g' \
|
||||
-e 's/[[:space:]]*$//' \
|
||||
-e 's/^\([A-Za-z][A-Za-z0-9_]*\)[[:space:]]*=[[:space:]]*\(.*\)/\1="\2"/' \
|
||||
-e 's/\$(\([A-Za-z][A-Za-z0-9_]*\))/${\1}/g' \
|
||||
< Makefile.inc > tmpscript.sh
|
||||
. ./tmpscript.sh
|
||||
|
||||
|
||||
# Compile the sources into modules.
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
INCLUDES="'$(pwd)'"
|
||||
|
||||
for SRC in "${TOPDIR}/os400/os400sys.c" "${TOPDIR}/os400/ccsid.c" \
|
||||
${CSOURCES} macros.c
|
||||
do MODULE=$(db2_name "${SRC}")
|
||||
make_module "${MODULE}" "${SRC}"
|
||||
done
|
||||
|
||||
|
||||
# If needed, (re)create the static binding directory.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ -n "${LINK}" ]
|
||||
then rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
|
||||
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} TEXT('libssh2 API static binding directory')"
|
||||
system "${CMD}"
|
||||
|
||||
for MODULE in ${MODULES}
|
||||
do CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
|
||||
system "${CMD}"
|
||||
done
|
||||
|
||||
# V6R1M0 does not list system service program QC3PBEXT in the
|
||||
# implicit binding directory: thus we add it here in ours.
|
||||
|
||||
CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
|
||||
CMD="${CMD} OBJ((QSYS/QC3PBEXT *SRVPGM))"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# The exportation file for service program creation must be in a DB2
|
||||
# source file, so make sure it exists.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/TOOLS.FILE"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
|
||||
CMD="${CMD} TEXT('libssh2: build tools')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Gather the list of symbols to export.
|
||||
|
||||
EXPORTS=$(cat "${TOPDIR}"/include/*.h "${TOPDIR}/os400/macros.h" \
|
||||
"${TOPDIR}/os400/libssh2_ccsid.h" |
|
||||
extproto |
|
||||
sed -e 's/(.*//;s/[^A-Za-z0-9_]/ /g;s/ *$//;s/^.* //')
|
||||
|
||||
# Create the service program exportation file in DB2 member if needed.
|
||||
|
||||
BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
|
||||
|
||||
if action_needed "${BSF}" Makefile.am
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ -n "${LINK}" ]
|
||||
then echo " STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('LIBSSH2_${SONAME}')" \
|
||||
> "${BSF}"
|
||||
for EXPORT in ${EXPORTS}
|
||||
do echo ' EXPORT SYMBOL("'"${EXPORT}"'")' >> "${BSF}"
|
||||
done
|
||||
|
||||
echo ' ENDPGMEXP' >> "${BSF}"
|
||||
fi
|
||||
|
||||
|
||||
# Build the service program if needed.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ -n "${LINK}" ]
|
||||
then CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
|
||||
CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
|
||||
CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
|
||||
CMD="${CMD} BNDDIR(${TARGETLIB}/${STATBNDDIR}"
|
||||
if [ "${WITH_ZLIB}" != 0 ]
|
||||
then CMD="${CMD} ${ZLIB_LIB}/${ZLIB_BNDDIR}"
|
||||
liblist -a "${ZLIB_LIB}"
|
||||
fi
|
||||
CMD="${CMD})"
|
||||
CMD="${CMD} BNDSRVPGM(QADRTTS)"
|
||||
CMD="${CMD} TEXT('libssh2 API library')"
|
||||
CMD="${CMD} TGTRLS(${TGTRLS})"
|
||||
system "${CMD}"
|
||||
LINK=YES
|
||||
fi
|
||||
|
||||
|
||||
# If needed, (re)create the dynamic binding directory.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
||||
then LINK=YES
|
||||
fi
|
||||
|
||||
if [ -n "${LINK}" ]
|
||||
then rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
|
||||
CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
||||
CMD="${CMD} TEXT('libssh2 API dynamic binding directory')"
|
||||
system "${CMD}"
|
||||
CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
|
||||
CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
|
||||
system "${CMD}"
|
||||
fi
|
||||
81
vendor/libssh2/os400/make.sh
vendored
Executable file
81
vendor/libssh2/os400/make.sh
vendored
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) The libssh2 project and its contributors.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
# libssh2 compilation script for the OS/400.
|
||||
#
|
||||
#
|
||||
# This is a shell script since make is not a standard component of OS/400.
|
||||
|
||||
SCRIPTDIR=$(dirname "${0}")
|
||||
. "${SCRIPTDIR}/initscript.sh"
|
||||
cd "${TOPDIR}" || exit 1
|
||||
|
||||
|
||||
# Create the OS/400 library if it does not exist.
|
||||
|
||||
if action_needed "${LIBIFSNAME}"
|
||||
then CMD="CRTLIB LIB(${TARGETLIB}) TEXT('libssh2: SSH2 protocol API')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Create the DOCS source file if it does not exist.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/DOCS.FILE"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/DOCS) RCDLEN(240)"
|
||||
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('Documentation texts')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Copy some documentation files if needed.
|
||||
|
||||
for TEXT in "${TOPDIR}/COPYING" "${SCRIPTDIR}/README400" \
|
||||
"${TOPDIR}/NEWS" "${TOPDIR}/README" "${TOPDIR}/docs/AUTHORS" \
|
||||
"${TOPDIR}/docs/BINDINGS.md"
|
||||
do MEMBER="${LIBIFSNAME}/DOCS.FILE/$(db2_name "${TEXT}").MBR"
|
||||
|
||||
if action_needed "${MEMBER}" "${TEXT}"
|
||||
then CMD="CPY OBJ('${TEXT}') TOOBJ('${MEMBER}') TOCCSID(${TGTCCSID})"
|
||||
CMD="${CMD} DTAFMT(*TEXT) REPLACE(*YES)"
|
||||
system "${CMD}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Create the RPGXAMPLES source file if it does not exist.
|
||||
|
||||
if action_needed "${LIBIFSNAME}/RPGXAMPLES.FILE"
|
||||
then CMD="CRTSRCPF FILE(${TARGETLIB}/RPGXAMPLES) RCDLEN(240)"
|
||||
CMD="${CMD} CCSID(${TGTCCSID}) TEXT('ILE/RPG examples')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
|
||||
|
||||
# Copy RPG examples if needed.
|
||||
|
||||
for EXAMPLE in "${SCRIPTDIR}/rpg-examples"/*
|
||||
do MEMBER="$(basename "${EXAMPLE}")"
|
||||
IFSMEMBER="${LIBIFSNAME}/RPGXAMPLES.FILE/$(db2_name "${MEMBER}").MBR"
|
||||
|
||||
[ -e "${EXAMPLE}" ] || continue
|
||||
|
||||
if action_needed "${IFSMEMBER}" "${EXAMPLE}"
|
||||
then CMD="CPY OBJ('${EXAMPLE}') TOOBJ('${IFSMEMBER}')"
|
||||
CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)"
|
||||
system "${CMD}"
|
||||
MBRTEXT=$(sed -e '1!d;/^ \*/!d;s/^ *\* *//' \
|
||||
-e 's/ *$//;s/'"'"'/&&/g' < "${EXAMPLE}")
|
||||
CMD="CHGPFM FILE(${TARGETLIB}/RPGXAMPLES) MBR(${MEMBER})"
|
||||
CMD="${CMD} SRCTYPE(RPGLE) TEXT('${MBRTEXT}')"
|
||||
system "${CMD}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Build in each directory.
|
||||
|
||||
for SUBDIR in include rpg src
|
||||
do "${SCRIPTDIR}/make-${SUBDIR}.sh"
|
||||
done
|
||||
168
vendor/libssh2/os400/os400sys.c
vendored
Normal file
168
vendor/libssh2/os400/os400sys.c
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (C) Patrick Monnerat <patrick@monnerat.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/* OS/400 additional support. */
|
||||
|
||||
#define LIBSSH2_DISABLE_QADRT_EXT
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <alloca.h>
|
||||
#include <netdb.h>
|
||||
#include <qadrt.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifdef LIBSSH2_HAVE_ZLIB
|
||||
# include <zlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
*** QADRT OS/400 ASCII runtime defines only the most used procedures, but
|
||||
*** a lot of them are not supported. This module implements
|
||||
*** ASCII wrappers for those that are used by libssh2, but not
|
||||
*** defined by QADRT.
|
||||
**/
|
||||
|
||||
#pragma convert(37) /* Restore EBCDIC. */
|
||||
|
||||
|
||||
static int
|
||||
convert_sockaddr(struct sockaddr_storage *dstaddr,
|
||||
const struct sockaddr *srcaddr, int srclen)
|
||||
{
|
||||
const struct sockaddr_un *srcu;
|
||||
struct sockaddr_un *dstu;
|
||||
unsigned int i;
|
||||
unsigned int dstsize;
|
||||
|
||||
/* Convert a socket address into job CCSID, if needed. */
|
||||
|
||||
if(!srcaddr || srclen < offsetof(struct sockaddr, sa_family) +
|
||||
sizeof(srcaddr->sa_family) || srclen > sizeof(*dstaddr)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy((char *) dstaddr, (char *) srcaddr, srclen);
|
||||
|
||||
switch(srcaddr->sa_family) {
|
||||
|
||||
case AF_UNIX:
|
||||
srcu = (const struct sockaddr_un *) srcaddr;
|
||||
dstu = (struct sockaddr_un *) dstaddr;
|
||||
dstsize = sizeof(*dstaddr) - offsetof(struct sockaddr_un, sun_path);
|
||||
srclen -= offsetof(struct sockaddr_un, sun_path);
|
||||
i = QadrtConvertA2E(dstu->sun_path, srcu->sun_path,
|
||||
dstsize - 1, srclen);
|
||||
dstu->sun_path[i] = '\0';
|
||||
i += offsetof(struct sockaddr_un, sun_path);
|
||||
srclen = i;
|
||||
}
|
||||
|
||||
return srclen;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_libssh2_os400_connect(int sd, struct sockaddr *destaddr, int addrlen)
|
||||
{
|
||||
int i;
|
||||
struct sockaddr_storage laddr;
|
||||
|
||||
i = convert_sockaddr(&laddr, destaddr, addrlen);
|
||||
|
||||
if(i < 0)
|
||||
return -1;
|
||||
|
||||
return connect(sd, (struct sockaddr *) &laddr, i);
|
||||
}
|
||||
|
||||
|
||||
#ifdef LIBSSH2_HAVE_ZLIB
|
||||
int
|
||||
_libssh2_os400_inflateInit_(z_streamp strm,
|
||||
const char *version, int stream_size)
|
||||
{
|
||||
char *ebcversion;
|
||||
int i;
|
||||
|
||||
if(!version)
|
||||
return Z_VERSION_ERROR;
|
||||
i = strlen(version);
|
||||
ebcversion = alloca(i + 1);
|
||||
if(!ebcversion)
|
||||
return Z_VERSION_ERROR;
|
||||
i = QadrtConvertA2E(ebcversion, version, i, i - 1);
|
||||
ebcversion[i] = '\0';
|
||||
return inflateInit_(strm, ebcversion, stream_size);
|
||||
}
|
||||
|
||||
int
|
||||
_libssh2_os400_deflateInit_(z_streamp strm, int level,
|
||||
const char *version, int stream_size)
|
||||
{
|
||||
char *ebcversion;
|
||||
int i;
|
||||
|
||||
if(!version)
|
||||
return Z_VERSION_ERROR;
|
||||
i = strlen(version);
|
||||
ebcversion = alloca(i + 1);
|
||||
if(!ebcversion)
|
||||
return Z_VERSION_ERROR;
|
||||
i = QadrtConvertA2E(ebcversion, version, i, i - 1);
|
||||
ebcversion[i] = '\0';
|
||||
return deflateInit_(strm, level, ebcversion, stream_size);
|
||||
}
|
||||
|
||||
#endif
|
||||
326
vendor/libssh2/os400/rpg-examples/SFTPXMPLE
vendored
Normal file
326
vendor/libssh2/os400/rpg-examples/SFTPXMPLE
vendored
Normal file
@@ -0,0 +1,326 @@
|
||||
* Example: print a remote ascii file using sftp
|
||||
*
|
||||
h DFTACTGRP(*NO) ACTGRP(*NEW)
|
||||
h OPTION(*NOSHOWCPY)
|
||||
h BNDDIR('LIBSSH2')
|
||||
h BNDDIR('QC2LE')
|
||||
*
|
||||
* Copyright (C) The libssh2 project and its contributors.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* CALL SFTPXMPLE ('<host>' '<port>' '<user>' '<password>' '<filepath>')
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
fQPRINT o f 120 printer
|
||||
*
|
||||
/include LIBSSH2RPG,SSH2_SFTP
|
||||
/include LIBSSH2RPG,SSH2_CCSID
|
||||
*
|
||||
d pi
|
||||
d host 120
|
||||
d port 5
|
||||
d user 20
|
||||
d password 120
|
||||
d filepath 120
|
||||
*
|
||||
**************************************************************************
|
||||
* External definitions
|
||||
**************************************************************************
|
||||
*
|
||||
d atoi pr 10i 0 extproc('atoi')
|
||||
d numstr * value options(*string)
|
||||
*
|
||||
d inet_addr pr 10u 0 extproc('inet_addr')
|
||||
d char_addr * value options(*string)
|
||||
*
|
||||
d socket pr 10i 0 extproc('socket')
|
||||
d domain 10i 0 value
|
||||
d type 10i 0 value
|
||||
d protocol 10i 0 value
|
||||
*
|
||||
d AF_INET c 2
|
||||
d SOCK_STREAM c 1
|
||||
d IPPROTO_IP c 0
|
||||
*
|
||||
d connect pr 10i 0 extproc('connect')
|
||||
d sockfd 10i 0 value
|
||||
d addr * value
|
||||
d addrlen 10u 0 value
|
||||
*
|
||||
d sockaddr_in ds based(######typedef######)
|
||||
d align qualified
|
||||
d sin_family 5i 0
|
||||
d sin_port 5i 0
|
||||
d sin_addr 10u 0
|
||||
d sin_zero 8
|
||||
*
|
||||
d shutdown pr 10i 0 extproc('shutdown')
|
||||
d socket 10i 0 value
|
||||
d how 10i 0 value
|
||||
*
|
||||
d SHUT_RDWR c 2
|
||||
*
|
||||
d qmhsndpm pr extpgm('QMHSNDPM')
|
||||
d msgid 7 const
|
||||
d qmsgfn 20 const
|
||||
d data 999999 const options(*varsize)
|
||||
d datalength 10u 0 const
|
||||
d msgtype 10 const
|
||||
d csentry 999999 const options(*varsize)
|
||||
d cscounter 10u 0 const
|
||||
d msgkey 4
|
||||
d errcode 999999 options(*varsize)
|
||||
d csentrylen 10u 0 const options(*nopass)
|
||||
d csqual 20 const options(*nopass)
|
||||
d waittime 10u 0 const options(*nopass)
|
||||
d csentrytype 10 const options(*nopass)
|
||||
d ccsid 10u 0 const options(*nopass)
|
||||
*
|
||||
**************************************************************************
|
||||
* Constants
|
||||
**************************************************************************
|
||||
*
|
||||
d EBCDIC_CR c X'0D'
|
||||
d EBCDIC_LF c X'25'
|
||||
*
|
||||
**************************************************************************
|
||||
* Global storage
|
||||
**************************************************************************
|
||||
*
|
||||
d sc s * inz(*NULL) String cache
|
||||
d session s * inz(*NULL) Session
|
||||
d sftp_session s * inz(*NULL) LIBSSH2_SFTP *
|
||||
d sftp_handle s * inz(*NULL) LIBSSH2_SFTP_HANDLE*
|
||||
d sin ds likeds(sockaddr_in) Remote IP address
|
||||
d sock s 10i 0 inz(LIBSSH2_INVALID_SOCKET) Socket descriptor
|
||||
d rc s 10i 0 Result code
|
||||
d hostlen s 10u 0 Host name length
|
||||
*
|
||||
**************************************************************************
|
||||
* Main program
|
||||
**************************************************************************
|
||||
|
||||
// Initialize ssh lbrary
|
||||
rc = libssh2_init(0);
|
||||
if rc <> 0;
|
||||
error('libssh2 initialization failed (' + %trim(%char(rc)) + ')');
|
||||
else;
|
||||
// Build remote address
|
||||
sin.sin_family = AF_INET;
|
||||
hostlen = trimmed_length(host: %len(host): %addr(port));
|
||||
if hostlen <> 0;
|
||||
sin.sin_addr = inet_addr(%subst(host: 1: hostlen));
|
||||
else;
|
||||
sin.sin_addr = inet_addr('127.0.0.1');
|
||||
endif;
|
||||
sin.sin_port = atoi(port);
|
||||
if sin.sin_port <= 0;
|
||||
sin.sin_port = 22;
|
||||
endif;
|
||||
sin.sin_zero = *ALLX'00';
|
||||
|
||||
main();
|
||||
cleanout();
|
||||
endif;
|
||||
|
||||
*inlr = *on;
|
||||
/space 3
|
||||
begsr *pssr;
|
||||
cleanout();
|
||||
endsr;
|
||||
/eject
|
||||
**************************************************************************
|
||||
* Main procedure
|
||||
**************************************************************************
|
||||
*
|
||||
p main b
|
||||
*
|
||||
d buf s 1024 Data buffer
|
||||
d nread s 10i 0 Read bytes count
|
||||
|
||||
// Connect to remote server
|
||||
sock = socket(AF_INET: SOCK_STREAM: IPPROTO_IP);
|
||||
if sock = LIBSSH2_INVALID_SOCKET;
|
||||
error('failed to create socket');
|
||||
return;
|
||||
endif;
|
||||
if connect(sock: %addr(sin): %size(sin)) <> 0;
|
||||
error('failed to connect');
|
||||
return;
|
||||
endif;
|
||||
|
||||
// Create a session instance
|
||||
session = libssh2_session_init();
|
||||
if session = *NULL;
|
||||
error('Could not initialize SSH session');
|
||||
return;
|
||||
endif;
|
||||
|
||||
// Since we have set non-blocking, tell libssh2 we are blocking
|
||||
libssh2_session_set_blocking(session: 1);
|
||||
|
||||
// ... start it up. This will trade welcome banners, exchange keys,
|
||||
// and setup crypto, compression, and MAC layers
|
||||
rc = libssh2_session_handshake(session: sock);
|
||||
if rc <> 0;
|
||||
error('Failure establishing SSH session: ' + %trim(%char(rc)));
|
||||
return;
|
||||
endif;
|
||||
|
||||
// Authenticate
|
||||
if libssh2_userauth_password(session:
|
||||
libssh2_from_ccsid(session: sc: 0: user:
|
||||
trimmed_length(user: %size(user):
|
||||
%addr(password)): *omit):
|
||||
libssh2_from_ccsid(session: sc: 0: password:
|
||||
trimmed_length(password: %size(password):
|
||||
%addr(filepath)): *omit)) <> 0;
|
||||
error('Authentication by password failed');
|
||||
return;
|
||||
endif;
|
||||
|
||||
// Request a file via SFTP
|
||||
sftp_session = libssh2_sftp_init(session);
|
||||
|
||||
if sftp_session = *NULL;
|
||||
error('Unable to init SFTP session');
|
||||
return;
|
||||
endif;
|
||||
|
||||
sftp_handle = libssh2_sftp_open(sftp_session:
|
||||
libssh2_from_ccsid(session: sc: 0: filepath:
|
||||
trimmed_length(filepath: %size(filepath): *null):
|
||||
*omit): LIBSSH2_FXF_READ: 0);
|
||||
if sftp_handle = *NULL;
|
||||
error('Unable to open file with SFTP: ' +
|
||||
%trim(%char(libssh2_sftp_last_error(sftp_session))));
|
||||
return;
|
||||
endif;
|
||||
|
||||
// Download and display the remote file
|
||||
nread = libssh2_sftp_read(sftp_handle: %addr(buf): %size(buf));
|
||||
dow nread > 0; // loop until we fail
|
||||
print(libssh2_to_ccsid(session: sc: 0: %addr(buf): nread: *omit):
|
||||
-1);
|
||||
libssh2_release_string_cache(session: sc);
|
||||
nread = libssh2_sftp_read(sftp_handle: %addr(buf): %size(buf));
|
||||
enddo;
|
||||
p main e
|
||||
/eject
|
||||
**************************************************************************
|
||||
* Release all allocated resources
|
||||
**************************************************************************
|
||||
*
|
||||
p cleanout b
|
||||
*
|
||||
|
||||
if sftp_handle <> *NULL;
|
||||
libssh2_sftp_close(sftp_handle);
|
||||
endif;
|
||||
|
||||
if sftp_session <> *NULL;
|
||||
libssh2_sftp_shutdown(sftp_session);
|
||||
endif;
|
||||
|
||||
if session <> *NULL;
|
||||
libssh2_session_disconnect(session: libssh2_from_ccsid(session: sc:
|
||||
0: 'Normal shutdown': -1: *omit));
|
||||
libssh2_release_string_cache(session: sc);
|
||||
libssh2_session_free(session);
|
||||
endif;
|
||||
|
||||
if sock <> LIBSSH2_INVALID_SOCKET;
|
||||
shutdown(sock: SHUT_RDWR);
|
||||
LIBSSH2_SOCKET_CLOSE(sock);
|
||||
endif;
|
||||
|
||||
libssh2_exit();
|
||||
p cleanout e
|
||||
/eject
|
||||
**************************************************************************
|
||||
* Print data line by line
|
||||
**************************************************************************
|
||||
*
|
||||
p print b
|
||||
d pi
|
||||
d string * value options(*string)
|
||||
d len 10i 0 value
|
||||
*
|
||||
d recout ds Output line buffer
|
||||
d lineout 120 inz(*blanks)
|
||||
*
|
||||
d i s 10u 0
|
||||
d j s 10u 0 inz(0)
|
||||
|
||||
if len < 0;
|
||||
len = %len(%str(string));
|
||||
endif;
|
||||
|
||||
for i = 0 to len - 1;
|
||||
if %str(string + i: 1) <> EBCDIC_CR;
|
||||
if %str(string + i: 1) = EBCDIC_LF;
|
||||
write QPRINT recout;
|
||||
lineout = *blanks;
|
||||
j = 0;
|
||||
else;
|
||||
if j >= %size(lineout);
|
||||
write QPRINT recout;
|
||||
lineout = *blanks;
|
||||
j = 0;
|
||||
endif;
|
||||
j = j + 1;
|
||||
%subst(lineout: j: 1) = %str(string + i: 1);
|
||||
endif;
|
||||
endif;
|
||||
endfor;
|
||||
if j > 0;
|
||||
write QPRINT recout;
|
||||
endif;
|
||||
p print e
|
||||
/eject
|
||||
**************************************************************************
|
||||
* Error procedure
|
||||
**************************************************************************
|
||||
*
|
||||
p error b
|
||||
d pi
|
||||
d message * value options(*string)
|
||||
*
|
||||
d errcode ds qualified
|
||||
d provided 10u 0 inz(0)
|
||||
d available 10u 0
|
||||
*
|
||||
d msgkey s 4
|
||||
|
||||
// Send error as an exception to the calling level.
|
||||
qmhsndpm('CPF9898': 'QCPFMSG QSYS':
|
||||
%str(message): %len(%str(message)): '*ESCAPE':
|
||||
'* ': 1: msgkey: errcode);
|
||||
p error e
|
||||
/eject
|
||||
**************************************************************************
|
||||
* Get the length of right-trimmed string
|
||||
**************************************************************************
|
||||
*
|
||||
p trimmed_length b
|
||||
d pi 10u 0
|
||||
d string 999999 options(*varsize)
|
||||
d length 10u 0 value
|
||||
d nextarg * value
|
||||
*
|
||||
d len s 10u 0
|
||||
|
||||
if nextarg <> *null;
|
||||
len = nextarg - %addr(string);
|
||||
if length > len;
|
||||
length = len;
|
||||
endif;
|
||||
endif;
|
||||
len = %scan(X'00': string: 1: length); // Maybe zero-terminated
|
||||
if len = 0;
|
||||
len = length + 1;
|
||||
endif;
|
||||
return %checkr(' ': string: len - 1); // Trim right
|
||||
p trimmed_length e
|
||||
Reference in New Issue
Block a user