//
//  NXSignalPacket.h
//  NXSdwan
//
//  Created by 徐家骏 on 2019/4/26.
//  Copyright © 2019 徐家骏. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

#define NX_DEFAULT_SIGNAL_TTL 0
#define NXSessionManagerUserId -1

typedef NS_ENUM(uint16_t, NXSignalCategory)
{
    NXSignalCategoryInternal = 0,
    NXSignalCategoryCall     = 1,
    NXSignalCategoryMessage  = 2,
    NXSignalCategoryCustom   = 100,
};

typedef NS_ENUM(uint16_t, NXSignalSource)
{
    NXSignalSourceUDP         = 1,
    NXSignalSourcePushkit     = 2,
    NXSignalSourceApns        = 3,
};


@interface NXSignalPacket : NSObject

@property(nonatomic, strong)  NSMutableDictionary  *signalDict;
@property(nonatomic)          uint16_t   category;
@property(nonatomic)          int64_t    timestamp;
@property(nonatomic)          int64_t    from;
@property(nonatomic)          int64_t    to;
@property(nonatomic)          uint32_t   ttl;
@property(nonatomic, strong)  NSString  *uuid;
@property(nonatomic)   NXSignalSource   source;

- (instancetype)init;
- (instancetype)initWithData:(NSData *)data;
- (instancetype)initWithString:(NSString *)string;
- (NSData *)toData;
- (NSString *)toString;

@end



NS_ASSUME_NONNULL_END
