skorek
Well Known Member
Hi
I would like to know if there is any way to retrive user IP address?
In web I found such CL program:
/*********************************************************************/
/* Retrieve/display TCP/IP addresses for pass-through devices */
/*********************************************************************/
/* */
/* Check for / install these PTFs or supercedes on your system */
/* to get support for the additional fields in the QDCRDEVD API */
/* DEVD0600 format: */
/* */
/* OS/400 V3R2 LICPGM 5763SS1 PTF SF44503 */
/* OS/400 V3R7 LICPGM 5716SS1 PTF SF44312 */
/* */
/* Additional information about these PTFs (cover letters) can be */
/* found at IBM's web site: */
/* */
/* www.as400service.ibm.com */
/* */
/* For additional information about the QDCRDEVD API, see the IBM */
/* manual "OS/400 Configuration APIs" */
/*********************************************************************/
/* Copyright (c) Craig Pelkie, 1997 */
/* ALL RIGHTS RESERVED */
/* */
/* Craig Pelkie */
/* Bits & Bytes Programming */
/* PO Box 1473 */
/* Valley Center, CA 92082-1473 */
/* [email protected] */
/*********************************************************************/
rtvtcpaddr: pgm
dcl &bytesprov *char 4 /* Bytes Provided */ +
value(x'00000010') /* 16 byte structure*/
dcl &ctld *char 10 /* Controller desc */
dcl &devnam *char 10 /* Device name */
dcl &error *char 16 /* Error field */
dcl &msg *char 150 /* Displayed msg */
dcl &port *dec len(5 0) /* Port number */
dcl &portbin *char 2 /* Port (binary) */
dcl &portchar *char 5 /* Port number */
dcl &protocol *char 1 /* Network protocol */ +
value(x'02') /* TCP/IP protocol */
dcl &rcvvar *char 1024 /* Receiver var */
dcl &rtvdev *char 10 /* Dev to retrieve */
dcl &rtvdevno *dec len(4 0) /* Device number */
dcl &rtvdevnoc *char 4 /* Device number */
dcl &tcpaddr *char 15 /* TCP/IP address */
/*********************************************************************/
/* Initialize "bytes provided" subfield in Error Code structure */
/*********************************************************************/
chgvar %sst(&error 1 4) value(&bytesprov)
/*********************************************************************/
/* Create pass-through device ID in loop. Start at 'QPADEV0001', */
/* end after 'QPADEV0250'. This is incremented in the loop. */
/*********************************************************************/
chgvar &rtvdevno 0
loop:
chgvar &rtvdevno value(&rtvdevno + 1)
if (&rtvdevno *gt 250) then(return)
chgvar &rtvdevnoc &rtvdevno
chgvar &rtvdev value('QPADEV' *cat &rtvdevnoc)
/*********************************************************************/
/* Call the Retrieve Device Description API, format DEVD0600 */
/* to retrieve information about selected device */
/*********************************************************************/
chgvar &rcvvar ' '
call qdcrdevd parm( +
&rcvvar /* Receiver variable */ +
x'00000400' /* Length of &rcvvar (1024)*/ +
'DEVD0600' /* Format to receive */ +
&rtvdev /* Device ID to retrieve */ +
&error) /* Error field */
/*********************************************************************/
/* Extract values from receiver variable if retrieved device */
/* is a TCP/IP device (position 859, network protocol = x'02') */
/*********************************************************************/
chgvar &devnam %sst(&rcvvar 22 10)
if (&devnam *eq ' ') then(return)
if ((%sst(&rcvvar 859 1) *ne &protocol)) +
then(goto loop)
chgvar &ctld %sst(&rcvvar 205 10)
chgvar &portbin %sst(&rcvvar 860 2)
chgvar &port %bin(&portbin)
chgvar &portchar &port
chgvar &tcpaddr %sst(&rcvvar 877 5)
/*********************************************************************/
/* Format/display message */
/*********************************************************************/
chgvar &msg value( +
' Device: ' *cat &devnam *tcat +
' Controller: ' *cat &ctld *tcat +
' Port: ' *cat &portchar *tcat +
' Address: ' *cat &tcpaddr)
sndpgmmsg msg(&msg) topgmq(*same)
goto loop
endpgm
--------------------------------------------------------------------------------
But the problem is that these two ptf's are not installed, so how to check it without support for API: QDCRDEVD?
In one of post from 1996 I found also this threads:
QUESTION:
I want to know if there is s way to retrive the IP address that one 5250 session is using. For example if I signon to the AS/400 using TELNET I give the IP address of the remote host system, the remote systems (AS/400) assigns a virtual 5250 device and sends the signon format, but I do not know from which IP address the remote station is connecting.
ANSWER
There is no way to determine the IP address used by a given Virtual Device in a TELNET session. Those bindings are all made internally in microcode, and there is no API available to retrieve them.
But I hope that from 96 this problem was resolved. Probably above program is solution, but PTF is required...
Do you have any solution without API?
Regards
Tomek
PS: when I try to call this program I get logs:
DEVICE: QPADEV0003 CONTROLLER: QPACTL01 PORT: 01141 ADDRESS: 10.1
DEVICE: QPADEV0006 CONTROLLER: QPACTL01 PORT: 01132 ADDRESS: 10.1
If remaning part of IP address is caused by lack of API?
I would like to know if there is any way to retrive user IP address?
In web I found such CL program:
/*********************************************************************/
/* Retrieve/display TCP/IP addresses for pass-through devices */
/*********************************************************************/
/* */
/* Check for / install these PTFs or supercedes on your system */
/* to get support for the additional fields in the QDCRDEVD API */
/* DEVD0600 format: */
/* */
/* OS/400 V3R2 LICPGM 5763SS1 PTF SF44503 */
/* OS/400 V3R7 LICPGM 5716SS1 PTF SF44312 */
/* */
/* Additional information about these PTFs (cover letters) can be */
/* found at IBM's web site: */
/* */
/* www.as400service.ibm.com */
/* */
/* For additional information about the QDCRDEVD API, see the IBM */
/* manual "OS/400 Configuration APIs" */
/*********************************************************************/
/* Copyright (c) Craig Pelkie, 1997 */
/* ALL RIGHTS RESERVED */
/* */
/* Craig Pelkie */
/* Bits & Bytes Programming */
/* PO Box 1473 */
/* Valley Center, CA 92082-1473 */
/* [email protected] */
/*********************************************************************/
rtvtcpaddr: pgm
dcl &bytesprov *char 4 /* Bytes Provided */ +
value(x'00000010') /* 16 byte structure*/
dcl &ctld *char 10 /* Controller desc */
dcl &devnam *char 10 /* Device name */
dcl &error *char 16 /* Error field */
dcl &msg *char 150 /* Displayed msg */
dcl &port *dec len(5 0) /* Port number */
dcl &portbin *char 2 /* Port (binary) */
dcl &portchar *char 5 /* Port number */
dcl &protocol *char 1 /* Network protocol */ +
value(x'02') /* TCP/IP protocol */
dcl &rcvvar *char 1024 /* Receiver var */
dcl &rtvdev *char 10 /* Dev to retrieve */
dcl &rtvdevno *dec len(4 0) /* Device number */
dcl &rtvdevnoc *char 4 /* Device number */
dcl &tcpaddr *char 15 /* TCP/IP address */
/*********************************************************************/
/* Initialize "bytes provided" subfield in Error Code structure */
/*********************************************************************/
chgvar %sst(&error 1 4) value(&bytesprov)
/*********************************************************************/
/* Create pass-through device ID in loop. Start at 'QPADEV0001', */
/* end after 'QPADEV0250'. This is incremented in the loop. */
/*********************************************************************/
chgvar &rtvdevno 0
loop:
chgvar &rtvdevno value(&rtvdevno + 1)
if (&rtvdevno *gt 250) then(return)
chgvar &rtvdevnoc &rtvdevno
chgvar &rtvdev value('QPADEV' *cat &rtvdevnoc)
/*********************************************************************/
/* Call the Retrieve Device Description API, format DEVD0600 */
/* to retrieve information about selected device */
/*********************************************************************/
chgvar &rcvvar ' '
call qdcrdevd parm( +
&rcvvar /* Receiver variable */ +
x'00000400' /* Length of &rcvvar (1024)*/ +
'DEVD0600' /* Format to receive */ +
&rtvdev /* Device ID to retrieve */ +
&error) /* Error field */
/*********************************************************************/
/* Extract values from receiver variable if retrieved device */
/* is a TCP/IP device (position 859, network protocol = x'02') */
/*********************************************************************/
chgvar &devnam %sst(&rcvvar 22 10)
if (&devnam *eq ' ') then(return)
if ((%sst(&rcvvar 859 1) *ne &protocol)) +
then(goto loop)
chgvar &ctld %sst(&rcvvar 205 10)
chgvar &portbin %sst(&rcvvar 860 2)
chgvar &port %bin(&portbin)
chgvar &portchar &port
chgvar &tcpaddr %sst(&rcvvar 877 5)
/*********************************************************************/
/* Format/display message */
/*********************************************************************/
chgvar &msg value( +
' Device: ' *cat &devnam *tcat +
' Controller: ' *cat &ctld *tcat +
' Port: ' *cat &portchar *tcat +
' Address: ' *cat &tcpaddr)
sndpgmmsg msg(&msg) topgmq(*same)
goto loop
endpgm
--------------------------------------------------------------------------------
But the problem is that these two ptf's are not installed, so how to check it without support for API: QDCRDEVD?
In one of post from 1996 I found also this threads:
QUESTION:
I want to know if there is s way to retrive the IP address that one 5250 session is using. For example if I signon to the AS/400 using TELNET I give the IP address of the remote host system, the remote systems (AS/400) assigns a virtual 5250 device and sends the signon format, but I do not know from which IP address the remote station is connecting.
ANSWER
There is no way to determine the IP address used by a given Virtual Device in a TELNET session. Those bindings are all made internally in microcode, and there is no API available to retrieve them.
But I hope that from 96 this problem was resolved. Probably above program is solution, but PTF is required...
Do you have any solution without API?
Regards
Tomek
PS: when I try to call this program I get logs:
DEVICE: QPADEV0003 CONTROLLER: QPACTL01 PORT: 01141 ADDRESS: 10.1
DEVICE: QPADEV0006 CONTROLLER: QPACTL01 PORT: 01132 ADDRESS: 10.1
If remaning part of IP address is caused by lack of API?