From f966977a95dac3023b1aebb419ac32ff5439e384 Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Wed, 6 Sep 2017 22:31:20 +0300 Subject: [PATCH 1/2] Rename OpenVPNEvent to OpenVPNAdapterEvent --- .../OpenVPNAdapterTests.swift | 2 +- OpenVPN Adapter.xcodeproj/project.pbxproj | 12 +++--- OpenVPN Adapter/OpenVPNAdapter+Public.h | 6 +-- OpenVPN Adapter/OpenVPNAdapter.mm | 40 +++++++++---------- OpenVPN Adapter/OpenVPNAdapterEvent.h | 31 ++++++++++++++ OpenVPN Adapter/OpenVPNEvent.h | 31 -------------- OpenVPN Adapter/Umbrella-Header.h | 2 +- 7 files changed, 62 insertions(+), 62 deletions(-) create mode 100644 OpenVPN Adapter/OpenVPNAdapterEvent.h delete mode 100644 OpenVPN Adapter/OpenVPNEvent.h diff --git a/OpenVPN Adapter Tests/OpenVPNAdapterTests.swift b/OpenVPN Adapter Tests/OpenVPNAdapterTests.swift index 537c8c3..e66be6f 100644 --- a/OpenVPN Adapter Tests/OpenVPNAdapterTests.swift +++ b/OpenVPN Adapter Tests/OpenVPNAdapterTests.swift @@ -113,7 +113,7 @@ extension OpenVPNAdapterTests: OpenVPNAdapterDelegate { callback(self) } - func handle(event: OpenVPNEvent, message: String?) { + func handle(event: OpenVPNAdapterEvent, message: String?) { switch event { case .connected: guard let connectionExpectation = expectations[.connection] else { return } diff --git a/OpenVPN Adapter.xcodeproj/project.pbxproj b/OpenVPN Adapter.xcodeproj/project.pbxproj index c71f75d..3d27645 100644 --- a/OpenVPN Adapter.xcodeproj/project.pbxproj +++ b/OpenVPN Adapter.xcodeproj/project.pbxproj @@ -84,7 +84,7 @@ C9B7956C1F1D26C900CF35FE /* OpenVPNReachability+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = C9B795691F1D26C900CF35FE /* OpenVPNReachability+Internal.h */; }; C9BB47601E71663A00F3F98C /* Umbrella-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB475E1E71663A00F3F98C /* Umbrella-Header.h */; settings = {ATTRIBUTES = (Public, ); }; }; C9BB47711E7171A100F3F98C /* OpenVPNError.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB476F1E7171A100F3F98C /* OpenVPNError.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C9BB47721E7171A100F3F98C /* OpenVPNEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47701E7171A100F3F98C /* OpenVPNEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C9BB47721E7171A100F3F98C /* OpenVPNAdapterEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; C9BB47791E7171ED00F3F98C /* OpenVPNClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47771E7171ED00F3F98C /* OpenVPNClient.h */; }; C9BB477A1E7171ED00F3F98C /* OpenVPNClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = C9BB47781E7171ED00F3F98C /* OpenVPNClient.mm */; }; C9BB477F1E7173C700F3F98C /* OpenVPNAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477B1E7173C700F3F98C /* OpenVPNAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -110,7 +110,7 @@ C9D2ABE01EA20F99007EDF9D /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C912BB241E7C3339002B9414 /* NetworkExtension.framework */; }; C9D2ABE11EA20F99007EDF9D /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C90BAD301E73FF6C00DEFB32 /* SystemConfiguration.framework */; }; C9D2ABE31EA20F99007EDF9D /* OpenVPNClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47771E7171ED00F3F98C /* OpenVPNClient.h */; }; - C9D2ABE41EA20F99007EDF9D /* OpenVPNEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47701E7171A100F3F98C /* OpenVPNEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C9D2ABE41EA20F99007EDF9D /* OpenVPNAdapterEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */; settings = {ATTRIBUTES = (Public, ); }; }; C9D2ABE51EA20F99007EDF9D /* OpenVPNAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477B1E7173C700F3F98C /* OpenVPNAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; }; C9D2ABE61EA20F99007EDF9D /* Umbrella-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB475E1E71663A00F3F98C /* Umbrella-Header.h */; settings = {ATTRIBUTES = (Public, ); }; }; C9D2ABE71EA20F99007EDF9D /* OpenVPNAdapter+Public.h in Headers */ = {isa = PBXBuildFile; fileRef = C9BB477D1E7173C700F3F98C /* OpenVPNAdapter+Public.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -191,7 +191,7 @@ C9BB475C1E71663A00F3F98C /* OpenVPNAdapter.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OpenVPNAdapter.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C9BB475E1E71663A00F3F98C /* Umbrella-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Umbrella-Header.h"; sourceTree = ""; }; C9BB476F1E7171A100F3F98C /* OpenVPNError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = OpenVPNError.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - C9BB47701E7171A100F3F98C /* OpenVPNEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNEvent.h; sourceTree = ""; }; + C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapterEvent.h; sourceTree = ""; }; C9BB47771E7171ED00F3F98C /* OpenVPNClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNClient.h; sourceTree = ""; }; C9BB47781E7171ED00F3F98C /* OpenVPNClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OpenVPNClient.mm; sourceTree = ""; }; C9BB477B1E7173C700F3F98C /* OpenVPNAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenVPNAdapter.h; sourceTree = ""; }; @@ -340,7 +340,7 @@ children = ( C9BB476F1E7171A100F3F98C /* OpenVPNError.h */, C93A4F611EE18009004DC561 /* OpenVPNError.m */, - C9BB47701E7171A100F3F98C /* OpenVPNEvent.h */, + C9BB47701E7171A100F3F98C /* OpenVPNAdapterEvent.h */, C9657A5D1EB0D60700EFF210 /* OpenVPNTransportProtocol.h */, C9657A601EB0D64E00EFF210 /* OpenVPNIPv6Preference.h */, C9657A631EB0D6AD00EFF210 /* OpenVPNCompressionMode.h */, @@ -495,7 +495,7 @@ C9657A3A1EB0BAAB00EFF210 /* OpenVPNInterfaceStats+Internal.h in Headers */, C9354F451F1E4A4500F4C935 /* OpenVPNReachabilityStatus.h in Headers */, C9BCE25E1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h in Headers */, - C9BB47721E7171A100F3F98C /* OpenVPNEvent.h in Headers */, + C9BB47721E7171A100F3F98C /* OpenVPNAdapterEvent.h in Headers */, C9BB477F1E7173C700F3F98C /* OpenVPNAdapter.h in Headers */, C9657A4C1EB0CD6C00EFF210 /* OpenVPNProperties.h in Headers */, C9657A571EB0CDFB00EFF210 /* OpenVPNProperties+Internal.h in Headers */, @@ -536,7 +536,7 @@ C9657A3B1EB0BAAB00EFF210 /* OpenVPNInterfaceStats+Internal.h in Headers */, C9354F461F1E4A4600F4C935 /* OpenVPNReachabilityStatus.h in Headers */, C9BCE25F1EB3C201009D6AC1 /* OpenVPNSessionToken+Internal.h in Headers */, - C9D2ABE41EA20F99007EDF9D /* OpenVPNEvent.h in Headers */, + C9D2ABE41EA20F99007EDF9D /* OpenVPNAdapterEvent.h in Headers */, C9D2ABE51EA20F99007EDF9D /* OpenVPNAdapter.h in Headers */, C9657A4D1EB0CD6C00EFF210 /* OpenVPNProperties.h in Headers */, C9657A561EB0CDFA00EFF210 /* OpenVPNProperties+Internal.h in Headers */, diff --git a/OpenVPN Adapter/OpenVPNAdapter+Public.h b/OpenVPN Adapter/OpenVPNAdapter+Public.h index 7eb5831..13797b0 100644 --- a/OpenVPN Adapter/OpenVPNAdapter+Public.h +++ b/OpenVPN Adapter/OpenVPNAdapter+Public.h @@ -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; diff --git a/OpenVPN Adapter/OpenVPNAdapter.mm b/OpenVPN Adapter/OpenVPNAdapter.mm index 7215e16..855edbd 100644 --- a/OpenVPN Adapter/OpenVPNAdapter.mm +++ b/OpenVPN Adapter/OpenVPNAdapter.mm @@ -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; } diff --git a/OpenVPN Adapter/OpenVPNAdapterEvent.h b/OpenVPN Adapter/OpenVPNAdapterEvent.h new file mode 100644 index 0000000..326e981 --- /dev/null +++ b/OpenVPN Adapter/OpenVPNAdapterEvent.h @@ -0,0 +1,31 @@ +// +// OpenVPNAdapterEvent.h +// OpenVPN Adapter +// +// Created by Sergey Abramchuk on 05.11.16. +// Copyright © 2016 ss-abramchuk. All rights reserved. +// + +#import + +/** + OpenVPN event codes + */ +typedef NS_ENUM(NSInteger, OpenVPNAdapterEvent) { + OpenVPNAdapterEventDisconnected, + OpenVPNAdapterEventConnected, + OpenVPNAdapterEventReconnecting, + OpenVPNAdapterEventResolve, + OpenVPNAdapterEventWait, + OpenVPNAdapterEventWaitProxy, + OpenVPNAdapterEventConnecting, + OpenVPNAdapterEventGetConfig, + OpenVPNAdapterEventAssignIP, + OpenVPNAdapterEventAddRoutes, + OpenVPNAdapterEventEcho, + OpenVPNAdapterEventInfo, + OpenVPNAdapterEventPause, + OpenVPNAdapterEventResume, + OpenVPNAdapterEventRelay, + OpenVPNAdapterEventUnknown +}; diff --git a/OpenVPN Adapter/OpenVPNEvent.h b/OpenVPN Adapter/OpenVPNEvent.h deleted file mode 100644 index 4ec9537..0000000 --- a/OpenVPN Adapter/OpenVPNEvent.h +++ /dev/null @@ -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 - -/** - OpenVPN event codes - */ -typedef NS_ENUM(NSInteger, OpenVPNEvent) { - OpenVPNEventDisconnected, - OpenVPNEventConnected, - OpenVPNEventReconnecting, - OpenVPNEventResolve, - OpenVPNEventWait, - OpenVPNEventWaitProxy, - OpenVPNEventConnecting, - OpenVPNEventGetConfig, - OpenVPNEventAssignIP, - OpenVPNEventAddRoutes, - OpenVPNEventEcho, - OpenVPNEventInfo, - OpenVPNEventPause, - OpenVPNEventResume, - OpenVPNEventRelay, - OpenVPNEventUnknown -}; diff --git a/OpenVPN Adapter/Umbrella-Header.h b/OpenVPN Adapter/Umbrella-Header.h index 02c1192..eb6bacb 100644 --- a/OpenVPN Adapter/Umbrella-Header.h +++ b/OpenVPN Adapter/Umbrella-Header.h @@ -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 #import -#import +#import #import #import #import From 9c5831fd9d76ae7cc4ad93c5c3028f3fd3b4df04 Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Wed, 6 Sep 2017 22:32:12 +0300 Subject: [PATCH 2/2] Change project name and header names --- OpenVPN Adapter/OpenVPNClient.h | 4 ++-- OpenVPN Adapter/OpenVPNClient.mm | 2 +- OpenVPN Adapter/OpenVPNError.h | 2 +- OpenVPN Adapter/OpenVPNTunnelSettings.h | 2 +- OpenVPN Adapter/OpenVPNTunnelSettings.m | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenVPN Adapter/OpenVPNClient.h b/OpenVPN Adapter/OpenVPNClient.h index 1fbeec3..c9741e9 100644 --- a/OpenVPN Adapter/OpenVPNClient.h +++ b/OpenVPN Adapter/OpenVPNClient.h @@ -1,6 +1,6 @@ // -// OpenVPNClient+Internal.h -// OpenVPN iOS Client +// OpenVPNClient.h +// OpenVPN Adapter // // Created by Sergey Abramchuk on 11.02.17. // diff --git a/OpenVPN Adapter/OpenVPNClient.mm b/OpenVPN Adapter/OpenVPNClient.mm index 95fabe0..4865f87 100644 --- a/OpenVPN Adapter/OpenVPNClient.mm +++ b/OpenVPN Adapter/OpenVPNClient.mm @@ -1,6 +1,6 @@ // // OpenVPNClient.m -// OpenVPN iOS Client +// OpenVPN Adapter // // Created by Sergey Abramchuk on 11.02.17. // diff --git a/OpenVPN Adapter/OpenVPNError.h b/OpenVPN Adapter/OpenVPNError.h index d68a390..14ea5ca 100644 --- a/OpenVPN Adapter/OpenVPNError.h +++ b/OpenVPN Adapter/OpenVPNError.h @@ -1,6 +1,6 @@ // // OpenVPNError.h -// OpenVPN iOS Client +// OpenVPN Adapter // // Created by Sergey Abramchuk on 11.02.17. // diff --git a/OpenVPN Adapter/OpenVPNTunnelSettings.h b/OpenVPN Adapter/OpenVPNTunnelSettings.h index 738952a..e8fbd40 100644 --- a/OpenVPN Adapter/OpenVPNTunnelSettings.h +++ b/OpenVPN Adapter/OpenVPNTunnelSettings.h @@ -1,6 +1,6 @@ // // OpenVPNTunnelSettings.h -// OpenVPN iOS Client +// OpenVPN Adapter // // Created by Sergey Abramchuk on 26.02.17. // diff --git a/OpenVPN Adapter/OpenVPNTunnelSettings.m b/OpenVPN Adapter/OpenVPNTunnelSettings.m index adfac65..f8d105d 100644 --- a/OpenVPN Adapter/OpenVPNTunnelSettings.m +++ b/OpenVPN Adapter/OpenVPNTunnelSettings.m @@ -1,6 +1,6 @@ // // OpenVPNTunnelSettings.m -// OpenVPN iOS Client +// OpenVPN Adapter // // Created by Sergey Abramchuk on 26.02.17. //