diff --git a/README.md b/README.md index cdd3047..bd9384f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ This supports the following RFC dictionaries at the moment: - [RFC2867](https://tools.ietf.org/html/rfc2867) - [RFC2868](https://tools.ietf.org/html/rfc2868) - [RFC3576](https://tools.ietf.org/html/rfc3576) +- [RFC6677](https://tools.ietf.org/html/rfc6677) ## Usage @@ -46,7 +47,6 @@ Simple example implementations are here: - rfc5904 - rfc6519 - rfc6572 - - rfc6677 - rfc6911 - rfc6929 - rfc6930 diff --git a/dicts/dictionary.rfc6677 b/dicts/dictionary.rfc6677 new file mode 100644 index 0000000..8f29bcc --- /dev/null +++ b/dicts/dictionary.rfc6677 @@ -0,0 +1,20 @@ +# -*- text -*- +# Copyright (C) 2020 The FreeRADIUS Server project and contributors +# This work is licensed under CC-BY version 4.0 https://creativecommons.org/licenses/by/4.0 +# Version $Id$ +# +# Attributes and values defined in RFC 6677 +# http://www.ietf.org/rfc/rfc6677.txt +# + +ATTRIBUTE EAP-Lower-Layer 163 integer + +VALUE EAP-Lower-Layer Wired-IEEE-802.1X 1 +VALUE EAP-Lower-Layer IEEE-802.1X-No-Preauth 2 +VALUE EAP-Lower-Layer IEEE-802.1X-Preauth 3 +VALUE EAP-Lower-Layer IEEE-802.16e 4 +VALUE EAP-Lower-Layer IKEv2 5 +VALUE EAP-Lower-Layer PPP 6 +VALUE EAP-Lower-Layer PANA-No-Preauth 7 +VALUE EAP-Lower-Layer GSS-API 8 +VALUE EAP-Lower-Layer PANA-Preauth 9 diff --git a/radius/src/lib.rs b/radius/src/lib.rs index cd8b92f..b40a5ed 100644 --- a/radius/src/lib.rs +++ b/radius/src/lib.rs @@ -8,4 +8,5 @@ pub mod rfc2866; pub mod rfc2867; pub mod rfc2868; pub mod rfc3576; +pub mod rfc6677; pub mod tag; diff --git a/radius/src/rfc6677.rs b/radius/src/rfc6677.rs new file mode 100644 index 0000000..4f7ae4f --- /dev/null +++ b/radius/src/rfc6677.rs @@ -0,0 +1,35 @@ +// Code generated by machine generator; DO NOT EDIT. + +use crate::avp::{AVPError, AVPType, AVP}; +use crate::packet::Packet; + +pub type EapLowerLayer = u32; +pub const EAP_LOWER_LAYER_WIRED_IEEE_802_1X: EapLowerLayer = 1; +pub const EAP_LOWER_LAYER_IEEE_802_1X_NO_PREAUTH: EapLowerLayer = 2; +pub const EAP_LOWER_LAYER_IEEE_802_1X_PREAUTH: EapLowerLayer = 3; +pub const EAP_LOWER_LAYER_IEEE_802_1_6E: EapLowerLayer = 4; +pub const EAP_LOWER_LAYER_IK_EV_2: EapLowerLayer = 5; +pub const EAP_LOWER_LAYER_PPP: EapLowerLayer = 6; +pub const EAP_LOWER_LAYER_PANA_NO_PREAUTH: EapLowerLayer = 7; +pub const EAP_LOWER_LAYER_GSS_API: EapLowerLayer = 8; +pub const EAP_LOWER_LAYER_PANA_PREAUTH: EapLowerLayer = 9; + +pub const EAP_LOWER_LAYER_TYPE: AVPType = 163; +pub fn delete_eap_lower_layer(packet: &mut Packet) { + packet.delete(EAP_LOWER_LAYER_TYPE); +} +pub fn add_eap_lower_layer(packet: &mut Packet, value: EapLowerLayer) { + packet.add(AVP::from_u32(EAP_LOWER_LAYER_TYPE, value as u32)); +} +pub fn lookup_eap_lower_layer(packet: &Packet) -> Option> { + packet + .lookup(EAP_LOWER_LAYER_TYPE) + .map(|v| Ok(v.encode_u32()? as EapLowerLayer)) +} +pub fn lookup_all_eap_lower_layer(packet: &Packet) -> Result, AVPError> { + let mut vec = Vec::new(); + for avp in packet.lookup_all(EAP_LOWER_LAYER_TYPE) { + vec.push(avp.encode_u32()? as EapLowerLayer) + } + Ok(vec) +}