![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-or-later */ 0002 #ifndef _PPP_CHANNEL_H_ 0003 #define _PPP_CHANNEL_H_ 0004 /* 0005 * Definitions for the interface between the generic PPP code 0006 * and a PPP channel. 0007 * 0008 * A PPP channel provides a way for the generic PPP code to send 0009 * and receive packets over some sort of communications medium. 0010 * Packets are stored in sk_buffs and have the 2-byte PPP protocol 0011 * number at the start, but not the address and control bytes. 0012 * 0013 * Copyright 1999 Paul Mackerras. 0014 * 0015 * ==FILEVERSION 20000322== 0016 */ 0017 0018 #include <linux/list.h> 0019 #include <linux/skbuff.h> 0020 #include <linux/poll.h> 0021 #include <net/net_namespace.h> 0022 0023 struct net_device_path; 0024 struct net_device_path_ctx; 0025 struct ppp_channel; 0026 0027 struct ppp_channel_ops { 0028 /* Send a packet (or multilink fragment) on this channel. 0029 Returns 1 if it was accepted, 0 if not. */ 0030 int (*start_xmit)(struct ppp_channel *, struct sk_buff *); 0031 /* Handle an ioctl call that has come in via /dev/ppp. */ 0032 int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long); 0033 int (*fill_forward_path)(struct net_device_path_ctx *, 0034 struct net_device_path *, 0035 const struct ppp_channel *); 0036 }; 0037 0038 struct ppp_channel { 0039 void *private; /* channel private data */ 0040 const struct ppp_channel_ops *ops; /* operations for this channel */ 0041 int mtu; /* max transmit packet size */ 0042 int hdrlen; /* amount of headroom channel needs */ 0043 void *ppp; /* opaque to channel */ 0044 int speed; /* transfer rate (bytes/second) */ 0045 /* the following is not used at present */ 0046 int latency; /* overhead time in milliseconds */ 0047 }; 0048 0049 #ifdef __KERNEL__ 0050 /* Called by the channel when it can send some more data. */ 0051 extern void ppp_output_wakeup(struct ppp_channel *); 0052 0053 /* Called by the channel to process a received PPP packet. 0054 The packet should have just the 2-byte PPP protocol header. */ 0055 extern void ppp_input(struct ppp_channel *, struct sk_buff *); 0056 0057 /* Called by the channel when an input error occurs, indicating 0058 that we may have missed a packet. */ 0059 extern void ppp_input_error(struct ppp_channel *, int code); 0060 0061 /* Attach a channel to a given PPP unit in specified net. */ 0062 extern int ppp_register_net_channel(struct net *, struct ppp_channel *); 0063 0064 /* Attach a channel to a given PPP unit. */ 0065 extern int ppp_register_channel(struct ppp_channel *); 0066 0067 /* Detach a channel from its PPP unit (e.g. on hangup). */ 0068 extern void ppp_unregister_channel(struct ppp_channel *); 0069 0070 /* Get the channel number for a channel */ 0071 extern int ppp_channel_index(struct ppp_channel *); 0072 0073 /* Get the unit number associated with a channel, or -1 if none */ 0074 extern int ppp_unit_number(struct ppp_channel *); 0075 0076 /* Get the device name associated with a channel, or NULL if none */ 0077 extern char *ppp_dev_name(struct ppp_channel *); 0078 0079 /* 0080 * SMP locking notes: 0081 * The channel code must ensure that when it calls ppp_unregister_channel, 0082 * nothing is executing in any of the procedures above, for that 0083 * channel. The generic layer will ensure that nothing is executing 0084 * in the start_xmit and ioctl routines for the channel by the time 0085 * that ppp_unregister_channel returns. 0086 */ 0087 0088 #endif /* __KERNEL__ */ 0089 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |