0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __LINUX_IF_PPPOX_H
0012 #define __LINUX_IF_PPPOX_H
0013
0014 #include <linux/if.h>
0015 #include <linux/netdevice.h>
0016 #include <linux/ppp_channel.h>
0017 #include <linux/skbuff.h>
0018 #include <linux/workqueue.h>
0019 #include <uapi/linux/if_pppox.h>
0020
0021 static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
0022 {
0023 return (struct pppoe_hdr *)skb_network_header(skb);
0024 }
0025
0026 struct pppoe_opt {
0027 struct net_device *dev;
0028 int ifindex;
0029 struct pppoe_addr pa;
0030 struct sockaddr_pppox relay;
0031
0032 struct work_struct padt_work;
0033 };
0034
0035 struct pptp_opt {
0036 struct pptp_addr src_addr;
0037 struct pptp_addr dst_addr;
0038 u32 ack_sent, ack_recv;
0039 u32 seq_sent, seq_recv;
0040 int ppp_flags;
0041 };
0042 #include <net/sock.h>
0043
0044 struct pppox_sock {
0045
0046 struct sock sk;
0047 struct ppp_channel chan;
0048 struct pppox_sock *next;
0049 union {
0050 struct pppoe_opt pppoe;
0051 struct pptp_opt pptp;
0052 } proto;
0053 __be16 num;
0054 };
0055 #define pppoe_dev proto.pppoe.dev
0056 #define pppoe_ifindex proto.pppoe.ifindex
0057 #define pppoe_pa proto.pppoe.pa
0058 #define pppoe_relay proto.pppoe.relay
0059
0060 static inline struct pppox_sock *pppox_sk(struct sock *sk)
0061 {
0062 return (struct pppox_sock *)sk;
0063 }
0064
0065 static inline struct sock *sk_pppox(struct pppox_sock *po)
0066 {
0067 return (struct sock *)po;
0068 }
0069
0070 struct module;
0071
0072 struct pppox_proto {
0073 int (*create)(struct net *net, struct socket *sock, int kern);
0074 int (*ioctl)(struct socket *sock, unsigned int cmd,
0075 unsigned long arg);
0076 struct module *owner;
0077 };
0078
0079 extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp);
0080 extern void unregister_pppox_proto(int proto_num);
0081 extern void pppox_unbind_sock(struct sock *sk);
0082 extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
0083 extern int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
0084
0085 #define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t)
0086
0087
0088 enum {
0089 PPPOX_NONE = 0,
0090 PPPOX_CONNECTED = 1,
0091 PPPOX_BOUND = 2,
0092 PPPOX_RELAY = 4,
0093 PPPOX_DEAD = 16
0094 };
0095
0096 #endif