From bbd70e4838785afed7c6a509e7f4f99e6a8567c0 Mon Sep 17 00:00:00 2001 From: moznion Date: Wed, 2 Dec 2020 02:52:04 +0900 Subject: [PATCH] Support RFC4072 --- README.md | 3 +-- dicts/dictionary.rfc4072 | 12 ++++++++++++ radius/src/lib.rs | 1 + radius/src/rfc4072.rs | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 dicts/dictionary.rfc4072 create mode 100644 radius/src/rfc4072.rs diff --git a/README.md b/README.md index bdfc248..5a7128a 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) +- [RFC4072](https://tools.ietf.org/html/rfc4072) - [RFC5090](https://tools.ietf.org/html/rfc5090) - [RFC6519](https://tools.ietf.org/html/rfc6519) - [RFC6677](https://tools.ietf.org/html/rfc6677) @@ -34,14 +35,12 @@ Simple example implementations are here: - rfc2869 - rfc3162 - rfc3580 - - rfc4072 - rfc4372 - rfc4603 - rfc4675 - rfc4679 - rfc4818 - rfc4849 - - rfc5090 - rfc5176 - rfc5447 - rfc5580 diff --git a/dicts/dictionary.rfc4072 b/dicts/dictionary.rfc4072 new file mode 100644 index 0000000..3247cfb --- /dev/null +++ b/dicts/dictionary.rfc4072 @@ -0,0 +1,12 @@ +# -*- 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 4072 +# http://www.ietf.org/rfc/rfc4072.txt +# +# $Id$ +# + +ATTRIBUTE EAP-Key-Name 102 octets diff --git a/radius/src/lib.rs b/radius/src/lib.rs index a6c94d0..bc1c080 100644 --- a/radius/src/lib.rs +++ b/radius/src/lib.rs @@ -8,6 +8,7 @@ pub mod rfc2866; pub mod rfc2867; pub mod rfc2868; pub mod rfc3576; +pub mod rfc4072; pub mod rfc5090; pub mod rfc6519; pub mod rfc6677; diff --git a/radius/src/rfc4072.rs b/radius/src/rfc4072.rs new file mode 100644 index 0000000..d5af4b0 --- /dev/null +++ b/radius/src/rfc4072.rs @@ -0,0 +1,22 @@ +// Code generated by machine generator; DO NOT EDIT. + +use crate::avp::{AVPType, AVP}; +use crate::packet::Packet; + +pub const EAP_KEY_NAME_TYPE: AVPType = 102; +pub fn delete_eap_key_name(packet: &mut Packet) { + packet.delete(EAP_KEY_NAME_TYPE); +} +pub fn add_eap_key_name(packet: &mut Packet, value: &[u8]) { + packet.add(AVP::from_bytes(EAP_KEY_NAME_TYPE, value)); +} +pub fn lookup_eap_key_name(packet: &Packet) -> Option> { + packet.lookup(EAP_KEY_NAME_TYPE).map(|v| v.encode_bytes()) +} +pub fn lookup_all_eap_key_name(packet: &Packet) -> Vec> { + let mut vec = Vec::new(); + for avp in packet.lookup_all(EAP_KEY_NAME_TYPE) { + vec.push(avp.encode_bytes()) + } + vec +}