Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _LINUX_GSMMUX_H
3#define _LINUX_GSMMUX_H
4
5#include <linux/const.h>
6#include <linux/if.h>
7#include <linux/ioctl.h>
8#include <linux/types.h>
9
10/*
11 * flags definition for n_gsm
12 *
13 * Used by:
14 * struct gsm_config_ext.flags
15 * struct gsm_dlci_config.flags
16 */
17/* Forces a DLCI reset if set. Otherwise, a DLCI reset is only done if
18 * incompatible settings were provided. Always cleared on retrieval.
19 */
20#define GSM_FL_RESTART _BITUL(0)
21
22/**
23 * struct gsm_config - n_gsm basic configuration parameters
24 *
25 * This structure is used in combination with GSMIOC_GETCONF and GSMIOC_SETCONF
26 * to retrieve and set the basic parameters of an n_gsm ldisc.
27 * struct gsm_config_ext can be used to configure extended ldisc parameters.
28 *
29 * All timers are in units of 1/100th of a second.
30 *
31 * @adaption: Convergence layer type
32 * @encapsulation: Framing (0 = basic option, 1 = advanced option)
33 * @initiator: Initiator or responder
34 * @t1: Acknowledgment timer
35 * @t2: Response timer for multiplexer control channel
36 * @t3: Response timer for wake-up procedure
37 * @n2: Maximum number of retransmissions
38 * @mru: Maximum incoming frame payload size
39 * @mtu: Maximum outgoing frame payload size
40 * @k: Window size
41 * @i: Frame type (1 = UIH, 2 = UI)
42 * @unused: Can not be used
43 */
44struct gsm_config
45{
46 unsigned int adaption;
47 unsigned int encapsulation;
48 unsigned int initiator;
49 unsigned int t1;
50 unsigned int t2;
51 unsigned int t3;
52 unsigned int n2;
53 unsigned int mru;
54 unsigned int mtu;
55 unsigned int k;
56 unsigned int i;
57 unsigned int unused[8];
58};
59
60#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
61#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
62
63/**
64 * struct gsm_netconfig - n_gsm network configuration parameters
65 *
66 * This structure is used in combination with GSMIOC_ENABLE_NET and
67 * GSMIOC_DISABLE_NET to enable or disable a network data connection
68 * over a mux virtual tty channel. This is for modems that support
69 * data connections with raw IP frames instead of PPP.
70 *
71 * @adaption: Adaption to use in network mode.
72 * @protocol: Protocol to use - only ETH_P_IP supported.
73 * @unused2: Can not be used.
74 * @if_name: Interface name format string.
75 * @unused: Can not be used.
76 */
77struct gsm_netconfig {
78 unsigned int adaption;
79 unsigned short protocol;
80 unsigned short unused2;
81 char if_name[IFNAMSIZ];
82 __u8 unused[28];
83};
84
85#define GSMIOC_ENABLE_NET _IOW('G', 2, struct gsm_netconfig)
86#define GSMIOC_DISABLE_NET _IO('G', 3)
87
88/* get the base tty number for a configured gsmmux tty */
89#define GSMIOC_GETFIRST _IOR('G', 4, __u32)
90
91/**
92 * struct gsm_config_ext - n_gsm extended configuration parameters
93 *
94 * This structure is used in combination with GSMIOC_GETCONF_EXT and
95 * GSMIOC_SETCONF_EXT to retrieve and set the extended parameters of an
96 * n_gsm ldisc.
97 *
98 * All timers are in units of 1/100th of a second.
99 *
100 * @keep_alive: Control channel keep-alive in 1/100th of a second (0 to disable).
101 * @wait_config: Wait for DLCI config before opening virtual link?
102 * @flags: Mux specific flags.
103 * @reserved: For future use, must be initialized to zero.
104 */
105struct gsm_config_ext {
106 __u32 keep_alive;
107 __u32 wait_config;
108 __u32 flags;
109 __u32 reserved[5];
110};
111
112#define GSMIOC_GETCONF_EXT _IOR('G', 5, struct gsm_config_ext)
113#define GSMIOC_SETCONF_EXT _IOW('G', 6, struct gsm_config_ext)
114
115/**
116 * struct gsm_dlci_config - n_gsm channel configuration parameters
117 *
118 * This structure is used in combination with GSMIOC_GETCONF_DLCI and
119 * GSMIOC_SETCONF_DLCI to retrieve and set the channel specific parameters
120 * of an n_gsm ldisc.
121 *
122 * Set the channel accordingly before calling GSMIOC_GETCONF_DLCI.
123 *
124 * @channel: DLCI (0 for the associated DLCI).
125 * @adaption: Convergence layer type.
126 * @mtu: Maximum transfer unit.
127 * @priority: Priority (0 for default value).
128 * @i: Frame type (1 = UIH, 2 = UI).
129 * @k: Window size (0 for default value).
130 * @flags: DLCI specific flags.
131 * @reserved: For future use, must be initialized to zero.
132 */
133struct gsm_dlci_config {
134 __u32 channel;
135 __u32 adaption;
136 __u32 mtu;
137 __u32 priority;
138 __u32 i;
139 __u32 k;
140 __u32 flags;
141 __u32 reserved[7];
142};
143
144#define GSMIOC_GETCONF_DLCI _IOWR('G', 7, struct gsm_dlci_config)
145#define GSMIOC_SETCONF_DLCI _IOW('G', 8, struct gsm_dlci_config)
146
147#endif