Computer Laboratory

tesla.proto
Go to the documentation of this file.
1 
2 /*
3  * Copyright (c) 2012 Jonathan Anderson
4  * All rights reserved.
5  *
6  * This software was developed by SRI International and the University of
7  * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
8  * ("CTSRD"), as part of the DARPA CRASH research programme.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  */
31 package tesla;
32 
33 
37 message ManifestFile {
40 
45  repeated Usage root = 2;
46 }
47 
48 
52 message Usage {
54  required Identifier identifier = 1;
55 
57  optional Expression beginning = 2;
58 
61 }
62 
63 
68  required Identifier identifier = 1;
69 
74  enum Context { Global = 1; ThreadLocal = 2; };
75  required Context context = 2;
76 
78  required Expression expression = 3;
79 
81  repeated Argument argument = 5;
82 }
83 
84 
86 message Identifier {
88  optional string name = 1;
89 
91  optional Location location = 2;
92 }
93 
95 message Location {
96  required string filename = 1;
97  required int32 line = 2;
98  required int32 counter = 3;
99 }
100 
107 message Expression {
108  enum Type {
109  BOOLEAN_EXPR = 1; SEQUENCE = 2; NULL_EXPR = 3;
110  NOW = 4; FUNCTION = 5; FIELD_ASSIGN = 6;
111  SUB_AUTOMATON = 7;
112  };
113  required Type type = 1;
114 
115  optional BooleanExpr booleanExpr = 2;
116  optional Sequence sequence = 3;
118  optional FunctionEvent function = 5;
119  optional FieldAssignment fieldAssign = 6;
120  optional Identifier subAutomaton = 7;
121 }
122 
124 message BooleanExpr {
125  enum Operation { BE_And = 1; BE_Or = 2; BE_Xor = 3; }
126 
127  required Operation operation = 1;
128  repeated Expression expression = 2;
129 }
130 
132 message Sequence {
133  repeated Expression expression = 1;
134 }
135 
140 message NowEvent {
141  required Location location = 1;
142 }
143 
145 message FunctionEvent {
146  enum Direction { Entry = 1; Exit = 2; }
147  enum CallContext { Caller = 1; Callee = 2; }
149  enum CallKind { CCall = 1; ObjCInstanceMessage = 2; ObjCClassMessage = 3;
150  ObjCSuperMessage = 4; }
151 
154  required FunctionRef function = 1;
155 
157  optional Direction direction = 2;
158 
160  optional CallContext context = 3;
161 
163  repeated Argument argument = 4;
164 
166  optional Argument expectedReturnValue = 5;
167 
169  optional bool strict = 6 [ default = true ];
170 
172  optional CallKind kind = 7 [ default = CCall ];
173 
176  optional Argument receiver = 8;
177 }
178 
180 message FunctionRef {
189  required string name = 1;
190 }
191 
195  enum AssignType { SimpleAssign = 1; PlusEqual = 2; MinusEqual = 3; };
196 
198  required StructField field = 8;
199 
201  required AssignType operation = 4;
202 
204  required Argument value = 5;
205 
207  optional bool strict = 7 [ default = true ];
208 }
209 
211 message StructField {
213  required string type = 1;
214 
216  required Argument base = 2;
217 
219  required string name = 3;
220 
222  required int32 index = 4;
223 }
224 
226 message Argument {
227  enum Type { Constant = 1; Variable = 2; Any = 3; Indirect = 4; Field = 5; }
228  required Type type = 1;
229 
233  enum MatchType { Exact = 1; Flags = 2; Mask = 3; }
234 
244  optional int32 index = 2;
245 
247  optional string name = 3;
248 
250  optional int64 value = 5;
251 
253  optional MatchType constantMatch = 6 [ default = Exact ];
254 
256  optional Argument indirection = 7;
257 
260 }
261