Struct Dictionary

Source
pub struct Dictionary { /* private fields */ }

Implementations§

Source§

impl Dictionary

Source

pub fn new(xmls: &[&str]) -> Self

Examples found in repository?
example/client.rs (line 17)
16fn main() -> DiameterResult<()> {
17    let dict = Arc::new(Dictionary::new(&[&dictionary::DEFAULT_DICT_XML]));
18
19    let mut ccr: DiameterMessage = DiameterMessage::new(
20        CommandFlag::Request,
21        CommandCode::CreditControl,
22        ApplicationId::Gx,
23        1123158611,
24        3102381851,
25    );
26
27    ccr.add(Avp::new(263, M, None, UTF8String::from_str("a")));
28    ccr.add_avp(264, M, None, Identity::from_str("host.example.com"));
29    ccr.add(Avp::new(
30        296,
31        M,
32        None,
33        Identity::from_str("realm.example.com"),
34    ));
35    ccr.add(Avp::new(263, M, None, UTF8String::from_str("ses;12345888")));
36    ccr.add(Avp::new(416, M, None, Enumerated::new(1)));
37    ccr.add(Avp::new(415, M, None, Unsigned32::new(1000)));
38    ccr.add(Avp::new(
39        264,
40        M,
41        None,
42        Identity::from_str("host.example.com"),
43    ));
44    ccr.add(Avp::new(
45        296,
46        M,
47        None,
48        Identity::from_str("realm.example.com"),
49    ));
50    ccr.add(Avp::new(416, M, None, Enumerated::new(1)));
51    ccr.add(Avp::new(415, M, None, Unsigned32::new(1000)));
52
53    let mut client = DiameterClient::new("127.0.0.1:3868");
54    client.connect()?;
55    let cca: DiameterMessage = client.send_message(&mut ccr, dict)?;
56    client.close()?;
57    println!("{:?}", cca);
58    Ok(())
59}
Source

pub fn load_xml(&mut self, xml: &str)

Source

pub fn add_avp(&mut self, avp: AvpDefinition)

Source

pub fn get_avp( &self, code: u32, vendor_id: Option<u32>, ) -> Option<&AvpDefinition>

Source

pub fn get_avp_by_name(&self, name: &str) -> Option<&AvpDefinition>

Source

pub fn get_avp_type( &self, code: u32, vendor_id: Option<u32>, ) -> Option<&AvpType>

Source

pub fn get_avp_name(&self, code: u32, vendor_id: Option<u32>) -> Option<&str>

Trait Implementations§

Source§

impl Debug for Dictionary

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.