Support RFC6677

This commit is contained in:
moznion
2020-12-02 02:44:12 +09:00
parent 6e59de2707
commit 258416839b
4 changed files with 57 additions and 1 deletions
+1 -1
View File
@@ -15,6 +15,7 @@ This supports the following RFC dictionaries at the moment:
- [RFC2867](https://tools.ietf.org/html/rfc2867) - [RFC2867](https://tools.ietf.org/html/rfc2867)
- [RFC2868](https://tools.ietf.org/html/rfc2868) - [RFC2868](https://tools.ietf.org/html/rfc2868)
- [RFC3576](https://tools.ietf.org/html/rfc3576) - [RFC3576](https://tools.ietf.org/html/rfc3576)
- [RFC6677](https://tools.ietf.org/html/rfc6677)
## Usage ## Usage
@@ -46,7 +47,6 @@ Simple example implementations are here:
- rfc5904 - rfc5904
- rfc6519 - rfc6519
- rfc6572 - rfc6572
- rfc6677
- rfc6911 - rfc6911
- rfc6929 - rfc6929
- rfc6930 - rfc6930
+20
View File
@@ -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
+1
View File
@@ -8,4 +8,5 @@ pub mod rfc2866;
pub mod rfc2867; pub mod rfc2867;
pub mod rfc2868; pub mod rfc2868;
pub mod rfc3576; pub mod rfc3576;
pub mod rfc6677;
pub mod tag; pub mod tag;
+35
View File
@@ -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<Result<EapLowerLayer, AVPError>> {
packet
.lookup(EAP_LOWER_LAYER_TYPE)
.map(|v| Ok(v.encode_u32()? as EapLowerLayer))
}
pub fn lookup_all_eap_lower_layer(packet: &Packet) -> Result<Vec<EapLowerLayer>, 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)
}