diff options
author | Kozlov Dmitry <dima@server> | 2010-10-08 12:16:07 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-10-08 12:16:07 +0400 |
commit | c258ec9bc665fdbd479498a77aea5589b316e074 (patch) | |
tree | 4db52663a053e7237e06d1474e603f97b17aafa2 /accel-pptpd/ctrl/pppoe.h | |
parent | 66ecf5cd90f437b508749e64914daed0a9e2ba3e (diff) | |
download | accel-ppp-c258ec9bc665fdbd479498a77aea5589b316e074.tar.gz accel-ppp-c258ec9bc665fdbd479498a77aea5589b316e074.zip |
ctrl: implemented PPPoE server
Diffstat (limited to 'accel-pptpd/ctrl/pppoe.h')
-rw-r--r-- | accel-pptpd/ctrl/pppoe.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/accel-pptpd/ctrl/pppoe.h b/accel-pptpd/ctrl/pppoe.h new file mode 100644 index 0000000..0506108 --- /dev/null +++ b/accel-pptpd/ctrl/pppoe.h @@ -0,0 +1,59 @@ +#ifndef __PPPOE_H +#define __PPPOE_H + +#include <linux/if.h> +#include <linux/if_pppox.h> + +/* PPPoE codes */ +#define CODE_PADI 0x09 +#define CODE_PADO 0x07 +#define CODE_PADR 0x19 +#define CODE_PADS 0x65 +#define CODE_PADT 0xA7 +#define CODE_SESS 0x00 + +/* PPPoE Tags */ +#define TAG_END_OF_LIST 0x0000 +#define TAG_SERVICE_NAME 0x0101 +#define TAG_AC_NAME 0x0102 +#define TAG_HOST_UNIQ 0x0103 +#define TAG_AC_COOKIE 0x0104 +#define TAG_VENDOR_SPECIFIC 0x0105 +#define TAG_RELAY_SESSION_ID 0x0110 +#define TAG_SERVICE_NAME_ERROR 0x0201 +#define TAG_AC_SYSTEM_ERROR 0x0202 +#define TAG_GENERIC_ERROR 0x0203 + +/* Discovery phase states */ +#define STATE_SENT_PADI 0 +#define STATE_RECEIVED_PADO 1 +#define STATE_SENT_PADR 2 +#define STATE_SESSION 3 +#define STATE_TERMINATED 4 + +/* Header size of a PPPoE packet */ +#define PPPOE_OVERHEAD 6 /* type, code, session, length */ +#define HDR_SIZE (sizeof(struct ethhdr) + PPPOE_OVERHEAD) +#define MAX_PPPOE_PAYLOAD (ETH_DATA_LEN - PPPOE_OVERHEAD) +#define MAX_PPPOE_MTU (MAX_PPPOE_PAYLOAD - 2) + +#define MAX_SID 65534 + +struct pppoe_tag_t +{ + struct list_head entry; + int type; + int len; +}; + +struct pppoe_packet_t +{ + uint8_t src[ETH_ALEN]; + uint8_t dst[ETH_ALEN]; + int code; + uint16_t sid; + struct list_head tags; +}; + +#endif + |