#include <stream.h> #include <netx25/x25_proto.h > struct strbuf ctlb; struct pvcattf attach; . . . ctlb.len = sizeof(struct pvcattf); ctlb.buf = (char *)attach; putmsg(x25_fd, &ctlb, NULL, 0);
N_PVC_ATTCH is used when an application wants to attach to a PVC.The control part of the PVC Attach is defined by the pvcattf structure. The example shows a putmsg. Example 6-1 shows how a getmsg can be constructed.
The pvcattf structure is shown below:
struct pvcattf { unsigned char xl_type; /* Always XL_CTL */ unsigned char xl_command; /* Always N_PVC_ATTACH */ unsigned short lci; /* Logical channel */ uint32_t link_id; /* Link # */ /* 0 for next 3 parameters implies use of default */ unsigned char reqackservice; unsigned char reqnsdulimit; int nsdulimit; int result_code; /* Non-zero - error */ };
The members used by pvcattf are:
Table 6-13 PVC Attach Parameters
Member |
Description |
---|---|
lci |
Contains the logical channel identifier of the required PVC. |
link_id |
Denotes the particular link identifier for the PVC. |
reqackservice |
If non-zero, denotes that the receipt acknowledgement service is requested by use of the D-bit. Setting reqackservice to 1 signifies receipt confirmation by the remote DTE. Setting reqackservice to 2 signifies receipt confirmation by the remote application. In the case of receipt confirmation by the remote DTE, no acknowledgements are expected or given over the X.25 interface. In the case of receipt confirmation by the remote application, there is a one-to-one correspondence between D-bit data and acknowledgements with one data acknowledgement being received/sent for each D-bit data packet sent/received over the X.25 interface. |
reqnsdulimit |
If this is non-zero, use value in nsdulimit. |
nsdulimit |
Specifies the packet concatenation limit for NSDUs. If you want to use this parameter, reqnsdulimit must be non-zero. (The X.25 driver does not look at reqnsdulimit if nsdulimit is zero.) |
result_code |
In the attach message sent to the user as acknowledgment, this member denotes whether the attach was successful. The possible values are defined in the netx25/x25_proto.h file. |