mirror of
https://github.com/cubixle/radius-rs.git
synced 2026-07-29 23:23:05 +01:00
Add code generator for string attribute
This commit is contained in:
+18
-1
@@ -2,7 +2,8 @@ use std::convert::TryInto;
|
||||
|
||||
use rand::Rng;
|
||||
|
||||
use crate::attributes::Attributes;
|
||||
use crate::attribute::Attribute;
|
||||
use crate::attributes::{AVPType, Attributes};
|
||||
use crate::code::Code;
|
||||
|
||||
const MAX_PACKET_LENGTH: usize = 4096;
|
||||
@@ -177,6 +178,22 @@ impl Packet {
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add(&mut self, typ: AVPType, attr: &Attribute) {
|
||||
self.attributes.add(typ, attr.clone());
|
||||
}
|
||||
|
||||
pub fn delete(&mut self, typ: AVPType) {
|
||||
self.attributes.del(typ);
|
||||
}
|
||||
|
||||
pub fn lookup(&self, typ: AVPType) -> Option<&Attribute> {
|
||||
self.attributes.lookup(typ)
|
||||
}
|
||||
|
||||
pub fn lookup_all(&self, typ: AVPType) -> Vec<&Attribute> {
|
||||
self.attributes.lookup_all(typ)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user