blob: cc8cdb4bf20d89d5c056f97982aee255670da4e4 [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
Mark Slee7e9eea42007-09-10 21:00:23 +000020#import <Cocoa/Cocoa.h>
21
22#import "TTransport.h"
23
24
25enum {
26 TMessageType_CALL = 1,
27 TMessageType_REPLY = 2,
David Reissdeda1412009-04-02 19:22:31 +000028 TMessageType_EXCEPTION = 3,
29 TMessageType_ONEWAY = 4
Mark Slee7e9eea42007-09-10 21:00:23 +000030};
31
32enum {
33 TType_STOP = 0,
34 TType_VOID = 1,
35 TType_BOOL = 2,
36 TType_BYTE = 3,
37 TType_DOUBLE = 4,
38 TType_I16 = 6,
39 TType_I32 = 8,
40 TType_I64 = 10,
41 TType_STRING = 11,
42 TType_STRUCT = 12,
43 TType_MAP = 13,
44 TType_SET = 14,
45 TType_LIST = 15
46};
47
48
49@protocol TProtocol <NSObject>
50
51- (id <TTransport>) transport;
52
Mark Slee33a7d892007-09-14 19:44:30 +000053- (void) readMessageBeginReturningName: (NSString **) name
54 type: (int *) type
55 sequenceID: (int *) sequenceID;
Mark Slee7e9eea42007-09-10 21:00:23 +000056- (void) readMessageEnd;
57
Mark Slee33a7d892007-09-14 19:44:30 +000058- (void) readStructBeginReturningName: (NSString **) name;
Mark Slee7e9eea42007-09-10 21:00:23 +000059- (void) readStructEnd;
60
Mark Slee33a7d892007-09-14 19:44:30 +000061- (void) readFieldBeginReturningName: (NSString **) name
62 type: (int *) fieldType
63 fieldID: (int *) fieldID;
Mark Slee7e9eea42007-09-10 21:00:23 +000064- (void) readFieldEnd;
65
66- (NSString *) readString;
67
68- (BOOL) readBool;
69
70- (unsigned char) readByte;
71
72- (short) readI16;
73
74- (int32_t) readI32;
75
76- (int64_t) readI64;
77
78- (double) readDouble;
79
80- (NSData *) readBinary;
81
Mark Slee33a7d892007-09-14 19:44:30 +000082- (void) readMapBeginReturningKeyType: (int *) keyType
83 valueType: (int *) valueType
84 size: (int *) size;
Mark Slee7e9eea42007-09-10 21:00:23 +000085- (void) readMapEnd;
86
87
Mark Slee33a7d892007-09-14 19:44:30 +000088- (void) readSetBeginReturningElementType: (int *) elementType
89 size: (int *) size;
Mark Slee7e9eea42007-09-10 21:00:23 +000090- (void) readSetEnd;
91
92
Mark Slee33a7d892007-09-14 19:44:30 +000093- (void) readListBeginReturningElementType: (int *) elementType
94 size: (int *) size;
Mark Slee7e9eea42007-09-10 21:00:23 +000095- (void) readListEnd;
96
97
98- (void) writeMessageBeginWithName: (NSString *) name
99 type: (int) messageType
100 sequenceID: (int) sequenceID;
101- (void) writeMessageEnd;
102
103- (void) writeStructBeginWithName: (NSString *) name;
104- (void) writeStructEnd;
105
106- (void) writeFieldBeginWithName: (NSString *) name
107 type: (int) fieldType
108 fieldID: (int) fieldID;
109
110- (void) writeI32: (int32_t) value;
111
112- (void) writeI64: (int64_t) value;
113
114- (void) writeI16: (short) value;
115
116- (void) writeByte: (uint8_t) value;
117
118- (void) writeString: (NSString *) value;
119
120- (void) writeDouble: (double) value;
121
Mark Slee33a7d892007-09-14 19:44:30 +0000122- (void) writeBool: (BOOL) value;
123
Mark Slee7e9eea42007-09-10 21:00:23 +0000124- (void) writeBinary: (NSData *) data;
125
126- (void) writeFieldStop;
127
128- (void) writeFieldEnd;
129
130- (void) writeMapBeginWithKeyType: (int) keyType
131 valueType: (int) valueType
132 size: (int) size;
133- (void) writeMapEnd;
134
135
136- (void) writeSetBeginWithElementType: (int) elementType
137 size: (int) size;
138- (void) writeSetEnd;
139
140
141- (void) writeListBeginWithElementType: (int) elementType
142 size: (int) size;
143
144- (void) writeListEnd;
145
146
147@end
148