diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings index 99e61eb2d9dd72ae9741f341dde554df493b22fb..8223c784b9abf2b252b73e447c358ef57e3bb8b6 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h index 2acd7d58607297732a3a8fcb3cb8048738342fa0..1519ddb7fc5cd358bdf9fbcb599ee2f719f616a7 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Headers/Bindings.objc.h @@ -20,6 +20,7 @@ @class BindingsChannelDef; @class BindingsCmix; @class BindingsConnection; +@class BindingsDummyTraffic; @class BindingsE2ESendReport; @class BindingsE2e; @class BindingsEventReport; @@ -605,6 +606,65 @@ Returns: - (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; @end +/** + * DummyTraffic is the bindings-layer dummy (or "cover") traffic manager. T +The manager can be used to set and get the status of the thread responsible for +sending dummy messages. + */ +@interface BindingsDummyTraffic : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +- (nullable instancetype)initManager:(long)cmixId maxNumMessages:(long)maxNumMessages avgSendDeltaMS:(long)avgSendDeltaMS randomRangeMS:(long)randomRangeMS; +/** + * GetStatus returns the current state of the dummy traffic sending thread. +Note that this function does not return the status set by the most recent call to +SetStatus directly. Instead, this call returns the current status of the sending thread. +This is due to the small delay that may occur between calling SetStatus and the +sending thread taking into effect that status change. + +Returns: + - boolean - True: Sending thread is sending dummy messages. + - False: Sending thread is paused/stopped and is not sending dummy messages. + */ +- (BOOL)getStatus; +/** + * SetStatus sets the state of the dummy traffic send thread by passing in +a boolean parameter. There may be a small delay in between this call +and the status of the sending thread to change accordingly. For example, +passing False into this call while the sending thread is currently sending messages +will not cancel nor halt the sending operation, but will pause the thread once that +operation has completed. + +Params: + - boolean - True: Sending thread is sending dummy messages. + False: Sending thread is paused/stopped and is not sending dummy messages. +Returns: + - error - if the DummyTraffic.SetStatus is called too frequently, causing the + internal status channel to fill. + */ +- (BOOL)setStatus:(BOOL)status error:(NSError* _Nullable* _Nullable)error; +@end + /** * E2ESendReport is the bindings' representation of the return values of SendE2E. @@ -1869,6 +1929,26 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsNewCmixFromBackup(NSString* _Nullable ndfJSON, NSString* _Nullable storageDir, NSString* _Nullable backupPassphrase, NSData* _Nullable sessionPassword, NSData* _Nullable backupFileContents, NSError* _Nullable* _Nullable error); +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +FOUNDATION_EXPORT BindingsDummyTraffic* _Nullable BindingsNewDummyTrafficManager(long cmixId, long maxNumMessages, long avgSendDeltaMS, long randomRangeMS, NSError* _Nullable* _Nullable error); + /** * NewGroupChat creates a bindings-layer group chat manager. diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings index 99e61eb2d9dd72ae9741f341dde554df493b22fb..8223c784b9abf2b252b73e447c358ef57e3bb8b6 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h index 2acd7d58607297732a3a8fcb3cb8048738342fa0..1519ddb7fc5cd358bdf9fbcb599ee2f719f616a7 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -20,6 +20,7 @@ @class BindingsChannelDef; @class BindingsCmix; @class BindingsConnection; +@class BindingsDummyTraffic; @class BindingsE2ESendReport; @class BindingsE2e; @class BindingsEventReport; @@ -605,6 +606,65 @@ Returns: - (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; @end +/** + * DummyTraffic is the bindings-layer dummy (or "cover") traffic manager. T +The manager can be used to set and get the status of the thread responsible for +sending dummy messages. + */ +@interface BindingsDummyTraffic : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +- (nullable instancetype)initManager:(long)cmixId maxNumMessages:(long)maxNumMessages avgSendDeltaMS:(long)avgSendDeltaMS randomRangeMS:(long)randomRangeMS; +/** + * GetStatus returns the current state of the dummy traffic sending thread. +Note that this function does not return the status set by the most recent call to +SetStatus directly. Instead, this call returns the current status of the sending thread. +This is due to the small delay that may occur between calling SetStatus and the +sending thread taking into effect that status change. + +Returns: + - boolean - True: Sending thread is sending dummy messages. + - False: Sending thread is paused/stopped and is not sending dummy messages. + */ +- (BOOL)getStatus; +/** + * SetStatus sets the state of the dummy traffic send thread by passing in +a boolean parameter. There may be a small delay in between this call +and the status of the sending thread to change accordingly. For example, +passing False into this call while the sending thread is currently sending messages +will not cancel nor halt the sending operation, but will pause the thread once that +operation has completed. + +Params: + - boolean - True: Sending thread is sending dummy messages. + False: Sending thread is paused/stopped and is not sending dummy messages. +Returns: + - error - if the DummyTraffic.SetStatus is called too frequently, causing the + internal status channel to fill. + */ +- (BOOL)setStatus:(BOOL)status error:(NSError* _Nullable* _Nullable)error; +@end + /** * E2ESendReport is the bindings' representation of the return values of SendE2E. @@ -1869,6 +1929,26 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsNewCmixFromBackup(NSString* _Nullable ndfJSON, NSString* _Nullable storageDir, NSString* _Nullable backupPassphrase, NSData* _Nullable sessionPassword, NSData* _Nullable backupFileContents, NSError* _Nullable* _Nullable error); +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +FOUNDATION_EXPORT BindingsDummyTraffic* _Nullable BindingsNewDummyTrafficManager(long cmixId, long maxNumMessages, long avgSendDeltaMS, long randomRangeMS, NSError* _Nullable* _Nullable error); + /** * NewGroupChat creates a bindings-layer group chat manager. diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings index 99e61eb2d9dd72ae9741f341dde554df493b22fb..8223c784b9abf2b252b73e447c358ef57e3bb8b6 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h index 2acd7d58607297732a3a8fcb3cb8048738342fa0..1519ddb7fc5cd358bdf9fbcb599ee2f719f616a7 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64/Bindings.framework/Versions/Current/Headers/Bindings.objc.h @@ -20,6 +20,7 @@ @class BindingsChannelDef; @class BindingsCmix; @class BindingsConnection; +@class BindingsDummyTraffic; @class BindingsE2ESendReport; @class BindingsE2e; @class BindingsEventReport; @@ -605,6 +606,65 @@ Returns: - (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; @end +/** + * DummyTraffic is the bindings-layer dummy (or "cover") traffic manager. T +The manager can be used to set and get the status of the thread responsible for +sending dummy messages. + */ +@interface BindingsDummyTraffic : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +- (nullable instancetype)initManager:(long)cmixId maxNumMessages:(long)maxNumMessages avgSendDeltaMS:(long)avgSendDeltaMS randomRangeMS:(long)randomRangeMS; +/** + * GetStatus returns the current state of the dummy traffic sending thread. +Note that this function does not return the status set by the most recent call to +SetStatus directly. Instead, this call returns the current status of the sending thread. +This is due to the small delay that may occur between calling SetStatus and the +sending thread taking into effect that status change. + +Returns: + - boolean - True: Sending thread is sending dummy messages. + - False: Sending thread is paused/stopped and is not sending dummy messages. + */ +- (BOOL)getStatus; +/** + * SetStatus sets the state of the dummy traffic send thread by passing in +a boolean parameter. There may be a small delay in between this call +and the status of the sending thread to change accordingly. For example, +passing False into this call while the sending thread is currently sending messages +will not cancel nor halt the sending operation, but will pause the thread once that +operation has completed. + +Params: + - boolean - True: Sending thread is sending dummy messages. + False: Sending thread is paused/stopped and is not sending dummy messages. +Returns: + - error - if the DummyTraffic.SetStatus is called too frequently, causing the + internal status channel to fill. + */ +- (BOOL)setStatus:(BOOL)status error:(NSError* _Nullable* _Nullable)error; +@end + /** * E2ESendReport is the bindings' representation of the return values of SendE2E. @@ -1869,6 +1929,26 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsNewCmixFromBackup(NSString* _Nullable ndfJSON, NSString* _Nullable storageDir, NSString* _Nullable backupPassphrase, NSData* _Nullable sessionPassword, NSData* _Nullable backupFileContents, NSError* _Nullable* _Nullable error); +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +FOUNDATION_EXPORT BindingsDummyTraffic* _Nullable BindingsNewDummyTrafficManager(long cmixId, long maxNumMessages, long avgSendDeltaMS, long randomRangeMS, NSError* _Nullable* _Nullable error); + /** * NewGroupChat creates a bindings-layer group chat manager. diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Bindings b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Bindings index bf6711e57010f64da9a93fdab740fd759a5a18a5..6b38659ebf76779717aca879ef37cb9f2a103e21 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h index 2acd7d58607297732a3a8fcb3cb8048738342fa0..1519ddb7fc5cd358bdf9fbcb599ee2f719f616a7 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Headers/Bindings.objc.h @@ -20,6 +20,7 @@ @class BindingsChannelDef; @class BindingsCmix; @class BindingsConnection; +@class BindingsDummyTraffic; @class BindingsE2ESendReport; @class BindingsE2e; @class BindingsEventReport; @@ -605,6 +606,65 @@ Returns: - (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; @end +/** + * DummyTraffic is the bindings-layer dummy (or "cover") traffic manager. T +The manager can be used to set and get the status of the thread responsible for +sending dummy messages. + */ +@interface BindingsDummyTraffic : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +- (nullable instancetype)initManager:(long)cmixId maxNumMessages:(long)maxNumMessages avgSendDeltaMS:(long)avgSendDeltaMS randomRangeMS:(long)randomRangeMS; +/** + * GetStatus returns the current state of the dummy traffic sending thread. +Note that this function does not return the status set by the most recent call to +SetStatus directly. Instead, this call returns the current status of the sending thread. +This is due to the small delay that may occur between calling SetStatus and the +sending thread taking into effect that status change. + +Returns: + - boolean - True: Sending thread is sending dummy messages. + - False: Sending thread is paused/stopped and is not sending dummy messages. + */ +- (BOOL)getStatus; +/** + * SetStatus sets the state of the dummy traffic send thread by passing in +a boolean parameter. There may be a small delay in between this call +and the status of the sending thread to change accordingly. For example, +passing False into this call while the sending thread is currently sending messages +will not cancel nor halt the sending operation, but will pause the thread once that +operation has completed. + +Params: + - boolean - True: Sending thread is sending dummy messages. + False: Sending thread is paused/stopped and is not sending dummy messages. +Returns: + - error - if the DummyTraffic.SetStatus is called too frequently, causing the + internal status channel to fill. + */ +- (BOOL)setStatus:(BOOL)status error:(NSError* _Nullable* _Nullable)error; +@end + /** * E2ESendReport is the bindings' representation of the return values of SendE2E. @@ -1869,6 +1929,26 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsNewCmixFromBackup(NSString* _Nullable ndfJSON, NSString* _Nullable storageDir, NSString* _Nullable backupPassphrase, NSData* _Nullable sessionPassword, NSData* _Nullable backupFileContents, NSError* _Nullable* _Nullable error); +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +FOUNDATION_EXPORT BindingsDummyTraffic* _Nullable BindingsNewDummyTrafficManager(long cmixId, long maxNumMessages, long avgSendDeltaMS, long randomRangeMS, NSError* _Nullable* _Nullable error); + /** * NewGroupChat creates a bindings-layer group chat manager. diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings index bf6711e57010f64da9a93fdab740fd759a5a18a5..6b38659ebf76779717aca879ef37cb9f2a103e21 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h index 2acd7d58607297732a3a8fcb3cb8048738342fa0..1519ddb7fc5cd358bdf9fbcb599ee2f719f616a7 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/A/Headers/Bindings.objc.h @@ -20,6 +20,7 @@ @class BindingsChannelDef; @class BindingsCmix; @class BindingsConnection; +@class BindingsDummyTraffic; @class BindingsE2ESendReport; @class BindingsE2e; @class BindingsEventReport; @@ -605,6 +606,65 @@ Returns: - (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; @end +/** + * DummyTraffic is the bindings-layer dummy (or "cover") traffic manager. T +The manager can be used to set and get the status of the thread responsible for +sending dummy messages. + */ +@interface BindingsDummyTraffic : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +- (nullable instancetype)initManager:(long)cmixId maxNumMessages:(long)maxNumMessages avgSendDeltaMS:(long)avgSendDeltaMS randomRangeMS:(long)randomRangeMS; +/** + * GetStatus returns the current state of the dummy traffic sending thread. +Note that this function does not return the status set by the most recent call to +SetStatus directly. Instead, this call returns the current status of the sending thread. +This is due to the small delay that may occur between calling SetStatus and the +sending thread taking into effect that status change. + +Returns: + - boolean - True: Sending thread is sending dummy messages. + - False: Sending thread is paused/stopped and is not sending dummy messages. + */ +- (BOOL)getStatus; +/** + * SetStatus sets the state of the dummy traffic send thread by passing in +a boolean parameter. There may be a small delay in between this call +and the status of the sending thread to change accordingly. For example, +passing False into this call while the sending thread is currently sending messages +will not cancel nor halt the sending operation, but will pause the thread once that +operation has completed. + +Params: + - boolean - True: Sending thread is sending dummy messages. + False: Sending thread is paused/stopped and is not sending dummy messages. +Returns: + - error - if the DummyTraffic.SetStatus is called too frequently, causing the + internal status channel to fill. + */ +- (BOOL)setStatus:(BOOL)status error:(NSError* _Nullable* _Nullable)error; +@end + /** * E2ESendReport is the bindings' representation of the return values of SendE2E. @@ -1869,6 +1929,26 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsNewCmixFromBackup(NSString* _Nullable ndfJSON, NSString* _Nullable storageDir, NSString* _Nullable backupPassphrase, NSData* _Nullable sessionPassword, NSData* _Nullable backupFileContents, NSError* _Nullable* _Nullable error); +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +FOUNDATION_EXPORT BindingsDummyTraffic* _Nullable BindingsNewDummyTrafficManager(long cmixId, long maxNumMessages, long avgSendDeltaMS, long randomRangeMS, NSError* _Nullable* _Nullable error); + /** * NewGroupChat creates a bindings-layer group chat manager. diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Bindings b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Bindings index bf6711e57010f64da9a93fdab740fd759a5a18a5..6b38659ebf76779717aca879ef37cb9f2a103e21 100644 Binary files a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Bindings and b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Bindings differ diff --git a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h index 2acd7d58607297732a3a8fcb3cb8048738342fa0..1519ddb7fc5cd358bdf9fbcb599ee2f719f616a7 100644 --- a/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h +++ b/Frameworks/Bindings.xcframework/ios-arm64_x86_64-simulator/Bindings.framework/Versions/Current/Headers/Bindings.objc.h @@ -20,6 +20,7 @@ @class BindingsChannelDef; @class BindingsCmix; @class BindingsConnection; +@class BindingsDummyTraffic; @class BindingsE2ESendReport; @class BindingsE2e; @class BindingsEventReport; @@ -605,6 +606,65 @@ Returns: - (NSData* _Nullable)sendE2E:(long)mt payload:(NSData* _Nullable)payload error:(NSError* _Nullable* _Nullable)error; @end +/** + * DummyTraffic is the bindings-layer dummy (or "cover") traffic manager. T +The manager can be used to set and get the status of the thread responsible for +sending dummy messages. + */ +@interface BindingsDummyTraffic : NSObject <goSeqRefInterface> { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +- (nullable instancetype)initManager:(long)cmixId maxNumMessages:(long)maxNumMessages avgSendDeltaMS:(long)avgSendDeltaMS randomRangeMS:(long)randomRangeMS; +/** + * GetStatus returns the current state of the dummy traffic sending thread. +Note that this function does not return the status set by the most recent call to +SetStatus directly. Instead, this call returns the current status of the sending thread. +This is due to the small delay that may occur between calling SetStatus and the +sending thread taking into effect that status change. + +Returns: + - boolean - True: Sending thread is sending dummy messages. + - False: Sending thread is paused/stopped and is not sending dummy messages. + */ +- (BOOL)getStatus; +/** + * SetStatus sets the state of the dummy traffic send thread by passing in +a boolean parameter. There may be a small delay in between this call +and the status of the sending thread to change accordingly. For example, +passing False into this call while the sending thread is currently sending messages +will not cancel nor halt the sending operation, but will pause the thread once that +operation has completed. + +Params: + - boolean - True: Sending thread is sending dummy messages. + False: Sending thread is paused/stopped and is not sending dummy messages. +Returns: + - error - if the DummyTraffic.SetStatus is called too frequently, causing the + internal status channel to fill. + */ +- (BOOL)setStatus:(BOOL)status error:(NSError* _Nullable* _Nullable)error; +@end + /** * E2ESendReport is the bindings' representation of the return values of SendE2E. @@ -1869,6 +1929,26 @@ Returns: */ FOUNDATION_EXPORT NSData* _Nullable BindingsNewCmixFromBackup(NSString* _Nullable ndfJSON, NSString* _Nullable storageDir, NSString* _Nullable backupPassphrase, NSData* _Nullable sessionPassword, NSData* _Nullable backupFileContents, NSError* _Nullable* _Nullable error); +/** + * NewDummyTrafficManager creates a DummyTraffic manager and initialises the +dummy traffic sending thread. Note that the manager does not start sending dummy +traffic until `True` is passed into DummyTraffic.SetStatus. The time duration +between each sending operation and the amount of messages sent each interval +are randomly generated values with bounds defined by the +given parameters below. + +Params: + - cmixId - a Cmix object ID in the tracker. + - maxNumMessages - the upper bound of the random number of messages sent + each sending cycle. + - avgSendDeltaMS - the average duration, in milliseconds, to wait + between sends. + - randomRangeMS - the upper bound of the interval between sending cycles, + in milliseconds. Sends occur every avgSendDeltaMS +/- a random duration + with an upper bound of randomRangeMS. + */ +FOUNDATION_EXPORT BindingsDummyTraffic* _Nullable BindingsNewDummyTrafficManager(long cmixId, long maxNumMessages, long avgSendDeltaMS, long randomRangeMS, NSError* _Nullable* _Nullable error); + /** * NewGroupChat creates a bindings-layer group chat manager. diff --git a/Sources/ElixxirDAppsSDK/DummyTraffic/DummyTraffic.swift b/Sources/ElixxirDAppsSDK/DummyTraffic/DummyTraffic.swift new file mode 100644 index 0000000000000000000000000000000000000000..4c35ed48ed8180c8c94029169183b09393d89f4c --- /dev/null +++ b/Sources/ElixxirDAppsSDK/DummyTraffic/DummyTraffic.swift @@ -0,0 +1,22 @@ +import Bindings + +public struct DummyTraffic { + public var getStatus: DummyTrafficGetStatus + public var setStatus: DummyTrafficSetStatus +} + +extension DummyTraffic { + public static func live(_ bindingsDummyTraffic: BindingsDummyTraffic) -> DummyTraffic { + DummyTraffic( + getStatus: .live(bindingsDummyTraffic), + setStatus: .live(bindingsDummyTraffic) + ) + } +} + +extension DummyTraffic { + public static let unimplemented = DummyTraffic( + getStatus: .unimplemented, + setStatus: .unimplemented + ) +} diff --git a/Sources/ElixxirDAppsSDK/DummyTraffic/Functors/DummyTrafficGetStatus.swift b/Sources/ElixxirDAppsSDK/DummyTraffic/Functors/DummyTrafficGetStatus.swift new file mode 100644 index 0000000000000000000000000000000000000000..6d93a7bd5cef3e66a54773c0d78e2a7adeac4ed7 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/DummyTraffic/Functors/DummyTrafficGetStatus.swift @@ -0,0 +1,22 @@ +import Bindings +import XCTestDynamicOverlay + +public struct DummyTrafficGetStatus { + public var run: () -> Bool + + public func callAsFunction() -> Bool { + run() + } +} + +extension DummyTrafficGetStatus { + public static func live(_ bindingsDummyTraffic: BindingsDummyTraffic) -> DummyTrafficGetStatus { + DummyTrafficGetStatus(run: bindingsDummyTraffic.getStatus) + } +} + +extension DummyTrafficGetStatus { + public static let unimplemented = DummyTrafficGetStatus( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/DummyTraffic/Functors/DummyTrafficSetStatus.swift b/Sources/ElixxirDAppsSDK/DummyTraffic/Functors/DummyTrafficSetStatus.swift new file mode 100644 index 0000000000000000000000000000000000000000..c3c998010c787a369718db1fad5c2dc3c2852968 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/DummyTraffic/Functors/DummyTrafficSetStatus.swift @@ -0,0 +1,22 @@ +import Bindings +import XCTestDynamicOverlay + +public struct DummyTrafficSetStatus { + public var run: (Bool) throws -> Void + + public func callAsFunction(_ status: Bool) throws { + try run(status) + } +} + +extension DummyTrafficSetStatus { + public static func live(_ bindingsDummyTraffic: BindingsDummyTraffic) -> DummyTrafficSetStatus { + DummyTrafficSetStatus(run: bindingsDummyTraffic.setStatus) + } +} + +extension DummyTrafficSetStatus { + public static let unimplemented = DummyTrafficSetStatus( + run: XCTUnimplemented("\(Self.self)") + ) +} diff --git a/Sources/ElixxirDAppsSDK/Functors/NewDummyTrafficManager.swift b/Sources/ElixxirDAppsSDK/Functors/NewDummyTrafficManager.swift new file mode 100644 index 0000000000000000000000000000000000000000..3a031033e07924cf72abbed94d45d469c41cdb22 --- /dev/null +++ b/Sources/ElixxirDAppsSDK/Functors/NewDummyTrafficManager.swift @@ -0,0 +1,40 @@ +import Bindings +import XCTestDynamicOverlay + +public struct NewDummyTrafficManager { + public var run: (Int, Int, Int, Int) throws -> DummyTraffic + + public func callAsFunction( + cMixId: Int, + maxNumMessages: Int, + avgSendDeltaMS: Int, + randomRangeMS: Int + ) throws -> DummyTraffic { + try run(cMixId, maxNumMessages, avgSendDeltaMS, randomRangeMS) + } +} + +extension NewDummyTrafficManager { + public static let live = NewDummyTrafficManager { + cMixId, maxNumMessages, avgSendDeltaMS, randomRangeMS in + + var error: NSError? + let bindingsDummyTraffic = BindingsNewDummyTrafficManager( + cMixId, + maxNumMessages, + avgSendDeltaMS, + randomRangeMS, + &error + ) + guard let bindingsDummyTraffic = bindingsDummyTraffic else { + fatalError("BindingsNewDummyTrafficManager returned `nil` without providing error") + } + return .live(bindingsDummyTraffic) + } +} + +extension NewDummyTrafficManager { + public static let unimplemented = NewDummyTrafficManager( + run: XCTUnimplemented("\(Self.self)") + ) +}