Add code generator for string attribute

This commit is contained in:
moznion
2020-11-25 00:43:11 +09:00
parent 7e6831e282
commit 84943f10eb
8 changed files with 548 additions and 18 deletions
+18 -1
View File
@@ -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)]