130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * These are the public elements of the Linux kernel X.25 implementation.
330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 	History
530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	mar/20/00	Daniela Squassoni Disabling/enabling of facilities
630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *					  negotiation.
730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	apr/02/05	Shaun Pereira Selective sub address matching with
830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *					call user data
930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
1030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
1130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#ifndef	X25_KERNEL_H
1230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_KERNEL_H
1330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
1430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#include <linux/types.h>
1530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#include <linux/socket.h>
1630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
1730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	SIOCX25GSUBSCRIP	(SIOCPROTOPRIVATE + 0)
1830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	SIOCX25SSUBSCRIP	(SIOCPROTOPRIVATE + 1)
1930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	SIOCX25GFACILITIES	(SIOCPROTOPRIVATE + 2)
2030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	SIOCX25SFACILITIES	(SIOCPROTOPRIVATE + 3)
2130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	SIOCX25GCALLUSERDATA	(SIOCPROTOPRIVATE + 4)
2230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	SIOCX25SCALLUSERDATA	(SIOCPROTOPRIVATE + 5)
2330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	SIOCX25GCAUSEDIAG	(SIOCPROTOPRIVATE + 6)
2430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SIOCX25SCUDMATCHLEN	(SIOCPROTOPRIVATE + 7)
2530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SIOCX25CALLACCPTAPPRV   (SIOCPROTOPRIVATE + 8)
2630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SIOCX25SENDCALLACCPT    (SIOCPROTOPRIVATE + 9)
2730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10)
2830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11)
2930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SIOCX25SCAUSEDIAG	(SIOCPROTOPRIVATE + 12)
3030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
3130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
3230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	Values for {get,set}sockopt.
3330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
3430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_QBITINCL		1
3530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
3630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
3730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	X.25 Packet Size values.
3830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
3930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS16		4
4030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS32		5
4130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS64		6
4230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS128		7
4330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS256		8
4430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS512		9
4530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS1024		10
4630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS2048		11
4730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_PS4096		12
4830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
4930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
5030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * An X.121 address, it is held as ASCII text, null terminated, up to 15
5130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * digits and a null terminator.
5230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
5330692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct x25_address {
5430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	char x25_addr[16];
5530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
5630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
5730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
5830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	Linux X.25 Address structure, used for bind, and connect mostly.
5930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
6030692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sockaddr_x25 {
6130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__kernel_sa_family_t sx25_family;	/* Must be AF_X25 */
6230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct x25_address sx25_addr;		/* X.121 Address */
6330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
6430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
6530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
6630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	DTE/DCE subscription options.
6730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
6830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *      As this is missing lots of options, user should expect major
6930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	changes of this structure in 2.5.x which might break compatibilty.
7030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *      The somewhat ugly dimension 200-sizeof() is needed to maintain
7130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	backward compatibility.
7230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
7330692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct x25_subscrip_struct {
7430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	char device[200-sizeof(unsigned long)];
7530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned long	global_facil_mask;	/* 0 to disable negotiation */
7630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned int	extended;
7730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
7830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
7930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* values for above global_facil_mask */
8030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
8130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_MASK_REVERSE	0x01
8230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_MASK_THROUGHPUT	0x02
8330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_MASK_PACKET_SIZE	0x04
8430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define	X25_MASK_WINDOW_SIZE	0x08
8530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
8630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define X25_MASK_CALLING_AE 0x10
8730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define X25_MASK_CALLED_AE 0x20
8830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
8930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
9030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
9130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	Routing table control structure.
9230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
9330692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct x25_route_struct {
9430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct x25_address address;
9530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned int	   sigdigits;
9630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	char		   device[200];
9730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
9830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
9930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
10030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	Facilities structure.
10130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
10230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct x25_facilities {
10330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned int	winsize_in, winsize_out;
10430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned int	pacsize_in, pacsize_out;
10530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned int	throughput;
10630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned int	reverse;
10730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
10830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
10930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
11030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng* ITU DTE facilities
11130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng* Only the called and calling address
11230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng* extension are currently implemented.
11330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng* The rest are in place to avoid the struct
11430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng* changing size if someone needs them later
11530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng*/
11630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
11730692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct x25_dte_facilities {
11830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 delay_cumul;
11930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 delay_target;
12030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 delay_max;
12130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 min_throughput;
12230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 expedited;
12330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 calling_len;
12430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 called_len;
12530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 calling_ae[20];
12630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 called_ae[20];
12730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
12830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
12930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
13030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	Call User Data structure.
13130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
13230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct x25_calluserdata {
13330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned int	cudlength;
13430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned char	cuddata[128];
13530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
13630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
13730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
13830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	Call clearing Cause and Diagnostic structure.
13930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
14030692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct x25_causediag {
14130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned char	cause;
14230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned char	diagnostic;
14330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
14430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
14530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
14630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *	Further optional call user data match length selection
14730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
14830692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct x25_subaddr {
14930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	unsigned int cudmatchlength;
15030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
15130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
15230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#endif
153