kernel-ark/include/linux/x25.h
Shaun Pereira a64b7b936d [X25]: allow ITU-T DTE facilities for x25
Allows use of the optional user facility to insert ITU-T
(http://www.itu.int/ITU-T/) specified DTE facilities in call set-up x25
packets.  This feature is optional; no facilities will be added if the ioctl
is not used, and call setup packet remains the same as before.

If the ioctls provided by the patch are used, then a facility marker will be
added to the x25 packet header so that the called dte address extension
facility can be differentiated from other types of facilities (as described in
the ITU-T X.25 recommendation) that are also allowed in the x25 packet header.

Facility markers are made up of two octets, and may be present in the x25
packet headers of call-request, incoming call, call accepted, clear request,
and clear indication packets.  The first of the two octets represents the
facility code field and is set to zero by this patch.  The second octet of the
marker represents the facility parameter field and is set to 0x0F because the
marker will be inserted before ITU-T type DTE facilities.

Since according to ITU-T X.25 Recommendation X.25(10/96)- 7.1 "All networks
will support the facility markers with a facility parameter field set to all
ones or to 00001111", therefore this patch should work with all x.25 networks.

While there are many ITU-T DTE facilities, this patch implements only the
called and calling address extension, with placeholders in the
x25_dte_facilities structure for the rest of the facilities.

Testing:

This patch was tested using a cisco xot router connected on its serial ports
to an X.25 network, and on its lan ports to a host running an xotd daemon.

It is also possible to test this patch using an xotd daemon and an x25tap
patch, where the xotd daemons work back-to-back without actually using an x.25
network.  See www.fyonne.net for details on how to do this.

Signed-off-by: Shaun Pereira <spereira@tusc.com.au>
Acked-by: Andrew Hendry <ahendry@tusc.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-03-22 00:01:31 -08:00

151 lines
3.3 KiB
C

/*
* These are the public elements of the Linux kernel X.25 implementation.
*
* History
* mar/20/00 Daniela Squassoni Disabling/enabling of facilities
* negotiation.
* apr/02/05 Shaun Pereira Selective sub address matching with
* call user data
*/
#ifndef X25_KERNEL_H
#define X25_KERNEL_H
#include <linux/types.h>
#define SIOCX25GSUBSCRIP (SIOCPROTOPRIVATE + 0)
#define SIOCX25SSUBSCRIP (SIOCPROTOPRIVATE + 1)
#define SIOCX25GFACILITIES (SIOCPROTOPRIVATE + 2)
#define SIOCX25SFACILITIES (SIOCPROTOPRIVATE + 3)
#define SIOCX25GCALLUSERDATA (SIOCPROTOPRIVATE + 4)
#define SIOCX25SCALLUSERDATA (SIOCPROTOPRIVATE + 5)
#define SIOCX25GCAUSEDIAG (SIOCPROTOPRIVATE + 6)
#define SIOCX25SCUDMATCHLEN (SIOCPROTOPRIVATE + 7)
#define SIOCX25CALLACCPTAPPRV (SIOCPROTOPRIVATE + 8)
#define SIOCX25SENDCALLACCPT (SIOCPROTOPRIVATE + 9)
#define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10)
#define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11)
/*
* Values for {get,set}sockopt.
*/
#define X25_QBITINCL 1
/*
* X.25 Packet Size values.
*/
#define X25_PS16 4
#define X25_PS32 5
#define X25_PS64 6
#define X25_PS128 7
#define X25_PS256 8
#define X25_PS512 9
#define X25_PS1024 10
#define X25_PS2048 11
#define X25_PS4096 12
/*
* An X.121 address, it is held as ASCII text, null terminated, up to 15
* digits and a null terminator.
*/
struct x25_address {
char x25_addr[16];
};
/*
* Linux X.25 Address structure, used for bind, and connect mostly.
*/
struct sockaddr_x25 {
sa_family_t sx25_family; /* Must be AF_X25 */
struct x25_address sx25_addr; /* X.121 Address */
};
/*
* DTE/DCE subscription options.
*
* As this is missing lots of options, user should expect major
* changes of this structure in 2.5.x which might break compatibilty.
* The somewhat ugly dimension 200-sizeof() is needed to maintain
* backward compatibility.
*/
struct x25_subscrip_struct {
char device[200-sizeof(unsigned long)];
unsigned long global_facil_mask; /* 0 to disable negotiation */
unsigned int extended;
};
/* values for above global_facil_mask */
#define X25_MASK_REVERSE 0x01
#define X25_MASK_THROUGHPUT 0x02
#define X25_MASK_PACKET_SIZE 0x04
#define X25_MASK_WINDOW_SIZE 0x08
#define X25_MASK_CALLING_AE 0x10
#define X25_MASK_CALLED_AE 0x20
/*
* Routing table control structure.
*/
struct x25_route_struct {
struct x25_address address;
unsigned int sigdigits;
char device[200];
};
/*
* Facilities structure.
*/
struct x25_facilities {
unsigned int winsize_in, winsize_out;
unsigned int pacsize_in, pacsize_out;
unsigned int throughput;
unsigned int reverse;
};
/*
* ITU DTE facilities
* Only the called and calling address
* extension are currently implemented.
* The rest are in place to avoid the struct
* changing size if someone needs them later
*/
struct x25_dte_facilities {
__u16 delay_cumul;
__u16 delay_target;
__u16 delay_max;
__u8 min_throughput;
__u8 expedited;
__u8 calling_len;
__u8 called_len;
__u8 calling_ae[20];
__u8 called_ae[20];
};
/*
* Call User Data structure.
*/
struct x25_calluserdata {
unsigned int cudlength;
unsigned char cuddata[128];
};
/*
* Call clearing Cause and Diagnostic structure.
*/
struct x25_causediag {
unsigned char cause;
unsigned char diagnostic;
};
/*
* Further optional call user data match length selection
*/
struct x25_subaddr {
unsigned int cudmatchlength;
};
#endif