def pack(self): packed = [] packed.append(struct.pack("!H", self.type)) packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 packed.append(util.pack_port_no(self.value)) length = sum([len(x) for x in packed]) packed[1] = struct.pack("!H", length) return ''.join(packed)
def pack(self): packed = [] packed.append(util.pack_port_no(self.port_no)) packed.append("\x00" * 2) packed.append(struct.pack("!L", self.queue_id)) packed.append(struct.pack("!Q", self.tx_bytes)) packed.append(struct.pack("!Q", self.tx_packets)) packed.append(struct.pack("!Q", self.tx_errors)) return "".join(packed)
def pack(self): packed = [] packed.append(util.pack_port_no(self.port_no)) packed.append('\x00' * 2) packed.append(struct.pack("!L", self.queue_id)) packed.append(struct.pack("!Q", self.tx_bytes)) packed.append(struct.pack("!Q", self.tx_packets)) packed.append(struct.pack("!Q", self.tx_errors)) return ''.join(packed)
def pack(self): packed = [] packed.append(struct.pack("!H", self.type)) packed.append(struct.pack("!H", 0)) # placeholder for length at index 1 packed.append(struct.pack("!L", self.flags)) packed.append(util.pack_port_no(self.port_no)) packed.append(util.pack_port_no(self.loopback_port_no)) packed.append(struct.pack("!6B", *self.local_mac)) packed.append(struct.pack("!6B", *self.nh_mac)) packed.append(struct.pack("!L", self.src_ip)) packed.append(struct.pack("!L", self.dst_ip)) packed.append(struct.pack("!B", self.dscp)) packed.append(struct.pack("!B", self.ttl)) packed.append('\x00' * 2) packed.append(struct.pack("!L", self.vpn)) packed.append(struct.pack("!16s", self.if_name)) 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(util.pack_port_no(self.port)) packed.append(struct.pack("!H", self.max_len)) packed.append("\x00" * 6) 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 length at index 1 packed.append(struct.pack("!L", self.flags)) packed.append(util.pack_port_no(self.port_no)) packed.append(util.pack_port_no(self.loopback_port_no)) packed.append(struct.pack("!6B", *self.local_mac)) packed.append(struct.pack("!6B", *self.nh_mac)) packed.append(struct.pack("!L", self.src_ip)) packed.append(struct.pack("!L", self.dst_ip)) packed.append(struct.pack("!B", self.dscp)) packed.append(struct.pack("!B", self.ttl)) packed.append('\x00' * 2) packed.append(struct.pack("!L", self.vpn)) packed.append(struct.pack("!L", self.rate_limit)) packed.append(struct.pack("!16s", self.if_name)) length = sum([len(x) for x in packed]) packed[1] = struct.pack("!H", length) return ''.join(packed)
def pack(self): packed = [] packed.append(util.pack_port_no(self.port_no)) packed.append(struct.pack("!6B", *self.hw_addr)) packed.append(struct.pack("!16s", self.name)) packed.append(struct.pack("!L", self.config)) packed.append(struct.pack("!L", self.state)) packed.append(struct.pack("!L", self.curr)) packed.append(struct.pack("!L", self.advertised)) packed.append(struct.pack("!L", self.supported)) packed.append(struct.pack("!L", self.peer)) return "".join(packed)
def pack(self): packed = [] packed.append(util.pack_port_no(self.port_no)) packed.append(struct.pack("!6B", *self.hw_addr)) packed.append(struct.pack("!16s", self.name)) packed.append(struct.pack("!L", self.config)) packed.append(struct.pack("!L", self.state)) packed.append(struct.pack("!L", self.curr)) packed.append(struct.pack("!L", self.advertised)) packed.append(struct.pack("!L", self.supported)) packed.append(struct.pack("!L", self.peer)) 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(util.pack_port_no(self.port)) packed.append(struct.pack("!H", self.max_len)) packed.append('\x00' * 6) length = sum([len(x) for x in packed]) if self.length is not None: length = self.length packed[1] = struct.pack("!H", length) return ''.join(packed)
def pack(self): packed = [] packed.append(util.pack_port_no(self.port_no)) packed.append("\x00" * 6) packed.append(struct.pack("!Q", self.rx_packets)) packed.append(struct.pack("!Q", self.tx_packets)) packed.append(struct.pack("!Q", self.rx_bytes)) packed.append(struct.pack("!Q", self.tx_bytes)) packed.append(struct.pack("!Q", self.rx_dropped)) packed.append(struct.pack("!Q", self.tx_dropped)) packed.append(struct.pack("!Q", self.rx_errors)) packed.append(struct.pack("!Q", self.tx_errors)) packed.append(struct.pack("!Q", self.rx_frame_err)) packed.append(struct.pack("!Q", self.rx_over_err)) packed.append(struct.pack("!Q", self.rx_crc_err)) packed.append(struct.pack("!Q", self.collisions)) return "".join(packed)
def pack(self): packed = [] packed.append(util.pack_port_no(self.port_no)) packed.append('\x00' * 6) packed.append(struct.pack("!Q", self.rx_packets)) packed.append(struct.pack("!Q", self.tx_packets)) packed.append(struct.pack("!Q", self.rx_bytes)) packed.append(struct.pack("!Q", self.tx_bytes)) packed.append(struct.pack("!Q", self.rx_dropped)) packed.append(struct.pack("!Q", self.tx_dropped)) packed.append(struct.pack("!Q", self.rx_errors)) packed.append(struct.pack("!Q", self.tx_errors)) packed.append(struct.pack("!Q", self.rx_frame_err)) packed.append(struct.pack("!Q", self.rx_over_err)) packed.append(struct.pack("!Q", self.rx_crc_err)) packed.append(struct.pack("!Q", self.collisions)) return ''.join(packed)
def pack(self): packed = [] packed.append(util.pack_wc_bmap(self.wildcards)) packed.append(util.pack_port_no(self.in_port)) packed.append(struct.pack("!6B", *self.eth_src)) packed.append(struct.pack("!6B", *self.eth_dst)) packed.append(struct.pack("!H", self.vlan_vid)) packed.append(struct.pack("!B", self.vlan_pcp)) packed.append("\x00" * 1) packed.append(struct.pack("!H", self.eth_type)) packed.append(struct.pack("!B", self.ip_dscp)) packed.append(struct.pack("!B", self.ip_proto)) packed.append("\x00" * 2) packed.append(struct.pack("!L", self.ipv4_src)) packed.append(struct.pack("!L", self.ipv4_dst)) packed.append(struct.pack("!H", self.tcp_src)) packed.append(struct.pack("!H", self.tcp_dst)) return "".join(packed)
def pack(self): packed = [] packed.append(util.pack_wc_bmap(self.wildcards)) packed.append(util.pack_port_no(self.in_port)) packed.append(struct.pack("!6B", *self.eth_src)) packed.append(struct.pack("!6B", *self.eth_dst)) packed.append(struct.pack("!H", self.vlan_vid)) packed.append(struct.pack("!B", self.vlan_pcp)) packed.append('\x00' * 1) packed.append(struct.pack("!H", self.eth_type)) packed.append(struct.pack("!B", self.ip_dscp)) packed.append(struct.pack("!B", self.ip_proto)) packed.append('\x00' * 2) packed.append(struct.pack("!L", self.ipv4_src)) packed.append(struct.pack("!L", self.ipv4_dst)) packed.append(struct.pack("!H", self.tcp_src)) packed.append(struct.pack("!H", self.tcp_dst)) return ''.join(packed)