• BlackBerry Dynamics
  • Runtime library for iOS applications
  • 12.0.1.79
GDNETiOS.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023 BlackBerry Limited. All rights reserved.
3  *
4  */
5 
6 #pragma once
7 
8 #import <Foundation/Foundation.h>
9 #import "GDURLLoadingSystem.h"
10 #import "GDNET.h"
11 
19 typedef NS_ENUM(NSInteger, GDSocketErrorType)
20 {
27 
34 
41 };
42 
43 NS_ASSUME_NONNULL_BEGIN
44 
54 
55 @required
66 - (void)onOpen:(id) socket;
67 
68 @required
81 - (void)onRead:(id) socket;
82 
83 @required
96 - (void)onClose:(id) socket;
97 
98 @required
108 - (void)onErr:(int)error inSocket:(id) socket;
109 
110 @end
111 
112 
125 @interface GDDirectByteBuffer : NSObject {
126  @private
127  void* m_dbbInternal;
128 }
129 
137 - (instancetype)init;
138 
151 - (void)write:(const char*)data;
152 
164 - (void)writeData:(NSData*)data;
165 
178 - (void)write:(const char*)data withLength:(int)length;
179 
184 - (int)bytesUnread;
185 
217 - (int)read:(char*)data toMaxLength:(int)maxLength;
218 
241 - (nullable NSMutableString*)unreadDataAsString;
242 
264 - (nullable NSMutableData*)unreadData;
265 
266 @end
267 
279 @interface GDSocket : NSObject {
281  __weak id <GDSocketDelegate> _Nullable delegate;
282  @private
283  void* m_socketInternal;
286 }
287 
305 - (instancetype)init:(const char*)url onPort:(int)port andUseSSL:(BOOL)ssl;
306 
336 - (BOOL)disableHostVerification;
337 
370 - (BOOL)disablePeerVerification;
371 
379 - (void)connect;
380 
387 - (void)write;
388 
396 - (void)disconnect;
397 
408 @property (nullable, nonatomic, weak) id<GDSocketDelegate> delegate;
409 
418 @property (nullable, nonatomic, strong) GDDirectByteBuffer* writeStream;
419 
432 @property (nullable, nonatomic, strong) GDDirectByteBuffer* readStream;
433 
434 @end
435 
436 /* \cond DOXYGEN_IGNORE */
437 #if __has_extension(attribute_deprecated_with_message)
438 # define DEPRECATE_GDHTTPREQUESTDELEGATE __attribute__((deprecated("GDHttpRequestDelegate interface has been deprecated")))
439 #else
440 # define DEPRECATE_GDHTTPREQUESTDELEGATE __attribute__((deprecated))
441 #endif
442 /* \endcond */
443 
453 DEPRECATE_GDHTTPREQUESTDELEGATE
455 
456 @required
475 - (void)onStatusChange:(id) httpRequest DEPRECATE_GDHTTPREQUESTDELEGATE;
476 
477 @end
478 
494 typedef NS_ENUM(NSInteger, GDHttpRequest_state_t)
495 {
517 } DEPRECATE_GDHTTPREQUESTDELEGATE;
518 
519 // See: http://clang.llvm.org/docs/LanguageExtensions.html
520 /* \cond DOXYGEN_IGNORE */
521 #ifndef __has_extension
522 #define __has_extension(x) 0 // Compatibility with non-clang compilers.
523 #endif
524 /* \endcond */
525 
526 /* \cond DOXYGEN_IGNORE */
527 #if __has_extension(attribute_deprecated_with_message)
528 # define DEPRECATE_CLEARCOOKIES __attribute__((deprecated("No longer supported")))
529 #else
530 # define DEPRECATE_CLEARCOOKIES __attribute__((deprecated))
531 #endif
532 #if __has_extension(attribute_deprecated_with_message)
533 # define DEPRECATE_GDHTTPREQUEST __attribute__((deprecated("GDHttpRequest interface has been deprecated")))
534 #else
535 # define DEPRECATE_GDHTTPREQUEST __attribute__((deprecated))
536 #endif
537 /* \endcond */
884 DEPRECATE_GDHTTPREQUEST
885 @interface GDHttpRequest : NSObject {
886  __weak id <GDHttpRequestDelegate> _Nullable delegate;
887  @private
888  void* m_httpRequestInternal;
889 }
890 
904 - (instancetype)init DEPRECATE_GDHTTPREQUEST;
905 
968 - (BOOL) open:(const char*)method withUrl:(const char*)url withAsync:(BOOL) isAsync withUser:(nullable const char*)user withPass:(nullable const char*)password withAuth:(nullable const char*)auth DEPRECATE_GDHTTPREQUEST;
969 
981 - (BOOL) open:(const char*)method withUrl:(const char*)url withUser:(nullable const char*)user withPass:(nullable const char*)password withAuth:(nullable const char*)auth DEPRECATE_GDHTTPREQUEST;
982 
999 - (BOOL) open:(const char*)method withUrl:(const char*)url withAsync:(BOOL)isAsync DEPRECATE_GDHTTPREQUEST;
1000 
1017 - (BOOL) open:(const char*)method withUrl:(const char*)url DEPRECATE_GDHTTPREQUEST;
1018 
1062 - (BOOL) disableHostVerification DEPRECATE_GDHTTPREQUEST;
1063 
1111 - (BOOL) disablePeerVerification DEPRECATE_GDHTTPREQUEST;
1112 
1141 - (BOOL) disableFollowLocation DEPRECATE_GDHTTPREQUEST;
1142 
1167 - (BOOL) disableCookieHandling DEPRECATE_GDHTTPREQUEST;
1168 
1196 - (void) clearCookies:(BOOL) includePersistentStore DEPRECATE_CLEARCOOKIES;
1197 
1247 - (BOOL) enableHttpProxy:(const char*)host withPort:(int)port withUser:(const char*)user withPass:(const char*)password withAuth:(const char*)auth DEPRECATE_GDHTTPREQUEST;
1248 
1262 - (BOOL) enableHttpProxy:(const char*)host withPort:(int)port DEPRECATE_GDHTTPREQUEST;
1263 
1284 - (BOOL) disableHttpProxy DEPRECATE_GDHTTPREQUEST;
1285 
1316 - (BOOL) setRequestHeader:(const char*)header withValue:(const char*)value DEPRECATE_GDHTTPREQUEST;
1317 
1342 - (void) setPostValue:(const char*)value forKey:(const char*)key DEPRECATE_GDHTTPREQUEST;
1343 
1363 - (void) clearPostValues DEPRECATE_GDHTTPREQUEST;
1364 
1424 - (BOOL) send:(nullable const char*)data withLength:(unsigned int)len withTimeout:(int)timeout_s DEPRECATE_GDHTTPREQUEST;
1425 
1438 - (BOOL) send:(nullable const char*)data withTimeout:(int)timeout_s DEPRECATE_GDHTTPREQUEST;
1439 
1440 
1452 - (BOOL) send:(nullable const char*)data DEPRECATE_GDHTTPREQUEST;
1453 
1468 - (BOOL) send DEPRECATE_GDHTTPREQUEST;
1469 
1481 - (BOOL) sendData:(nullable NSData*)data withTimeout:(int)timeout_s DEPRECATE_GDHTTPREQUEST;
1482 
1494 - (BOOL) sendData:(nullable NSData*)data DEPRECATE_GDHTTPREQUEST;
1495 
1529 - (BOOL) sendWithFile:(NSString*)pathAndFileName withTimeout:(NSTimeInterval)timeoutSeconds DEPRECATE_GDHTTPREQUEST;
1530 
1543 - (BOOL) sendWithFile:(NSString*)pathAndFileName DEPRECATE_GDHTTPREQUEST;
1544 
1562 - (GDHttpRequest_state_t) getState DEPRECATE_GDHTTPREQUEST;
1563 
1590 - (nullable const char*) getResponseHeader:(const char*)header DEPRECATE_GDHTTPREQUEST;
1591 
1615 - (nullable const char*) getAllResponseHeaders DEPRECATE_GDHTTPREQUEST;
1616 
1679 - (int) getStatus DEPRECATE_GDHTTPREQUEST;
1680 
1724 - (nullable const char*) getStatusText DEPRECATE_GDHTTPREQUEST;
1725 
1759 - (nullable GDDirectByteBuffer*) getReceiveBuffer DEPRECATE_GDHTTPREQUEST;
1760 
1797 - (BOOL) close DEPRECATE_GDHTTPREQUEST;
1798 
1825 - (BOOL) abort DEPRECATE_GDHTTPREQUEST;
1826 
1849 @property (nonatomic, assign) BOOL enablePipelining DEPRECATE_GDHTTPREQUEST;
1850 
1868 @property (nullable, nonatomic, weak) id<GDHttpRequestDelegate> delegate DEPRECATE_GDHTTPREQUEST;
1869 
1870 @end
1871 
1872 NS_ASSUME_NONNULL_END
GDHttpRequestDelegate-p
Delegate for handling GDHttpRequest state transitions (deprecated).
Definition: GDNETiOS.h:454
GDSocketErrorServiceTimeOut
@ GDSocketErrorServiceTimeOut
Socket operation timed out.
Definition: GDNETiOS.h:40
GDSocketErrorType
GDSocketErrorType
Constants for GDSocket errors.
Definition: GDNETiOS.h:19
GDHttpRequest_HEADERS_RECEIVED
@ GDHttpRequest_HEADERS_RECEIVED
The request has been sent, and response headers have been received (deprecated).
Definition: GDNETiOS.h:508
GDSocketErrorNone
@ GDSocketErrorNone
No error.
Definition: GDNETiOS.h:26
GDSocketErrorNetworkUnvailable
@ GDSocketErrorNetworkUnvailable
Destination network not available.
Definition: GDNETiOS.h:33
GDHttpRequest_state_t
GDHttpRequest_state_t
Constants for HTTP Request ready states (deprecated).
Definition: GDNETiOS.h:494
GDHttpRequest_DONE
@ GDHttpRequest_DONE
All data has been received, or a permanent error has been encountered (deprecated).
Definition: GDNETiOS.h:516
GDURLLoadingSystem.h
GDNET.h
GDSocket::writeStream
GDDirectByteBuffer * writeStream
Outbound buffer.
Definition: GDNETiOS.h:284
GDHttpRequest_SENT
@ GDHttpRequest_SENT
The request has been sent (deprecated).
Definition: GDNETiOS.h:504
GDHttpRequest_UNSENT
@ GDHttpRequest_UNSENT
Prior to the request being opened (deprecated).
Definition: GDNETiOS.h:498
GDSocket::readStream
GDDirectByteBuffer * readStream
Inbound buffer.
Definition: GDNETiOS.h:285
GDSocketDelegate-p
Delegate for handling GDSocket state transitions and received data.
Definition: GDNETiOS.h:53
GDSocket
TCP socket, supporting SSL/TLS and communication across the firewall.
Definition: GDNETiOS.h:279
GDHttpRequest::delegate
__weak id< GDHttpRequestDelegate > _Nullable delegate
Definition: GDNETiOS.h:886
GDHttpRequest_LOADING
@ GDHttpRequest_LOADING
Headers and some data have been received in response to the request (deprecated).
Definition: GDNETiOS.h:512
GDHttpRequest_OPENED
@ GDHttpRequest_OPENED
The request is ready to have headers added, and be sent (deprecated).
Definition: GDNETiOS.h:501
GDHttpRequest
Standards-based HTTP request, also supporting HTTPS and communication across the firewall (deprecated...
Definition: GDNETiOS.h:885
GDDirectByteBuffer
Buffer for accessing GDSocket and GDHttpRequest data.
Definition: GDNETiOS.h:125