The NPI interface works in the STREAMS environment. The following provides an overview of how to program to the STREAMS interface.
Initially the NPI module is not available for use by an application, and the application itself must push it onto a stream.
For an application to work with NPI in the STREAMS environment, the NPI module must be available to STREAMS applications. Once the AIX software is installed on a system, the NPI module is made available. Then applications that link to the STREAMS library are able to access the NPI module. The way that an application "pushes" NPI is shown in the following sample of pseudo code:
dev=open("/dev/x25pkt", O_RDWR); assumes good return value ioctl(dev, I_PUSH, "npi"); uses the streams library push ioctl
Once pushed, the application would then bind to NPI. See the bind primitive for more details. The application uses the functions putmsg and getmsg to communicate with NPI. Detailed under the STREAMS documentation, examples of their use with NPI are given under some of the primitives. An example of programming to NPI can be seen in the licensed program's sample programs.
The N_CONN primitives are used to generate outgoing calls and accept incoming calls. If incoming calls are expected, the application must specify their characteristics to identify them. The X.25 call user data field is used to identify incoming calls to NPI, and how the listen is specified is described under the N_BIND_REQ primitive. The N_DISCON primitives are used to terminate the calls.