Watt-32 tcp/ip  2.2 dev-rel.10
pppoe.h
Go to the documentation of this file.
1 
3 #ifndef _w32_PPPOE_H
4 #define _w32_PPPOE_H
5 
6 #define PPPOE_CODE_PADI 0x09 /* Active Discovery Initiation */
7 #define PPPOE_CODE_PADO 0x07 /* Active Discovery Offer packet */
8 #define PPPOE_CODE_PADR 0x19 /* Active Discovery Request */
9 #define PPPOE_CODE_PADS 0x65 /* Active Discovery Session-confirmation */
10 #define PPPOE_CODE_PADT 0xA7 /* Active Discovery Terminate */
11 #define PPPOE_CODE_PADM 0xD3 /* Active Discovery Message packet */
12 #define PPPOE_CODE_PADN 0xD4 /* Active Discovery Network packet */
13 #define PPPOE_CODE_SESS 0x00 /* code when we have a session */
14 
15 /* These 16-bit tags are on network order (RFC2516).
16  */
17 #define PPPOE_TAG_END_LIST 0x0000
18 #define PPPOE_TAG_SERVICE_NAME 0x0101
19 #define PPPOE_TAG_AC_NAME 0x0102
20 #define PPPOE_TAG_HOST_UNIQ 0x0103
21 #define PPPOE_TAG_AC_COOKIE 0x0104
22 #define PPPOE_TAG_VENDOR_SPES 0x0105
23 #define PPPOE_TAG_RELAY_SESS 0x0106
24 #define PPPOE_TAG_HOST_URL 0x0111
25 #define PPPOE_TAG_MOTM 0x0112
26 #define PPPOE_TAG_IP_ROUTE_ADD 0x0121
27 #define PPPOE_TAG_SERVICE_ERR 0x0201
28 #define PPPOE_TAG_AC_SYSTEM_ERR 0x0202
29 #define PPPOE_TAG_GENERIC_ERR 0x0203
30 
31 #define PPPOE_HDR_SIZE 6 /* ver/type,code,session,length */
32 #define PPPOE_TAG_HDR_SIZE 4 /* type,length header */
33 
34 /*
35  * The PPPOE header (RFC-2561) excluding Ether-header.
36  */
37 #include <sys/pack_on.h>
38 
39 typedef struct pppoe_Packet {
40 #if defined(USE_BIGENDIAN)
41  BYTE type : 4;
42  BYTE ver : 4;
43 #else
44  BYTE ver : 4;
45  BYTE type : 4;
46 #endif
47  BYTE code;
48  WORD session;
49  WORD length;
50  BYTE data [PPPOE_MAX_DATA]; /* higher level proto at data[2] */
51  } pppoe_Packet;
52 
53 #include <sys/pack_off.h>
54 
55 
56 extern void pppoe_init (void);
57 extern void pppoe_exit (void);
58 extern int pppoe_start (void);
59 extern int pppoe_handler (const pppoe_Packet *pkt);
60 extern BOOL pppoe_is_up (const void *dest);
61 extern int pppoe_send_sess (const void *sock, const BYTE *buf, WORD len);
62 extern void *pppoe_mac_format (union link_Packet *buf);
63 
64 #endif
int pppoe_start(void)
Start PPPoE by doing a Discovery.
Definition: pppoe.c:184
void pppoe_exit(void)
Close down PPPoE by sending a PADT.
Definition: pppoe.c:209
BOOL pppoe_is_up(const void *dest)
Determine if we have a PPPoE session with the machine given by 'dest'.
Definition: pppoe.c:287
int pppoe_send_sess(const void *sock, const BYTE *buf, WORD len)
Build and send a PPPoE Session packet (IPCP or LCP packet).
Definition: pppoe.c:357
int pppoe_handler(const pppoe_Packet *pkt)
Handle incoming PPPoE packets.
Definition: pppoe.c:223
Definition: zinftree.h:24
void * pppoe_mac_format(union link_Packet *buf)
Build a PPPoE session packet header.
Definition: pppoe.c:377
void pppoe_init(void)
Set config-parser hook and initial values.
Definition: pppoe.c:166