mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-06 00:00:03 +08:00
Refactor implementation of OpenVPNAdapter class
This commit is contained in:
@@ -14,6 +14,9 @@ typedef NS_ENUM(NSInteger, OpenVPNAdapterEvent);
|
||||
|
||||
@class NEPacketTunnelFlow;
|
||||
@class NEPacketTunnelNetworkSettings;
|
||||
|
||||
@protocol OpenVPNAdapterPacketFlow;
|
||||
|
||||
@class OpenVPNAdapter;
|
||||
@class OpenVPNConfiguration;
|
||||
@class OpenVPNConnectionInfo;
|
||||
@@ -23,33 +26,6 @@ typedef NS_ENUM(NSInteger, OpenVPNAdapterEvent);
|
||||
@class OpenVPNTransportStats;
|
||||
@class OpenVPNSessionToken;
|
||||
|
||||
@protocol OpenVPNAdapterPacketFlow <NSObject>
|
||||
|
||||
/**
|
||||
Read IP packets from the TUN interface.
|
||||
|
||||
@param completionHandler A block that is executed when some packets are read from the TUN interface. The packets that were
|
||||
read are passed to this block in the packets array. The protocol numbers of the packets that were read are passed to this
|
||||
block in the protocols array. Each packet has a protocol number in the corresponding index in the protocols array. The
|
||||
protocol numbers are given in host byte order. Valid protocol numbers include PF_INET and PF_INET6. See /usr/include/sys/socket.h.
|
||||
*/
|
||||
- (void)readPacketsWithCompletionHandler:(void (^)(NSArray<NSData *> *packets, NSArray<NSNumber *> *protocols))completionHandler;
|
||||
|
||||
/**
|
||||
Write IP packets to the TUN interface
|
||||
|
||||
@param packets An array of NSData objects containing the IP packets to the written.
|
||||
@param protocols An array of NSNumber objects containing the protocol numbers (e.g. PF_INET or PF_INET6) of the IP packets
|
||||
in packets in host byte order.
|
||||
|
||||
@discussion The number of NSData objects in packets must be exactly equal to the number of NSNumber objects in protocols.
|
||||
|
||||
@return YES on success, otherwise NO.
|
||||
*/
|
||||
- (BOOL)writePackets:(NSArray<NSData *> *)packets withProtocols:(NSArray<NSNumber *> *)protocols;
|
||||
|
||||
@end
|
||||
|
||||
@protocol OpenVPNAdapterDelegate <NSObject>
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user