diff --git a/OpenVPN Adapter/OpenVPNAdapter+Public.h b/OpenVPN Adapter/OpenVPNAdapter+Public.h index 8ba630f..5bd5a09 100644 --- a/OpenVPN Adapter/OpenVPNAdapter+Public.h +++ b/OpenVPN Adapter/OpenVPNAdapter+Public.h @@ -14,43 +14,111 @@ // TODO: Add documentation to properties and methods +/** + <#Description#> + */ @protocol OpenVPNAdapterPacketFlow -- (void)readPacketsWithCompletionHandler:(nonnull void (^)(NSArray * _Nonnull packets, NSArray * _Nonnull protocols))completionHandler; +/** + <#Description#> + + @param completionHandler <#completionHandler description#> + */ +- (void)readPacketsWithCompletionHandler:(nonnull void (^)(NSArray * _Nonnull packets, NSArray * _Nonnull protocols))completionHandler; + +/** + <#Description#> + + @param packets <#packets description#> + @param protocols <#protocols description#> + @return <#return value description#> + */ - (BOOL)writePackets:(nonnull NSArray *)packets withProtocols:(nonnull NSArray *)protocols; @end +/** + <#Description#> + */ @protocol OpenVPNAdapterDelegate +/** + <#Description#> + + @param settings <#settings description#> + @param callback <#callback description#> + */ - (void)configureTunnelWithSettings:(nonnull NEPacketTunnelNetworkSettings *)settings callback:(nonnull void (^)(id _Nullable flow))callback NS_SWIFT_NAME(configureTunnel(settings:callback:)); +/** + <#Description#> + + @param event <#event description#> + @param message <#message description#> + */ - (void)handleEvent:(OpenVPNEvent)event message:(nullable NSString *)message NS_SWIFT_NAME(handle(event:message:)); +/** + <#Description#> + + @param error <#error description#> + */ - (void)handleError:(nonnull NSError *)error NS_SWIFT_NAME(handle(error:)); +/** + <#Description#> + + @param logMessage <#logMessage description#> + */ - (void)handleLog:(nonnull NSString *)logMessage NS_SWIFT_NAME(handle(logMessage:)); @end +/** + <#Description#> + */ @interface OpenVPNAdapter (Provider) +/** + <#Description#> + */ @property (strong, nonatomic, nullable) NSString *username; + +/** + <#Description#> + */ @property (strong, nonatomic, nullable) NSString *password; +/** + <#Description#> + */ @property (weak, nonatomic, null_unspecified) id delegate; -- (BOOL)configureUsing:(nonnull NSData *)settings +/** + <#Description#> + + @param settings <#settings description#> + @param error <#error description#> + @return <#return value description#> + */ +- (BOOL)configureUsingSettings:(nonnull NSData *)settings error:(out NSError * __nullable * __nullable)error NS_SWIFT_NAME(configure(using:)); +/** + Establish connection with the VPN server + */ - (void)connect; + +/** + Close connection with the VPN server + */ - (void)disconnect; @end diff --git a/OpenVPN Adapter/OpenVPNAdapter.mm b/OpenVPN Adapter/OpenVPNAdapter.mm index 1698756..43c9e3f 100644 --- a/OpenVPN Adapter/OpenVPNAdapter.mm +++ b/OpenVPN Adapter/OpenVPNAdapter.mm @@ -393,7 +393,7 @@ static void socketCallback(CFSocketRef socket, CFSocketCallBackType type, CFData #pragma mark Client Configuration -- (BOOL)configureUsing:(NSData *)settings error:(out NSError * __autoreleasing _Nullable *)error { +- (BOOL)configureUsingSettings:(NSData *)settings error:(out NSError * __autoreleasing _Nullable *)error { NSString *vpnConfiguration = [[NSString alloc] initWithData:settings encoding:NSUTF8StringEncoding]; if (vpnConfiguration == nil) { diff --git a/OpenVPN Adapter/OpenVPNError.h b/OpenVPN Adapter/OpenVPNError.h index b036602..4c202c7 100644 --- a/OpenVPN Adapter/OpenVPNError.h +++ b/OpenVPN Adapter/OpenVPNError.h @@ -8,11 +8,18 @@ #import + extern NSString * __nonnull const OpenVPNAdapterErrorDomain; extern NSString * __nonnull const OpenVPNAdapterErrorFatalKey; extern NSString * __nonnull const OpenVPNAdapterErrorEventKey; +/** + <#Description#> + + - OpenVPNErrorConfigurationFailure: <#OpenVPNErrorConfigurationFailure description#> + - OpenVPNErrorClientFailure: <#OpenVPNErrorClientFailure description#> + */ typedef NS_ENUM(NSUInteger, OpenVPNError) { OpenVPNErrorConfigurationFailure, OpenVPNErrorClientFailure diff --git a/OpenVPN Adapter/OpenVPNEvent.h b/OpenVPN Adapter/OpenVPNEvent.h index 25f29d3..fae7e00 100644 --- a/OpenVPN Adapter/OpenVPNEvent.h +++ b/OpenVPN Adapter/OpenVPNEvent.h @@ -8,7 +8,44 @@ #import +/** + <#Description#> + - OpenVPNEventDisconnected: <#OpenVPNEventDisconnected description#> + - OpenVPNEventConnected: <#OpenVPNEventConnected description#> + - OpenVPNEventReconnecting: <#OpenVPNEventReconnecting description#> + - OpenVPNEventResolve: <#OpenVPNEventResolve description#> + - OpenVPNEventWait: <#OpenVPNEventWait description#> + - OpenVPNEventWaitProxy: <#OpenVPNEventWaitProxy description#> + - OpenVPNEventConnecting: <#OpenVPNEventConnecting description#> + - OpenVPNEventGetConfig: <#OpenVPNEventGetConfig description#> + - OpenVPNEventAssignIP: <#OpenVPNEventAssignIP description#> + - OpenVPNEventAddRoutes: <#OpenVPNEventAddRoutes description#> + - OpenVPNEventEcho: <#OpenVPNEventEcho description#> + - OpenVPNEventInfo: <#OpenVPNEventInfo description#> + - OpenVPNEventPause: <#OpenVPNEventPause description#> + - OpenVPNEventResume: <#OpenVPNEventResume description#> + - OpenVPNEventTransportError: <#OpenVPNEventTransportError description#> + - OpenVPNEventTunError: <#OpenVPNEventTunError description#> + - OpenVPNEventClientRestart: <#OpenVPNEventClientRestart description#> + - OpenVPNEventAuthFailed: <#OpenVPNEventAuthFailed description#> + - OpenVPNEventCertVerifyFail: <#OpenVPNEventCertVerifyFail description#> + - OpenVPNEventTLSVersionMin: <#OpenVPNEventTLSVersionMin description#> + - OpenVPNEventClientHalt: <#OpenVPNEventClientHalt description#> + - OpenVPNEventConnectionTimeout: <#OpenVPNEventConnectionTimeout description#> + - OpenVPNEventInactiveTimeout: <#OpenVPNEventInactiveTimeout description#> + - OpenVPNEventDynamicChallenge: <#OpenVPNEventDynamicChallenge description#> + - OpenVPNEventProxyNeedCreds: <#OpenVPNEventProxyNeedCreds description#> + - OpenVPNEventProxyError: <#OpenVPNEventProxyError description#> + - OpenVPNEventTunSetupFailed: <#OpenVPNEventTunSetupFailed description#> + - OpenVPNEventTunIfaceCreate: <#OpenVPNEventTunIfaceCreate description#> + - OpenVPNEventTunIfaceDisabled: <#OpenVPNEventTunIfaceDisabled description#> + - OpenVPNEventEPKIError: <#OpenVPNEventEPKIError description#> + - OpenVPNEventEPKIInvalidAlias: <#OpenVPNEventEPKIInvalidAlias description#> + - OpenVPNEventInitializationFailed: <#OpenVPNEventInitializationFailed description#> + - OpenVPNEventConnectionFailed: <#OpenVPNEventConnectionFailed description#> + - OpenVPNEventUnknown: <#OpenVPNEventUnknown description#> + */ typedef NS_ENUM(NSUInteger, OpenVPNEvent) { OpenVPNEventDisconnected, OpenVPNEventConnected,