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