summaryrefslogtreecommitdiffstats
path: root/shared/opensource/include/bcm963xx/wan_det.h
diff options
context:
space:
mode:
Diffstat (limited to 'shared/opensource/include/bcm963xx/wan_det.h')
-rwxr-xr-xshared/opensource/include/bcm963xx/wan_det.h245
1 files changed, 245 insertions, 0 deletions
diff --git a/shared/opensource/include/bcm963xx/wan_det.h b/shared/opensource/include/bcm963xx/wan_det.h
new file mode 100755
index 0000000..d8a5645
--- /dev/null
+++ b/shared/opensource/include/bcm963xx/wan_det.h
@@ -0,0 +1,245 @@
+/***************************************************************************
+***
+*** Copyright 2008 Hon Hai Precision Ind. Co. Ltd.
+*** All Rights Reserved.
+*** No portions of this material shall be reproduced in any form without the
+*** written permission of Hon Hai Precision Ind. Co. Ltd.
+***
+*** All information contained in this document is Hon Hai Precision Ind.
+*** Co. Ltd. company private, proprietary, and trade secret property and
+*** are protected by international intellectual property laws and treaties.
+***
+****************************************************************************/
+
+#ifndef __WAN_DET_H__
+#define __WAN_DET_H__
+
+/* Foxconn added start Bob, 01/22/2010 */
+
+#define MAX_SCAN_SERVICE 8
+
+typedef struct _vpivcitable
+{
+ int portId;
+ int vpi;
+ int vci;
+}_VpiVciTable;
+
+
+typedef struct scanResult
+{
+ _VpiVciTable service[MAX_SCAN_SERVICE];
+ _VpiVciTable oam;
+ _VpiVciTable BPDU;
+}SCAN_RESULT;
+/* Foxconn added end Bob, 01/22/2010 */
+
+typedef unsigned short U16;
+typedef unsigned int U32;
+typedef unsigned char U8;
+
+#define PATTERN_ROUTED 0
+#define PATTERN_BRIDGED 1
+
+#define ETHER_TYPE_OFFSET 12
+#define ETHERTYPE_IP 0x0800
+#define ETHERTYPE_ARP 0x0806
+#define ETHERTYPE_PPPOE_DISCOVERY 0x8863
+#define ETHERHEADER_LEN 14
+
+typedef struct _PacketContent
+{
+ U32 length;
+ U8 *data;
+}PacketContent;
+
+typedef struct _Pattern
+{
+ const char *name;
+ const PacketContent *payload;
+ int protoType;
+ U16 ethertype;
+ const PacketContent *header;
+ const PacketContent *expected_payload;
+
+}Pattern;
+
+
+static U8 dhcp_request_bytes[] = {
+
+ // IP header
+ 0x45, 0x00, 0x01, 0x48, // version, IHL, TOS, Total Length
+ 0x00, 0x04, 0x00, 0x00, // ident, flags, frag off
+ 0x9b, 0x11, 0x1e, 0xa2, // TTL, proto, hdr checksum
+ 0x00, 0x00, 0x00, 0x00, // source addr
+ 0xff, 0xff, 0xff, 0xff, // destination addr
+
+ // UDP header
+ 0x00, 0x44, 0x00, 0x43, 0x01, 0x34, 0xe6, 0x9a, 0x01, 0x01, 0x06, 0x00,
+ 0xb3, 0x05, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x2b, 0x00, 0x74, 0xb1, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x82, 0x53, 0x63, 0x35, 0x01, 0x01, 0x33,
+ 0x04, 0x00, 0x00, 0x1c, 0x20, 0x37, 0x07, 0x01, 0x1c, 0x02, 0x03, 0x0f, 0x06, 0x0c, 0xff, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+
+};
+
+static PacketContent dhcp_request = { sizeof(dhcp_request_bytes), dhcp_request_bytes
+};
+
+static U8 pppoe_padi_bytes[] = {
+ 0x11, 0x09, 0x00, 0x00, 0x00, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+static PacketContent pppoe_padi = { sizeof(pppoe_padi_bytes), pppoe_padi_bytes };
+
+/** Sequence of bytes for a PPP LCP Configure-Request (RFC1661). */
+static U8 ppp_lcp_confreq_bytes[] = {
+ 0xc0, 0x21, // LCP
+ 0x01, // Configure Request
+ 0x99, // randomish identifier
+ 0x00, 0x04, // length
+};
+static PacketContent ppp_lcp_confreq = { sizeof(ppp_lcp_confreq_bytes), ppp_lcp_confreq_bytes };
+
+/** Expected response from NULL (aka VcMux) encapsulated PPP/LCP */
+static U8 ppp_lcp_response_bytes[] = { 0xc0, 0x21 };
+static PacketContent ppp_lcp_response = { sizeof(ppp_lcp_response_bytes), ppp_lcp_response_bytes };
+
+/** SNAP/LLC routed */
+static U8 snap_llc_routed_bytes[] = { 0xaa, 0xaa, 3, 0, 0, 0, 8, 0 };
+static PacketContent snap_llc_routed = { sizeof(snap_llc_routed_bytes), snap_llc_routed_bytes };
+
+/** SNAP/LLC bridged, no fcs */
+static U8 snap_llc_bridged_bytes[] = {
+ 0xaa, 0xaa, 0x3, // LLC
+ 0x0, 0x80, 0xc2, // OUI
+ 0x00, 0x07, // PID
+ 0x00, 0x00 // PAD
+ };
+static PacketContent snap_llc_bridged = { sizeof(snap_llc_bridged_bytes), snap_llc_bridged_bytes };
+
+/* foxconn added start Bob, 12/07/2009, ignore BPDU frame */
+/** SNAP/LLC bridged BPDU */
+static U8 snap_llc_bridged_BPDU_bytes[] = {
+ 0xaa, 0xaa, 0x3, // LLC
+ 0x0, 0x80, 0xc2, // OUI
+ 0x00, 0x0e, // PID
+ };
+ /* foxconn added end Bob, 12/07/2009, ignore BPDU frame */
+
+/** LLC for PPPoA. See RFC2364 section 6. */
+static U8 llc_pppoa_bytes[] = { 0xfe, 0xfe, 0x03, 0xcf };
+static PacketContent llc_pppoa = {
+ sizeof(llc_pppoa_bytes), llc_pppoa_bytes
+};
+
+static U8 vcmux_bridged_bytes[] = { 0, 0 };
+static PacketContent vcmux_bridged = { sizeof(vcmux_bridged_bytes), vcmux_bridged_bytes };
+
+/**
+Patterns to be sent to CO side
+1. PPPoE LLC Bridged
+2. VcMux encapsulated PPPoA
+3. LLC encapsulated PPPoA
+4. RFC1483 SNAP/LLC Routed
+5. RFC1483 VcMux Bridged
+6. PPPoE VCMux Bridged
+7. RFC1483 SNAP/LLC Bridged
+8. RFC1483 VcMux Routed
+*/
+static Pattern patterns[] =
+{
+ {
+ "PPPoE LLC Bridged",
+ &pppoe_padi,
+ PATTERN_BRIDGED,
+ ETHERTYPE_PPPOE_DISCOVERY,
+ &snap_llc_bridged,
+ NULL
+ },
+ {
+ "VcMux encapsulated PPPoA",
+ &ppp_lcp_confreq,
+ PATTERN_ROUTED,
+ 0, // no need for etherheader!
+ NULL,
+ &ppp_lcp_response
+ },
+
+ {
+ "LLC encapsulated PPPoA",
+ &ppp_lcp_confreq,
+ PATTERN_ROUTED,
+ 0, // no need for etherheader!
+ &llc_pppoa, // encapsulated with PPPoA LLC header
+ NULL
+ },
+
+ /* RFC1483 SNAP/LLC routed */
+ {
+ "RFC1483 SNAP/LLC Routed",
+ &dhcp_request,
+ PATTERN_ROUTED,
+ 0,
+ &snap_llc_routed,
+ NULL
+ },
+
+ /* RFC1483 VC mux bridged */
+ {
+ "RFC1483 VcMux Bridged",
+ &dhcp_request,
+ PATTERN_BRIDGED,
+ ETHERTYPE_IP,
+ &vcmux_bridged,
+ NULL
+ },
+
+ /* PPPOE VCMux Bridged*/
+ {
+ "PPPoE VCMux Bridged",
+ &pppoe_padi,
+ PATTERN_BRIDGED,
+ ETHERTYPE_PPPOE_DISCOVERY,
+ &vcmux_bridged,
+ NULL
+ },
+
+ /* RFC1483 SNAP/LLC bridged */
+ {
+ "RFC1483 SNAP/LLC Bridged",
+ &dhcp_request,
+ PATTERN_BRIDGED,
+ ETHERTYPE_IP,
+ &snap_llc_bridged,
+ NULL
+ },
+
+ /* RFC1483 VC mux routed */
+ {
+ "RFC1483 VcMux Routed",
+ &dhcp_request,
+ PATTERN_ROUTED,
+ 0,
+ NULL,
+ NULL
+ },
+};
+
+#endif /* __WAN_DET_H__ */