def pack(self): packed = [] packed.append(struct.pack("!L", self.queue_id)) packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 packed.append("\x00" * 2) packed.append(util.pack_list(self.properties)) length = sum([len(x) for x in packed]) packed[1] = struct.pack("!H", length) return "".join(packed)
def pack(self): packed = [] packed.append(struct.pack("!H", self.type)) packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 packed.append('\x00' * 4) packed.append(util.pack_list(self.actions)) length = sum([len(x) for x in packed]) packed[1] = struct.pack("!H", length) return ''.join(packed)
def pack(self): packed = [] packed.append(struct.pack("!L", self.queue_id)) packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 packed.append('\x00' * 2) packed.append(util.pack_list(self.properties)) length = sum([len(x) for x in packed]) packed[1] = struct.pack("!H", length) return ''.join(packed)
def pack(self): packed = [] packed.append(struct.pack("!H", 0)) # placeholder for length at index 0 packed.append(struct.pack("!B", self.table_id)) packed.append("\x00" * 1) packed.append(self.match.pack()) packed.append(struct.pack("!L", self.duration_sec)) packed.append(struct.pack("!L", self.duration_nsec)) packed.append(struct.pack("!H", self.priority)) packed.append(struct.pack("!H", self.idle_timeout)) packed.append(struct.pack("!H", self.hard_timeout)) packed.append("\x00" * 6) packed.append(struct.pack("!Q", self.cookie)) packed.append(struct.pack("!Q", self.packet_count)) packed.append(struct.pack("!Q", self.byte_count)) packed.append(util.pack_list(self.actions)) length = sum([len(x) for x in packed]) packed[0] = struct.pack("!H", length) return "".join(packed)
def pack(self): packed = [] packed.append(struct.pack("!H", 0)) # placeholder for length at index 0 packed.append(struct.pack("!B", self.table_id)) packed.append('\x00' * 1) packed.append(self.match.pack()) packed.append(struct.pack("!L", self.duration_sec)) packed.append(struct.pack("!L", self.duration_nsec)) packed.append(struct.pack("!H", self.priority)) packed.append(struct.pack("!H", self.idle_timeout)) packed.append(struct.pack("!H", self.hard_timeout)) packed.append('\x00' * 6) packed.append(struct.pack("!Q", self.cookie)) packed.append(struct.pack("!Q", self.packet_count)) packed.append(struct.pack("!Q", self.byte_count)) packed.append(util.pack_list(self.actions)) length = sum([len(x) for x in packed]) packed[0] = struct.pack("!H", length) return ''.join(packed)