1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef __LINUX_IF_PPPOX_H
16#define __LINUX_IF_PPPOX_H
17
18#include <linux/if.h>
19#include <linux/netdevice.h>
20#include <linux/ppp_channel.h>
21#include <linux/skbuff.h>
22#include <linux/workqueue.h>
23#include <uapi/linux/if_pppox.h>
24
25static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
26{
27 return (struct pppoe_hdr *)skb_network_header(skb);
28}
29
30struct pppoe_opt {
31 struct net_device *dev;
32 int ifindex;
33 struct pppoe_addr pa;
34 struct sockaddr_pppox relay;
35
36 struct work_struct padt_work;
37};
38
39struct pptp_opt {
40 struct pptp_addr src_addr;
41 struct pptp_addr dst_addr;
42 u32 ack_sent, ack_recv;
43 u32 seq_sent, seq_recv;
44 int ppp_flags;
45};
46#include <net/sock.h>
47
48struct pppox_sock {
49
50 struct sock sk;
51 struct ppp_channel chan;
52 struct pppox_sock *next;
53 union {
54 struct pppoe_opt pppoe;
55 struct pptp_opt pptp;
56 } proto;
57 __be16 num;
58};
59#define pppoe_dev proto.pppoe.dev
60#define pppoe_ifindex proto.pppoe.ifindex
61#define pppoe_pa proto.pppoe.pa
62#define pppoe_relay proto.pppoe.relay
63
64static inline struct pppox_sock *pppox_sk(struct sock *sk)
65{
66 return (struct pppox_sock *)sk;
67}
68
69static inline struct sock *sk_pppox(struct pppox_sock *po)
70{
71 return (struct sock *)po;
72}
73
74struct module;
75
76struct pppox_proto {
77 int (*create)(struct net *net, struct socket *sock);
78 int (*ioctl)(struct socket *sock, unsigned int cmd,
79 unsigned long arg);
80 struct module *owner;
81};
82
83extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp);
84extern void unregister_pppox_proto(int proto_num);
85extern void pppox_unbind_sock(struct sock *sk);
86extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
87
88
89enum {
90 PPPOX_NONE = 0,
91 PPPOX_CONNECTED = 1,
92 PPPOX_BOUND = 2,
93 PPPOX_RELAY = 4,
94 PPPOX_ZOMBIE = 8,
95 PPPOX_DEAD = 16
96};
97
98#endif
99