]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/kernel-video.git/blob - include/linux/if_pppox.h
Merge branch 'p-ti-linux-3.8.y' into p-ti-android-3.8.y
[android-sdk/kernel-video.git] / include / linux / if_pppox.h
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  */
15 #ifndef __LINUX_IF_PPPOX_H
16 #define __LINUX_IF_PPPOX_H
18 #include <linux/if.h>
19 #include <linux/netdevice.h>
20 #include <linux/ppp_channel.h>
21 #include <linux/skbuff.h>
22 #include <uapi/linux/if_pppox.h>
24 static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
25 {
26         return (struct pppoe_hdr *)skb_network_header(skb);
27 }
29 struct pppoe_opt {
30         struct net_device      *dev;      /* device associated with socket*/
31         int                     ifindex;  /* ifindex of device associated with socket */
32         struct pppoe_addr       pa;       /* what this socket is bound to*/
33         struct sockaddr_pppox   relay;    /* what socket data will be
34                                              relayed to (PPPoE relaying) */
35 };
37 struct pptp_opt {
38         struct pptp_addr src_addr;
39         struct pptp_addr dst_addr;
40         u32 ack_sent, ack_recv;
41         u32 seq_sent, seq_recv;
42         int ppp_flags;
43 };
45 struct pppolac_opt {
46         __u32           local;
47         __u32           remote;
48         __u32           recv_sequence;
49         __u32           xmit_sequence;
50         atomic_t        sequencing;
51         int             (*backlog_rcv)(struct sock *sk_udp, struct sk_buff *skb);
52 };
54 struct pppopns_opt {
55         __u16           local;
56         __u16           remote;
57         __u32           recv_sequence;
58         __u32           xmit_sequence;
59         void            (*data_ready)(struct sock *sk_raw, int length);
60         int             (*backlog_rcv)(struct sock *sk_raw, struct sk_buff *skb);
61 };
63 #include <net/sock.h>
65 struct pppox_sock {
66         /* struct sock must be the first member of pppox_sock */
67         struct sock sk;
68         struct ppp_channel chan;
69         struct pppox_sock       *next;    /* for hash table */
70         union {
71                 struct pppoe_opt pppoe;
72                 struct pptp_opt  pptp;
73                 struct pppolac_opt lac;
74                 struct pppopns_opt pns;
75         } proto;
76         __be16                  num;
77 };
78 #define pppoe_dev       proto.pppoe.dev
79 #define pppoe_ifindex   proto.pppoe.ifindex
80 #define pppoe_pa        proto.pppoe.pa
81 #define pppoe_relay     proto.pppoe.relay
83 static inline struct pppox_sock *pppox_sk(struct sock *sk)
84 {
85         return (struct pppox_sock *)sk;
86 }
88 static inline struct sock *sk_pppox(struct pppox_sock *po)
89 {
90         return (struct sock *)po;
91 }
93 struct module;
95 struct pppox_proto {
96         int             (*create)(struct net *net, struct socket *sock);
97         int             (*ioctl)(struct socket *sock, unsigned int cmd,
98                                  unsigned long arg);
99         struct module   *owner;
100 };
102 extern int register_pppox_proto(int proto_num, const struct pppox_proto *pp);
103 extern void unregister_pppox_proto(int proto_num);
104 extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */
105 extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
107 /* PPPoX socket states */
108 enum {
109     PPPOX_NONE          = 0,  /* initial state */
110     PPPOX_CONNECTED     = 1,  /* connection established ==TCP_ESTABLISHED */
111     PPPOX_BOUND         = 2,  /* bound to ppp device */
112     PPPOX_RELAY         = 4,  /* forwarding is enabled */
113     PPPOX_ZOMBIE        = 8,  /* dead, but still bound to ppp device */
114     PPPOX_DEAD          = 16  /* dead, useless, please clean me up!*/
115 };
117 #endif /* !(__LINUX_IF_PPPOX_H) */