if_pppox.h
001: 
002: 
003: 
004: 
005: 
006: 
007: 
008: 
009: 
010: 
011: 
012: 
013: 
014: 
015: 
016: #ifndef __LINUX_IF_PPPOX_H
017: #define __LINUX_IF_PPPOX_H
018: 
019: 
020: #include <linux/types.h>
021: #include <asm/byteorder.h>
022: 
023: #include <linux/socket.h>
024: #include <linux/if_ether.h>
025: #include <linux/if_pppol2tp.h>
026: 
027: 
028: 
029: 
030: #ifndef AF_PPPOX
031: #define AF_PPPOX        24
032: #define PF_PPPOX        AF_PPPOX
033: #endif 
034: 
035: 
036: 
037:  
038: typedef __be16 sid_t;
039: struct pppoe_addr {
040:         sid_t         sid;                    
041:         unsigned char remote[ETH_ALEN];       
042:         char          dev[IFNAMSIZ];          
043: }; 
044:  
045: 
046: 
047: 
048: struct pptp_addr {
049:         __be16          call_id;
050:         struct in_addr  sin_addr;
051: };
052: 
053: 
054: 
055: 
056: #define PX_PROTO_OE    0 
057: #define PX_PROTO_OL2TP 1 
058: #define PX_PROTO_PPTP  2
059: #define PX_MAX_PROTO   3
060: 
061: struct sockaddr_pppox {
062:         __kernel_sa_family_t sa_family;       
063:         unsigned int    sa_protocol;          
064:         union {
065:                 struct pppoe_addr  pppoe;
066:                 struct pptp_addr   pptp;
067:         } sa_addr;
068: } __attribute__((packed));
069: 
070: 
071: 
072: 
073: 
074: 
075: struct sockaddr_pppol2tp {
076:         __kernel_sa_family_t sa_family; 
077:         unsigned int    sa_protocol;    
078:         struct pppol2tp_addr pppol2tp;
079: } __attribute__((packed));
080: 
081: 
082: 
083: 
084: struct sockaddr_pppol2tpv3 {
085:         __kernel_sa_family_t sa_family; 
086:         unsigned int    sa_protocol;    
087:         struct pppol2tpv3_addr pppol2tp;
088: } __attribute__((packed));
089: 
090: 
091: 
092: 
093: 
094: 
095: 
096: #define PPPOEIOCSFWD    _IOW(0xB1 ,0, size_t)
097: #define PPPOEIOCDFWD    _IO(0xB1 ,1)
098: 
099: 
100: 
101: #define PADI_CODE       0x09
102: #define PADO_CODE       0x07
103: #define PADR_CODE       0x19
104: #define PADS_CODE       0x65
105: #define PADT_CODE       0xa7
106: struct pppoe_tag {
107:         __be16 tag_type;
108:         __be16 tag_len;
109:         char tag_data[0];
110: } __attribute__ ((packed));
111: 
112: 
113: #define PTT_EOL         __cpu_to_be16(0x0000)
114: #define PTT_SRV_NAME    __cpu_to_be16(0x0101)
115: #define PTT_AC_NAME     __cpu_to_be16(0x0102)
116: #define PTT_HOST_UNIQ   __cpu_to_be16(0x0103)
117: #define PTT_AC_COOKIE   __cpu_to_be16(0x0104)
118: #define PTT_VENDOR      __cpu_to_be16(0x0105)
119: #define PTT_RELAY_SID   __cpu_to_be16(0x0110)
120: #define PTT_SRV_ERR     __cpu_to_be16(0x0201)
121: #define PTT_SYS_ERR     __cpu_to_be16(0x0202)
122: #define PTT_GEN_ERR     __cpu_to_be16(0x0203)
123: 
124: struct pppoe_hdr {
125: #if defined(__LITTLE_ENDIAN_BITFIELD)
126:         __u8 ver : 4;
127:         __u8 type : 4;
128: #elif defined(__BIG_ENDIAN_BITFIELD)
129:         __u8 type : 4;
130:         __u8 ver : 4;
131: #else
132: #error  "Please fix <asm/byteorder.h>"
133: #endif
134:         __u8 code;
135:         __be16 sid;
136:         __be16 length;
137:         struct pppoe_tag tag[0];
138: } __attribute__((packed));
139: 
140: 
141: #define PPPOE_SES_HLEN  8
142: 
143: 
144: #endif 
145: 
      
      
      
      
   
      
      
         
            
            © Andrew Scott 2006 -
            2025, 
            All Rights Reserved