HPlogo X25/9000: X.25/9000 Programmer's Guide > Chapter 6 Extended Features

Using Permanent Virtual Circuits

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

Permanent virtual circuits (PVCs) must be acquired from the network provider. They are set-up during X.25 configuration. Refer to your X.25/9000 User's Guide for details on configuring PVCs.

A PVC is similar to a "leased line" in that it is always connected and terminates at a single destination. By contrast, an SVC can terminate at different destinations, depending upon the call. A PVC may be used by only one socket at a time.

Although a PVC can be RESET, so all data on the connection is discarded, it cannot be cleared like an SVC. A PVC is connected as long as X.25 Level 3 is active.

A socket is bound to a PVC with the ioctl(X25_SETUP_PVC) call. Unlike the case of an SVC set-up, the listen(), connect(), and accept() system calls are not used to establish a connection over a PVC. The close() call removes the binding between a socket and the circuit of a PVC and also sends a RESET REQUEST packet out on the circuit. Data is cleared from the circuit, but the circuit is not destroyed.

The ioctl() calls that are associated with sending and receiving CALL REQUEST and CALL ACCEPTED packets, and the fields within them, such as ioctl(X25_RD_USER_DATA), ioctl(X25_WR_USER_DATA), ioctl(X25_WR_FACILITIES), and ioctl(X25_RD_FACILITIES)have no effect on a PVC.

Preparing a PVC for Use

A PVC is connected from the moment the programmatic access interface is active. However, until a socket is bound to the PVC, X.25 discards all packets received over the PVC and a RESET REQUEST packet is sent. There is no implicit client/server relationship in establishing a PVC connection. Actions taken on either end of a PVC are essentially the same.

The ioctl(X25_SETUP_PVC) call binds a socket to a PVC. The application first creates the socket, then calls the ioctl(X25_SETUP_PVC). The logical channel identifier (lci) of the PVC must be known before the ioctl(X25_SETUP_PVC) is issued. This can be obtained from the system administrator.

If the ioctl(X25_SETUP_PVC) call is successful, the socket is bound to the PVC as a dedicated socket. However, there is no assurance that there is an y process running at the other end of the PVC. Programs should send a message to say that they are alive and then wait for a reply from the remote end of the PVC. Once a process is operational at the remote end of the PVC, it can be used, like a SVC, to send and receive data and out-of-band information.

The primary difference between PVCs and SVCs is that a CLEAR REQUEST packet cannot be sent or received on a PVC. A remote peer process may abort or die without notice. X.25 sends a RESET REQUEST packet on the PVC if the socket is closed for any reason, for example, the local process dies. However, RESET REQUEST packets can be received on a PVC for other reasons. Refer to the discussion of OOB_VC_L2DOWN in Chapter 5 “ Receiving and Transmitting Out-of-Band Information” for how a PVC recovers when Level 2 fails.

Syntax for ioctl(X25_SETUP_PVC)

The ioctl(X25_SETUP_PVC) and its parameters are described below.

#include <x25/x25ioctls.h>
#include <x25/x25str.h>
/* define X25_MAX_IFNAMELEN 12
* struct x25_setup_pvc_str {
* char ifname[X25_MAX_IFNAMELEN+1];
* int lci;


* }
*/
int err;
int sd;
struct x25_setup_pvc_str pvc_str;
err = ioctl(sd, X25_SETUP_PVC, &pvc_str);
sd

Is a socket descriptor for an AF_CCITT socket that has not yet been bound to an address.

X25_SETUP_PVC

Is the definition for the request.

pvc_str

Indicates the interface and logical channel indicator for the PVC to which the socket shall be connected.

err

If the call succeeds, 0 is returned. If the call fails, -1 is returned and errno contains an indication of the cause of the error. ENETUNREACH indicates Level 2 is down. ENODEV indicates the named interface does not exist. ENETDOWN indicates the interface is down because it has been shutdown, suffered either a power fail without being reinitialized or incurred a hard error. EINVAL indicates the virtual circuit is illegal or not a PVC. EBUSY indicates that the lci is in use.