From 7e3c900ad51af436f7f60686382f55e19131c669 Mon Sep 17 00:00:00 2001 From: moznion Date: Wed, 2 Dec 2020 02:46:20 +0900 Subject: [PATCH] Support RFC6519 --- README.md | 2 +- dicts/dictionary.rfc6519 | 12 ++++++++++++ radius/src/lib.rs | 1 + radius/src/rfc6519.rs | 24 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 dicts/dictionary.rfc6519 create mode 100644 radius/src/rfc6519.rs diff --git a/README.md b/README.md index bd9384f..7bafbc4 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) +- [RFC6519](https://tools.ietf.org/html/rfc6519) - [RFC6677](https://tools.ietf.org/html/rfc6677) ## Usage @@ -45,7 +46,6 @@ Simple example implementations are here: - rfc5580 - rfc5607 - rfc5904 - - rfc6519 - rfc6572 - rfc6911 - rfc6929 diff --git a/dicts/dictionary.rfc6519 b/dicts/dictionary.rfc6519 new file mode 100644 index 0000000..8d32744 --- /dev/null +++ b/dicts/dictionary.rfc6519 @@ -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 6519. +# http://www.ietf.org/rfc/rfc6519.txt +# +# $Id$ +# + +ATTRIBUTE DS-Lite-Tunnel-Name 144 string diff --git a/radius/src/lib.rs b/radius/src/lib.rs index b40a5ed..5492e5d 100644 --- a/radius/src/lib.rs +++ b/radius/src/lib.rs @@ -8,5 +8,6 @@ pub mod rfc2866; pub mod rfc2867; pub mod rfc2868; pub mod rfc3576; +pub mod rfc6519; pub mod rfc6677; pub mod tag; diff --git a/radius/src/rfc6519.rs b/radius/src/rfc6519.rs new file mode 100644 index 0000000..8db9286 --- /dev/null +++ b/radius/src/rfc6519.rs @@ -0,0 +1,24 @@ +// Code generated by machine generator; DO NOT EDIT. + +use crate::avp::{AVPError, AVPType, AVP}; +use crate::packet::Packet; + +pub const DS_LITE_TUNNEL_NAME_TYPE: AVPType = 144; +pub fn delete_ds_lite_tunnel_name(packet: &mut Packet) { + packet.delete(DS_LITE_TUNNEL_NAME_TYPE); +} +pub fn add_ds_lite_tunnel_name(packet: &mut Packet, value: &str) { + packet.add(AVP::from_string(DS_LITE_TUNNEL_NAME_TYPE, value)); +} +pub fn lookup_ds_lite_tunnel_name(packet: &Packet) -> Option> { + packet + .lookup(DS_LITE_TUNNEL_NAME_TYPE) + .map(|v| v.encode_string()) +} +pub fn lookup_all_ds_lite_tunnel_name(packet: &Packet) -> Result, AVPError> { + let mut vec = Vec::new(); + for avp in packet.lookup_all(DS_LITE_TUNNEL_NAME_TYPE) { + vec.push(avp.encode_string()?) + } + Ok(vec) +}