blob: 28fc0f07a0762de4d2178742befb7341f24638c4 [file] [log] [blame]
Rich Lane7dcdf022013-12-11 14:45:27 -08001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import const
12import common
13import action
14import instruction
15import oxm
16import action_id
17import instruction_id
18import meter_band
Rich Lane5454b682014-01-14 17:07:36 -080019import bsn_tlv
Rich Lane7dcdf022013-12-11 14:45:27 -080020import util
21import loxi.generic_util
22
23class instruction_id(loxi.OFObject):
24 subtypes = {}
25
Rich Lane95f7fc92014-01-27 17:08:16 -080026
27 def __init__(self, type=None):
28 if type != None:
29 self.type = type
30 else:
31 self.type = 0
32 return
33
34 def pack(self):
35 packed = []
36 packed.append(struct.pack("!H", self.type))
37 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
38 length = sum([len(x) for x in packed])
39 packed[1] = struct.pack("!H", length)
40 return ''.join(packed)
41
Rich Lane7dcdf022013-12-11 14:45:27 -080042 @staticmethod
43 def unpack(reader):
44 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080045 subclass = instruction_id.subtypes.get(subtype)
46 if subclass:
47 return subclass.unpack(reader)
48
49 obj = instruction_id()
50 obj.type = reader.read("!H")[0]
51 _len = reader.read("!H")[0]
52 orig_reader = reader
53 reader = orig_reader.slice(_len - (2 + 2))
54 return obj
55
56 def __eq__(self, other):
57 if type(self) != type(other): return False
58 if self.type != other.type: return False
59 return True
60
61 def pretty_print(self, q):
62 q.text("instruction_id {")
63 with q.group():
64 with q.indent(2):
65 q.breakable()
66 q.breakable()
67 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -080068
69
70class apply_actions(instruction_id):
71 type = 4
72
73 def __init__(self):
74 return
75
76 def pack(self):
77 packed = []
78 packed.append(struct.pack("!H", self.type))
79 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -080080 length = sum([len(x) for x in packed])
81 packed[1] = struct.pack("!H", length)
82 return ''.join(packed)
83
84 @staticmethod
85 def unpack(reader):
86 obj = apply_actions()
87 _type = reader.read("!H")[0]
88 assert(_type == 4)
89 _len = reader.read("!H")[0]
90 orig_reader = reader
91 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -080092 return obj
93
94 def __eq__(self, other):
95 if type(self) != type(other): return False
96 return True
97
98 def pretty_print(self, q):
99 q.text("apply_actions {")
100 with q.group():
101 with q.indent(2):
102 q.breakable()
103 q.breakable()
104 q.text('}')
105
106instruction_id.subtypes[4] = apply_actions
107
108class experimenter(instruction_id):
109 subtypes = {}
110
Rich Lane95f7fc92014-01-27 17:08:16 -0800111 type = 65535
112
113 def __init__(self, experimenter=None):
114 if experimenter != None:
115 self.experimenter = experimenter
116 else:
117 self.experimenter = 0
118 return
119
120 def pack(self):
121 packed = []
122 packed.append(struct.pack("!H", self.type))
123 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
124 packed.append(struct.pack("!L", self.experimenter))
125 length = sum([len(x) for x in packed])
126 packed[1] = struct.pack("!H", length)
127 return ''.join(packed)
128
Rich Lane7dcdf022013-12-11 14:45:27 -0800129 @staticmethod
130 def unpack(reader):
131 subtype, = reader.peek('!L', 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800132 subclass = experimenter.subtypes.get(subtype)
133 if subclass:
134 return subclass.unpack(reader)
135
136 obj = experimenter()
137 _type = reader.read("!H")[0]
138 assert(_type == 65535)
139 _len = reader.read("!H")[0]
140 orig_reader = reader
141 reader = orig_reader.slice(_len - (2 + 2))
142 obj.experimenter = reader.read("!L")[0]
143 return obj
144
145 def __eq__(self, other):
146 if type(self) != type(other): return False
147 if self.experimenter != other.experimenter: return False
148 return True
149
150 def pretty_print(self, q):
151 q.text("experimenter {")
152 with q.group():
153 with q.indent(2):
154 q.breakable()
155 q.breakable()
156 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800157
158instruction_id.subtypes[65535] = experimenter
159
160class bsn(experimenter):
161 subtypes = {}
162
Rich Lane95f7fc92014-01-27 17:08:16 -0800163 type = 65535
164 experimenter = 6035143
165
166 def __init__(self, subtype=None):
167 if subtype != None:
168 self.subtype = subtype
169 else:
170 self.subtype = 0
171 return
172
173 def pack(self):
174 packed = []
175 packed.append(struct.pack("!H", self.type))
176 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
177 packed.append(struct.pack("!L", self.experimenter))
178 packed.append(struct.pack("!L", self.subtype))
Rich Lane95f7fc92014-01-27 17:08:16 -0800179 length = sum([len(x) for x in packed])
180 packed[1] = struct.pack("!H", length)
181 return ''.join(packed)
182
Rich Lane7dcdf022013-12-11 14:45:27 -0800183 @staticmethod
184 def unpack(reader):
185 subtype, = reader.peek('!L', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800186 subclass = bsn.subtypes.get(subtype)
187 if subclass:
188 return subclass.unpack(reader)
189
190 obj = bsn()
191 _type = reader.read("!H")[0]
192 assert(_type == 65535)
193 _len = reader.read("!H")[0]
194 orig_reader = reader
195 reader = orig_reader.slice(_len - (2 + 2))
196 _experimenter = reader.read("!L")[0]
197 assert(_experimenter == 6035143)
198 obj.subtype = reader.read("!L")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -0800199 return obj
200
201 def __eq__(self, other):
202 if type(self) != type(other): return False
203 if self.subtype != other.subtype: return False
204 return True
205
206 def pretty_print(self, q):
207 q.text("bsn {")
208 with q.group():
209 with q.indent(2):
210 q.breakable()
211 q.breakable()
212 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800213
214experimenter.subtypes[6035143] = bsn
215
Rich Lane5454b682014-01-14 17:07:36 -0800216class bsn_arp_offload(bsn):
217 type = 65535
218 experimenter = 6035143
219 subtype = 1
220
221 def __init__(self):
222 return
223
224 def pack(self):
225 packed = []
226 packed.append(struct.pack("!H", self.type))
227 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
228 packed.append(struct.pack("!L", self.experimenter))
229 packed.append(struct.pack("!L", self.subtype))
Rich Lane5454b682014-01-14 17:07:36 -0800230 length = sum([len(x) for x in packed])
231 packed[1] = struct.pack("!H", length)
232 return ''.join(packed)
233
234 @staticmethod
235 def unpack(reader):
236 obj = bsn_arp_offload()
237 _type = reader.read("!H")[0]
238 assert(_type == 65535)
239 _len = reader.read("!H")[0]
240 orig_reader = reader
241 reader = orig_reader.slice(_len - (2 + 2))
242 _experimenter = reader.read("!L")[0]
243 assert(_experimenter == 6035143)
244 _subtype = reader.read("!L")[0]
245 assert(_subtype == 1)
Rich Lane5454b682014-01-14 17:07:36 -0800246 return obj
247
248 def __eq__(self, other):
249 if type(self) != type(other): return False
250 return True
251
252 def pretty_print(self, q):
253 q.text("bsn_arp_offload {")
254 with q.group():
255 with q.indent(2):
256 q.breakable()
257 q.breakable()
258 q.text('}')
259
260bsn.subtypes[1] = bsn_arp_offload
261
Rich Lane9ec3fca2014-02-26 16:22:56 -0800262class bsn_deny(bsn):
263 type = 65535
264 experimenter = 6035143
265 subtype = 5
266
267 def __init__(self):
268 return
269
270 def pack(self):
271 packed = []
272 packed.append(struct.pack("!H", self.type))
273 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
274 packed.append(struct.pack("!L", self.experimenter))
275 packed.append(struct.pack("!L", self.subtype))
276 length = sum([len(x) for x in packed])
277 packed[1] = struct.pack("!H", length)
278 return ''.join(packed)
279
280 @staticmethod
281 def unpack(reader):
282 obj = bsn_deny()
283 _type = reader.read("!H")[0]
284 assert(_type == 65535)
285 _len = reader.read("!H")[0]
286 orig_reader = reader
287 reader = orig_reader.slice(_len - (2 + 2))
288 _experimenter = reader.read("!L")[0]
289 assert(_experimenter == 6035143)
290 _subtype = reader.read("!L")[0]
291 assert(_subtype == 5)
292 return obj
293
294 def __eq__(self, other):
295 if type(self) != type(other): return False
296 return True
297
298 def pretty_print(self, q):
299 q.text("bsn_deny {")
300 with q.group():
301 with q.indent(2):
302 q.breakable()
303 q.breakable()
304 q.text('}')
305
306bsn.subtypes[5] = bsn_deny
307
Rich Lane1b75abf2014-02-05 11:23:20 -0800308class bsn_dhcp_offload(bsn):
309 type = 65535
310 experimenter = 6035143
311 subtype = 2
312
313 def __init__(self):
314 return
315
316 def pack(self):
317 packed = []
318 packed.append(struct.pack("!H", self.type))
319 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
320 packed.append(struct.pack("!L", self.experimenter))
321 packed.append(struct.pack("!L", self.subtype))
Rich Lane1b75abf2014-02-05 11:23:20 -0800322 length = sum([len(x) for x in packed])
323 packed[1] = struct.pack("!H", length)
324 return ''.join(packed)
325
326 @staticmethod
327 def unpack(reader):
328 obj = bsn_dhcp_offload()
329 _type = reader.read("!H")[0]
330 assert(_type == 65535)
331 _len = reader.read("!H")[0]
332 orig_reader = reader
333 reader = orig_reader.slice(_len - (2 + 2))
334 _experimenter = reader.read("!L")[0]
335 assert(_experimenter == 6035143)
336 _subtype = reader.read("!L")[0]
337 assert(_subtype == 2)
Rich Lane1b75abf2014-02-05 11:23:20 -0800338 return obj
339
340 def __eq__(self, other):
341 if type(self) != type(other): return False
342 return True
343
344 def pretty_print(self, q):
345 q.text("bsn_dhcp_offload {")
346 with q.group():
347 with q.indent(2):
348 q.breakable()
349 q.breakable()
350 q.text('}')
351
352bsn.subtypes[2] = bsn_dhcp_offload
353
Rich Lane9ec3fca2014-02-26 16:22:56 -0800354class bsn_disable_split_horizon_check(bsn):
355 type = 65535
356 experimenter = 6035143
357 subtype = 3
358
359 def __init__(self):
360 return
361
362 def pack(self):
363 packed = []
364 packed.append(struct.pack("!H", self.type))
365 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
366 packed.append(struct.pack("!L", self.experimenter))
367 packed.append(struct.pack("!L", self.subtype))
368 length = sum([len(x) for x in packed])
369 packed[1] = struct.pack("!H", length)
370 return ''.join(packed)
371
372 @staticmethod
373 def unpack(reader):
374 obj = bsn_disable_split_horizon_check()
375 _type = reader.read("!H")[0]
376 assert(_type == 65535)
377 _len = reader.read("!H")[0]
378 orig_reader = reader
379 reader = orig_reader.slice(_len - (2 + 2))
380 _experimenter = reader.read("!L")[0]
381 assert(_experimenter == 6035143)
382 _subtype = reader.read("!L")[0]
383 assert(_subtype == 3)
384 return obj
385
386 def __eq__(self, other):
387 if type(self) != type(other): return False
388 return True
389
390 def pretty_print(self, q):
391 q.text("bsn_disable_split_horizon_check {")
392 with q.group():
393 with q.indent(2):
394 q.breakable()
395 q.breakable()
396 q.text('}')
397
398bsn.subtypes[3] = bsn_disable_split_horizon_check
399
Rich Lane7dcdf022013-12-11 14:45:27 -0800400class bsn_disable_src_mac_check(bsn):
401 type = 65535
402 experimenter = 6035143
403 subtype = 0
404
405 def __init__(self):
406 return
407
408 def pack(self):
409 packed = []
410 packed.append(struct.pack("!H", self.type))
411 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
412 packed.append(struct.pack("!L", self.experimenter))
413 packed.append(struct.pack("!L", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -0800414 length = sum([len(x) for x in packed])
415 packed[1] = struct.pack("!H", length)
416 return ''.join(packed)
417
418 @staticmethod
419 def unpack(reader):
420 obj = bsn_disable_src_mac_check()
421 _type = reader.read("!H")[0]
422 assert(_type == 65535)
423 _len = reader.read("!H")[0]
424 orig_reader = reader
425 reader = orig_reader.slice(_len - (2 + 2))
426 _experimenter = reader.read("!L")[0]
427 assert(_experimenter == 6035143)
428 _subtype = reader.read("!L")[0]
429 assert(_subtype == 0)
Rich Lane7dcdf022013-12-11 14:45:27 -0800430 return obj
431
432 def __eq__(self, other):
433 if type(self) != type(other): return False
434 return True
435
436 def pretty_print(self, q):
437 q.text("bsn_disable_src_mac_check {")
438 with q.group():
439 with q.indent(2):
440 q.breakable()
441 q.breakable()
442 q.text('}')
443
444bsn.subtypes[0] = bsn_disable_src_mac_check
445
Harshmeet Singhc0378a92014-07-22 17:09:36 -0700446class bsn_disable_vlan_counters(bsn):
447 type = 65535
448 experimenter = 6035143
449 subtype = 9
450
451 def __init__(self):
452 return
453
454 def pack(self):
455 packed = []
456 packed.append(struct.pack("!H", self.type))
457 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
458 packed.append(struct.pack("!L", self.experimenter))
459 packed.append(struct.pack("!L", self.subtype))
460 length = sum([len(x) for x in packed])
461 packed[1] = struct.pack("!H", length)
462 return ''.join(packed)
463
464 @staticmethod
465 def unpack(reader):
466 obj = bsn_disable_vlan_counters()
467 _type = reader.read("!H")[0]
468 assert(_type == 65535)
469 _len = reader.read("!H")[0]
470 orig_reader = reader
471 reader = orig_reader.slice(_len - (2 + 2))
472 _experimenter = reader.read("!L")[0]
473 assert(_experimenter == 6035143)
474 _subtype = reader.read("!L")[0]
475 assert(_subtype == 9)
476 return obj
477
478 def __eq__(self, other):
479 if type(self) != type(other): return False
480 return True
481
482 def pretty_print(self, q):
483 q.text("bsn_disable_vlan_counters {")
484 with q.group():
485 with q.indent(2):
486 q.breakable()
487 q.breakable()
488 q.text('}')
489
490bsn.subtypes[9] = bsn_disable_vlan_counters
491
Rich Lanef50b7c32014-03-20 11:38:02 -0700492class bsn_packet_of_death(bsn):
493 type = 65535
494 experimenter = 6035143
495 subtype = 6
496
497 def __init__(self):
498 return
499
500 def pack(self):
501 packed = []
502 packed.append(struct.pack("!H", self.type))
503 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
504 packed.append(struct.pack("!L", self.experimenter))
505 packed.append(struct.pack("!L", self.subtype))
506 length = sum([len(x) for x in packed])
507 packed[1] = struct.pack("!H", length)
508 return ''.join(packed)
509
510 @staticmethod
511 def unpack(reader):
512 obj = bsn_packet_of_death()
513 _type = reader.read("!H")[0]
514 assert(_type == 65535)
515 _len = reader.read("!H")[0]
516 orig_reader = reader
517 reader = orig_reader.slice(_len - (2 + 2))
518 _experimenter = reader.read("!L")[0]
519 assert(_experimenter == 6035143)
520 _subtype = reader.read("!L")[0]
521 assert(_subtype == 6)
522 return obj
523
524 def __eq__(self, other):
525 if type(self) != type(other): return False
526 return True
527
528 def pretty_print(self, q):
529 q.text("bsn_packet_of_death {")
530 with q.group():
531 with q.indent(2):
532 q.breakable()
533 q.breakable()
534 q.text('}')
535
536bsn.subtypes[6] = bsn_packet_of_death
537
Rich Lane9ec3fca2014-02-26 16:22:56 -0800538class bsn_permit(bsn):
539 type = 65535
540 experimenter = 6035143
541 subtype = 4
542
543 def __init__(self):
544 return
545
546 def pack(self):
547 packed = []
548 packed.append(struct.pack("!H", self.type))
549 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
550 packed.append(struct.pack("!L", self.experimenter))
551 packed.append(struct.pack("!L", self.subtype))
552 length = sum([len(x) for x in packed])
553 packed[1] = struct.pack("!H", length)
554 return ''.join(packed)
555
556 @staticmethod
557 def unpack(reader):
558 obj = bsn_permit()
559 _type = reader.read("!H")[0]
560 assert(_type == 65535)
561 _len = reader.read("!H")[0]
562 orig_reader = reader
563 reader = orig_reader.slice(_len - (2 + 2))
564 _experimenter = reader.read("!L")[0]
565 assert(_experimenter == 6035143)
566 _subtype = reader.read("!L")[0]
567 assert(_subtype == 4)
568 return obj
569
570 def __eq__(self, other):
571 if type(self) != type(other): return False
572 return True
573
574 def pretty_print(self, q):
575 q.text("bsn_permit {")
576 with q.group():
577 with q.indent(2):
578 q.breakable()
579 q.breakable()
580 q.text('}')
581
582bsn.subtypes[4] = bsn_permit
583
Rich Lane78d9bcb2014-05-12 13:27:44 -0700584class bsn_prioritize_pdus(bsn):
585 type = 65535
586 experimenter = 6035143
587 subtype = 7
588
589 def __init__(self):
590 return
591
592 def pack(self):
593 packed = []
594 packed.append(struct.pack("!H", self.type))
595 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
596 packed.append(struct.pack("!L", self.experimenter))
597 packed.append(struct.pack("!L", self.subtype))
598 length = sum([len(x) for x in packed])
599 packed[1] = struct.pack("!H", length)
600 return ''.join(packed)
601
602 @staticmethod
603 def unpack(reader):
604 obj = bsn_prioritize_pdus()
605 _type = reader.read("!H")[0]
606 assert(_type == 65535)
607 _len = reader.read("!H")[0]
608 orig_reader = reader
609 reader = orig_reader.slice(_len - (2 + 2))
610 _experimenter = reader.read("!L")[0]
611 assert(_experimenter == 6035143)
612 _subtype = reader.read("!L")[0]
613 assert(_subtype == 7)
614 return obj
615
616 def __eq__(self, other):
617 if type(self) != type(other): return False
618 return True
619
620 def pretty_print(self, q):
621 q.text("bsn_prioritize_pdus {")
622 with q.group():
623 with q.indent(2):
624 q.breakable()
625 q.breakable()
626 q.text('}')
627
628bsn.subtypes[7] = bsn_prioritize_pdus
629
Rich Lane5587ab12014-06-30 11:19:09 -0700630class bsn_require_vlan_xlate(bsn):
631 type = 65535
632 experimenter = 6035143
633 subtype = 8
634
635 def __init__(self):
636 return
637
638 def pack(self):
639 packed = []
640 packed.append(struct.pack("!H", self.type))
641 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
642 packed.append(struct.pack("!L", self.experimenter))
643 packed.append(struct.pack("!L", self.subtype))
644 length = sum([len(x) for x in packed])
645 packed[1] = struct.pack("!H", length)
646 return ''.join(packed)
647
648 @staticmethod
649 def unpack(reader):
650 obj = bsn_require_vlan_xlate()
651 _type = reader.read("!H")[0]
652 assert(_type == 65535)
653 _len = reader.read("!H")[0]
654 orig_reader = reader
655 reader = orig_reader.slice(_len - (2 + 2))
656 _experimenter = reader.read("!L")[0]
657 assert(_experimenter == 6035143)
658 _subtype = reader.read("!L")[0]
659 assert(_subtype == 8)
660 return obj
661
662 def __eq__(self, other):
663 if type(self) != type(other): return False
664 return True
665
666 def pretty_print(self, q):
667 q.text("bsn_require_vlan_xlate {")
668 with q.group():
669 with q.indent(2):
670 q.breakable()
671 q.breakable()
672 q.text('}')
673
674bsn.subtypes[8] = bsn_require_vlan_xlate
675
Rich Lane7dcdf022013-12-11 14:45:27 -0800676class clear_actions(instruction_id):
677 type = 5
678
679 def __init__(self):
680 return
681
682 def pack(self):
683 packed = []
684 packed.append(struct.pack("!H", self.type))
685 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800686 length = sum([len(x) for x in packed])
687 packed[1] = struct.pack("!H", length)
688 return ''.join(packed)
689
690 @staticmethod
691 def unpack(reader):
692 obj = clear_actions()
693 _type = reader.read("!H")[0]
694 assert(_type == 5)
695 _len = reader.read("!H")[0]
696 orig_reader = reader
697 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800698 return obj
699
700 def __eq__(self, other):
701 if type(self) != type(other): return False
702 return True
703
704 def pretty_print(self, q):
705 q.text("clear_actions {")
706 with q.group():
707 with q.indent(2):
708 q.breakable()
709 q.breakable()
710 q.text('}')
711
712instruction_id.subtypes[5] = clear_actions
713
714class goto_table(instruction_id):
715 type = 1
716
717 def __init__(self):
718 return
719
720 def pack(self):
721 packed = []
722 packed.append(struct.pack("!H", self.type))
723 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800724 length = sum([len(x) for x in packed])
725 packed[1] = struct.pack("!H", length)
726 return ''.join(packed)
727
728 @staticmethod
729 def unpack(reader):
730 obj = goto_table()
731 _type = reader.read("!H")[0]
732 assert(_type == 1)
733 _len = reader.read("!H")[0]
734 orig_reader = reader
735 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800736 return obj
737
738 def __eq__(self, other):
739 if type(self) != type(other): return False
740 return True
741
742 def pretty_print(self, q):
743 q.text("goto_table {")
744 with q.group():
745 with q.indent(2):
746 q.breakable()
747 q.breakable()
748 q.text('}')
749
750instruction_id.subtypes[1] = goto_table
751
752class meter(instruction_id):
753 type = 6
754
755 def __init__(self):
756 return
757
758 def pack(self):
759 packed = []
760 packed.append(struct.pack("!H", self.type))
761 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
762 length = sum([len(x) for x in packed])
763 packed[1] = struct.pack("!H", length)
764 return ''.join(packed)
765
766 @staticmethod
767 def unpack(reader):
768 obj = meter()
769 _type = reader.read("!H")[0]
770 assert(_type == 6)
771 _len = reader.read("!H")[0]
772 orig_reader = reader
773 reader = orig_reader.slice(_len - (2 + 2))
774 return obj
775
776 def __eq__(self, other):
777 if type(self) != type(other): return False
778 return True
779
780 def pretty_print(self, q):
781 q.text("meter {")
782 with q.group():
783 with q.indent(2):
784 q.breakable()
785 q.breakable()
786 q.text('}')
787
788instruction_id.subtypes[6] = meter
789
790class write_actions(instruction_id):
791 type = 3
792
793 def __init__(self):
794 return
795
796 def pack(self):
797 packed = []
798 packed.append(struct.pack("!H", self.type))
799 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800800 length = sum([len(x) for x in packed])
801 packed[1] = struct.pack("!H", length)
802 return ''.join(packed)
803
804 @staticmethod
805 def unpack(reader):
806 obj = write_actions()
807 _type = reader.read("!H")[0]
808 assert(_type == 3)
809 _len = reader.read("!H")[0]
810 orig_reader = reader
811 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800812 return obj
813
814 def __eq__(self, other):
815 if type(self) != type(other): return False
816 return True
817
818 def pretty_print(self, q):
819 q.text("write_actions {")
820 with q.group():
821 with q.indent(2):
822 q.breakable()
823 q.breakable()
824 q.text('}')
825
826instruction_id.subtypes[3] = write_actions
827
828class write_metadata(instruction_id):
829 type = 2
830
831 def __init__(self):
832 return
833
834 def pack(self):
835 packed = []
836 packed.append(struct.pack("!H", self.type))
837 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800838 length = sum([len(x) for x in packed])
839 packed[1] = struct.pack("!H", length)
840 return ''.join(packed)
841
842 @staticmethod
843 def unpack(reader):
844 obj = write_metadata()
845 _type = reader.read("!H")[0]
846 assert(_type == 2)
847 _len = reader.read("!H")[0]
848 orig_reader = reader
849 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800850 return obj
851
852 def __eq__(self, other):
853 if type(self) != type(other): return False
854 return True
855
856 def pretty_print(self, q):
857 q.text("write_metadata {")
858 with q.group():
859 with q.indent(2):
860 q.breakable()
861 q.breakable()
862 q.text('}')
863
864instruction_id.subtypes[2] = write_metadata
865
866