HP X.25/9000 Programmer's Guide
46 Chapter3
Establishing and Terminating a Socket Connection
Using Permanent Virtual Circuits
If the ioctl(X25_SETUP_PVC) call is successful, the socket is bound to
the PVC as a dedicated socket. However, there is no guarantee that there
is a process running at the other end of the PVC. Applications should
send a message to say that they are alive, then wait for a reply from the
remote end of the PVC (a “handshake”). Once a process is running at the
remote end of the PVC, it can be used (like an 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, if
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 information on 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 Socket descriptor for an AF_CCITT socket that has not yet been bound to
an address.
X25_SETUP_PVC Definition for the request.
pvc_str Indicates the interface and logical channel indicator for the PVC, to
which the socket will 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
36960-90061.bk Page 46 Friday, November 10, 2000 3:42 PM










