#include <linux/errno.h>
#include <linux/hdlc.h>
#include <linux/if_arp.h>
#include <linux/inetdevice.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pkt_sched.h>
#include <linux/poll.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#define DEBUG_CP …
#define DEBUG_STATE …
#define DEBUG_HARD_HEADER …
#define HDLC_ADDR_ALLSTATIONS …
#define HDLC_CTRL_UI …
#define PID_LCP …
#define PID_IP …
#define PID_IPCP …
#define PID_IPV6 …
#define PID_IPV6CP …
enum { … };
enum { … };
#if DEBUG_CP
static const char *const code_names[CP_CODES] = {
"0", "ConfReq", "ConfAck", "ConfNak", "ConfRej", "TermReq",
"TermAck", "CodeRej", "ProtoRej", "EchoReq", "EchoReply", "Discard"
};
static char debug_buffer[64 + 3 * DEBUG_CP];
#endif
enum { … };
struct hdlc_header { … };
struct cp_header { … };
struct proto { … };
struct ppp { … };
enum { … };
enum { … };
enum { … };
#if DEBUG_STATE
static const char *const state_names[STATES] = {
"Closed", "Stopped", "Stopping", "ReqSent", "AckRecv", "AckSent",
"Opened"
};
static const char *const event_names[EVENTS] = {
"Start", "Stop", "TO+", "TO-", "RCR+", "RCR-", "RCA", "RCN",
"RTR", "RTA", "RUC", "RXJ+", "RXJ-"
};
#endif
static struct sk_buff_head tx_queue;
static int ppp_ioctl(struct net_device *dev, struct if_settings *ifs);
static inline struct ppp *get_ppp(struct net_device *dev)
{ … }
static inline struct proto *get_proto(struct net_device *dev, u16 pid)
{ … }
static inline const char *proto_name(u16 pid)
{ … }
static __be16 ppp_type_trans(struct sk_buff *skb, struct net_device *dev)
{ … }
static int ppp_hard_header(struct sk_buff *skb, struct net_device *dev,
u16 type, const void *daddr, const void *saddr,
unsigned int len)
{ … }
static void ppp_tx_flush(void)
{ … }
static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code,
u8 id, unsigned int len, const void *data)
{ … }
static int cp_table[EVENTS][STATES] = …;
static void ppp_cp_event(struct net_device *dev, u16 pid, u16 event, u8 code,
u8 id, unsigned int len, const void *data)
{ … }
static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
unsigned int req_len, const u8 *data)
{ … }
static int ppp_rx(struct sk_buff *skb)
{ … }
static void ppp_timer(struct timer_list *t)
{ … }
static void ppp_start(struct net_device *dev)
{ … }
static void ppp_stop(struct net_device *dev)
{ … }
static void ppp_close(struct net_device *dev)
{ … }
static struct hdlc_proto proto = …;
static const struct header_ops ppp_header_ops = …;
static int ppp_ioctl(struct net_device *dev, struct if_settings *ifs)
{ … }
static int __init hdlc_ppp_init(void)
{ … }
static void __exit hdlc_ppp_exit(void)
{ … }
module_init(…) …;
module_exit(hdlc_ppp_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;