blackberry.com
BlackBerry Dynamics
Runtime library for iOS applications
from the application developer portal

GDNETiOS.h

Go to the documentation of this file.
00001 /*
00002  * (c) 2017 BlackBerry Limited. All rights reserved.
00003  *
00004  */
00005 
00006 #pragma once
00007 
00008 #import <Foundation/Foundation.h>
00009 #import "GDURLLoadingSystem.h"
00010 #import "GDPortability.h"
00011 #import "GDNET.h"
00012 
00020 typedef NS_ENUM(NSInteger, GDSocketErrorType)
00021 {
00027     GDSocketErrorNone=0,
00028     
00034     GDSocketErrorNetworkUnvailable,
00035 
00041     GDSocketErrorServiceTimeOut
00042 };
00043 
00044 GD_NS_ASSUME_NONNULL_BEGIN
00045 
00052 @protocol GDSocketDelegate
00053 
00054 @required
00065 - (void)onOpen:(id) socket;
00066 
00067 @required
00080 - (void)onRead:(id) socket;
00081 
00082 @required
00095 - (void)onClose:(id) socket;
00096 
00097 @required
00107 - (void)onErr:(int)error inSocket:(id) socket;
00108 
00109 @end
00110 
00111 
00122 @interface GDDirectByteBuffer : NSObject {
00123     @private
00124     void* m_dbbInternal;
00125 }
00126 
00134 - (instancetype)init;
00135 
00148 - (void)write:(const char*)data;
00149 
00161 - (void)writeData:(NSData*)data;
00162 
00175 - (void)write:(const char*)data withLength:(int)length;
00176 
00181 - (int)bytesUnread;
00182 
00214 - (int)read:(char*)data toMaxLength:(int)maxLength;
00215 
00238 - (GD_NSNULLABLE NSMutableString*)unreadDataAsString;
00239 
00261 - (GD_NSNULLABLE NSMutableData*)unreadData;
00262 
00263 @end
00264 
00473 @interface GDSocket : NSObject {
00475     __weak id <GDSocketDelegate> GD_NSNULLABLE_POINTER delegate;
00476     @private
00477     void* m_socketInternal;
00478     GDDirectByteBuffer* writeStream;
00479     GDDirectByteBuffer* readStream;
00480 }
00481 
00499 - (instancetype)init:(const char*)url onPort:(int)port andUseSSL:(BOOL)ssl;
00500 
00530 - (BOOL)disableHostVerification;
00531 
00564 - (BOOL)disablePeerVerification;
00565 
00573 - (void)connect;
00574 
00581 - (void)write;
00582 
00590 - (void)disconnect;
00591 
00602 @property (GD_NSNULLABLE_PROP nonatomic, weak) id<GDSocketDelegate> delegate;
00603 
00612 @property (GD_NSNULLABLE_PROP nonatomic, strong) GDDirectByteBuffer* writeStream;
00613 
00626 @property (GD_NSNULLABLE_PROP nonatomic, strong) GDDirectByteBuffer* readStream;
00627 
00628 @end
00629 
00630 #if __has_extension(attribute_deprecated_with_message)
00631 #   define DEPRECATE_GDHTTPREQUESTDELEGATE __attribute__((deprecated("GDHttpRequestDelegate interface has been deprecated")))
00632 #else
00633 #   define DEPRECATE_GDHTTPREQUESTDELEGATE __attribute__((deprecated))
00634 #endif
00635 
00645 DEPRECATE_GDHTTPREQUESTDELEGATE
00646 @protocol GDHttpRequestDelegate
00647 
00648 @required
00667 - (void)onStatusChange:(id) httpRequest DEPRECATE_GDHTTPREQUESTDELEGATE;
00668 
00669 @end
00670 
00686 typedef NS_ENUM(NSInteger, GDHttpRequest_state_t)
00687 {
00690     GDHttpRequest_UNSENT = 0,
00693     GDHttpRequest_OPENED = 1,
00696     GDHttpRequest_SENT = 2,
00700     GDHttpRequest_HEADERS_RECEIVED = 3,
00704     GDHttpRequest_LOADING = 4,
00708     GDHttpRequest_DONE = 5
00709 } DEPRECATE_GDHTTPREQUESTDELEGATE;
00710 
00716 // See: http://clang.llvm.org/docs/LanguageExtensions.html
00717 #ifndef __has_extension
00718 #define __has_extension(x) 0  // Compatibility with non-clang compilers.
00719 #endif
00720 
00721 #if __has_extension(attribute_deprecated_with_message)
00722 #   define DEPRECATE_CLEARCOOKIES __attribute__((deprecated("No longer supported")))
00723 #else
00724 #   define DEPRECATE_CLEARCOOKIES __attribute__((deprecated))
00725 #endif
00726 #if __has_extension(attribute_deprecated_with_message)
00727 #   define DEPRECATE_GDHTTPREQUEST __attribute__((deprecated("GDHttpRequest interface has been deprecated")))
00728 #else
00729 #   define DEPRECATE_GDHTTPREQUEST __attribute__((deprecated))
00730 #endif
00731 
01081 DEPRECATE_GDHTTPREQUEST
01082 @interface GDHttpRequest : NSObject {
01083     __weak id <GDHttpRequestDelegate> GD_NSNULLABLE_POINTER delegate;
01084     @private
01085     void* m_httpRequestInternal;
01086 }
01087 
01101 - (instancetype)init DEPRECATE_GDHTTPREQUEST;
01102 
01165 - (BOOL) open:(const char*)method withUrl:(const char*)url withAsync:(BOOL) isAsync withUser:(GD_NSNULLABLE const char*)user withPass:(GD_NSNULLABLE const char*)password withAuth:(GD_NSNULLABLE const char*)auth DEPRECATE_GDHTTPREQUEST;
01166 
01178 - (BOOL) open:(const char*)method withUrl:(const char*)url withUser:(GD_NSNULLABLE const char*)user withPass:(GD_NSNULLABLE const char*)password withAuth:(GD_NSNULLABLE const char*)auth DEPRECATE_GDHTTPREQUEST;
01179 
01196 - (BOOL) open:(const char*)method withUrl:(const char*)url withAsync:(BOOL)isAsync DEPRECATE_GDHTTPREQUEST;
01197 
01214 - (BOOL) open:(const char*)method withUrl:(const char*)url DEPRECATE_GDHTTPREQUEST;
01215 
01259 - (BOOL) disableHostVerification DEPRECATE_GDHTTPREQUEST;
01260 
01308 - (BOOL) disablePeerVerification DEPRECATE_GDHTTPREQUEST;
01309 
01338 - (BOOL) disableFollowLocation DEPRECATE_GDHTTPREQUEST;
01339 
01364 - (BOOL) disableCookieHandling DEPRECATE_GDHTTPREQUEST;
01365 
01393 - (void) clearCookies:(BOOL) includePersistentStore DEPRECATE_CLEARCOOKIES;
01394 
01444 - (BOOL) enableHttpProxy:(const char*)host withPort:(int)port withUser:(const char*)user withPass:(const char*)password withAuth:(const char*)auth DEPRECATE_GDHTTPREQUEST;
01445 
01459 - (BOOL) enableHttpProxy:(const char*)host withPort:(int)port DEPRECATE_GDHTTPREQUEST;
01460 
01481 - (BOOL) disableHttpProxy DEPRECATE_GDHTTPREQUEST;
01482 
01513 - (BOOL) setRequestHeader:(const char*)header withValue:(const char*)value DEPRECATE_GDHTTPREQUEST;
01514 
01539 - (void) setPostValue:(const char*)value forKey:(const char*)key DEPRECATE_GDHTTPREQUEST;
01540 
01560 - (void) clearPostValues DEPRECATE_GDHTTPREQUEST;
01561 
01621 - (BOOL) send:(GD_NSNULLABLE const char*)data withLength:(unsigned int)len withTimeout:(int)timeout_s DEPRECATE_GDHTTPREQUEST;
01622 
01635 - (BOOL) send:(GD_NSNULLABLE const char*)data withTimeout:(int)timeout_s DEPRECATE_GDHTTPREQUEST;
01636 
01637 
01649 - (BOOL) send:(GD_NSNULLABLE const char*)data DEPRECATE_GDHTTPREQUEST;
01650 
01665 - (BOOL) send DEPRECATE_GDHTTPREQUEST;
01666 
01678 - (BOOL) sendData:(GD_NSNULLABLE NSData*)data withTimeout:(int)timeout_s DEPRECATE_GDHTTPREQUEST;
01679 
01691 - (BOOL) sendData:(GD_NSNULLABLE NSData*)data DEPRECATE_GDHTTPREQUEST;
01692 
01726 - (BOOL) sendWithFile:(NSString*)pathAndFileName withTimeout:(NSTimeInterval)timeoutSeconds DEPRECATE_GDHTTPREQUEST;
01727 
01740 - (BOOL) sendWithFile:(NSString*)pathAndFileName DEPRECATE_GDHTTPREQUEST;
01741 
01759 - (GDHttpRequest_state_t) getState DEPRECATE_GDHTTPREQUEST;
01760 
01787 - (GD_NSNULLABLE const char*) getResponseHeader:(const char*)header DEPRECATE_GDHTTPREQUEST;
01788 
01812 - (GD_NSNULLABLE const char*) getAllResponseHeaders DEPRECATE_GDHTTPREQUEST;
01813 
01876 - (int) getStatus DEPRECATE_GDHTTPREQUEST;
01877 
01921 - (GD_NSNULLABLE const char*) getStatusText DEPRECATE_GDHTTPREQUEST;
01922 
01956 - (GD_NSNULLABLE GDDirectByteBuffer*) getReceiveBuffer DEPRECATE_GDHTTPREQUEST;
01957 
01994 - (BOOL) close DEPRECATE_GDHTTPREQUEST;
01995 
02022 - (BOOL) abort DEPRECATE_GDHTTPREQUEST;
02023 
02046 @property (nonatomic, assign) BOOL enablePipelining DEPRECATE_GDHTTPREQUEST;
02047 
02065 @property (GD_NSNULLABLE_PROP nonatomic, weak) id<GDHttpRequestDelegate> delegate DEPRECATE_GDHTTPREQUEST;
02066 
02067 @end
02068 
02069 GD_NS_ASSUME_NONNULL_END