]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/if_pppox.h
ACPI: fix acpi_find_child_device() invocation in acpi_preset_companion()
[mirror_ubuntu-bionic-kernel.git] / include / linux / if_pppox.h
CommitLineData
1da177e4
LT
1/***************************************************************************
2 * Linux PPP over X - Generic PPP transport layer sockets
3 * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516)
4 *
5 * This file supplies definitions required by the PPP over Ethernet driver
6 * (pppox.c). All version information wrt this file is located in pppox.c
7 *
8 * License:
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
1da177e4
LT
15#ifndef __LINUX_IF_PPPOX_H
16#define __LINUX_IF_PPPOX_H
17
1da177e4
LT
18#include <linux/if.h>
19#include <linux/netdevice.h>
1da177e4 20#include <linux/ppp_channel.h>
797659fb 21#include <linux/skbuff.h>
287f3a94 22#include <linux/workqueue.h>
607ca46e 23#include <uapi/linux/if_pppox.h>
797659fb
ACM
24
25static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
26{
d56f90a7 27 return (struct pppoe_hdr *)skb_network_header(skb);
797659fb
ACM
28}
29
1da177e4
LT
30struct pppoe_opt {
31 struct net_device *dev; /* device associated with socket*/
6f30e186 32 int ifindex; /* ifindex of device associated with socket */
1da177e4
LT
33 struct pppoe_addr pa; /* what this socket is bound to*/
34 struct sockaddr_pppox relay; /* what socket data will be
35 relayed to (PPPoE relaying) */
287f3a94 36 struct work_struct padt_work;/* Work item for handling PADT */
1da177e4
LT
37};
38
00959ade
DK
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};
1da177e4
LT
46#include <net/sock.h>
47
48struct pppox_sock {
49 /* struct sock must be the first member of pppox_sock */
00959ade
DK
50 struct sock sk;
51 struct ppp_channel chan;
1da177e4
LT
52 struct pppox_sock *next; /* for hash table */
53 union {
54 struct pppoe_opt pppoe;
00959ade 55 struct pptp_opt pptp;
1da177e4 56 } proto;
b963dc1d 57 __be16 num;
1da177e4
LT
58};
59#define pppoe_dev proto.pppoe.dev
6f30e186 60#define pppoe_ifindex proto.pppoe.ifindex
1da177e4
LT
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 {
11aa9c28 77 int (*create)(struct net *net, struct socket *sock, int kern);
1da177e4
LT
78 int (*ioctl)(struct socket *sock, unsigned int cmd,
79 unsigned long arg);
80 struct module *owner;
81};
82
756e64a0 83extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp);
1da177e4
LT
84extern void unregister_pppox_proto(int proto_num);
85extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
17ba15fb 86extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
bba3a826
AB
87extern int pppox_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
88
89#define PPPOEIOCSFWD32 _IOW(0xB1 ,0, compat_size_t)
1da177e4
LT
90
91/* PPPoX socket states */
92enum {
93 PPPOX_NONE = 0, /* initial state */
94 PPPOX_CONNECTED = 1, /* connection established ==TCP_ESTABLISHED */
95 PPPOX_BOUND = 2, /* bound to ppp device */
96 PPPOX_RELAY = 4, /* forwarding is enabled */
1da177e4
LT
97 PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/
98};
99
1da177e4 100#endif /* !(__LINUX_IF_PPPOX_H) */