1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
use crate::wrappers::{*, structs::*, unreal::*};
use super::*;

pub struct NetStatGraphWrapper(pub usize);
impl_object!(NetStatGraphWrapper);

impl NetStatGraph for NetStatGraphWrapper {}
impl StatGraph for NetStatGraphWrapper {}

pub trait NetStatGraph : StatGraph {
    fn get_packets_out(&self) -> Option<SampleHistoryWrapper> {
        unsafe {
            SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_PacketsOut(self.addr()))
        }
    }
    fn get_packets_in(&self) -> Option<SampleHistoryWrapper> {
        unsafe {
            SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_PacketsIn(self.addr()))
        }
    }
    fn get_lost_packets_out(&self) -> Option<SampleHistoryWrapper> {
        unsafe {
            SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_LostPacketsOut(self.addr()))
        }
    }
    fn get_lost_packets_in(&self) -> Option<SampleHistoryWrapper> {
        unsafe {
            SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_LostPacketsIn(self.addr()))
        }
    }
    fn get_bytes_out(&self) -> Option<SampleHistoryWrapper> {
        unsafe {
            SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_BytesOut(self.addr()))
        }
    }
    fn get_bytes_in(&self) -> Option<SampleHistoryWrapper> {
        unsafe {
            SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_BytesIn(self.addr()))
        }
    }
    fn get_latency(&self) -> Option<SampleHistoryWrapper> {
        unsafe {
            SampleHistoryWrapper::try_new(NetStatGraph_TA_Get_Latency(self.addr()))
        }
    }
    fn get_expected_out_packet_rate(&self) -> f32 {
        unsafe {
            NetStatGraph_TA_Get_ExpectedOutPacketRate(self.addr())
        }
    }
    fn get_expected_in_packet_rate(&self) -> f32 {
        unsafe {
            NetStatGraph_TA_Get_ExpectedInPacketRate(self.addr())
        }
    }
    fn get_max_bytes_rate(&self) -> f32 {
        unsafe {
            NetStatGraph_TA_Get_MaxBytesRate(self.addr())
        }
    }
    fn create_bytes_summary(&self, title: RLString) -> Option<SampleHistoryWrapper> {
        unsafe {
            let mut title = title;
            let title: *mut RLString = &mut title as *mut RLString;
            SampleHistoryWrapper::try_new(NetStatGraph_TA_CreateBytesSummary(self.addr(), title))
        }
    }
    fn create_loss_summary(&self, title: RLString) -> Option<SampleHistoryWrapper> {
        unsafe {
            let mut title = title;
            let title: *mut RLString = &mut title as *mut RLString;
            SampleHistoryWrapper::try_new(NetStatGraph_TA_CreateLossSummary(self.addr(), title))
        }
    }
    fn create_pkt_summary(&self, title: RLString) -> Option<SampleHistoryWrapper> {
        unsafe {
            let mut title = title;
            let title: *mut RLString = &mut title as *mut RLString;
            SampleHistoryWrapper::try_new(NetStatGraph_TA_CreatePktSummary(self.addr(), title))
        }
    }

}

extern "C" {
    fn NetStatGraph_TA_Get_PacketsOut(obj: usize) -> usize;
    fn NetStatGraphWrapper_SetPacketsOut(obj: usize, new_val: usize);
    fn NetStatGraph_TA_Get_PacketsIn(obj: usize) -> usize;
    fn NetStatGraphWrapper_SetPacketsIn(obj: usize, new_val: usize);
    fn NetStatGraph_TA_Get_LostPacketsOut(obj: usize) -> usize;
    fn NetStatGraphWrapper_SetLostPacketsOut(obj: usize, new_val: usize);
    fn NetStatGraph_TA_Get_LostPacketsIn(obj: usize) -> usize;
    fn NetStatGraphWrapper_SetLostPacketsIn(obj: usize, new_val: usize);
    fn NetStatGraph_TA_Get_BytesOut(obj: usize) -> usize;
    fn NetStatGraphWrapper_SetBytesOut(obj: usize, new_val: usize);
    fn NetStatGraph_TA_Get_BytesIn(obj: usize) -> usize;
    fn NetStatGraphWrapper_SetBytesIn(obj: usize, new_val: usize);
    fn NetStatGraph_TA_Get_Latency(obj: usize) -> usize;
    fn NetStatGraphWrapper_SetLatency(obj: usize, new_val: usize);
    fn NetStatGraph_TA_Get_ExpectedOutPacketRate(obj: usize) -> f32;
    fn NetStatGraphWrapper_SetExpectedOutPacketRate(obj: usize, new_val: f32);
    fn NetStatGraph_TA_Get_ExpectedInPacketRate(obj: usize) -> f32;
    fn NetStatGraphWrapper_SetExpectedInPacketRate(obj: usize, new_val: f32);
    fn NetStatGraph_TA_Get_MaxBytesRate(obj: usize) -> f32;
    fn NetStatGraphWrapper_SetMaxBytesRate(obj: usize, new_val: f32);
    fn NetStatGraph_TA_CreateBytesSummary(obj: usize, Title: *mut RLString) -> usize;
    fn NetStatGraph_TA_CreateLossSummary(obj: usize, Title: *mut RLString) -> usize;
    fn NetStatGraph_TA_CreatePktSummary(obj: usize, Title: *mut RLString) -> usize;

}