pub struct DiameterClient { /* private fields */ }Implementations§
Source§impl DiameterClient
impl DiameterClient
Sourcepub fn new(address: &'static str) -> Self
pub fn new(address: &'static str) -> Self
Examples found in repository?
example/client.rs (line 53)
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}Sourcepub fn connect(&mut self) -> DiameterResult<()>
pub fn connect(&mut self) -> DiameterResult<()>
Examples found in repository?
example/client.rs (line 54)
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}Sourcepub fn close(&mut self) -> DiameterResult<()>
pub fn close(&mut self) -> DiameterResult<()>
Examples found in repository?
example/client.rs (line 56)
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}Sourcepub fn send_message(
&mut self,
message: &mut DiameterMessage,
dict: Arc<Dictionary>,
) -> DiameterResult<DiameterMessage>
pub fn send_message( &mut self, message: &mut DiameterMessage, dict: Arc<Dictionary>, ) -> DiameterResult<DiameterMessage>
Examples found in repository?
example/client.rs (line 55)
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}Auto Trait Implementations§
impl Freeze for DiameterClient
impl RefUnwindSafe for DiameterClient
impl Send for DiameterClient
impl Sync for DiameterClient
impl Unpin for DiameterClient
impl UnwindSafe for DiameterClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more