mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-24 00:00:05 +08:00
Wrap transport stats
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// OpenVPNTransportStats+Internal.h
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import <client/ovpncli.hpp>
|
||||
|
||||
#import <OpenVPNAdapter/OpenVPNAdapter.h>
|
||||
|
||||
using namespace openvpn;
|
||||
|
||||
@interface OpenVPNTransportStats (Internal)
|
||||
|
||||
- (instancetype)initWithTransportStats:(ClientAPI::TransportStats)stats;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// OpenVPNTransportStats.h
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
Class used to provide basic transport stats
|
||||
*/
|
||||
@interface OpenVPNTransportStats : NSObject
|
||||
|
||||
/**
|
||||
Amount of received bytes
|
||||
*/
|
||||
@property (readonly, nonatomic) NSInteger bytesIn;
|
||||
|
||||
/**
|
||||
Amout of sent bytes
|
||||
*/
|
||||
@property (readonly, nonatomic) NSInteger bytesOut;
|
||||
|
||||
/**
|
||||
Amount of received packets
|
||||
*/
|
||||
@property (readonly, nonatomic) NSInteger packetsIn;
|
||||
|
||||
/**
|
||||
Amout of sent packets
|
||||
*/
|
||||
@property (readonly, nonatomic) NSInteger packetsOut;
|
||||
|
||||
/**
|
||||
Number of binary milliseconds (1/1024th of a second) since
|
||||
last packet was received, or -1 if undefined
|
||||
*/
|
||||
@property (readonly, nonatomic) NSInteger lastPacketReceived;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// OpenVPNTransportStats.m
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 26.04.17.
|
||||
//
|
||||
//
|
||||
|
||||
#import "OpenVPNTransportStats.h"
|
||||
#import "OpenVPNTransportStats+Internal.h"
|
||||
|
||||
using namespace openvpn;
|
||||
|
||||
@implementation OpenVPNTransportStats
|
||||
|
||||
- (instancetype)initWithTransportStats:(ClientAPI::TransportStats)stats
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_bytesIn = stats.bytesIn;
|
||||
_bytesOut = stats.bytesOut;
|
||||
_packetsIn = stats.packetsIn;
|
||||
_packetsOut = stats.packetsOut;
|
||||
_lastPacketReceived = stats.lastPacketReceived;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user