|
I wrote NETIFCR to detect TCP IFC status for your reference as following : * <http://publib.boulder.ibm.com/html/as400/v5r1/ic2924/index.htm?info/api s/qtoclstnetifc.htm> http://publib.boulder.ibm.com/html/as400/v5r1/ic2924/index.htm?info/apis /qtoclstnetifc.htm * * CRTRPGMOD MODULE(NETIFCR) SRCFILE(xxx/QRPGLESRC) SRCMBR(NETIFCR) * CRTPGM PGM(NETIFCR) BNDSRVPGM(QTOCNETSTS) * H DEBUG OPTION(*SRCSTMT:*NODEBUGIO) BNDDIR('QC2LE') H dftactgrp(*NO) FQSYSPRT O F 198 Printer USROPN D uSpaceName s 20 inz('NETIFC QTEMP ') D cmdStr1 s 256 inz('OVRPRTF FILE(QSYSPRT) PAGESIZE(- D *N 198) CPI(15) OVRSCOPE(*JOB)') D cmdStr2 s 256 inz('DLTOVR FILE(QSYSPRT) LVL(*JOB)') *---------------------------------------------------------------- * Get user space list info from header section. *---------------------------------------------------------------- D ds based(uHeadPtr) D uOffSetToList 125 128i 0 D uNumOfEntrys 133 136i 0 D uSizeOfEntry 137 140i 0 * D uListEntry1 ds Based(uListPtr ) D InetAdr 15 overlay(uListEntry1:1) D Reservedr 1 overlay(uListEntry1:16) D InetAdrb 10i 0 overlay(uListEntry1:17) D NetAdr 15 overlay(uListEntry1:21) D Reserved1 1 overlay(uListEntry1:36) D NetAdrb 10i 0 overlay(uListEntry1:37) D NetName 10 overlay(uListEntry1:41) D LineDsc 10 overlay(uListEntry1:51) D IfcName 10 overlay(uListEntry1:61) D Reserved2 2 overlay(uListEntry1:71) D IfcSts 10i 0 overlay(uListEntry1:73) D IfcTypSrv 10i 0 overlay(uListEntry1:77) D IfcMtu 10i 0 overlay(uListEntry1:81) D IfcLinTyp 10i 0 overlay(uListEntry1:85) D HostAdr 15 overlay(uListEntry1:89) D Reserved3 1a overlay(uListEntry1:104) D HostAdrb 10i 0 overlay(uListEntry1:105) D IfcSbnMask 15 overlay(uListEntry1:109) D Reserved4 1a overlay(uListEntry1:124) D IfcSbnMaskb 10i 0 overlay(uListEntry1:125) D DrtBrdCstAdr 15 overlay(uListEntry1:129) D Reserved5 1a overlay(uListEntry1:144) D DrtBrdCstAdrb 10i 0 overlay(uListEntry1:145) D ChgDate 8 overlay(uListEntry1:149) D ChgTime 6 overlay(uListEntry1:157) D AsoLclIfc 15 overlay(uListEntry1:163) D Reserved6 3a overlay(uListEntry1:178) D AsoLclIfcb 10i 0 overlay(uListEntry1:181) D ChgSts 10i 0 overlay(uListEntry1:185) D PacketRules 10i 0 overlay(uListEntry1:189) D AutoStart 10i 0 overlay(uListEntry1:193) D TorkenRingSeq 10i 0 overlay(uListEntry1:197) D IfcType 10i 0 overlay(uListEntry1:201) D ProxyARPEbl 10i 0 overlay(uListEntry1:205) D ProxyARPAlw 10i 0 overlay(uListEntry1:209) D CfgMTU 10i 0 overlay(uListEntry1:213) D NetNameFull 24 overlay(uListEntry1:217) D IfcNameFull 24 overlay(uListEntry1:241) *---------------------------------------------------------------- * Error return code parm for APIs. *---------------------------------------------------------------- D vApiErrDs ds D vbytpv 10i 0 inz(%size(vApiErrDs)) D vbytav 10i 0 inz(0) D vmsgid 7a D vresvd 1a D vrpldta 50a *---------------------------------------------------------------- * Create Prototypes for calls *---------------------------------------------------------------- **-- Create user space: ----------------------------------------- D quscrtus PR ExtPgm('QUSCRTUS') D 20 D 10 const D 10i 0 const D 1 const D 10 const D 50 const D 10 const Db like(vApiErrDS) **-- Delete user space: ------------------------------------------ D qusdltus Pr ExtPgm( 'QUSDLTUS' ) D 20 Const Db like(vApiErrDS) **-- Call system command: --------------------------------------- D system PR 10I 0 extproc('system') D i_cmd * value options(*string) * D EXCP_MSGID S 7A import('_EXCP_MSGID') **-- List network connections: ---------------------------------- D LstNetIfc PR ExtProc('QtocLstNetIfc') D 20 D 8 const Db like(vApiErrDS) **-- Retrieve pointer to user space: ---------------------------- D qusptrus PR ExtPgm('QUSPTRUS') D 20 D * Db like(vApiErrDS) D main PR extpgm('NETIFCR') D main PI *---------------------------------------------------------------- * Create user space C callp QUSCRTUS( C uSpaceName: C 'TEST': C 1500000: C x'00': C '*ALL': C 'User Space JCR ': C '*NO': C vApiErrDs) * Get pointer to user space C callp QUSPTRUS( C uSpaceName: C uHeadPtr: C vApiErrDs) * call api to load job log into user space. C callp LstNetIfc( C uSpaceName: C 'NIFC0100': C vApiErrDs) * Process elements * C callp system(cmdStr1) C open QSYSPRT C eval uListPtr = uHeadPtr + uOffSetToList C except Head 1B C do uNumOfEntrys C exsr cvtTxtSr C except Out C eval uListPtr = uListPtr + uSizeOfEntry 1E C enddo C close QSYSPRT C callp system(cmdStr2) * Delete user space C callp qusdltus( C uSpaceName: C vApiErrDs) * C eval *inlr = *on C return **-- Convert text : ---------------------------------------------- C cvtTxtSr BegSr C Move *blanks IfcStsC 11 C Select C When IfcSts = 0 c eval IfcStsC = 'Inactive' C When IfcSts = 1 c eval IfcStsC = 'Active' C When IfcSts = 2 c eval IfcStsC = 'Starting' C When IfcSts = 3 c eval IfcStsC = 'Ending' C When IfcSts = 4 c eval IfcStsC = 'RCYPND' C When IfcSts = 5 c eval IfcStsC = 'RCYCNL' C When IfcSts = 6 c eval IfcStsC = 'Failed' C When IfcSts = 7 c eval IfcStsC = 'Failed(TCP)' C When IfcSts = 8 c eval IfcStsC = 'DOD' C EndSl C EndSr OQSYSPRT E HEAD 1 O 8 'Inet Adr' O 23 'Net Adr' O 40 'Net Name' O 51 'Line Dsc' O 61 'Ifc Name' O 75 'Ifc Status' O 85 'Host Adr' O E OUT 1 O InetAdr O NetAdr + 1 O NetName + 1 O LineDsc + 1 O IfcName + 1 O IfcStsC + 1 O HostAdr + 1 Best regards, Vengoal Chang -----Original Message----- From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Bruce Vining Sent: Thursday, July 03, 2003 9:31 PM To: Midrange Systems Technical Discussion Subject: Re: Netstat This information is available to ILE CL by way of the List Network Interfaces (QtocLstNetIfc) API. The API can return a list of all logical IPv4 or IPv6 TCP/IP interfaces (you many need to call the API twice to get both lists if you have a combination) along with the status of the interface. Given this information you could then send a message to the system operator, issue the appropriate vary commands, etc. The API can be found in the Information Center under Programming/APIs/APIs by category/Communications/TCP/IP Management APIs. Bruce Phil Kestenbaum <pkestenbaum@xxxxxxx To: midrange-l@xxxxxxxxxxxx om> cc: Sent by: Subject: Netstat midrange-l-bounces@x idrange.com 07/02/2003 03:09 PM Please respond to Midrange Systems Technical Discussion Greetings! I would like to check the status of a TCP/IP interface. If the status is not *active I would want to get a notification to the system operator, and if the status is failed to vary off and on. Can this be accomplished in a CL? Thanks, Phil __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l. _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.