tunnelkit/TunnelKit/Sources/Core/DataPath.h
Davide De Rosa 94890c08cf Do not deprecate until replacement
Implement new compression framing later.
2018-08-24 00:48:17 +02:00

32 lines
1.0 KiB
Objective-C

//
// DataPath.h
// TunnelKit
//
// 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
- (void)setLZOFraming:(BOOL)LZOFraming;// DEPRECATED_ATTRIBUTE;
- (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