Commit | Line | Data |
---|---|---|
2874c5fd | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
1da177e4 LT |
2 | #ifndef _PPP_CHANNEL_H_ |
3 | #define _PPP_CHANNEL_H_ | |
4 | /* | |
5 | * Definitions for the interface between the generic PPP code | |
6 | * and a PPP channel. | |
7 | * | |
8 | * A PPP channel provides a way for the generic PPP code to send | |
9 | * and receive packets over some sort of communications medium. | |
10 | * Packets are stored in sk_buffs and have the 2-byte PPP protocol | |
11 | * number at the start, but not the address and control bytes. | |
12 | * | |
13 | * Copyright 1999 Paul Mackerras. | |
14 | * | |
1da177e4 LT |
15 | * ==FILEVERSION 20000322== |
16 | */ | |
17 | ||
18 | #include <linux/list.h> | |
19 | #include <linux/skbuff.h> | |
20 | #include <linux/poll.h> | |
273ec51d | 21 | #include <net/net_namespace.h> |
1da177e4 LT |
22 | |
23 | struct ppp_channel; | |
24 | ||
25 | struct ppp_channel_ops { | |
26 | /* Send a packet (or multilink fragment) on this channel. | |
27 | Returns 1 if it was accepted, 0 if not. */ | |
28 | int (*start_xmit)(struct ppp_channel *, struct sk_buff *); | |
29 | /* Handle an ioctl call that has come in via /dev/ppp. */ | |
30 | int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long); | |
f6efc675 FF |
31 | int (*fill_forward_path)(struct net_device_path_ctx *, |
32 | struct net_device_path *, | |
33 | const struct ppp_channel *); | |
1da177e4 LT |
34 | }; |
35 | ||
36 | struct ppp_channel { | |
37 | void *private; /* channel private data */ | |
d7100da0 | 38 | const struct ppp_channel_ops *ops; /* operations for this channel */ |
1da177e4 LT |
39 | int mtu; /* max transmit packet size */ |
40 | int hdrlen; /* amount of headroom channel needs */ | |
41 | void *ppp; /* opaque to channel */ | |
1da177e4 | 42 | int speed; /* transfer rate (bytes/second) */ |
9c705260 | 43 | /* the following is not used at present */ |
1da177e4 LT |
44 | int latency; /* overhead time in milliseconds */ |
45 | }; | |
46 | ||
47 | #ifdef __KERNEL__ | |
48 | /* Called by the channel when it can send some more data. */ | |
49 | extern void ppp_output_wakeup(struct ppp_channel *); | |
50 | ||
51 | /* Called by the channel to process a received PPP packet. | |
52 | The packet should have just the 2-byte PPP protocol header. */ | |
53 | extern void ppp_input(struct ppp_channel *, struct sk_buff *); | |
54 | ||
55 | /* Called by the channel when an input error occurs, indicating | |
56 | that we may have missed a packet. */ | |
57 | extern void ppp_input_error(struct ppp_channel *, int code); | |
58 | ||
273ec51d CG |
59 | /* Attach a channel to a given PPP unit in specified net. */ |
60 | extern int ppp_register_net_channel(struct net *, struct ppp_channel *); | |
61 | ||
1da177e4 LT |
62 | /* Attach a channel to a given PPP unit. */ |
63 | extern int ppp_register_channel(struct ppp_channel *); | |
64 | ||
65 | /* Detach a channel from its PPP unit (e.g. on hangup). */ | |
66 | extern void ppp_unregister_channel(struct ppp_channel *); | |
67 | ||
68 | /* Get the channel number for a channel */ | |
69 | extern int ppp_channel_index(struct ppp_channel *); | |
70 | ||
71 | /* Get the unit number associated with a channel, or -1 if none */ | |
72 | extern int ppp_unit_number(struct ppp_channel *); | |
73 | ||
63f96072 JC |
74 | /* Get the device name associated with a channel, or NULL if none */ |
75 | extern char *ppp_dev_name(struct ppp_channel *); | |
76 | ||
1da177e4 LT |
77 | /* |
78 | * SMP locking notes: | |
79 | * The channel code must ensure that when it calls ppp_unregister_channel, | |
80 | * nothing is executing in any of the procedures above, for that | |
81 | * channel. The generic layer will ensure that nothing is executing | |
82 | * in the start_xmit and ioctl routines for the channel by the time | |
83 | * that ppp_unregister_channel returns. | |
84 | */ | |
85 | ||
86 | #endif /* __KERNEL__ */ | |
87 | #endif |