Support RFC4372

This commit is contained in:
moznion
2020-12-06 15:39:50 +09:00
parent a792e174c1
commit bece870914
4 changed files with 37 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ This supports the following RFC dictionaries at the moment:
- [RFC3576](https://tools.ietf.org/html/rfc3576)
- [RFC3580](https://tools.ietf.org/html/rfc3580)
- [RFC4072](https://tools.ietf.org/html/rfc4072)
- [RFC4372](https://tools.ietf.org/html/rfc4372)
- [RFC5090](https://tools.ietf.org/html/rfc5090)
- [RFC5607](https://tools.ietf.org/html/rfc5607)
- [RFC6519](https://tools.ietf.org/html/rfc6519)
@@ -35,7 +36,6 @@ Simple example implementations are here:
- retransmission feature on the client
- Support the following RFC dictionaries:
- rfc4372
- rfc4603
- rfc4675
- rfc4679

11
dicts/dictionary.rfc4372 Normal file
View File

@@ -0,0 +1,11 @@
# -*- 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 4372.
# http://www.ietf.org/rfc/rfc4372.txt
#
# $Id$
#
ATTRIBUTE Chargeable-User-Identity 89 octets

View File

@@ -12,6 +12,7 @@ pub mod rfc3162;
pub mod rfc3576;
pub mod rfc3580;
pub mod rfc4072;
pub mod rfc4372;
pub mod rfc5090;
pub mod rfc5607;
pub mod rfc6519;

24
radius/src/rfc4372.rs Normal file
View File

@@ -0,0 +1,24 @@
// Code generated by machine generator; DO NOT EDIT.
use crate::avp::{AVPType, AVP};
use crate::packet::Packet;
pub const CHARGEABLE_USER_IDENTITY_TYPE: AVPType = 89;
pub fn delete_chargeable_user_identity(packet: &mut Packet) {
packet.delete(CHARGEABLE_USER_IDENTITY_TYPE);
}
pub fn add_chargeable_user_identity(packet: &mut Packet, value: &[u8]) {
packet.add(AVP::from_bytes(CHARGEABLE_USER_IDENTITY_TYPE, value));
}
pub fn lookup_chargeable_user_identity(packet: &Packet) -> Option<Vec<u8>> {
packet
.lookup(CHARGEABLE_USER_IDENTITY_TYPE)
.map(|v| v.encode_bytes())
}
pub fn lookup_all_chargeable_user_identity(packet: &Packet) -> Vec<Vec<u8>> {
let mut vec = Vec::new();
for avp in packet.lookup_all(CHARGEABLE_USER_IDENTITY_TYPE) {
vec.push(avp.encode_bytes())
}
vec
}