blob: 96d3af6af4312480c5c0d6bbbef8a06638af644a [file] [log] [blame]
Mark Slee7e9eea42007-09-10 21:00:23 +00001#import <Cocoa/Cocoa.h>
2
3#import "TTransport.h"
4
5
6enum {
7 TMessageType_CALL = 1,
8 TMessageType_REPLY = 2,
9 TMessageType_EXCEPTION = 3
10};
11
12enum {
13 TType_STOP = 0,
14 TType_VOID = 1,
15 TType_BOOL = 2,
16 TType_BYTE = 3,
17 TType_DOUBLE = 4,
18 TType_I16 = 6,
19 TType_I32 = 8,
20 TType_I64 = 10,
21 TType_STRING = 11,
22 TType_STRUCT = 12,
23 TType_MAP = 13,
24 TType_SET = 14,
25 TType_LIST = 15
26};
27
28
29@protocol TProtocol <NSObject>
30
31- (id <TTransport>) transport;
32
33- (void) readMessageBeginWithName: (NSString **) name
34 type: (int *) type
35 sequenceID: (int *) sequenceID;
36- (void) readMessageEnd;
37
38- (void) readStructBeginWithName: (NSString **) name;
39- (void) readStructEnd;
40
41- (void) readFieldBeginWithName: (NSString **) name
42 type: (int *) fieldType
43 fieldID: (int *) fieldID;
44- (void) readFieldEnd;
45
46- (NSString *) readString;
47
48- (BOOL) readBool;
49
50- (unsigned char) readByte;
51
52- (short) readI16;
53
54- (int32_t) readI32;
55
56- (int64_t) readI64;
57
58- (double) readDouble;
59
60- (NSData *) readBinary;
61
62- (void) readMapBeginWithKeyType: (int *) keyType
63 valueType: (int *) valueType
64 size: (int *) size;
65- (void) readMapEnd;
66
67
68- (void) readSetBeginWithElementType: (int *) elementType
69 size: (int *) size;
70- (void) readSetEnd;
71
72
73- (void) readListBeginWithElementType: (int *) elementType
74 size: (int *) size;
75- (void) readListEnd;
76
77
78- (void) writeMessageBeginWithName: (NSString *) name
79 type: (int) messageType
80 sequenceID: (int) sequenceID;
81- (void) writeMessageEnd;
82
83- (void) writeStructBeginWithName: (NSString *) name;
84- (void) writeStructEnd;
85
86- (void) writeFieldBeginWithName: (NSString *) name
87 type: (int) fieldType
88 fieldID: (int) fieldID;
89
90- (void) writeI32: (int32_t) value;
91
92- (void) writeI64: (int64_t) value;
93
94- (void) writeI16: (short) value;
95
96- (void) writeByte: (uint8_t) value;
97
98- (void) writeString: (NSString *) value;
99
100- (void) writeDouble: (double) value;
101
102- (void) writeBinary: (NSData *) data;
103
104- (void) writeFieldStop;
105
106- (void) writeFieldEnd;
107
108- (void) writeMapBeginWithKeyType: (int) keyType
109 valueType: (int) valueType
110 size: (int) size;
111- (void) writeMapEnd;
112
113
114- (void) writeSetBeginWithElementType: (int) elementType
115 size: (int) size;
116- (void) writeSetEnd;
117
118
119- (void) writeListBeginWithElementType: (int) elementType
120 size: (int) size;
121
122- (void) writeListEnd;
123
124
125@end
126