NAME
x25, PF_X25 - ITU-T X.25 / ISO-8208 协议接口。
总览
#include <sys/socket.h>
#include <linux/x25.h>
x25_socket = socket(PF_X25, SOCK_SEQPACKET, 0);
描述
X25 sockets 为 X.25 数据包层协议(packet layer protocol)提供接口。这令应用程序可以使用标准的 ITU X.25 建议(X.25 DTE-DCE 模式)在公共 X.25 数据网中进行通讯。 X25 socket 也可以在没有在 ISO-8208中描述的那样的 X.25 中介(X.25 DTE-DCE 模式)的网络进行通讯.
信息分界的保持 - 对 socket 进行 read(2) 得到的数据块与对端 socket 对应 write(2) 动作输出的数据块是完全一样的.如果必要,内核负责处理信息片段和重组长信息,用的是 X.25 M-bit 方法(校注:请懂 x.25 的同志指正)。对信息大小没有硬编码的上限。 但是重组长信息有时会失败(比如系统资源暂时匮乏,或是出现其他的诸如此类的限制时)。如果出现这种情况,X.25 连接将被重置。
套接口地址 SOCKET ADDRESS
AF_X25 socket 地址族用 struct sockaddr_x25 代表 ITU-T X.121 规范中定义的网络地址。
-
struct sockaddr_x25 { sa_family_t sx25_family; /* 必须是 AF_X25 */ x25_address sx25_addr; /* X.121 地址 */ };
sx25_addr 包含一个空零结尾的字符串 x25_addr[] 。 sx25_addr.x25_addr[] 由最多 15 个 ASCII 字符(不包括结束的 0)构成 X.121 地址。只能使用数字 `0' 到 `9' 。
套接字选项 SOCKET OPTIONS
以下 X.25 相关的套接字选项可以在级别参数设置为 SOL_X25 时用 setsockopt(2) 设定并可用 getsockopt(2) 读取。
- X25_QBITINCL
- 控制用户是否能够访问 X.25 Q-bit ((资格数据位)Qualified Data Bit)。接受整型参数。 如果设为 0 (缺省), 那么传出的数据包不设置 Q-bit 传入的数据包中的 Q-bit 被忽略。如果设为 1, 就会在通过该套接字传入传出的信息中附加一个前置的首字节。对于从套接字中数据, 首位字节的 0 表示对应的读入包未设置 Q-bit;而如果是 1 则相反。 如果通过套接字写入(传出)的数据中首位字节为 1 则传出包设置 Q-bit ,如果是 0 则不设置 Q-bit。
缺憾
有很多, 比如 X.25 PLP 实现 CONFIG_EXPERIMENTAL.(译注:内核编译选项,尚处于试验阶段)。
本手册页也不完善。
还没有给程序员用的头文件;您需要包含内核头文件 linux/x25.h CONFIG_EXPERIMENTAL 也暗示着未来的接口版本可能在二进制级别不兼容。
X.25 N-重置事件(Reset events)还不会传播给用户进程。因此,如果重置,可能会发生数据丢失而得不到任何提示。
另见
socket(7), socket(2).
Jonathan Simon Naylor: lqThe Re-Analysis and Re-Implementation of X.25.rq The URL is
#p#
NAME
x25, PF_X25 - ITU-T X.25 / ISO-8208 protocol interface.
SYNOPSIS
#include <sys/socket.h>
#include <linux/x25.h>
x25_socket = socket(PF_X25, SOCK_SEQPACKET, 0);
DESCRIPTION
X25 sockets provide an interface to the X.25 packet layer protocol. This allows applications to communicate over a public X.25 data network as standardised by International Telecommunication Union's recommendation X.25 (X.25 DTE-DCE mode). X25 sockets can also be used for communication without an intermediate X.25 network (X.25 DTE-DTE mode) as described in ISO-8208.
Message boundaries are preserved - a read(2) from a socket will retrieve the same chunk of data as output with the corresponding write(2) to the peer socket. When necessary, the kernel takes care of segmenting and re-assembling long messages by means of the X.25 M-bit. There is no hard-coded upper limit for the message size. However, re-assembling of a long message might fail if there is a temporary lack of system resources or when other constraints (such as socket memory or buffer size limits) become effective. If that occurs, the X.25 connection will be reset.
SOCKET ADDRESSES
The AF_X25 socket address family uses the struct sockaddr_x25 for representing network addresses as defined in ITU-T recommendation X.121.
-
struct sockaddr_x25 { sa_family_t sx25_family; /* must be AF_X25 */ x25_address sx25_addr; /* X.121 Address */ };
sx25_addr contains a char array x25_addr[] to be interpreted as a null-terminated string. sx25_addr.x25_addr[] consists of up to 15 (not counting the terminating 0) ASCII characters forming the X.121 address. Only the decimal digit characters from `0' to `9' are allowed.
SOCKET OPTIONS
The following X.25 specific socket options can be set by using setsockopt(2) and read with getsockopt(2) with the level parameter set to SOL_X25.
- X25_QBITINCL
- Controls whether the X.25 Q-bit (Qualified Data Bit) is accessible by the user. It expects an integer argument. If set to 0 (default), the Q-bit is never set for outgoing packets and the Q-bit of incoming packets is ignored. If set to 1, an additional first byte is prepended to each message read from or written to the socket. For data read from the socket, a 0 first byte indicates that the Q-bits of the corresponding incoming data packets were not set. A first byte with value 1 indicates that the Q-bit of the corresponding incoming data packets was set. If the first byte of the data written to the socket is 1 the Q-bit of the corresponding outgoing data packets will be set. If the first byte is 0 the Q-bit will not be set.
BUGS
Plenty, as the X.25 PLP implementation is CONFIG_EXPERIMENTAL.
This man page is incomplete.
There is no dedicated application programmer's header file yet; you need to include the kernel header file <linux/x25.h>. CONFIG_EXPERIMENTAL might also imply that future versions of the interface are not binary compatible.
X.25 N-Reset events are not propagated to the user process yet. Thus, if a reset occurred, data might be lost without notice.
SEE ALSO
socket(7), socket(2)
Jonathan Simon Naylor: lqThe Re-Analysis and Re-Implementation of X.25.rq The URL is
- ftp://ftp.pspt.fi/pub/ham/linux/ax25/x25doc.tgz