This chapter discusses how the network provider interface (NPI) is used with X.25. It includes the primitives necessary to run NPI on an X.25 network and illustrates how programs can use NPI.
The network provider interface (NPI) provides a connection-oriented programming interface based on the UNIX International standard NPI V2.0. A connection-oriented subset of the standard has been implemented with enhancements to better suit it to an X.25 environment.
NPI consists of a set of primitives defined as STREAMS messages that provide access to the network layer services. The primitives are transferred between the network service (NS) user entity and the NS provider . An NPI primitive can be one of the following types:
|User-originated||These primitives make requests to the NS provider or respond to an event of the NS provider.|
|Provider-originated||These primitives are either confirmations of a request or are indications to the NS user that the event has occurred.|
The following figure illustrates the NPI:
Multiple NPI applications can access the X.25 protocol code.
The main features of the connection-mode communication are:
There are three phases to each instance of communication: connection establishment, data transfer, and connection termination. Units of data arrive at their destination in the same order as they departed their source, and the data is protected against duplication or loss. Along with the NPI primitives required to use the X.25 communications, there are a number of local management primitives that act locally to the NPI module.
For an application to use NPI, it would typically follow these steps:
The use of NPI is demonstrated in a set of sample programs, which are in one of the following directories:
|/usr/lpp/sx25/samples/npi||Directory for AIX version 3.|
|/usr/samples/sx25/npi||Directory for AIX version 4 users.|
Local management primitives are called to open, close, manage, and report information on a stream connected to the NPI module. They also manage options supported by it and report information on its supported parameter values.
The following local management primitives are supported:
|Indicates a network information request.|
|Indicates a network information acknowledgment.|
|Indicates a bind protocol address request.|
|Indicates a bind protocol address acknowledgment.|
|Indicates an unbind protocol address request.|
|Provides error acknowledgment.|
|N_OK_ACK||Provides successful receipt acknowledgment.|
A network connection (NC), once established, is like a pair of queues linking two network addresses, or X.25 hosts. There is one queue for each direction of information flow, and each queue provides a flow control function for its information flow. The pair of queues is considered to be available for each potential NC. As with the X.25 protocol, NPI is a state machine, what action the application should take at a given time is sometimes due to the state that the protocol layer is in. For example, a call cannot be established until the application binds to the NPI module.
The following rules and guidelines apply to connection-mode service:
The CONS primitives can be grouped as follows:
The following sections describe the format and rules of CONS primitives. The expedited data transfer service primitives are not supported.
The following network service primitives pertain to establishing a connection. To make a connection, the application must previously have bound to the NPI module.
|Indicates a network connection request.|
|Provides a network connection indication.|
|Indicates a network connection response.|
|Provides a network connection confirmation.|
A pair of queues is associated with the connection between the two systems when one of the NPI modules receives an N_CONN_REQ primitive. This is added to the applications read queue. The queues will remain associated with the connection until an N_DISCON_REQ primitive is either entered or removed from a queue. So once the application has bound to the NPI module, it associates a queue pair with a particular connection from the initial connection request/indication through to the final disconnection.
The following NPI primitives provide normal data transfer service:
|Indicates a normal data transfer request.|
|Provides a normal data transfer indication.|
These primitives provide a way to exchange data between the two systems. NPI refers to the units of data passed as network service data units (NSDUs). The exchange can occur in one direction or in both directions simultaneously. The X.25 layer preserves the sequence and the boundaries of these data units. If an N_DATA_REQ for an NSDU greater than the NIDU packet parameter is sent to NPI, the receiving application gets several N_DATA_IND primitives. It is the responsibility of the receiving application to check the N_MORE_DATA_FLAG in each data indication until the entire NSDU is received.
The following NPI primitives provide receipt confirmation service:
|Indicates a data acknowledgment request.|
|Provides a data acknowledgment indication.|
The N_RC_FLAG flag of the N_DATA_REQ primitive enables the receipt confirmation service. For each data unit received with the confirmation request parameter set, the receiving user should return an N_DATACK_REQ primitive. These acknowledgments are issued in the same order as the corresponding N_DATA_IND primitives are received. The NS provider responds to the primitives such that each acknowledgment is distinct from previous or subsequent acknowledgments. The application would have to correlate the acknowledgments with the original requests. When an NSDU has been segmented into more than one network interface data unit (NIDU), only the last NIDU can request receipt confirmation.
N_DATACK_REQ primitives are not subject to the flow control that affects N_DATA_REQ primitives at the same NC endpoint. N_DATACK_IND primitives are not subject to the flow control affecting N_DATA_IND primitives at the same NC endpoint.
To use receipt-confirmation, the two applications must agree upon its use at connection time, assuming it is supported by the underlying X.25 network. The REC_CONF_OPT flag of the N_CONN primitives requests receipt-confirmation service. As it is based on the X.25 D bit, the X.25 subscription being used must have D bit support.
The following NPI primitives provide a reset service:
|Indicates a reset request.|
|Provides a reset indication.|
|Indicates a reset response.|
|Provides a reset confirmation.|
An application would use the reset service to resynchronize the connection. The underlying X.25 layer uses the service to report a detected loss of unrecoverable data within the network service. The reset causes the NS provider to discard all data, expedited data, and receipt confirmations associated with this connection.
The following NPI primitives provide for network connection release:
|Indicates a disconnect request.|
|Provides a disconnect indication.|
The connection can be released in the following ways:
A connection can be released at any time, regardless of its current state. A disconnection request cannot be rejected, so once invoked, the connection will be released. Once the release phase is entered, the network service does not guarantee delivery of any data.