Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1 | # 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 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
| 12 | import port_desc_prop |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 13 | import bsn_tlv |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 14 | import meter_band |
| 15 | import table_mod_prop |
| 16 | import instruction |
| 17 | import queue_desc_prop |
| 18 | import oxm |
| 19 | import bundle_prop |
| 20 | import common |
| 21 | import instruction_id |
| 22 | import action |
| 23 | import role_prop |
| 24 | import message |
| 25 | import queue_stats_prop |
| 26 | import port_stats_prop |
| 27 | import port_mod_prop |
| 28 | import async_config_prop |
| 29 | import action_id |
| 30 | import util |
| 31 | import loxi.generic_util |
| 32 | |
| 33 | class async_config_prop(loxi.OFObject): |
| 34 | subtypes = {} |
| 35 | |
| 36 | |
| 37 | def __init__(self, type=None): |
| 38 | if type != None: |
| 39 | self.type = type |
| 40 | else: |
| 41 | self.type = 0 |
| 42 | return |
| 43 | |
| 44 | def pack(self): |
| 45 | packed = [] |
| 46 | packed.append(struct.pack("!H", self.type)) |
| 47 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 48 | length = sum([len(x) for x in packed]) |
| 49 | packed[1] = struct.pack("!H", length) |
| 50 | return ''.join(packed) |
| 51 | |
| 52 | @staticmethod |
| 53 | def unpack(reader): |
| 54 | subtype, = reader.peek('!H', 0) |
| 55 | subclass = async_config_prop.subtypes.get(subtype) |
| 56 | if subclass: |
| 57 | return subclass.unpack(reader) |
| 58 | |
| 59 | obj = async_config_prop() |
| 60 | obj.type = reader.read("!H")[0] |
| 61 | _length = reader.read("!H")[0] |
| 62 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 63 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 64 | return obj |
| 65 | |
| 66 | def __eq__(self, other): |
| 67 | if type(self) != type(other): return False |
| 68 | if self.type != other.type: return False |
| 69 | return True |
| 70 | |
| 71 | def pretty_print(self, q): |
| 72 | q.text("async_config_prop {") |
| 73 | with q.group(): |
| 74 | with q.indent(2): |
| 75 | q.breakable() |
| 76 | q.breakable() |
| 77 | q.text('}') |
| 78 | |
| 79 | |
| 80 | class experimenter_master(async_config_prop): |
| 81 | type = 65535 |
| 82 | |
| 83 | def __init__(self): |
| 84 | return |
| 85 | |
| 86 | def pack(self): |
| 87 | packed = [] |
| 88 | packed.append(struct.pack("!H", self.type)) |
| 89 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 90 | length = sum([len(x) for x in packed]) |
| 91 | packed[1] = struct.pack("!H", length) |
| 92 | return ''.join(packed) |
| 93 | |
| 94 | @staticmethod |
| 95 | def unpack(reader): |
| 96 | obj = experimenter_master() |
| 97 | _type = reader.read("!H")[0] |
| 98 | assert(_type == 65535) |
| 99 | _length = reader.read("!H")[0] |
| 100 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 101 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 102 | return obj |
| 103 | |
| 104 | def __eq__(self, other): |
| 105 | if type(self) != type(other): return False |
| 106 | return True |
| 107 | |
| 108 | def pretty_print(self, q): |
| 109 | q.text("experimenter_master {") |
| 110 | with q.group(): |
| 111 | with q.indent(2): |
| 112 | q.breakable() |
| 113 | q.breakable() |
| 114 | q.text('}') |
| 115 | |
| 116 | async_config_prop.subtypes[65535] = experimenter_master |
| 117 | |
| 118 | class experimenter_slave(async_config_prop): |
| 119 | type = 65534 |
| 120 | |
| 121 | def __init__(self): |
| 122 | return |
| 123 | |
| 124 | def pack(self): |
| 125 | packed = [] |
| 126 | packed.append(struct.pack("!H", self.type)) |
| 127 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 128 | length = sum([len(x) for x in packed]) |
| 129 | packed[1] = struct.pack("!H", length) |
| 130 | return ''.join(packed) |
| 131 | |
| 132 | @staticmethod |
| 133 | def unpack(reader): |
| 134 | obj = experimenter_slave() |
| 135 | _type = reader.read("!H")[0] |
| 136 | assert(_type == 65534) |
| 137 | _length = reader.read("!H")[0] |
| 138 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 139 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 140 | return obj |
| 141 | |
| 142 | def __eq__(self, other): |
| 143 | if type(self) != type(other): return False |
| 144 | return True |
| 145 | |
| 146 | def pretty_print(self, q): |
| 147 | q.text("experimenter_slave {") |
| 148 | with q.group(): |
| 149 | with q.indent(2): |
| 150 | q.breakable() |
| 151 | q.breakable() |
| 152 | q.text('}') |
| 153 | |
| 154 | async_config_prop.subtypes[65534] = experimenter_slave |
| 155 | |
| 156 | class flow_removed_master(async_config_prop): |
| 157 | type = 5 |
| 158 | |
| 159 | def __init__(self, mask=None): |
| 160 | if mask != None: |
| 161 | self.mask = mask |
| 162 | else: |
| 163 | self.mask = 0 |
| 164 | return |
| 165 | |
| 166 | def pack(self): |
| 167 | packed = [] |
| 168 | packed.append(struct.pack("!H", self.type)) |
| 169 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 170 | packed.append(struct.pack("!L", self.mask)) |
| 171 | length = sum([len(x) for x in packed]) |
| 172 | packed[1] = struct.pack("!H", length) |
| 173 | return ''.join(packed) |
| 174 | |
| 175 | @staticmethod |
| 176 | def unpack(reader): |
| 177 | obj = flow_removed_master() |
| 178 | _type = reader.read("!H")[0] |
| 179 | assert(_type == 5) |
| 180 | _length = reader.read("!H")[0] |
| 181 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 182 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 183 | obj.mask = reader.read("!L")[0] |
| 184 | return obj |
| 185 | |
| 186 | def __eq__(self, other): |
| 187 | if type(self) != type(other): return False |
| 188 | if self.mask != other.mask: return False |
| 189 | return True |
| 190 | |
| 191 | def pretty_print(self, q): |
| 192 | q.text("flow_removed_master {") |
| 193 | with q.group(): |
| 194 | with q.indent(2): |
| 195 | q.breakable() |
| 196 | q.text("mask = "); |
| 197 | q.text("%#x" % self.mask) |
| 198 | q.breakable() |
| 199 | q.text('}') |
| 200 | |
| 201 | async_config_prop.subtypes[5] = flow_removed_master |
| 202 | |
| 203 | class flow_removed_slave(async_config_prop): |
| 204 | type = 4 |
| 205 | |
| 206 | def __init__(self, mask=None): |
| 207 | if mask != None: |
| 208 | self.mask = mask |
| 209 | else: |
| 210 | self.mask = 0 |
| 211 | return |
| 212 | |
| 213 | def pack(self): |
| 214 | packed = [] |
| 215 | packed.append(struct.pack("!H", self.type)) |
| 216 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 217 | packed.append(struct.pack("!L", self.mask)) |
| 218 | length = sum([len(x) for x in packed]) |
| 219 | packed[1] = struct.pack("!H", length) |
| 220 | return ''.join(packed) |
| 221 | |
| 222 | @staticmethod |
| 223 | def unpack(reader): |
| 224 | obj = flow_removed_slave() |
| 225 | _type = reader.read("!H")[0] |
| 226 | assert(_type == 4) |
| 227 | _length = reader.read("!H")[0] |
| 228 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 229 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 230 | obj.mask = reader.read("!L")[0] |
| 231 | return obj |
| 232 | |
| 233 | def __eq__(self, other): |
| 234 | if type(self) != type(other): return False |
| 235 | if self.mask != other.mask: return False |
| 236 | return True |
| 237 | |
| 238 | def pretty_print(self, q): |
| 239 | q.text("flow_removed_slave {") |
| 240 | with q.group(): |
| 241 | with q.indent(2): |
| 242 | q.breakable() |
| 243 | q.text("mask = "); |
| 244 | q.text("%#x" % self.mask) |
| 245 | q.breakable() |
| 246 | q.text('}') |
| 247 | |
| 248 | async_config_prop.subtypes[4] = flow_removed_slave |
| 249 | |
| 250 | class packet_in_master(async_config_prop): |
| 251 | type = 1 |
| 252 | |
| 253 | def __init__(self, mask=None): |
| 254 | if mask != None: |
| 255 | self.mask = mask |
| 256 | else: |
| 257 | self.mask = 0 |
| 258 | return |
| 259 | |
| 260 | def pack(self): |
| 261 | packed = [] |
| 262 | packed.append(struct.pack("!H", self.type)) |
| 263 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 264 | packed.append(struct.pack("!L", self.mask)) |
| 265 | length = sum([len(x) for x in packed]) |
| 266 | packed[1] = struct.pack("!H", length) |
| 267 | return ''.join(packed) |
| 268 | |
| 269 | @staticmethod |
| 270 | def unpack(reader): |
| 271 | obj = packet_in_master() |
| 272 | _type = reader.read("!H")[0] |
| 273 | assert(_type == 1) |
| 274 | _length = reader.read("!H")[0] |
| 275 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 276 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 277 | obj.mask = reader.read("!L")[0] |
| 278 | return obj |
| 279 | |
| 280 | def __eq__(self, other): |
| 281 | if type(self) != type(other): return False |
| 282 | if self.mask != other.mask: return False |
| 283 | return True |
| 284 | |
| 285 | def pretty_print(self, q): |
| 286 | q.text("packet_in_master {") |
| 287 | with q.group(): |
| 288 | with q.indent(2): |
| 289 | q.breakable() |
| 290 | q.text("mask = "); |
| 291 | q.text("%#x" % self.mask) |
| 292 | q.breakable() |
| 293 | q.text('}') |
| 294 | |
| 295 | async_config_prop.subtypes[1] = packet_in_master |
| 296 | |
| 297 | class packet_in_slave(async_config_prop): |
| 298 | type = 0 |
| 299 | |
| 300 | def __init__(self, mask=None): |
| 301 | if mask != None: |
| 302 | self.mask = mask |
| 303 | else: |
| 304 | self.mask = 0 |
| 305 | return |
| 306 | |
| 307 | def pack(self): |
| 308 | packed = [] |
| 309 | packed.append(struct.pack("!H", self.type)) |
| 310 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 311 | packed.append(struct.pack("!L", self.mask)) |
| 312 | length = sum([len(x) for x in packed]) |
| 313 | packed[1] = struct.pack("!H", length) |
| 314 | return ''.join(packed) |
| 315 | |
| 316 | @staticmethod |
| 317 | def unpack(reader): |
| 318 | obj = packet_in_slave() |
| 319 | _type = reader.read("!H")[0] |
| 320 | assert(_type == 0) |
| 321 | _length = reader.read("!H")[0] |
| 322 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 323 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 324 | obj.mask = reader.read("!L")[0] |
| 325 | return obj |
| 326 | |
| 327 | def __eq__(self, other): |
| 328 | if type(self) != type(other): return False |
| 329 | if self.mask != other.mask: return False |
| 330 | return True |
| 331 | |
| 332 | def pretty_print(self, q): |
| 333 | q.text("packet_in_slave {") |
| 334 | with q.group(): |
| 335 | with q.indent(2): |
| 336 | q.breakable() |
| 337 | q.text("mask = "); |
| 338 | q.text("%#x" % self.mask) |
| 339 | q.breakable() |
| 340 | q.text('}') |
| 341 | |
| 342 | async_config_prop.subtypes[0] = packet_in_slave |
| 343 | |
| 344 | class port_status_master(async_config_prop): |
| 345 | type = 3 |
| 346 | |
| 347 | def __init__(self, mask=None): |
| 348 | if mask != None: |
| 349 | self.mask = mask |
| 350 | else: |
| 351 | self.mask = 0 |
| 352 | return |
| 353 | |
| 354 | def pack(self): |
| 355 | packed = [] |
| 356 | packed.append(struct.pack("!H", self.type)) |
| 357 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 358 | packed.append(struct.pack("!L", self.mask)) |
| 359 | length = sum([len(x) for x in packed]) |
| 360 | packed[1] = struct.pack("!H", length) |
| 361 | return ''.join(packed) |
| 362 | |
| 363 | @staticmethod |
| 364 | def unpack(reader): |
| 365 | obj = port_status_master() |
| 366 | _type = reader.read("!H")[0] |
| 367 | assert(_type == 3) |
| 368 | _length = reader.read("!H")[0] |
| 369 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 370 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 371 | obj.mask = reader.read("!L")[0] |
| 372 | return obj |
| 373 | |
| 374 | def __eq__(self, other): |
| 375 | if type(self) != type(other): return False |
| 376 | if self.mask != other.mask: return False |
| 377 | return True |
| 378 | |
| 379 | def pretty_print(self, q): |
| 380 | q.text("port_status_master {") |
| 381 | with q.group(): |
| 382 | with q.indent(2): |
| 383 | q.breakable() |
| 384 | q.text("mask = "); |
| 385 | q.text("%#x" % self.mask) |
| 386 | q.breakable() |
| 387 | q.text('}') |
| 388 | |
| 389 | async_config_prop.subtypes[3] = port_status_master |
| 390 | |
| 391 | class port_status_slave(async_config_prop): |
| 392 | type = 2 |
| 393 | |
| 394 | def __init__(self, mask=None): |
| 395 | if mask != None: |
| 396 | self.mask = mask |
| 397 | else: |
| 398 | self.mask = 0 |
| 399 | return |
| 400 | |
| 401 | def pack(self): |
| 402 | packed = [] |
| 403 | packed.append(struct.pack("!H", self.type)) |
| 404 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 405 | packed.append(struct.pack("!L", self.mask)) |
| 406 | length = sum([len(x) for x in packed]) |
| 407 | packed[1] = struct.pack("!H", length) |
| 408 | return ''.join(packed) |
| 409 | |
| 410 | @staticmethod |
| 411 | def unpack(reader): |
| 412 | obj = port_status_slave() |
| 413 | _type = reader.read("!H")[0] |
| 414 | assert(_type == 2) |
| 415 | _length = reader.read("!H")[0] |
| 416 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 417 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 418 | obj.mask = reader.read("!L")[0] |
| 419 | return obj |
| 420 | |
| 421 | def __eq__(self, other): |
| 422 | if type(self) != type(other): return False |
| 423 | if self.mask != other.mask: return False |
| 424 | return True |
| 425 | |
| 426 | def pretty_print(self, q): |
| 427 | q.text("port_status_slave {") |
| 428 | with q.group(): |
| 429 | with q.indent(2): |
| 430 | q.breakable() |
| 431 | q.text("mask = "); |
| 432 | q.text("%#x" % self.mask) |
| 433 | q.breakable() |
| 434 | q.text('}') |
| 435 | |
| 436 | async_config_prop.subtypes[2] = port_status_slave |
| 437 | |
| 438 | class requestforward_master(async_config_prop): |
| 439 | type = 11 |
| 440 | |
| 441 | def __init__(self, mask=None): |
| 442 | if mask != None: |
| 443 | self.mask = mask |
| 444 | else: |
| 445 | self.mask = 0 |
| 446 | return |
| 447 | |
| 448 | def pack(self): |
| 449 | packed = [] |
| 450 | packed.append(struct.pack("!H", self.type)) |
| 451 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 452 | packed.append(struct.pack("!L", self.mask)) |
| 453 | length = sum([len(x) for x in packed]) |
| 454 | packed[1] = struct.pack("!H", length) |
| 455 | return ''.join(packed) |
| 456 | |
| 457 | @staticmethod |
| 458 | def unpack(reader): |
| 459 | obj = requestforward_master() |
| 460 | _type = reader.read("!H")[0] |
| 461 | assert(_type == 11) |
| 462 | _length = reader.read("!H")[0] |
| 463 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 464 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 465 | obj.mask = reader.read("!L")[0] |
| 466 | return obj |
| 467 | |
| 468 | def __eq__(self, other): |
| 469 | if type(self) != type(other): return False |
| 470 | if self.mask != other.mask: return False |
| 471 | return True |
| 472 | |
| 473 | def pretty_print(self, q): |
| 474 | q.text("requestforward_master {") |
| 475 | with q.group(): |
| 476 | with q.indent(2): |
| 477 | q.breakable() |
| 478 | q.text("mask = "); |
| 479 | q.text("%#x" % self.mask) |
| 480 | q.breakable() |
| 481 | q.text('}') |
| 482 | |
| 483 | async_config_prop.subtypes[11] = requestforward_master |
| 484 | |
| 485 | class requestforward_slave(async_config_prop): |
| 486 | type = 10 |
| 487 | |
| 488 | def __init__(self, mask=None): |
| 489 | if mask != None: |
| 490 | self.mask = mask |
| 491 | else: |
| 492 | self.mask = 0 |
| 493 | return |
| 494 | |
| 495 | def pack(self): |
| 496 | packed = [] |
| 497 | packed.append(struct.pack("!H", self.type)) |
| 498 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 499 | packed.append(struct.pack("!L", self.mask)) |
| 500 | length = sum([len(x) for x in packed]) |
| 501 | packed[1] = struct.pack("!H", length) |
| 502 | return ''.join(packed) |
| 503 | |
| 504 | @staticmethod |
| 505 | def unpack(reader): |
| 506 | obj = requestforward_slave() |
| 507 | _type = reader.read("!H")[0] |
| 508 | assert(_type == 10) |
| 509 | _length = reader.read("!H")[0] |
| 510 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 511 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 512 | obj.mask = reader.read("!L")[0] |
| 513 | return obj |
| 514 | |
| 515 | def __eq__(self, other): |
| 516 | if type(self) != type(other): return False |
| 517 | if self.mask != other.mask: return False |
| 518 | return True |
| 519 | |
| 520 | def pretty_print(self, q): |
| 521 | q.text("requestforward_slave {") |
| 522 | with q.group(): |
| 523 | with q.indent(2): |
| 524 | q.breakable() |
| 525 | q.text("mask = "); |
| 526 | q.text("%#x" % self.mask) |
| 527 | q.breakable() |
| 528 | q.text('}') |
| 529 | |
| 530 | async_config_prop.subtypes[10] = requestforward_slave |
| 531 | |
| 532 | class role_status_master(async_config_prop): |
| 533 | type = 7 |
| 534 | |
| 535 | def __init__(self, mask=None): |
| 536 | if mask != None: |
| 537 | self.mask = mask |
| 538 | else: |
| 539 | self.mask = 0 |
| 540 | return |
| 541 | |
| 542 | def pack(self): |
| 543 | packed = [] |
| 544 | packed.append(struct.pack("!H", self.type)) |
| 545 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 546 | packed.append(struct.pack("!L", self.mask)) |
| 547 | length = sum([len(x) for x in packed]) |
| 548 | packed[1] = struct.pack("!H", length) |
| 549 | return ''.join(packed) |
| 550 | |
| 551 | @staticmethod |
| 552 | def unpack(reader): |
| 553 | obj = role_status_master() |
| 554 | _type = reader.read("!H")[0] |
| 555 | assert(_type == 7) |
| 556 | _length = reader.read("!H")[0] |
| 557 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 558 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 559 | obj.mask = reader.read("!L")[0] |
| 560 | return obj |
| 561 | |
| 562 | def __eq__(self, other): |
| 563 | if type(self) != type(other): return False |
| 564 | if self.mask != other.mask: return False |
| 565 | return True |
| 566 | |
| 567 | def pretty_print(self, q): |
| 568 | q.text("role_status_master {") |
| 569 | with q.group(): |
| 570 | with q.indent(2): |
| 571 | q.breakable() |
| 572 | q.text("mask = "); |
| 573 | q.text("%#x" % self.mask) |
| 574 | q.breakable() |
| 575 | q.text('}') |
| 576 | |
| 577 | async_config_prop.subtypes[7] = role_status_master |
| 578 | |
| 579 | class role_status_slave(async_config_prop): |
| 580 | type = 6 |
| 581 | |
| 582 | def __init__(self, mask=None): |
| 583 | if mask != None: |
| 584 | self.mask = mask |
| 585 | else: |
| 586 | self.mask = 0 |
| 587 | return |
| 588 | |
| 589 | def pack(self): |
| 590 | packed = [] |
| 591 | packed.append(struct.pack("!H", self.type)) |
| 592 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 593 | packed.append(struct.pack("!L", self.mask)) |
| 594 | length = sum([len(x) for x in packed]) |
| 595 | packed[1] = struct.pack("!H", length) |
| 596 | return ''.join(packed) |
| 597 | |
| 598 | @staticmethod |
| 599 | def unpack(reader): |
| 600 | obj = role_status_slave() |
| 601 | _type = reader.read("!H")[0] |
| 602 | assert(_type == 6) |
| 603 | _length = reader.read("!H")[0] |
| 604 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 605 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 606 | obj.mask = reader.read("!L")[0] |
| 607 | return obj |
| 608 | |
| 609 | def __eq__(self, other): |
| 610 | if type(self) != type(other): return False |
| 611 | if self.mask != other.mask: return False |
| 612 | return True |
| 613 | |
| 614 | def pretty_print(self, q): |
| 615 | q.text("role_status_slave {") |
| 616 | with q.group(): |
| 617 | with q.indent(2): |
| 618 | q.breakable() |
| 619 | q.text("mask = "); |
| 620 | q.text("%#x" % self.mask) |
| 621 | q.breakable() |
| 622 | q.text('}') |
| 623 | |
| 624 | async_config_prop.subtypes[6] = role_status_slave |
| 625 | |
| 626 | class table_status_master(async_config_prop): |
| 627 | type = 9 |
| 628 | |
| 629 | def __init__(self, mask=None): |
| 630 | if mask != None: |
| 631 | self.mask = mask |
| 632 | else: |
| 633 | self.mask = 0 |
| 634 | return |
| 635 | |
| 636 | def pack(self): |
| 637 | packed = [] |
| 638 | packed.append(struct.pack("!H", self.type)) |
| 639 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 640 | packed.append(struct.pack("!L", self.mask)) |
| 641 | length = sum([len(x) for x in packed]) |
| 642 | packed[1] = struct.pack("!H", length) |
| 643 | return ''.join(packed) |
| 644 | |
| 645 | @staticmethod |
| 646 | def unpack(reader): |
| 647 | obj = table_status_master() |
| 648 | _type = reader.read("!H")[0] |
| 649 | assert(_type == 9) |
| 650 | _length = reader.read("!H")[0] |
| 651 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 652 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 653 | obj.mask = reader.read("!L")[0] |
| 654 | return obj |
| 655 | |
| 656 | def __eq__(self, other): |
| 657 | if type(self) != type(other): return False |
| 658 | if self.mask != other.mask: return False |
| 659 | return True |
| 660 | |
| 661 | def pretty_print(self, q): |
| 662 | q.text("table_status_master {") |
| 663 | with q.group(): |
| 664 | with q.indent(2): |
| 665 | q.breakable() |
| 666 | q.text("mask = "); |
| 667 | q.text("%#x" % self.mask) |
| 668 | q.breakable() |
| 669 | q.text('}') |
| 670 | |
| 671 | async_config_prop.subtypes[9] = table_status_master |
| 672 | |
| 673 | class table_status_slave(async_config_prop): |
| 674 | type = 8 |
| 675 | |
| 676 | def __init__(self, mask=None): |
| 677 | if mask != None: |
| 678 | self.mask = mask |
| 679 | else: |
| 680 | self.mask = 0 |
| 681 | return |
| 682 | |
| 683 | def pack(self): |
| 684 | packed = [] |
| 685 | packed.append(struct.pack("!H", self.type)) |
| 686 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 |
| 687 | packed.append(struct.pack("!L", self.mask)) |
| 688 | length = sum([len(x) for x in packed]) |
| 689 | packed[1] = struct.pack("!H", length) |
| 690 | return ''.join(packed) |
| 691 | |
| 692 | @staticmethod |
| 693 | def unpack(reader): |
| 694 | obj = table_status_slave() |
| 695 | _type = reader.read("!H")[0] |
| 696 | assert(_type == 8) |
| 697 | _length = reader.read("!H")[0] |
| 698 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 699 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 700 | obj.mask = reader.read("!L")[0] |
| 701 | return obj |
| 702 | |
| 703 | def __eq__(self, other): |
| 704 | if type(self) != type(other): return False |
| 705 | if self.mask != other.mask: return False |
| 706 | return True |
| 707 | |
| 708 | def pretty_print(self, q): |
| 709 | q.text("table_status_slave {") |
| 710 | with q.group(): |
| 711 | with q.indent(2): |
| 712 | q.breakable() |
| 713 | q.text("mask = "); |
| 714 | q.text("%#x" % self.mask) |
| 715 | q.breakable() |
| 716 | q.text('}') |
| 717 | |
| 718 | async_config_prop.subtypes[8] = table_status_slave |
| 719 | |
| 720 | |