shill: EapListener: New class for listening for EAP
Create an entity that listens for EAP traffic on a given interface
index. It will invoke a callback method when an EAP request is
received.
BUG=chromium:225914
TEST=Unit tests + manual: Used core code base with real sockets and
a veth pair with hostapd running in wired mode on the other end.
Change-Id: If2e1c0100dc65875ef61d5747482cc1bae3cfd36
Reviewed-on: https://gerrit.chromium.org/gerrit/47212
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
diff --git a/eap_protocol.h b/eap_protocol.h
new file mode 100644
index 0000000..34cf224
--- /dev/null
+++ b/eap_protocol.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_EAP_PROTOCOL_H_
+#define SHILL_EAP_PROTOCOL_H_
+
+#include <base/basictypes.h>
+#include <base/compiler_specific.h>
+
+namespace shill {
+
+namespace eap_protocol {
+
+struct ALIGNAS(1) Ieee8021xHdr {
+ uint8 version;
+ uint8 type;
+ uint16 length;
+};
+
+enum IeeeEapolVersion {
+ kIeee8021xEapolVersion2 = 2
+};
+
+enum IeeeEapolType {
+ kIIeee8021xTypeEapPacket = 0,
+ kIIeee8021xTypeEapolStart = 1,
+ kIIeee8021xTypeEapolLogoff = 2,
+ kIIeee8021xTypeEapolKey = 3,
+ kIIeee8021xTypeEapolEncapsulatedAsfAlert = 4
+};
+
+struct ALIGNAS(1) EapHeader {
+ uint8 code;
+ uint8 identifier;
+ uint16 length; // including code and identifier; network byte order
+};
+
+enum EapCode {
+ kEapCodeRequest = 1,
+ kEapCodeRespnose = 2,
+ kEapCodeSuccess = 3,
+ kEapCodeFailure = 4
+};
+
+} // namespace eap_protocol
+
+} // namespace shill
+
+#endif // SHILL_EAP_PROTOCOL_H_