diff --git a/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionDecoder.h b/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionDecoder.h deleted file mode 100644 index 35e6f12..0000000 --- a/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionDecoder.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// RHSocketZlibCompressionDecoder.h -// RHSocketKitDemo -// -// Created by zhuruhong on 16/2/15. -// Copyright © 2016年 zhuruhong. All rights reserved. -// - -#import - -@interface RHSocketZlibCompressionDecoder : NSObject - -@end diff --git a/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionDecoder.m b/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionDecoder.m deleted file mode 100644 index 7cf5975..0000000 --- a/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionDecoder.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// RHSocketZlibCompressionDecoder.m -// RHSocketKitDemo -// -// Created by zhuruhong on 16/2/15. -// Copyright © 2016年 zhuruhong. All rights reserved. -// - -#import "RHSocketZlibCompressionDecoder.h" - -@implementation RHSocketZlibCompressionDecoder - -@end diff --git a/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionEncoder.h b/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionEncoder.h deleted file mode 100644 index 8095acf..0000000 --- a/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionEncoder.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// RHSocketZlibCompressionEncoder.h -// RHSocketKitDemo -// -// Created by zhuruhong on 16/2/15. -// Copyright © 2016年 zhuruhong. All rights reserved. -// - -#import - -@interface RHSocketZlibCompressionEncoder : NSObject - -@end diff --git a/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionEncoder.m b/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionEncoder.m deleted file mode 100644 index 2064ca9..0000000 --- a/RHSocketKit/Core/Codec/CompressionCodec/RHSocketZlibCompressionEncoder.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// RHSocketZlibCompressionEncoder.m -// RHSocketKitDemo -// -// Created by zhuruhong on 16/2/15. -// Copyright © 2016年 zhuruhong. All rights reserved. -// - -#import "RHSocketZlibCompressionEncoder.h" - -@implementation RHSocketZlibCompressionEncoder - -@end diff --git a/RHSocketKit/Core/Codec/RHSocketDelimiterDecoder.h b/RHSocketKit/Core/Codec/Delimiter/RHSocketDelimiterDecoder.h similarity index 100% rename from RHSocketKit/Core/Codec/RHSocketDelimiterDecoder.h rename to RHSocketKit/Core/Codec/Delimiter/RHSocketDelimiterDecoder.h diff --git a/RHSocketKit/Core/Codec/RHSocketDelimiterDecoder.m b/RHSocketKit/Core/Codec/Delimiter/RHSocketDelimiterDecoder.m similarity index 100% rename from RHSocketKit/Core/Codec/RHSocketDelimiterDecoder.m rename to RHSocketKit/Core/Codec/Delimiter/RHSocketDelimiterDecoder.m diff --git a/RHSocketKit/Core/Codec/RHSocketDelimiterEncoder.h b/RHSocketKit/Core/Codec/Delimiter/RHSocketDelimiterEncoder.h similarity index 100% rename from RHSocketKit/Core/Codec/RHSocketDelimiterEncoder.h rename to RHSocketKit/Core/Codec/Delimiter/RHSocketDelimiterEncoder.h diff --git a/RHSocketKit/Core/Codec/RHSocketDelimiterEncoder.m b/RHSocketKit/Core/Codec/Delimiter/RHSocketDelimiterEncoder.m similarity index 100% rename from RHSocketKit/Core/Codec/RHSocketDelimiterEncoder.m rename to RHSocketKit/Core/Codec/Delimiter/RHSocketDelimiterEncoder.m diff --git a/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthDecoder.h b/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthDecoder.h new file mode 100644 index 0000000..381826e --- /dev/null +++ b/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthDecoder.h @@ -0,0 +1,21 @@ +// +// RHProtobufVarint32LengthDecoder.h +// RHSocketKitDemo +// +// Created by zhuruhong on 16/5/26. +// Copyright © 2016年 zhuruhong. All rights reserved. +// + +#import +#import "RHSocketCodecProtocol.h" + +@interface RHProtobufVarint32LengthDecoder : NSObject + +/** + * 应用协议中允许发送的最大数据块大小,默认为65536 + */ +@property (nonatomic, assign) NSUInteger maxFrameSize; + +@property (nonatomic, strong) id nextDecoder; + +@end diff --git a/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthDecoder.m b/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthDecoder.m new file mode 100644 index 0000000..b25c503 --- /dev/null +++ b/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthDecoder.m @@ -0,0 +1,78 @@ +// +// RHProtobufVarint32LengthDecoder.m +// RHSocketKitDemo +// +// Created by zhuruhong on 16/5/26. +// Copyright © 2016年 zhuruhong. All rights reserved. +// + +#import "RHProtobufVarint32LengthDecoder.h" +#import "RHSocketException.h" +#import "RHSocketUtils+Protobuf.h" +#import "RHSocketPacketContext.h" + +@implementation RHProtobufVarint32LengthDecoder + +- (instancetype)init +{ + if (self = [super init]) { + _maxFrameSize = NSIntegerMax; + } + return self; +} + +- (NSInteger)decode:(id)downstreamPacket output:(id)output +{ + id object = [downstreamPacket object]; + if (![object isKindOfClass:[NSData class]]) { + [RHSocketException raiseWithReason:@"[Decode] object should be NSData ..."]; + return -1; + } + + NSData *downstreamData = object; + NSUInteger headIndex = 0; + + //先读区2个字节的协议长度 (前2个字节为数据包的长度) + while (downstreamData && downstreamData.length - headIndex > 1) { + + NSRange remainRange = NSMakeRange(headIndex, downstreamData.length - headIndex); + NSData *remainData = [downstreamData subdataWithRange:remainRange]; + + NSInteger countOfLengthByte = [RHSocketUtils computeCountOfLengthByte:remainData]; + if (countOfLengthByte <= 0) { + break; + } + + NSData *lenData = [downstreamData subdataWithRange:NSMakeRange(headIndex, countOfLengthByte)]; + //长度字节数据,可能存在高低位互换,通过数值转换工具处理 + NSUInteger frameLen = (NSUInteger)[RHSocketUtils valueWithVarint32Data:lenData]; + if (frameLen >= _maxFrameSize - countOfLengthByte) { + [RHSocketException raiseWithReason:@"[Decode] Too Long Frame ..."]; + return -1; + }// + + //剩余数据,不是完整的数据包,则break继续读取等待 + if (downstreamData.length - headIndex < countOfLengthByte + frameLen) { + break; + } + //数据包(长度+内容) + NSData *frameData = [downstreamData subdataWithRange:NSMakeRange(headIndex, countOfLengthByte + frameLen)]; + + //去除数据长度后的数据内容 + RHSocketPacketResponse *ctx = [[RHSocketPacketResponse alloc] init]; + ctx.object = [frameData subdataWithRange:NSMakeRange(countOfLengthByte, frameLen)]; + + //责任链模式,丢给下一个处理器 + if (_nextDecoder) { + [_nextDecoder decode:ctx output:output]; + } else { + [output didDecode:ctx]; + } + + //调整已经解码数据 + headIndex += frameData.length; + }//while + return headIndex; +} + +@end diff --git a/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthEncoder.h b/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthEncoder.h new file mode 100644 index 0000000..54f6deb --- /dev/null +++ b/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthEncoder.h @@ -0,0 +1,19 @@ +// +// RHProtobufVarint32LengthEncoder.h +// RHSocketKitDemo +// +// Created by zhuruhong on 16/5/26. +// Copyright © 2016年 zhuruhong. All rights reserved. +// + +#import +#import "RHSocketCodecProtocol.h" + +@interface RHProtobufVarint32LengthEncoder : NSObject + +/** + * 应用协议中允许发送的最大数据块大小,默认为65536 + */ +@property (nonatomic, assign) NSUInteger maxFrameSize; + +@end diff --git a/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthEncoder.m b/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthEncoder.m new file mode 100644 index 0000000..f07a590 --- /dev/null +++ b/RHSocketKit/Core/Codec/Protobuf/RHProtobufVarint32LengthEncoder.m @@ -0,0 +1,55 @@ +// +// RHProtobufVarint32LengthEncoder.m +// RHSocketKitDemo +// +// Created by zhuruhong on 16/5/26. +// Copyright © 2016年 zhuruhong. All rights reserved. +// + +#import "RHProtobufVarint32LengthEncoder.h" +#import "RHSocketException.h" +#import "RHSocketUtils+Protobuf.h" + +@implementation RHProtobufVarint32LengthEncoder + +- (instancetype)init +{ + if (self = [super init]) { + _maxFrameSize = NSIntegerMax; + } + return self; +} + +- (void)encode:(id)upstreamPacket output:(id)output +{ + id object = [upstreamPacket object]; + if (![object isKindOfClass:[NSData class]]) { + [RHSocketException raiseWithReason:@"[Encode] object should be NSData ..."]; + return; + } + + NSData *data = object; + if (data.length == 0) { + return; + }// + + if (data.length >= _maxFrameSize - 4) { + [RHSocketException raiseWithReason:@"[Encode] Too Long Frame ..."]; + return; + }// + + //可变长度编码,数据块的前两个字节为后续完整数据块的长度 + NSUInteger dataLen = data.length; + NSMutableData *sendData = [[NSMutableData alloc] init]; + + //将数据长度转换为长度字节,写入到数据块中。这里根据head占的字节个数转换data长度,长度不定[1~5] + NSData *headData = [RHSocketUtils dataWithRawVarint32:dataLen]; + [sendData appendData:headData]; + [sendData appendData:data]; + NSTimeInterval timeout = [upstreamPacket timeout]; + + RHSocketLog(@"timeout: %f, sendData: %@", timeout, sendData); + [output didEncode:sendData timeout:timeout]; +} + +@end diff --git a/RHSocketKit/Core/Codec/Protobuf/RHSocketUtils+Protobuf.h b/RHSocketKit/Core/Codec/Protobuf/RHSocketUtils+Protobuf.h new file mode 100644 index 0000000..3a9a9f5 --- /dev/null +++ b/RHSocketKit/Core/Codec/Protobuf/RHSocketUtils+Protobuf.h @@ -0,0 +1,25 @@ +// +// RHSocketUtils+Protobuf.h +// RHSocketKitDemo +// +// Created by zhuruhong on 16/5/26. +// Copyright © 2016年 zhuruhong. All rights reserved. +// + +#import "RHSocketUtils.h" + +@interface RHSocketUtils (Protobuf) + +/** + * 计算出一帧数据的长度字节个数 (1~5) + * + * @param frameData 带解码字节 + * + * @return 返回一帧数据的长度字节个数, varint32, 返回值为1~5有效,-1为计算失败 + */ ++ (NSInteger)computeCountOfLengthByte:(NSData *)frameData; + ++ (int64_t)valueWithVarint32Data:(NSData *)data; ++ (NSData *)dataWithRawVarint32:(int64_t)value; + +@end diff --git a/RHSocketKit/Core/Codec/Protobuf/RHSocketUtils+Protobuf.m b/RHSocketKit/Core/Codec/Protobuf/RHSocketUtils+Protobuf.m new file mode 100644 index 0000000..7d26fbd --- /dev/null +++ b/RHSocketKit/Core/Codec/Protobuf/RHSocketUtils+Protobuf.m @@ -0,0 +1,80 @@ +// +// RHSocketUtils+Protobuf.m +// RHSocketKitDemo +// +// Created by zhuruhong on 16/5/26. +// Copyright © 2016年 zhuruhong. All rights reserved. +// + +#import "RHSocketUtils+Protobuf.h" + +@implementation RHSocketUtils (Protobuf) + +/** + * 计算出一帧数据的长度字节个数 (1~5) + * + * @param frameData 带解码字节 + * + * @return 返回一帧数据的长度字节个数, varint32, 返回值为1~5有效,-1为计算失败 + */ ++ (NSInteger)computeCountOfLengthByte:(NSData *)frameData +{ + //默认长度字节个数为-1 + NSInteger countOfLengthByte = -1; + //最大尝试读区个数为4个字节,超过则认为是大数据5个字节 + NSInteger maxCountOfLengthByte = MIN(frameData.length, 4); + //从第1个字节开始尝试读取计算 + NSInteger testIndex = 0; + + while (testIndex < maxCountOfLengthByte) { + NSRange lengthRange = NSMakeRange(testIndex, 1); + NSData *oneByte = [frameData subdataWithRange:lengthRange]; + int8_t oneValue = [RHSocketUtils int8FromBytes:oneByte]; + + if ((oneValue & 0x80) == 0) { + countOfLengthByte = testIndex + 1; + break; + } + testIndex++;//增加长度字节个数 + }//while + + //超过4个字节,则认为是大数据5个字节 + if (testIndex >= 4) { + countOfLengthByte = 5; + } + return countOfLengthByte; +} + ++ (int64_t)valueWithVarint32Data:(NSData *)data +{ + NSUInteger dataLen = data.length; + int64_t value = 0; + int offset = 0; + + while (offset < dataLen) { + int32_t tempVal = 0; + [data getBytes:&tempVal range:NSMakeRange(offset, 1)]; + value += (tempVal << (7 * offset)); + offset++; + }//while + + return value; +} + ++ (NSData *)dataWithRawVarint32:(int64_t)value +{ + NSMutableData *valData = [[NSMutableData alloc] init]; + while (true) { + if ((value & ~0x7F) == 0) {//如果最高位是0,只要一个字节表示 + [valData appendBytes:&value length:1]; + break; + } else { + int valChar = (value & 0x7F) | 0x80;//先写入低7位,最高位置1 + [valData appendBytes:&valChar length:1]; + value = value >> 7;//再写高7位 + } + } + return valData; +} + +@end diff --git a/RHSocketKit/Core/Codec/RHSocketVariableLengthDecoder.h b/RHSocketKit/Core/Codec/VariableLength/RHSocketVariableLengthDecoder.h similarity index 100% rename from RHSocketKit/Core/Codec/RHSocketVariableLengthDecoder.h rename to RHSocketKit/Core/Codec/VariableLength/RHSocketVariableLengthDecoder.h diff --git a/RHSocketKit/Core/Codec/RHSocketVariableLengthDecoder.m b/RHSocketKit/Core/Codec/VariableLength/RHSocketVariableLengthDecoder.m similarity index 100% rename from RHSocketKit/Core/Codec/RHSocketVariableLengthDecoder.m rename to RHSocketKit/Core/Codec/VariableLength/RHSocketVariableLengthDecoder.m diff --git a/RHSocketKit/Core/Codec/RHSocketVariableLengthEncoder.h b/RHSocketKit/Core/Codec/VariableLength/RHSocketVariableLengthEncoder.h similarity index 100% rename from RHSocketKit/Core/Codec/RHSocketVariableLengthEncoder.h rename to RHSocketKit/Core/Codec/VariableLength/RHSocketVariableLengthEncoder.h diff --git a/RHSocketKit/Core/Codec/RHSocketVariableLengthEncoder.m b/RHSocketKit/Core/Codec/VariableLength/RHSocketVariableLengthEncoder.m similarity index 100% rename from RHSocketKit/Core/Codec/RHSocketVariableLengthEncoder.m rename to RHSocketKit/Core/Codec/VariableLength/RHSocketVariableLengthEncoder.m diff --git a/RHSocketKit/Core/Utils/RHSocketUtils.m b/RHSocketKit/Core/Utils/RHSocketUtils.m index 1305339..ed29f3a 100644 --- a/RHSocketKit/Core/Utils/RHSocketUtils.m +++ b/RHSocketKit/Core/Utils/RHSocketUtils.m @@ -136,7 +136,7 @@ + (int64_t)valueFromBytes:(NSData *)data int offset = 0; while (offset < dataLen) { - uint32_t tempVal = 0; + int32_t tempVal = 0; [data getBytes:&tempVal range:NSMakeRange(offset, 1)]; value += (tempVal << (8 * offset)); offset++; diff --git a/RHSocketKit/Core/Codec/Base64Codec/RHSocketBase64Decoder.h b/RHSocketKit/Extend/Codec/Base64Codec/RHSocketBase64Decoder.h similarity index 100% rename from RHSocketKit/Core/Codec/Base64Codec/RHSocketBase64Decoder.h rename to RHSocketKit/Extend/Codec/Base64Codec/RHSocketBase64Decoder.h diff --git a/RHSocketKit/Core/Codec/Base64Codec/RHSocketBase64Decoder.m b/RHSocketKit/Extend/Codec/Base64Codec/RHSocketBase64Decoder.m similarity index 100% rename from RHSocketKit/Core/Codec/Base64Codec/RHSocketBase64Decoder.m rename to RHSocketKit/Extend/Codec/Base64Codec/RHSocketBase64Decoder.m diff --git a/RHSocketKit/Core/Codec/Base64Codec/RHSocketBase64Encoder.h b/RHSocketKit/Extend/Codec/Base64Codec/RHSocketBase64Encoder.h similarity index 100% rename from RHSocketKit/Core/Codec/Base64Codec/RHSocketBase64Encoder.h rename to RHSocketKit/Extend/Codec/Base64Codec/RHSocketBase64Encoder.h diff --git a/RHSocketKit/Core/Codec/Base64Codec/RHSocketBase64Encoder.m b/RHSocketKit/Extend/Codec/Base64Codec/RHSocketBase64Encoder.m similarity index 100% rename from RHSocketKit/Core/Codec/Base64Codec/RHSocketBase64Encoder.m rename to RHSocketKit/Extend/Codec/Base64Codec/RHSocketBase64Encoder.m diff --git a/RHSocketKit/Core/Codec/ProtobufCodec/RHSocketProtobufDecoder.h b/RHSocketKit/Extend/Codec/ProtobufCodec/RHSocketProtobufDecoder.h similarity index 100% rename from RHSocketKit/Core/Codec/ProtobufCodec/RHSocketProtobufDecoder.h rename to RHSocketKit/Extend/Codec/ProtobufCodec/RHSocketProtobufDecoder.h diff --git a/RHSocketKit/Core/Codec/ProtobufCodec/RHSocketProtobufDecoder.m b/RHSocketKit/Extend/Codec/ProtobufCodec/RHSocketProtobufDecoder.m similarity index 100% rename from RHSocketKit/Core/Codec/ProtobufCodec/RHSocketProtobufDecoder.m rename to RHSocketKit/Extend/Codec/ProtobufCodec/RHSocketProtobufDecoder.m diff --git a/RHSocketKit/Core/Codec/ProtobufCodec/RHSocketProtobufEncoder.h b/RHSocketKit/Extend/Codec/ProtobufCodec/RHSocketProtobufEncoder.h similarity index 100% rename from RHSocketKit/Core/Codec/ProtobufCodec/RHSocketProtobufEncoder.h rename to RHSocketKit/Extend/Codec/ProtobufCodec/RHSocketProtobufEncoder.h diff --git a/RHSocketKit/Core/Codec/ProtobufCodec/RHSocketProtobufEncoder.m b/RHSocketKit/Extend/Codec/ProtobufCodec/RHSocketProtobufEncoder.m similarity index 100% rename from RHSocketKit/Core/Codec/ProtobufCodec/RHSocketProtobufEncoder.m rename to RHSocketKit/Extend/Codec/ProtobufCodec/RHSocketProtobufEncoder.m diff --git a/RHSocketKit/Core/Codec/SerializationCodec/NSDictionary+RHSocket.h b/RHSocketKit/Extend/Codec/SerializationCodec/NSDictionary+RHSocket.h similarity index 100% rename from RHSocketKit/Core/Codec/SerializationCodec/NSDictionary+RHSocket.h rename to RHSocketKit/Extend/Codec/SerializationCodec/NSDictionary+RHSocket.h diff --git a/RHSocketKit/Core/Codec/SerializationCodec/NSDictionary+RHSocket.m b/RHSocketKit/Extend/Codec/SerializationCodec/NSDictionary+RHSocket.m similarity index 100% rename from RHSocketKit/Core/Codec/SerializationCodec/NSDictionary+RHSocket.m rename to RHSocketKit/Extend/Codec/SerializationCodec/NSDictionary+RHSocket.m diff --git a/RHSocketKit/Core/Codec/SerializationCodec/RHSocketJSONSerializationDecoder.h b/RHSocketKit/Extend/Codec/SerializationCodec/RHSocketJSONSerializationDecoder.h similarity index 100% rename from RHSocketKit/Core/Codec/SerializationCodec/RHSocketJSONSerializationDecoder.h rename to RHSocketKit/Extend/Codec/SerializationCodec/RHSocketJSONSerializationDecoder.h diff --git a/RHSocketKit/Core/Codec/SerializationCodec/RHSocketJSONSerializationDecoder.m b/RHSocketKit/Extend/Codec/SerializationCodec/RHSocketJSONSerializationDecoder.m similarity index 100% rename from RHSocketKit/Core/Codec/SerializationCodec/RHSocketJSONSerializationDecoder.m rename to RHSocketKit/Extend/Codec/SerializationCodec/RHSocketJSONSerializationDecoder.m diff --git a/RHSocketKit/Core/Codec/SerializationCodec/RHSocketJSONSerializationEncoder.h b/RHSocketKit/Extend/Codec/SerializationCodec/RHSocketJSONSerializationEncoder.h similarity index 100% rename from RHSocketKit/Core/Codec/SerializationCodec/RHSocketJSONSerializationEncoder.h rename to RHSocketKit/Extend/Codec/SerializationCodec/RHSocketJSONSerializationEncoder.h diff --git a/RHSocketKit/Core/Codec/SerializationCodec/RHSocketJSONSerializationEncoder.m b/RHSocketKit/Extend/Codec/SerializationCodec/RHSocketJSONSerializationEncoder.m similarity index 100% rename from RHSocketKit/Core/Codec/SerializationCodec/RHSocketJSONSerializationEncoder.m rename to RHSocketKit/Extend/Codec/SerializationCodec/RHSocketJSONSerializationEncoder.m diff --git a/RHSocketKit/Core/Codec/StringCodec/RHSocketStringDecoder.h b/RHSocketKit/Extend/Codec/StringCodec/RHSocketStringDecoder.h similarity index 100% rename from RHSocketKit/Core/Codec/StringCodec/RHSocketStringDecoder.h rename to RHSocketKit/Extend/Codec/StringCodec/RHSocketStringDecoder.h diff --git a/RHSocketKit/Core/Codec/StringCodec/RHSocketStringDecoder.m b/RHSocketKit/Extend/Codec/StringCodec/RHSocketStringDecoder.m similarity index 100% rename from RHSocketKit/Core/Codec/StringCodec/RHSocketStringDecoder.m rename to RHSocketKit/Extend/Codec/StringCodec/RHSocketStringDecoder.m diff --git a/RHSocketKit/Core/Codec/StringCodec/RHSocketStringEncoder.h b/RHSocketKit/Extend/Codec/StringCodec/RHSocketStringEncoder.h similarity index 100% rename from RHSocketKit/Core/Codec/StringCodec/RHSocketStringEncoder.h rename to RHSocketKit/Extend/Codec/StringCodec/RHSocketStringEncoder.h diff --git a/RHSocketKit/Core/Codec/StringCodec/RHSocketStringEncoder.m b/RHSocketKit/Extend/Codec/StringCodec/RHSocketStringEncoder.m similarity index 100% rename from RHSocketKit/Core/Codec/StringCodec/RHSocketStringEncoder.m rename to RHSocketKit/Extend/Codec/StringCodec/RHSocketStringEncoder.m diff --git a/RHSocketKitDemo/RHSocketKitDemo.xcodeproj/project.pbxproj b/RHSocketKitDemo/RHSocketKitDemo.xcodeproj/project.pbxproj index 3e1b105..7a79255 100644 --- a/RHSocketKitDemo/RHSocketKitDemo.xcodeproj/project.pbxproj +++ b/RHSocketKitDemo/RHSocketKitDemo.xcodeproj/project.pbxproj @@ -12,12 +12,6 @@ 83167D471C760F5D0067234F /* Person.proto in Resources */ = {isa = PBXBuildFile; fileRef = 83167D451C760F5D0067234F /* Person.proto */; }; 8320EC121C23F166006A4CEC /* RHSocketChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8320EC011C23F166006A4CEC /* RHSocketChannel.m */; }; 8320EC131C23F166006A4CEC /* RHSocketConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 8320EC031C23F166006A4CEC /* RHSocketConnection.m */; }; - 8333F0351C71B41700FEB4BF /* RHSocketStringEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8333F0341C71B41700FEB4BF /* RHSocketStringEncoder.m */; }; - 8333F03B1C71B44500FEB4BF /* RHSocketStringDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8333F03A1C71B44500FEB4BF /* RHSocketStringDecoder.m */; }; - 8333F03E1C71B99900FEB4BF /* RHSocketDelimiterEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8333F03D1C71B99900FEB4BF /* RHSocketDelimiterEncoder.m */; }; - 8333F0411C71B9C200FEB4BF /* RHSocketDelimiterDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8333F0401C71B9C200FEB4BF /* RHSocketDelimiterDecoder.m */; }; - 8333F0441C71BE8400FEB4BF /* RHSocketVariableLengthEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8333F0431C71BE8400FEB4BF /* RHSocketVariableLengthEncoder.m */; }; - 8333F0471C71BEB900FEB4BF /* RHSocketVariableLengthDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8333F0461C71BEB900FEB4BF /* RHSocketVariableLengthDecoder.m */; }; 8338246E1B47D411000DB52A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8338246D1B47D411000DB52A /* main.m */; }; 833824711B47D411000DB52A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 833824701B47D411000DB52A /* AppDelegate.m */; }; 833824741B47D411000DB52A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 833824731B47D411000DB52A /* ViewController.m */; }; @@ -32,7 +26,22 @@ 837C5D1E1C2AB8A9003A000E /* RHSocketCallReply.m in Sources */ = {isa = PBXBuildFile; fileRef = 837C5D161C2AB8A9003A000E /* RHSocketCallReply.m */; }; 837C5D1F1C2AB8A9003A000E /* RHSocketCallReplyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 837C5D181C2AB8A9003A000E /* RHSocketCallReplyManager.m */; }; 837C5D201C2AB8A9003A000E /* RHSocketChannelProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 837C5D1B1C2AB8A9003A000E /* RHSocketChannelProxy.m */; }; - 838B8F9A1C7C875C0072BB5C /* NSDictionary+RHSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 838B8F991C7C875C0072BB5C /* NSDictionary+RHSocket.m */; }; + 8386477B1CF702790083DA33 /* RHSocketDelimiterDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647721CF702790083DA33 /* RHSocketDelimiterDecoder.m */; }; + 8386477C1CF702790083DA33 /* RHSocketDelimiterEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647741CF702790083DA33 /* RHSocketDelimiterEncoder.m */; }; + 8386477D1CF702790083DA33 /* RHSocketVariableLengthDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647781CF702790083DA33 /* RHSocketVariableLengthDecoder.m */; }; + 8386477E1CF702790083DA33 /* RHSocketVariableLengthEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8386477A1CF702790083DA33 /* RHSocketVariableLengthEncoder.m */; }; + 838647961CF7028B0083DA33 /* RHSocketBase64Decoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647821CF7028B0083DA33 /* RHSocketBase64Decoder.m */; }; + 838647971CF7028B0083DA33 /* RHSocketBase64Encoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647841CF7028B0083DA33 /* RHSocketBase64Encoder.m */; }; + 838647981CF7028B0083DA33 /* RHSocketProtobufDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647871CF7028B0083DA33 /* RHSocketProtobufDecoder.m */; }; + 838647991CF7028B0083DA33 /* RHSocketProtobufEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647891CF7028B0083DA33 /* RHSocketProtobufEncoder.m */; }; + 8386479A1CF7028B0083DA33 /* NSDictionary+RHSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 8386478C1CF7028B0083DA33 /* NSDictionary+RHSocket.m */; }; + 8386479B1CF7028B0083DA33 /* RHSocketJSONSerializationDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 8386478E1CF7028B0083DA33 /* RHSocketJSONSerializationDecoder.m */; }; + 8386479C1CF7028B0083DA33 /* RHSocketJSONSerializationEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647901CF7028B0083DA33 /* RHSocketJSONSerializationEncoder.m */; }; + 8386479D1CF7028B0083DA33 /* RHSocketStringDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647931CF7028B0083DA33 /* RHSocketStringDecoder.m */; }; + 8386479E1CF7028B0083DA33 /* RHSocketStringEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647951CF7028B0083DA33 /* RHSocketStringEncoder.m */; }; + 838647A41CF70B330083DA33 /* RHProtobufVarint32LengthEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647A31CF70B330083DA33 /* RHProtobufVarint32LengthEncoder.m */; }; + 838647A71CF70B5E0083DA33 /* RHProtobufVarint32LengthDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647A61CF70B5E0083DA33 /* RHProtobufVarint32LengthDecoder.m */; }; + 838647AA1CF71E760083DA33 /* RHSocketUtils+Protobuf.m in Sources */ = {isa = PBXBuildFile; fileRef = 838647A91CF71E760083DA33 /* RHSocketUtils+Protobuf.m */; }; 83A00E411C5F115500883FD8 /* RHSocketException.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A00E401C5F115500883FD8 /* RHSocketException.m */; }; 83A5DA141C72BD9D00E650A0 /* RHSocketPacketContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A5DA131C72BD9D00E650A0 /* RHSocketPacketContext.m */; }; 83A5DA1A1C730D4F00E650A0 /* RHSocketHttpEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A5DA191C730D4F00E650A0 /* RHSocketHttpEncoder.m */; }; @@ -41,14 +50,6 @@ 83A5DA231C730E0F00E650A0 /* RHSocketHttpResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A5DA221C730E0F00E650A0 /* RHSocketHttpResponse.m */; }; 83A5DA291C73286200E650A0 /* RHSocketUdpConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A5DA281C73286200E650A0 /* RHSocketUdpConnection.m */; }; 83A758131CF5800C008B3364 /* RHWebSocketChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = 83A758121CF5800C008B3364 /* RHWebSocketChannel.m */; }; - 83D2A9051C720DC400FFBB72 /* RHSocketJSONSerializationEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D2A9041C720DC400FFBB72 /* RHSocketJSONSerializationEncoder.m */; }; - 83D2A90B1C720E3D00FFBB72 /* RHSocketBase64Encoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D2A90A1C720E3D00FFBB72 /* RHSocketBase64Encoder.m */; }; - 83D2A90E1C720E5200FFBB72 /* RHSocketBase64Decoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D2A90D1C720E5200FFBB72 /* RHSocketBase64Decoder.m */; }; - 83D2A9111C720ED900FFBB72 /* RHSocketZlibCompressionEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D2A9101C720ED900FFBB72 /* RHSocketZlibCompressionEncoder.m */; }; - 83D2A9141C720EF200FFBB72 /* RHSocketZlibCompressionDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D2A9131C720EF200FFBB72 /* RHSocketZlibCompressionDecoder.m */; }; - 83D2A9171C720F0700FFBB72 /* RHSocketJSONSerializationDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D2A9161C720F0700FFBB72 /* RHSocketJSONSerializationDecoder.m */; }; - 83D2A91A1C720F2D00FFBB72 /* RHSocketProtobufEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D2A9191C720F2D00FFBB72 /* RHSocketProtobufEncoder.m */; }; - 83D2A91D1C720F4100FFBB72 /* RHSocketProtobufDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D2A91C1C720F4100FFBB72 /* RHSocketProtobufDecoder.m */; }; 83D831E11C9419EB0024E20C /* RHSocketRpcCmdDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D831DE1C9419EB0024E20C /* RHSocketRpcCmdDecoder.m */; }; 83D831E21C9419EB0024E20C /* RHSocketRpcCmdEncoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 83D831E01C9419EB0024E20C /* RHSocketRpcCmdEncoder.m */; }; /* End PBXBuildFile section */ @@ -78,18 +79,6 @@ 8320EC051C23F166006A4CEC /* RHSocketCodecProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketCodecProtocol.h; sourceTree = ""; }; 8320EC0D1C23F166006A4CEC /* RHSocketPacket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketPacket.h; sourceTree = ""; }; 8320EC0F1C23F166006A4CEC /* RHSocketConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketConfig.h; sourceTree = ""; }; - 8333F0331C71B41700FEB4BF /* RHSocketStringEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketStringEncoder.h; sourceTree = ""; }; - 8333F0341C71B41700FEB4BF /* RHSocketStringEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketStringEncoder.m; sourceTree = ""; }; - 8333F0391C71B44500FEB4BF /* RHSocketStringDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketStringDecoder.h; sourceTree = ""; }; - 8333F03A1C71B44500FEB4BF /* RHSocketStringDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketStringDecoder.m; sourceTree = ""; }; - 8333F03C1C71B99900FEB4BF /* RHSocketDelimiterEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketDelimiterEncoder.h; sourceTree = ""; }; - 8333F03D1C71B99900FEB4BF /* RHSocketDelimiterEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketDelimiterEncoder.m; sourceTree = ""; }; - 8333F03F1C71B9C200FEB4BF /* RHSocketDelimiterDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketDelimiterDecoder.h; sourceTree = ""; }; - 8333F0401C71B9C200FEB4BF /* RHSocketDelimiterDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketDelimiterDecoder.m; sourceTree = ""; }; - 8333F0421C71BE8400FEB4BF /* RHSocketVariableLengthEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketVariableLengthEncoder.h; sourceTree = ""; }; - 8333F0431C71BE8400FEB4BF /* RHSocketVariableLengthEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketVariableLengthEncoder.m; sourceTree = ""; }; - 8333F0451C71BEB900FEB4BF /* RHSocketVariableLengthDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketVariableLengthDecoder.h; sourceTree = ""; }; - 8333F0461C71BEB900FEB4BF /* RHSocketVariableLengthDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketVariableLengthDecoder.m; sourceTree = ""; }; 833824681B47D411000DB52A /* RHSocketKitDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RHSocketKitDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8338246C1B47D411000DB52A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8338246D1B47D411000DB52A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -118,8 +107,38 @@ 837C5D191C2AB8A9003A000E /* RHSocketCallReplyProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketCallReplyProtocol.h; sourceTree = ""; }; 837C5D1A1C2AB8A9003A000E /* RHSocketChannelProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketChannelProxy.h; sourceTree = ""; }; 837C5D1B1C2AB8A9003A000E /* RHSocketChannelProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketChannelProxy.m; sourceTree = ""; }; - 838B8F981C7C875C0072BB5C /* NSDictionary+RHSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+RHSocket.h"; sourceTree = ""; }; - 838B8F991C7C875C0072BB5C /* NSDictionary+RHSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+RHSocket.m"; sourceTree = ""; }; + 838647711CF702790083DA33 /* RHSocketDelimiterDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketDelimiterDecoder.h; sourceTree = ""; }; + 838647721CF702790083DA33 /* RHSocketDelimiterDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketDelimiterDecoder.m; sourceTree = ""; }; + 838647731CF702790083DA33 /* RHSocketDelimiterEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketDelimiterEncoder.h; sourceTree = ""; }; + 838647741CF702790083DA33 /* RHSocketDelimiterEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketDelimiterEncoder.m; sourceTree = ""; }; + 838647771CF702790083DA33 /* RHSocketVariableLengthDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketVariableLengthDecoder.h; sourceTree = ""; }; + 838647781CF702790083DA33 /* RHSocketVariableLengthDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketVariableLengthDecoder.m; sourceTree = ""; }; + 838647791CF702790083DA33 /* RHSocketVariableLengthEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketVariableLengthEncoder.h; sourceTree = ""; }; + 8386477A1CF702790083DA33 /* RHSocketVariableLengthEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketVariableLengthEncoder.m; sourceTree = ""; }; + 838647811CF7028B0083DA33 /* RHSocketBase64Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketBase64Decoder.h; sourceTree = ""; }; + 838647821CF7028B0083DA33 /* RHSocketBase64Decoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketBase64Decoder.m; sourceTree = ""; }; + 838647831CF7028B0083DA33 /* RHSocketBase64Encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketBase64Encoder.h; sourceTree = ""; }; + 838647841CF7028B0083DA33 /* RHSocketBase64Encoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketBase64Encoder.m; sourceTree = ""; }; + 838647861CF7028B0083DA33 /* RHSocketProtobufDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketProtobufDecoder.h; sourceTree = ""; }; + 838647871CF7028B0083DA33 /* RHSocketProtobufDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketProtobufDecoder.m; sourceTree = ""; }; + 838647881CF7028B0083DA33 /* RHSocketProtobufEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketProtobufEncoder.h; sourceTree = ""; }; + 838647891CF7028B0083DA33 /* RHSocketProtobufEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketProtobufEncoder.m; sourceTree = ""; }; + 8386478B1CF7028B0083DA33 /* NSDictionary+RHSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+RHSocket.h"; sourceTree = ""; }; + 8386478C1CF7028B0083DA33 /* NSDictionary+RHSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+RHSocket.m"; sourceTree = ""; }; + 8386478D1CF7028B0083DA33 /* RHSocketJSONSerializationDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketJSONSerializationDecoder.h; sourceTree = ""; }; + 8386478E1CF7028B0083DA33 /* RHSocketJSONSerializationDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketJSONSerializationDecoder.m; sourceTree = ""; }; + 8386478F1CF7028B0083DA33 /* RHSocketJSONSerializationEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketJSONSerializationEncoder.h; sourceTree = ""; }; + 838647901CF7028B0083DA33 /* RHSocketJSONSerializationEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketJSONSerializationEncoder.m; sourceTree = ""; }; + 838647921CF7028B0083DA33 /* RHSocketStringDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketStringDecoder.h; sourceTree = ""; }; + 838647931CF7028B0083DA33 /* RHSocketStringDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketStringDecoder.m; sourceTree = ""; }; + 838647941CF7028B0083DA33 /* RHSocketStringEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketStringEncoder.h; sourceTree = ""; }; + 838647951CF7028B0083DA33 /* RHSocketStringEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketStringEncoder.m; sourceTree = ""; }; + 838647A21CF70B330083DA33 /* RHProtobufVarint32LengthEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHProtobufVarint32LengthEncoder.h; sourceTree = ""; }; + 838647A31CF70B330083DA33 /* RHProtobufVarint32LengthEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHProtobufVarint32LengthEncoder.m; sourceTree = ""; }; + 838647A51CF70B5E0083DA33 /* RHProtobufVarint32LengthDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHProtobufVarint32LengthDecoder.h; sourceTree = ""; }; + 838647A61CF70B5E0083DA33 /* RHProtobufVarint32LengthDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHProtobufVarint32LengthDecoder.m; sourceTree = ""; }; + 838647A81CF71E760083DA33 /* RHSocketUtils+Protobuf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RHSocketUtils+Protobuf.h"; sourceTree = ""; }; + 838647A91CF71E760083DA33 /* RHSocketUtils+Protobuf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RHSocketUtils+Protobuf.m"; sourceTree = ""; }; 83A00E3F1C5F115500883FD8 /* RHSocketException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketException.h; sourceTree = ""; }; 83A00E401C5F115500883FD8 /* RHSocketException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketException.m; sourceTree = ""; }; 83A5DA121C72BD9D00E650A0 /* RHSocketPacketContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketPacketContext.h; sourceTree = ""; }; @@ -136,22 +155,6 @@ 83A5DA281C73286200E650A0 /* RHSocketUdpConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketUdpConnection.m; sourceTree = ""; }; 83A758111CF5800C008B3364 /* RHWebSocketChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHWebSocketChannel.h; sourceTree = ""; }; 83A758121CF5800C008B3364 /* RHWebSocketChannel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHWebSocketChannel.m; sourceTree = ""; }; - 83D2A9031C720DC400FFBB72 /* RHSocketJSONSerializationEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketJSONSerializationEncoder.h; sourceTree = ""; }; - 83D2A9041C720DC400FFBB72 /* RHSocketJSONSerializationEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketJSONSerializationEncoder.m; sourceTree = ""; }; - 83D2A9091C720E3D00FFBB72 /* RHSocketBase64Encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketBase64Encoder.h; sourceTree = ""; }; - 83D2A90A1C720E3D00FFBB72 /* RHSocketBase64Encoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketBase64Encoder.m; sourceTree = ""; }; - 83D2A90C1C720E5200FFBB72 /* RHSocketBase64Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketBase64Decoder.h; sourceTree = ""; }; - 83D2A90D1C720E5200FFBB72 /* RHSocketBase64Decoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketBase64Decoder.m; sourceTree = ""; }; - 83D2A90F1C720ED900FFBB72 /* RHSocketZlibCompressionEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketZlibCompressionEncoder.h; sourceTree = ""; }; - 83D2A9101C720ED900FFBB72 /* RHSocketZlibCompressionEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketZlibCompressionEncoder.m; sourceTree = ""; }; - 83D2A9121C720EF200FFBB72 /* RHSocketZlibCompressionDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketZlibCompressionDecoder.h; sourceTree = ""; }; - 83D2A9131C720EF200FFBB72 /* RHSocketZlibCompressionDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketZlibCompressionDecoder.m; sourceTree = ""; }; - 83D2A9151C720F0700FFBB72 /* RHSocketJSONSerializationDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketJSONSerializationDecoder.h; sourceTree = ""; }; - 83D2A9161C720F0700FFBB72 /* RHSocketJSONSerializationDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketJSONSerializationDecoder.m; sourceTree = ""; }; - 83D2A9181C720F2D00FFBB72 /* RHSocketProtobufEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketProtobufEncoder.h; sourceTree = ""; }; - 83D2A9191C720F2D00FFBB72 /* RHSocketProtobufEncoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketProtobufEncoder.m; sourceTree = ""; }; - 83D2A91B1C720F4100FFBB72 /* RHSocketProtobufDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketProtobufDecoder.h; sourceTree = ""; }; - 83D2A91C1C720F4100FFBB72 /* RHSocketProtobufDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketProtobufDecoder.m; sourceTree = ""; }; 83D831DD1C9419EB0024E20C /* RHSocketRpcCmdDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketRpcCmdDecoder.h; sourceTree = ""; }; 83D831DE1C9419EB0024E20C /* RHSocketRpcCmdDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RHSocketRpcCmdDecoder.m; sourceTree = ""; }; 83D831DF1C9419EB0024E20C /* RHSocketRpcCmdEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RHSocketRpcCmdEncoder.h; sourceTree = ""; }; @@ -229,20 +232,10 @@ 8320EC041C23F166006A4CEC /* Codec */ = { isa = PBXGroup; children = ( - 83D2A9061C720E2600FFBB72 /* Base64Codec */, - 83D2A9071C720E2600FFBB72 /* CompressionCodec */, - 83D2A9081C720E2600FFBB72 /* ProtobufCodec */, - 83D2A9021C720DC400FFBB72 /* SerializationCodec */, - 8333F02F1C71AF1B00FEB4BF /* StringCodec */, + 838647701CF702790083DA33 /* Delimiter */, + 838647751CF702790083DA33 /* Protobuf */, + 838647761CF702790083DA33 /* VariableLength */, 8320EC051C23F166006A4CEC /* RHSocketCodecProtocol.h */, - 8333F03C1C71B99900FEB4BF /* RHSocketDelimiterEncoder.h */, - 8333F03D1C71B99900FEB4BF /* RHSocketDelimiterEncoder.m */, - 8333F03F1C71B9C200FEB4BF /* RHSocketDelimiterDecoder.h */, - 8333F0401C71B9C200FEB4BF /* RHSocketDelimiterDecoder.m */, - 8333F0421C71BE8400FEB4BF /* RHSocketVariableLengthEncoder.h */, - 8333F0431C71BE8400FEB4BF /* RHSocketVariableLengthEncoder.m */, - 8333F0451C71BEB900FEB4BF /* RHSocketVariableLengthDecoder.h */, - 8333F0461C71BEB900FEB4BF /* RHSocketVariableLengthDecoder.m */, ); path = Codec; sourceTree = ""; @@ -257,17 +250,6 @@ path = Packet; sourceTree = ""; }; - 8333F02F1C71AF1B00FEB4BF /* StringCodec */ = { - isa = PBXGroup; - children = ( - 8333F0331C71B41700FEB4BF /* RHSocketStringEncoder.h */, - 8333F0341C71B41700FEB4BF /* RHSocketStringEncoder.m */, - 8333F0391C71B44500FEB4BF /* RHSocketStringDecoder.h */, - 8333F03A1C71B44500FEB4BF /* RHSocketStringDecoder.m */, - ); - path = StringCodec; - sourceTree = ""; - }; 8333F04B1C71D45700FEB4BF /* Http */ = { isa = PBXGroup; children = ( @@ -379,6 +361,7 @@ 836D65AD1C27E8ED0044AD4A /* Extend */ = { isa = PBXGroup; children = ( + 8386477F1CF7028B0083DA33 /* Codec */, 836D65B91C27E9360044AD4A /* RHSocketService.h */, 836D65BA1C27E9360044AD4A /* RHSocketService.m */, ); @@ -424,61 +407,107 @@ path = CallReply; sourceTree = ""; }; - 83A00E321C5F0D0000883FD8 /* Exception */ = { + 838647701CF702790083DA33 /* Delimiter */ = { isa = PBXGroup; children = ( - 83A00E3F1C5F115500883FD8 /* RHSocketException.h */, - 83A00E401C5F115500883FD8 /* RHSocketException.m */, + 838647711CF702790083DA33 /* RHSocketDelimiterDecoder.h */, + 838647721CF702790083DA33 /* RHSocketDelimiterDecoder.m */, + 838647731CF702790083DA33 /* RHSocketDelimiterEncoder.h */, + 838647741CF702790083DA33 /* RHSocketDelimiterEncoder.m */, ); - path = Exception; + path = Delimiter; sourceTree = ""; }; - 83D2A9021C720DC400FFBB72 /* SerializationCodec */ = { + 838647751CF702790083DA33 /* Protobuf */ = { isa = PBXGroup; children = ( - 83D2A9031C720DC400FFBB72 /* RHSocketJSONSerializationEncoder.h */, - 83D2A9041C720DC400FFBB72 /* RHSocketJSONSerializationEncoder.m */, - 83D2A9151C720F0700FFBB72 /* RHSocketJSONSerializationDecoder.h */, - 83D2A9161C720F0700FFBB72 /* RHSocketJSONSerializationDecoder.m */, - 838B8F981C7C875C0072BB5C /* NSDictionary+RHSocket.h */, - 838B8F991C7C875C0072BB5C /* NSDictionary+RHSocket.m */, + 838647A21CF70B330083DA33 /* RHProtobufVarint32LengthEncoder.h */, + 838647A31CF70B330083DA33 /* RHProtobufVarint32LengthEncoder.m */, + 838647A51CF70B5E0083DA33 /* RHProtobufVarint32LengthDecoder.h */, + 838647A61CF70B5E0083DA33 /* RHProtobufVarint32LengthDecoder.m */, + 838647A81CF71E760083DA33 /* RHSocketUtils+Protobuf.h */, + 838647A91CF71E760083DA33 /* RHSocketUtils+Protobuf.m */, + ); + path = Protobuf; + sourceTree = ""; + }; + 838647761CF702790083DA33 /* VariableLength */ = { + isa = PBXGroup; + children = ( + 838647771CF702790083DA33 /* RHSocketVariableLengthDecoder.h */, + 838647781CF702790083DA33 /* RHSocketVariableLengthDecoder.m */, + 838647791CF702790083DA33 /* RHSocketVariableLengthEncoder.h */, + 8386477A1CF702790083DA33 /* RHSocketVariableLengthEncoder.m */, ); - path = SerializationCodec; + path = VariableLength; sourceTree = ""; }; - 83D2A9061C720E2600FFBB72 /* Base64Codec */ = { + 8386477F1CF7028B0083DA33 /* Codec */ = { isa = PBXGroup; children = ( - 83D2A9091C720E3D00FFBB72 /* RHSocketBase64Encoder.h */, - 83D2A90A1C720E3D00FFBB72 /* RHSocketBase64Encoder.m */, - 83D2A90C1C720E5200FFBB72 /* RHSocketBase64Decoder.h */, - 83D2A90D1C720E5200FFBB72 /* RHSocketBase64Decoder.m */, + 838647801CF7028B0083DA33 /* Base64Codec */, + 838647851CF7028B0083DA33 /* ProtobufCodec */, + 8386478A1CF7028B0083DA33 /* SerializationCodec */, + 838647911CF7028B0083DA33 /* StringCodec */, ); - path = Base64Codec; + path = Codec; sourceTree = ""; }; - 83D2A9071C720E2600FFBB72 /* CompressionCodec */ = { + 838647801CF7028B0083DA33 /* Base64Codec */ = { isa = PBXGroup; children = ( - 83D2A90F1C720ED900FFBB72 /* RHSocketZlibCompressionEncoder.h */, - 83D2A9101C720ED900FFBB72 /* RHSocketZlibCompressionEncoder.m */, - 83D2A9121C720EF200FFBB72 /* RHSocketZlibCompressionDecoder.h */, - 83D2A9131C720EF200FFBB72 /* RHSocketZlibCompressionDecoder.m */, + 838647811CF7028B0083DA33 /* RHSocketBase64Decoder.h */, + 838647821CF7028B0083DA33 /* RHSocketBase64Decoder.m */, + 838647831CF7028B0083DA33 /* RHSocketBase64Encoder.h */, + 838647841CF7028B0083DA33 /* RHSocketBase64Encoder.m */, ); - path = CompressionCodec; + path = Base64Codec; sourceTree = ""; }; - 83D2A9081C720E2600FFBB72 /* ProtobufCodec */ = { + 838647851CF7028B0083DA33 /* ProtobufCodec */ = { isa = PBXGroup; children = ( - 83D2A9181C720F2D00FFBB72 /* RHSocketProtobufEncoder.h */, - 83D2A9191C720F2D00FFBB72 /* RHSocketProtobufEncoder.m */, - 83D2A91B1C720F4100FFBB72 /* RHSocketProtobufDecoder.h */, - 83D2A91C1C720F4100FFBB72 /* RHSocketProtobufDecoder.m */, + 838647861CF7028B0083DA33 /* RHSocketProtobufDecoder.h */, + 838647871CF7028B0083DA33 /* RHSocketProtobufDecoder.m */, + 838647881CF7028B0083DA33 /* RHSocketProtobufEncoder.h */, + 838647891CF7028B0083DA33 /* RHSocketProtobufEncoder.m */, ); path = ProtobufCodec; sourceTree = ""; }; + 8386478A1CF7028B0083DA33 /* SerializationCodec */ = { + isa = PBXGroup; + children = ( + 8386478B1CF7028B0083DA33 /* NSDictionary+RHSocket.h */, + 8386478C1CF7028B0083DA33 /* NSDictionary+RHSocket.m */, + 8386478D1CF7028B0083DA33 /* RHSocketJSONSerializationDecoder.h */, + 8386478E1CF7028B0083DA33 /* RHSocketJSONSerializationDecoder.m */, + 8386478F1CF7028B0083DA33 /* RHSocketJSONSerializationEncoder.h */, + 838647901CF7028B0083DA33 /* RHSocketJSONSerializationEncoder.m */, + ); + path = SerializationCodec; + sourceTree = ""; + }; + 838647911CF7028B0083DA33 /* StringCodec */ = { + isa = PBXGroup; + children = ( + 838647921CF7028B0083DA33 /* RHSocketStringDecoder.h */, + 838647931CF7028B0083DA33 /* RHSocketStringDecoder.m */, + 838647941CF7028B0083DA33 /* RHSocketStringEncoder.h */, + 838647951CF7028B0083DA33 /* RHSocketStringEncoder.m */, + ); + path = StringCodec; + sourceTree = ""; + }; + 83A00E321C5F0D0000883FD8 /* Exception */ = { + isa = PBXGroup; + children = ( + 83A00E3F1C5F115500883FD8 /* RHSocketException.h */, + 83A00E401C5F115500883FD8 /* RHSocketException.m */, + ); + path = Exception; + sourceTree = ""; + }; 9C1552C6FF76D1C5CD3E2DE0 /* Pods */ = { isa = PBXGroup; children = ( @@ -643,42 +672,43 @@ buildActionMask = 2147483647; files = ( 83D831E11C9419EB0024E20C /* RHSocketRpcCmdDecoder.m in Sources */, + 8386477E1CF702790083DA33 /* RHSocketVariableLengthEncoder.m in Sources */, 837C5D1C1C2AB8A9003A000E /* RHAuthCallReply.m in Sources */, 83A5DA1D1C730D5D00E650A0 /* RHSocketHttpDecoder.m in Sources */, - 8333F03B1C71B44500FEB4BF /* RHSocketStringDecoder.m in Sources */, - 83D2A9111C720ED900FFBB72 /* RHSocketZlibCompressionEncoder.m in Sources */, + 838647961CF7028B0083DA33 /* RHSocketBase64Decoder.m in Sources */, 833824741B47D411000DB52A /* ViewController.m in Sources */, - 83D2A9171C720F0700FFBB72 /* RHSocketJSONSerializationDecoder.m in Sources */, - 83D2A9141C720EF200FFBB72 /* RHSocketZlibCompressionDecoder.m in Sources */, + 838647981CF7028B0083DA33 /* RHSocketProtobufDecoder.m in Sources */, 837C5D1F1C2AB8A9003A000E /* RHSocketCallReplyManager.m in Sources */, - 8333F0351C71B41700FEB4BF /* RHSocketStringEncoder.m in Sources */, 837C5D0E1C2A7C58003A000E /* RHSocketUtils.m in Sources */, - 8333F0441C71BE8400FEB4BF /* RHSocketVariableLengthEncoder.m in Sources */, + 838647991CF7028B0083DA33 /* RHSocketProtobufEncoder.m in Sources */, 837C5D1E1C2AB8A9003A000E /* RHSocketCallReply.m in Sources */, - 83D2A90B1C720E3D00FFBB72 /* RHSocketBase64Encoder.m in Sources */, - 83D2A90E1C720E5200FFBB72 /* RHSocketBase64Decoder.m in Sources */, 83A5DA291C73286200E650A0 /* RHSocketUdpConnection.m in Sources */, 83167D461C760F5D0067234F /* Person.pb.m in Sources */, 833824711B47D411000DB52A /* AppDelegate.m in Sources */, 8338246E1B47D411000DB52A /* main.m in Sources */, 83A758131CF5800C008B3364 /* RHWebSocketChannel.m in Sources */, + 8386479E1CF7028B0083DA33 /* RHSocketStringEncoder.m in Sources */, + 838647AA1CF71E760083DA33 /* RHSocketUtils+Protobuf.m in Sources */, + 8386479B1CF7028B0083DA33 /* RHSocketJSONSerializationDecoder.m in Sources */, 83A5DA1A1C730D4F00E650A0 /* RHSocketHttpEncoder.m in Sources */, 8320EC121C23F166006A4CEC /* RHSocketChannel.m in Sources */, - 8333F0471C71BEB900FEB4BF /* RHSocketVariableLengthDecoder.m in Sources */, 836D65BB1C27E9360044AD4A /* RHSocketService.m in Sources */, - 83D2A9051C720DC400FFBB72 /* RHSocketJSONSerializationEncoder.m in Sources */, - 8333F03E1C71B99900FEB4BF /* RHSocketDelimiterEncoder.m in Sources */, 837C5D1D1C2AB8A9003A000E /* RHConnectCallReply.m in Sources */, - 83D2A91A1C720F2D00FFBB72 /* RHSocketProtobufEncoder.m in Sources */, + 838647A71CF70B5E0083DA33 /* RHProtobufVarint32LengthDecoder.m in Sources */, + 8386477C1CF702790083DA33 /* RHSocketDelimiterEncoder.m in Sources */, 83A5DA231C730E0F00E650A0 /* RHSocketHttpResponse.m in Sources */, 83D831E21C9419EB0024E20C /* RHSocketRpcCmdEncoder.m in Sources */, + 8386479A1CF7028B0083DA33 /* NSDictionary+RHSocket.m in Sources */, 837C5D201C2AB8A9003A000E /* RHSocketChannelProxy.m in Sources */, + 8386479C1CF7028B0083DA33 /* RHSocketJSONSerializationEncoder.m in Sources */, 8320EC131C23F166006A4CEC /* RHSocketConnection.m in Sources */, - 838B8F9A1C7C875C0072BB5C /* NSDictionary+RHSocket.m in Sources */, + 8386477D1CF702790083DA33 /* RHSocketVariableLengthDecoder.m in Sources */, + 838647971CF7028B0083DA33 /* RHSocketBase64Encoder.m in Sources */, 83A5DA141C72BD9D00E650A0 /* RHSocketPacketContext.m in Sources */, + 8386477B1CF702790083DA33 /* RHSocketDelimiterDecoder.m in Sources */, + 8386479D1CF7028B0083DA33 /* RHSocketStringDecoder.m in Sources */, + 838647A41CF70B330083DA33 /* RHProtobufVarint32LengthEncoder.m in Sources */, 83A5DA201C730DEF00E650A0 /* RHSocketHttpRequest.m in Sources */, - 8333F0411C71B9C200FEB4BF /* RHSocketDelimiterDecoder.m in Sources */, - 83D2A91D1C720F4100FFBB72 /* RHSocketProtobufDecoder.m in Sources */, 83A00E411C5F115500883FD8 /* RHSocketException.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/RHSocketKitDemo/RHSocketKitDemo/ViewController.m b/RHSocketKitDemo/RHSocketKitDemo/ViewController.m index 071c2f7..9849f0e 100644 --- a/RHSocketKitDemo/RHSocketKitDemo/ViewController.m +++ b/RHSocketKitDemo/RHSocketKitDemo/ViewController.m @@ -18,9 +18,6 @@ #import "RHSocketJSONSerializationEncoder.h" #import "RHSocketJSONSerializationDecoder.h" -#import "RHSocketZlibCompressionEncoder.h" -#import "RHSocketZlibCompressionDecoder.h" - #import "RHSocketProtobufEncoder.h" #import "RHSocketProtobufDecoder.h" #import "Person.pb.h" @@ -223,7 +220,7 @@ - (void)viewDidLoad { // _webSocketChannel = [[RHWebSocketChannel alloc] initWithURL:@"ws://115.29.193.48:8088"]; _webSocketChannel.delegate = self; - [_webSocketChannel openConnection]; +// [_webSocketChannel openConnection]; }