You are currently on IBM Systems Media’s archival website. Click here to view our new website.

IBM i > TIPS & TECHNIQUES > APPLICATION DEVELOPMENT

A PPP Monitor Utility

Here's a program developed to programmatically obtain the status of a PPP connection

Here's a program developed to programmatically obtain the

The Retrieve Connection Profiles API

I use the Retrieve Connection Profiles (QtocRtvPPPCnnPrf) API to determine the status of a PPP connection. This API is easy to use and has been available since V5R. A similar API, List TCP/IP Point-to-Point Jobs (QTOCLPPJ), can be used for versions V4R4 and earlier. Both of these APIs are documented at the Info Center under the TCP/IP Management APIs section.

QtocRtvPPPCnnPrf needs the configuration profile name to determine the status of the PPP connection. IBM defines the configuration profile as "the logical representation of the following connection details:

  • Line and profile type
  • Multilink settings
  • Remote phone numbers and dialing options
  • Authentication
  • TCP/IP settings: IP addresses and routing
  • Work management and connection customization
  • Domain name servers."

The configuration profile is the identifier used to refer to the connection. In my RPGLE procedure CHKPPPSTS.rpgle (see Figure 1), the pCfgPrf variable is the entry parameter containing the name of the configuration profile passed to the program. I'll show you a CLLE program that calls CHKPPPSTS shortly. The CHKPPPSTS procedure is straightforward--let's look at some of the details.

The entry parameter lines:

  D ChkPPPSts   PR     1   ExtProc(*CL:'CHKPPPSTS')
  D                   10

  P ChkPPPSts   B          Export
  D ChkPPPSts   PI     1
  D pCfgPrf           10

This identifies the name of the procedure, the name of the entry parameter and the calling technique *CL. It indicates that the value returned from CHKPPPSTS is returned to a CLLE and uses the CL calling format. This section of code also indicates that a one-byte value will be passed to the called. That one-byte value will contain the status of the PPP connection.

Here's the parameter list definition for the call to the QtocRtvPPPCnnPrf system procedure:

  D doRtvPPPCnnPrf  PR     ExtProc('QtocRtvPPPCnnPrf')
  D                  116   Const
  D                  10I 0 Const
  D                   10   Const
  D                    8   Const
  D SomeFld                like(StdErrDS)

And here's the actual call to the procedure:

  doRtvPPPCnnPrf(Wk116:     // Check connection profile
                 116:
                 ;pCfgPrf:
                 'PRFR0100':
                 StdErrDS);

Michael Ryan is a technical editor with IBM Systems Magazine. Michael can be reached at michael@ryantechnology.com.



Advertisement

Advertisement

2019 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

A PPP Monitor Utility

Here's a program developed to programmatically obtain the status of a PPP connection

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters