- snd_cc += so.so_snd.sb_cc
- mp = so.so_snd.sb_mb
- while mp != 0:
- snd_buf += 256
- if (mp.m_hdr.mh_flags & 0x01):
- snd_buf = mp.M_dat.MH.MH_dat.MH_ext.ext_size
- mp = mp.m_hdr.mh_next
- rcv_cc += so.so_rcv.sb_cc
- mp = so.so_rcv.sb_mb
- while mp != 0:
- rcv_buf += 256
- if (mp.m_hdr.mh_flags & 0x01):
- rcv_buf += mp.M_dat.MH.MH_dat.MH_ext.ext_size
- mp = mp.m_hdr.mh_next
- pcb = cast(pcb.inp_hash.le_next, 'inpcb *')
- i += 1
-
- out_string += "total seen " + str(int(pcbseen)) + " snd_cc " + str(int(snd_cc)) + " rcv_cc " + str(int(rcv_cc)) + "\n"
- out_string += "total snd_buf " + str(int(snd_buf)) + " rcv_buf " + str(int(rcv_buf)) + "\n"
- out_string += "port hash base is " + hex(pcbi.ipi_porthashbase) + "\n"
-
+ CalcMbufInSB(so, snd_cc, snd_buf, rcv_cc, rcv_buf, snd_record_cnt, rcv_record_cnt, snd_mbuf_cnt, rcv_mbuf_cnt, snd_mbuf_cluster_cnt, rcv_mbuf_cluster_cnt)
+ pcb = cast(pcb.inp_list.le_next, 'inpcb *')
+ else:
+ i = 0
+ hashbase = pcbi.ipi_hashbase
+ while (i < hashsize):
+ head = hashbase[i]
+ pcb = cast(head.lh_first, 'inpcb *')
+ while pcb != 0:
+ pcbseen += 1
+ out_string += GetInPcb(pcb, proto) + "\n"
+ so = pcb.inp_socket
+ if so != 0:
+ CalcMbufInSB(so, snd_cc, snd_buf, rcv_cc, rcv_buf, snd_record_cnt, rcv_record_cnt, snd_mbuf_cnt, rcv_mbuf_cnt, snd_mbuf_cluster_cnt, rcv_mbuf_cluster_cnt)
+ if proto == IPPROTO_TCP and pcb.inp_ppcb:
+ tcpcb = cast(pcb.inp_ppcb, 'tcpcb *')
+ tcp_reassqlen += tcpcb.t_reassqlen
+
+ pcb = cast(pcb.inp_hash.le_next, 'inpcb *')
+ i += 1
+
+ out_string += "total pcbs seen: " + str(int(pcbseen)) + "\n"
+ out_string += "total send mbuf count: " + str(int(snd_mbuf_cnt[0])) + " receive mbuf count: " + str(int(rcv_mbuf_cnt[0])) + "\n"
+ out_string += "total send mbuf cluster count: " + str(int(snd_mbuf_cluster_cnt[0])) + " receive mbuf cluster count: " + str(int(rcv_mbuf_cluster_cnt[0])) + "\n"
+ out_string += "total send record count: " + str(int(snd_record_cnt[0])) + " receive record count: " + str(int(rcv_record_cnt[0])) + "\n"
+ out_string += "total snd_cc (total bytes in send buffers): " + str(int(snd_cc[0])) + " rcv_cc (total bytes in receive buffers): " + str(int(rcv_cc[0])) + "\n"
+ out_string += "total snd_buf bytes " + str(int(snd_buf[Mbuf_Type.MT_LAST])) + " rcv_buf bytes " + str(int(rcv_buf[Mbuf_Type.MT_LAST])) + "\n"
+ for x in range(Mbuf_Type.MT_LAST):
+ if (snd_buf[x] != 0 or rcv_buf[x] != 0):
+ out_string += "total snd_buf bytes of type " + Mbuf_Type.reverse_mapping[x] + " : " + str(int(snd_buf[x])) + " total recv_buf bytes of type " + Mbuf_Type.reverse_mapping[x] + " : " + str(int(rcv_buf[x])) + "\n"
+ out_string += "port hash base is " + hex(pcbi.ipi_porthashbase) + "\n"
+ if proto == IPPROTO_TCP:
+ out_string += "TCP reassembly queue length: " + str(tcp_reassqlen) + "\n"
+