Example #1
0
 def pack(self):
     packed = []
     packed.append(struct.pack("!B", self.table_id))
     packed.append("\x00" * 3)
     packed.append(struct.pack("!32s", self.name))
     packed.append(util.pack_wc_bmap(self.wildcards))
     packed.append(struct.pack("!L", self.max_entries))
     packed.append(struct.pack("!L", self.active_count))
     packed.append(struct.pack("!Q", self.lookup_count))
     packed.append(struct.pack("!Q", self.matched_count))
     return "".join(packed)
Example #2
0
 def pack(self):
     packed = []
     packed.append(struct.pack("!B", self.table_id))
     packed.append('\x00' * 3)
     packed.append(struct.pack("!32s", self.name))
     packed.append(util.pack_wc_bmap(self.wildcards))
     packed.append(struct.pack("!L", self.max_entries))
     packed.append(struct.pack("!L", self.active_count))
     packed.append(struct.pack("!Q", self.lookup_count))
     packed.append(struct.pack("!Q", self.matched_count))
     return ''.join(packed)
Example #3
0
 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)
Example #4
0
 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)