blob: bc64789edf7292d6f15876ffdac794b833d2285e [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
Mark Slee33a7d892007-09-14 19:44:30 +000033- (void) readMessageBeginReturningName: (NSString **) name
34 type: (int *) type
35 sequenceID: (int *) sequenceID;
Mark Slee7e9eea42007-09-10 21:00:23 +000036- (void) readMessageEnd;
37
Mark Slee33a7d892007-09-14 19:44:30 +000038- (void) readStructBeginReturningName: (NSString **) name;
Mark Slee7e9eea42007-09-10 21:00:23 +000039- (void) readStructEnd;
40
Mark Slee33a7d892007-09-14 19:44:30 +000041- (void) readFieldBeginReturningName: (NSString **) name
42 type: (int *) fieldType
43 fieldID: (int *) fieldID;
Mark Slee7e9eea42007-09-10 21:00:23 +000044- (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
Mark Slee33a7d892007-09-14 19:44:30 +000062- (void) readMapBeginReturningKeyType: (int *) keyType
63 valueType: (int *) valueType
64 size: (int *) size;
Mark Slee7e9eea42007-09-10 21:00:23 +000065- (void) readMapEnd;
66
67
Mark Slee33a7d892007-09-14 19:44:30 +000068- (void) readSetBeginReturningElementType: (int *) elementType
69 size: (int *) size;
Mark Slee7e9eea42007-09-10 21:00:23 +000070- (void) readSetEnd;
71
72
Mark Slee33a7d892007-09-14 19:44:30 +000073- (void) readListBeginReturningElementType: (int *) elementType
74 size: (int *) size;
Mark Slee7e9eea42007-09-10 21:00:23 +000075- (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
Mark Slee33a7d892007-09-14 19:44:30 +0000102- (void) writeBool: (BOOL) value;
103
Mark Slee7e9eea42007-09-10 21:00:23 +0000104- (void) writeBinary: (NSData *) data;
105
106- (void) writeFieldStop;
107
108- (void) writeFieldEnd;
109
110- (void) writeMapBeginWithKeyType: (int) keyType
111 valueType: (int) valueType
112 size: (int) size;
113- (void) writeMapEnd;
114
115
116- (void) writeSetBeginWithElementType: (int) elementType
117 size: (int) size;
118- (void) writeSetEnd;
119
120
121- (void) writeListBeginWithElementType: (int) elementType
122 size: (int) size;
123
124- (void) writeListEnd;
125
126
127@end
128