mirror of
https://github.com/deneraraujo/OpenVPNAdapter.git
synced 2026-04-06 00:00:03 +08:00
Rename OpenVPNEvent to OpenVPNAdapterEvent
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
//
|
||||
//
|
||||
|
||||
#import "OpenVPNEvent.h"
|
||||
#import "OpenVPNAdapterEvent.h"
|
||||
#import "OpenVPNAdapter.h"
|
||||
|
||||
@class OpenVPNConfiguration;
|
||||
@@ -64,7 +64,7 @@ NS_SWIFT_NAME(configureTunnel(settings:callback:));
|
||||
@param event <#event description#>
|
||||
@param message <#message description#>
|
||||
*/
|
||||
- (void)handleEvent:(OpenVPNEvent)event
|
||||
- (void)handleEvent:(OpenVPNAdapterEvent)event
|
||||
message:(nullable NSString *)message
|
||||
NS_SWIFT_NAME(handle(event:message:));
|
||||
|
||||
@@ -115,7 +115,7 @@ NS_SWIFT_NAME(handle(logMessage:));
|
||||
|
||||
/**
|
||||
Return information about the most recent connection. Will be available
|
||||
after an event of type "OpenVPNEventConnected, otherwise return nil.
|
||||
after an event of type "OpenVPNAdapterEventConnected, otherwise return nil.
|
||||
*/
|
||||
@property (nullable, readonly, nonatomic) OpenVPNConnectionInfo *connectionInfo;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#import "OpenVPNTunnelSettings.h"
|
||||
#import "OpenVPNClient.h"
|
||||
#import "OpenVPNError.h"
|
||||
#import "OpenVPNEvent.h"
|
||||
#import "OpenVPNAdapterEvent.h"
|
||||
#import "OpenVPNConfiguration+Internal.h"
|
||||
#import "OpenVPNCredentials+Internal.h"
|
||||
#import "OpenVPNProperties+Internal.h"
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
- (void)readTUNPackets;
|
||||
- (void)readVPNPacket:(NSData *)packet;
|
||||
- (OpenVPNEvent)eventByName:(NSString *)eventName;
|
||||
- (OpenVPNAdapterEvent)eventByName:(NSString *)eventName;
|
||||
- (OpenVPNAdapterError)errorByName:(NSString *)errorName;
|
||||
- (NSString *)reasonForError:(OpenVPNAdapterError)error;
|
||||
- (NSString *)subnetFromPrefixLength:(NSNumber *)prefixLength;
|
||||
@@ -356,7 +356,7 @@ static void socketCallback(CFSocketRef socket, CFSocketCallBackType type, CFData
|
||||
[self.delegate handleError:error];
|
||||
}];
|
||||
} else {
|
||||
OpenVPNEvent eventIdentifier = [self eventByName:name];
|
||||
OpenVPNAdapterEvent eventIdentifier = [self eventByName:name];
|
||||
[self performAsyncBlock:^{
|
||||
[self.delegate handleEvent:eventIdentifier message:message == nil || [message isEqualToString:@""] ? nil : message];
|
||||
}];
|
||||
@@ -625,26 +625,26 @@ static void socketCallback(CFSocketRef socket, CFSocketCallBackType type, CFData
|
||||
|
||||
#pragma mark Utils
|
||||
|
||||
- (OpenVPNEvent)eventByName:(NSString *)eventName {
|
||||
- (OpenVPNAdapterEvent)eventByName:(NSString *)eventName {
|
||||
NSDictionary *events = @{
|
||||
@"DISCONNECTED": @(OpenVPNEventDisconnected),
|
||||
@"CONNECTED": @(OpenVPNEventConnected),
|
||||
@"RECONNECTING": @(OpenVPNEventReconnecting),
|
||||
@"RESOLVE": @(OpenVPNEventResolve),
|
||||
@"WAIT": @(OpenVPNEventWait),
|
||||
@"WAIT_PROXY": @(OpenVPNEventWaitProxy),
|
||||
@"CONNECTING": @(OpenVPNEventConnecting),
|
||||
@"GET_CONFIG": @(OpenVPNEventGetConfig),
|
||||
@"ASSIGN_IP": @(OpenVPNEventAssignIP),
|
||||
@"ADD_ROUTES": @(OpenVPNEventAddRoutes),
|
||||
@"ECHO": @(OpenVPNEventEcho),
|
||||
@"INFO": @(OpenVPNEventInfo),
|
||||
@"PAUSE": @(OpenVPNEventPause),
|
||||
@"RESUME": @(OpenVPNEventResume),
|
||||
@"RELAY": @(OpenVPNEventRelay)
|
||||
@"DISCONNECTED": @(OpenVPNAdapterEventDisconnected),
|
||||
@"CONNECTED": @(OpenVPNAdapterEventConnected),
|
||||
@"RECONNECTING": @(OpenVPNAdapterEventReconnecting),
|
||||
@"RESOLVE": @(OpenVPNAdapterEventResolve),
|
||||
@"WAIT": @(OpenVPNAdapterEventWait),
|
||||
@"WAIT_PROXY": @(OpenVPNAdapterEventWaitProxy),
|
||||
@"CONNECTING": @(OpenVPNAdapterEventConnecting),
|
||||
@"GET_CONFIG": @(OpenVPNAdapterEventGetConfig),
|
||||
@"ASSIGN_IP": @(OpenVPNAdapterEventAssignIP),
|
||||
@"ADD_ROUTES": @(OpenVPNAdapterEventAddRoutes),
|
||||
@"ECHO": @(OpenVPNAdapterEventEcho),
|
||||
@"INFO": @(OpenVPNAdapterEventInfo),
|
||||
@"PAUSE": @(OpenVPNAdapterEventPause),
|
||||
@"RESUME": @(OpenVPNAdapterEventResume),
|
||||
@"RELAY": @(OpenVPNAdapterEventRelay)
|
||||
};
|
||||
|
||||
OpenVPNEvent event = events[eventName] != nil ? (OpenVPNEvent)[events[eventName] integerValue] : OpenVPNEventUnknown;
|
||||
OpenVPNAdapterEvent event = events[eventName] != nil ? (OpenVPNAdapterEvent)[events[eventName] integerValue] : OpenVPNAdapterEventUnknown;
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
31
OpenVPN Adapter/OpenVPNAdapterEvent.h
Normal file
31
OpenVPN Adapter/OpenVPNAdapterEvent.h
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// OpenVPNAdapterEvent.h
|
||||
// OpenVPN Adapter
|
||||
//
|
||||
// Created by Sergey Abramchuk on 05.11.16.
|
||||
// Copyright © 2016 ss-abramchuk. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
OpenVPN event codes
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, OpenVPNAdapterEvent) {
|
||||
OpenVPNAdapterEventDisconnected,
|
||||
OpenVPNAdapterEventConnected,
|
||||
OpenVPNAdapterEventReconnecting,
|
||||
OpenVPNAdapterEventResolve,
|
||||
OpenVPNAdapterEventWait,
|
||||
OpenVPNAdapterEventWaitProxy,
|
||||
OpenVPNAdapterEventConnecting,
|
||||
OpenVPNAdapterEventGetConfig,
|
||||
OpenVPNAdapterEventAssignIP,
|
||||
OpenVPNAdapterEventAddRoutes,
|
||||
OpenVPNAdapterEventEcho,
|
||||
OpenVPNAdapterEventInfo,
|
||||
OpenVPNAdapterEventPause,
|
||||
OpenVPNAdapterEventResume,
|
||||
OpenVPNAdapterEventRelay,
|
||||
OpenVPNAdapterEventUnknown
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// ClientEvent.h
|
||||
// OpenVPN NEF Test
|
||||
//
|
||||
// Created by Sergey Abramchuk on 05.11.16.
|
||||
// Copyright © 2016 ss-abramchuk. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
OpenVPN event codes
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, OpenVPNEvent) {
|
||||
OpenVPNEventDisconnected,
|
||||
OpenVPNEventConnected,
|
||||
OpenVPNEventReconnecting,
|
||||
OpenVPNEventResolve,
|
||||
OpenVPNEventWait,
|
||||
OpenVPNEventWaitProxy,
|
||||
OpenVPNEventConnecting,
|
||||
OpenVPNEventGetConfig,
|
||||
OpenVPNEventAssignIP,
|
||||
OpenVPNEventAddRoutes,
|
||||
OpenVPNEventEcho,
|
||||
OpenVPNEventInfo,
|
||||
OpenVPNEventPause,
|
||||
OpenVPNEventResume,
|
||||
OpenVPNEventRelay,
|
||||
OpenVPNEventUnknown
|
||||
};
|
||||
@@ -17,7 +17,7 @@ FOUNDATION_EXPORT const unsigned char OpenVPNAdapterVersionString[];
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <OpenVPNAdapter/PublicHeader.h>
|
||||
|
||||
#import <OpenVPNAdapter/OpenVPNError.h>
|
||||
#import <OpenVPNAdapter/OpenVPNEvent.h>
|
||||
#import <OpenVPNAdapter/OpenVPNAdapterEvent.h>
|
||||
#import <OpenVPNAdapter/OpenVPNTransportProtocol.h>
|
||||
#import <OpenVPNAdapter/OpenVPNIPv6Preference.h>
|
||||
#import <OpenVPNAdapter/OpenVPNCompressionMode.h>
|
||||
|
||||
Reference in New Issue
Block a user