xref: /linux/include/uapi/linux/ppp-ioctl.h (revision f8bade6c9a6213c2c5ba6e5bf32415ecab6e41e5)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells /*
3607ca46eSDavid Howells  * ppp-ioctl.h - PPP ioctl definitions.
4607ca46eSDavid Howells  *
5607ca46eSDavid Howells  * Copyright 1999-2002 Paul Mackerras.
6607ca46eSDavid Howells  *
7607ca46eSDavid Howells  *  This program is free software; you can redistribute it and/or
8607ca46eSDavid Howells  *  modify it under the terms of the GNU General Public License
9607ca46eSDavid Howells  *  version 2 as published by the Free Software Foundation.
10607ca46eSDavid Howells  */
11607ca46eSDavid Howells #ifndef _PPP_IOCTL_H
12607ca46eSDavid Howells #define _PPP_IOCTL_H
13607ca46eSDavid Howells 
14607ca46eSDavid Howells #include <linux/types.h>
15607ca46eSDavid Howells #include <linux/compiler.h>
16e8b67146SMike Frysinger #include <linux/ppp_defs.h>
17607ca46eSDavid Howells 
18607ca46eSDavid Howells /*
19607ca46eSDavid Howells  * Bit definitions for flags argument to PPPIOCGFLAGS/PPPIOCSFLAGS.
20607ca46eSDavid Howells  */
21607ca46eSDavid Howells #define SC_COMP_PROT	0x00000001	/* protocol compression (output) */
22607ca46eSDavid Howells #define SC_COMP_AC	0x00000002	/* header compression (output) */
23607ca46eSDavid Howells #define	SC_COMP_TCP	0x00000004	/* TCP (VJ) compression (output) */
24607ca46eSDavid Howells #define SC_NO_TCP_CCID	0x00000008	/* disable VJ connection-id comp. */
25607ca46eSDavid Howells #define SC_REJ_COMP_AC	0x00000010	/* reject adrs/ctrl comp. on input */
26607ca46eSDavid Howells #define SC_REJ_COMP_TCP	0x00000020	/* reject TCP (VJ) comp. on input */
27607ca46eSDavid Howells #define SC_CCP_OPEN	0x00000040	/* Look at CCP packets */
28607ca46eSDavid Howells #define SC_CCP_UP	0x00000080	/* May send/recv compressed packets */
29607ca46eSDavid Howells #define SC_ENABLE_IP	0x00000100	/* IP packets may be exchanged */
30607ca46eSDavid Howells #define SC_LOOP_TRAFFIC	0x00000200	/* send traffic to pppd */
31607ca46eSDavid Howells #define SC_MULTILINK	0x00000400	/* do multilink encapsulation */
32607ca46eSDavid Howells #define SC_MP_SHORTSEQ	0x00000800	/* use short MP sequence numbers */
33607ca46eSDavid Howells #define SC_COMP_RUN	0x00001000	/* compressor has been inited */
34607ca46eSDavid Howells #define SC_DECOMP_RUN	0x00002000	/* decompressor has been inited */
35607ca46eSDavid Howells #define SC_MP_XSHORTSEQ	0x00004000	/* transmit short MP seq numbers */
36607ca46eSDavid Howells #define SC_DEBUG	0x00010000	/* enable debug messages */
37607ca46eSDavid Howells #define SC_LOG_INPKT	0x00020000	/* log contents of good pkts recvd */
38607ca46eSDavid Howells #define SC_LOG_OUTPKT	0x00040000	/* log contents of pkts sent */
39607ca46eSDavid Howells #define SC_LOG_RAWIN	0x00080000	/* log all chars received */
40607ca46eSDavid Howells #define SC_LOG_FLUSH	0x00100000	/* log all chars flushed */
41607ca46eSDavid Howells #define	SC_SYNC		0x00200000	/* synchronous serial mode */
42607ca46eSDavid Howells #define	SC_MUST_COMP    0x00400000	/* no uncompressed packets may be sent or received */
43607ca46eSDavid Howells #define	SC_MASK		0x0f600fff	/* bits that user can change */
44607ca46eSDavid Howells 
45607ca46eSDavid Howells /* state bits */
46607ca46eSDavid Howells #define SC_XMIT_BUSY	0x10000000	/* (used by isdn_ppp?) */
47607ca46eSDavid Howells #define SC_RCV_ODDP	0x08000000	/* have rcvd char with odd parity */
48607ca46eSDavid Howells #define SC_RCV_EVNP	0x04000000	/* have rcvd char with even parity */
49607ca46eSDavid Howells #define SC_RCV_B7_1	0x02000000	/* have rcvd char with bit 7 = 1 */
50607ca46eSDavid Howells #define SC_RCV_B7_0	0x01000000	/* have rcvd char with bit 7 = 0 */
51607ca46eSDavid Howells #define SC_DC_FERROR	0x00800000	/* fatal decomp error detected */
52607ca46eSDavid Howells #define SC_DC_ERROR	0x00400000	/* non-fatal decomp error detected */
53607ca46eSDavid Howells 
54607ca46eSDavid Howells /* Used with PPPIOCGNPMODE/PPPIOCSNPMODE */
55607ca46eSDavid Howells struct npioctl {
56607ca46eSDavid Howells 	int		protocol;	/* PPP protocol, e.g. PPP_IP */
57607ca46eSDavid Howells 	enum NPmode	mode;
58607ca46eSDavid Howells };
59607ca46eSDavid Howells 
60607ca46eSDavid Howells /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
61607ca46eSDavid Howells struct ppp_option_data {
62607ca46eSDavid Howells 	__u8	__user *ptr;
63607ca46eSDavid Howells 	__u32	length;
64607ca46eSDavid Howells 	int	transmit;
65607ca46eSDavid Howells };
66607ca46eSDavid Howells 
67607ca46eSDavid Howells /* For PPPIOCGL2TPSTATS */
68607ca46eSDavid Howells struct pppol2tp_ioc_stats {
69607ca46eSDavid Howells 	__u16		tunnel_id;	/* redundant */
70607ca46eSDavid Howells 	__u16		session_id;	/* if zero, get tunnel stats */
71b0e29063SGuillaume Nault 	__u32		using_ipsec:1;
72607ca46eSDavid Howells 	__aligned_u64	tx_packets;
73607ca46eSDavid Howells 	__aligned_u64	tx_bytes;
74607ca46eSDavid Howells 	__aligned_u64	tx_errors;
75607ca46eSDavid Howells 	__aligned_u64	rx_packets;
76607ca46eSDavid Howells 	__aligned_u64	rx_bytes;
77607ca46eSDavid Howells 	__aligned_u64	rx_seq_discards;
78607ca46eSDavid Howells 	__aligned_u64	rx_oos_packets;
79607ca46eSDavid Howells 	__aligned_u64	rx_errors;
80607ca46eSDavid Howells };
81607ca46eSDavid Howells 
82607ca46eSDavid Howells /*
83607ca46eSDavid Howells  * Ioctl definitions.
84607ca46eSDavid Howells  */
85607ca46eSDavid Howells 
86607ca46eSDavid Howells #define	PPPIOCGFLAGS	_IOR('t', 90, int)	/* get configuration flags */
87607ca46eSDavid Howells #define	PPPIOCSFLAGS	_IOW('t', 89, int)	/* set configuration flags */
88607ca46eSDavid Howells #define	PPPIOCGASYNCMAP	_IOR('t', 88, int)	/* get async map */
89607ca46eSDavid Howells #define	PPPIOCSASYNCMAP	_IOW('t', 87, int)	/* set async map */
90607ca46eSDavid Howells #define	PPPIOCGUNIT	_IOR('t', 86, int)	/* get ppp unit number */
91607ca46eSDavid Howells #define	PPPIOCGRASYNCMAP _IOR('t', 85, int)	/* get receive async map */
92607ca46eSDavid Howells #define	PPPIOCSRASYNCMAP _IOW('t', 84, int)	/* set receive async map */
93607ca46eSDavid Howells #define	PPPIOCGMRU	_IOR('t', 83, int)	/* get max receive unit */
94607ca46eSDavid Howells #define	PPPIOCSMRU	_IOW('t', 82, int)	/* set max receive unit */
95607ca46eSDavid Howells #define	PPPIOCSMAXCID	_IOW('t', 81, int)	/* set VJ max slot ID */
96607ca46eSDavid Howells #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) /* get extended ACCM */
97607ca46eSDavid Howells #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) /* set extended ACCM */
98607ca46eSDavid Howells #define PPPIOCXFERUNIT	_IO('t', 78)		/* transfer PPP unit */
99607ca46eSDavid Howells #define PPPIOCSCOMPRESS	_IOW('t', 77, struct ppp_option_data)
100607ca46eSDavid Howells #define PPPIOCGNPMODE	_IOWR('t', 76, struct npioctl) /* get NP mode */
101607ca46eSDavid Howells #define PPPIOCSNPMODE	_IOW('t', 75, struct npioctl)  /* set NP mode */
102607ca46eSDavid Howells #define PPPIOCSPASS	_IOW('t', 71, struct sock_fprog) /* set pass filter */
103607ca46eSDavid Howells #define PPPIOCSACTIVE	_IOW('t', 70, struct sock_fprog) /* set active filt */
104607ca46eSDavid Howells #define PPPIOCGDEBUG	_IOR('t', 65, int)	/* Read debug level */
105607ca46eSDavid Howells #define PPPIOCSDEBUG	_IOW('t', 64, int)	/* Set debug level */
106607ca46eSDavid Howells #define PPPIOCGIDLE	_IOR('t', 63, struct ppp_idle) /* get idle time */
10717c7e7f4SArnd Bergmann #define PPPIOCGIDLE32	_IOR('t', 63, struct ppp_idle32) /* 32-bit times */
10817c7e7f4SArnd Bergmann #define PPPIOCGIDLE64	_IOR('t', 63, struct ppp_idle64) /* 64-bit times */
109607ca46eSDavid Howells #define PPPIOCNEWUNIT	_IOWR('t', 62, int)	/* create new ppp unit */
110607ca46eSDavid Howells #define PPPIOCATTACH	_IOW('t', 61, int)	/* attach to ppp unit */
111af8d3c7cSEric Biggers #define PPPIOCDETACH	_IOW('t', 60, int)	/* obsolete, do not use */
112607ca46eSDavid Howells #define PPPIOCSMRRU	_IOW('t', 59, int)	/* set multilink MRU */
113607ca46eSDavid Howells #define PPPIOCCONNECT	_IOW('t', 58, int)	/* connect channel to unit */
114607ca46eSDavid Howells #define PPPIOCDISCONN	_IO('t', 57)		/* disconnect channel */
115607ca46eSDavid Howells #define PPPIOCATTCHAN	_IOW('t', 56, int)	/* attach to ppp channel */
116607ca46eSDavid Howells #define PPPIOCGCHAN	_IOR('t', 55, int)	/* get ppp channel number */
117607ca46eSDavid Howells #define PPPIOCGL2TPSTATS _IOR('t', 54, struct pppol2tp_ioc_stats)
1184cf476ceSTom Parkin #define PPPIOCBRIDGECHAN _IOW('t', 53, int)	/* bridge one channel to another */
119*bcce55f5SGuillaume Nault #define PPPIOCUNBRIDGECHAN _IO('t', 52)	/* unbridge channel */
120607ca46eSDavid Howells 
121607ca46eSDavid Howells #define SIOCGPPPSTATS   (SIOCDEVPRIVATE + 0)
122607ca46eSDavid Howells #define SIOCGPPPVER     (SIOCDEVPRIVATE + 1)	/* NEVER change this!! */
123607ca46eSDavid Howells #define SIOCGPPPCSTATS  (SIOCDEVPRIVATE + 2)
124607ca46eSDavid Howells 
125607ca46eSDavid Howells #endif /* _PPP_IOCTL_H */
126