2018-08-23 08:19:25 +00:00
|
|
|
//
|
|
|
|
// DataPath.h
|
2018-08-23 10:07:55 +00:00
|
|
|
// TunnelKit
|
2018-08-23 08:19:25 +00:00
|
|
|
//
|
|
|
|
// Created by Davide De Rosa on 3/2/17.
|
|
|
|
// Copyright © 2018 London Trust Media. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
@protocol DataPathEncrypter;
|
|
|
|
@protocol DataPathDecrypter;
|
|
|
|
|
|
|
|
// send/receive should be mutually thread-safe
|
|
|
|
|
|
|
|
@interface DataPath : NSObject
|
|
|
|
|
|
|
|
@property (nonatomic, assign) uint32_t maxPacketId;
|
|
|
|
|
|
|
|
- (nonnull instancetype)initWithEncrypter:(nonnull id<DataPathEncrypter>)encrypter
|
|
|
|
decrypter:(nonnull id<DataPathDecrypter>)decrypter
|
|
|
|
maxPackets:(NSInteger)maxPackets
|
|
|
|
usesReplayProtection:(BOOL)usesReplayProtection;
|
|
|
|
|
|
|
|
- (void)setPeerId:(uint32_t)peerId; // 24-bit, discard most significant byte
|
2018-08-23 22:47:19 +00:00
|
|
|
- (void)setLZOFraming:(BOOL)LZOFraming;// DEPRECATED_ATTRIBUTE;
|
2018-08-23 08:19:25 +00:00
|
|
|
|
|
|
|
- (NSArray<NSData *> *)encryptPackets:(nonnull NSArray<NSData *> *)packets key:(uint8_t)key error:(NSError **)error;
|
|
|
|
- (NSArray<NSData *> *)decryptPackets:(nonnull NSArray<NSData *> *)packets keepAlive:(nullable bool *)keepAlive error:(NSError **)error;
|
|
|
|
|
|
|
|
@end
|