SLAB_FREE(fi, tcp_unacked_t)
-/* Idea for gt: either x > y, or y is much bigger (assume wrap) */
-#define GT_SEQ(x, y) ((gint32)((y) - (x)) < 0)
-#define LT_SEQ(x, y) ((gint32)((x) - (y)) < 0)
-#define GE_SEQ(x, y) ((gint32)((y) - (x)) <= 0)
-#define LE_SEQ(x, y) ((gint32)((x) - (y)) <= 0)
-#define EQ_SEQ(x, y) ((x) == (y))
-
#define TCP_A_RETRANSMISSION 0x0001
#define TCP_A_LOST_PACKET 0x0002
#define TCP_A_ACK_LOST_PACKET 0x0004
and let TCP try to find out what it can about this segment
*/
static int
-scan_for_next_pdu(tvbuff_t *tvb, proto_tree *tcp_tree, packet_info *pinfo, int offset, guint32 seq, guint32 nxtseq, struct tcp_analysis *tcpd)
+scan_for_next_pdu(tvbuff_t *tvb, proto_tree *tcp_tree, packet_info *pinfo, int offset, guint32 seq, guint32 nxtseq, emem_tree_t *multisegment_pdus)
{
struct tcp_multisegment_pdu *msp=NULL;
if(!pinfo->fd->flags.visited){
- msp=se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, seq-1);
+ msp=se_tree_lookup32_le(multisegment_pdus, seq-1);
if(msp){
/* If this is a continuation of a PDU started in a
* previous segment we need to update the last_frame
* this segment we also verify that the found PDU does span
* beyond the end of this segment.
*/
- msp=se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, nxtseq-1);
+ msp=se_tree_lookup32_le(multisegment_pdus, nxtseq-1);
if(msp){
if( (pinfo->fd->num==msp->first_frame)
){
/* Second we check if this segment is part of a PDU started
* prior to the segment (seq-1)
*/
- msp=se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, seq-1);
+ msp=se_tree_lookup32_le(multisegment_pdus, seq-1);
if(msp){
/* If this segment is completely within a previous PDU
* then we just skip this packet
/* if we saw a PDU that extended beyond the end of the segment,
use this function to remember where the next pdu starts
*/
-static struct tcp_multisegment_pdu *
-pdu_store_sequencenumber_of_next_pdu(packet_info *pinfo, guint32 seq, guint32 nxtpdu, struct tcp_analysis *tcpd)
+struct tcp_multisegment_pdu *
+pdu_store_sequencenumber_of_next_pdu(packet_info *pinfo, guint32 seq, guint32 nxtpdu, emem_tree_t *multisegment_pdus)
{
struct tcp_multisegment_pdu *msp;
msp->last_frame=pinfo->fd->num;
msp->last_frame_time=pinfo->fd->abs_ts;
msp->flags=0;
- se_tree_insert32(tcpd->fwd->multisegment_pdus, seq, (void *)msp);
+ se_tree_insert32(multisegment_pdus, seq, (void *)msp);
return msp;
}
* above.
*/
msp = pdu_store_sequencenumber_of_next_pdu(pinfo,
- deseg_seq, nxtseq+1, tcpd);
+ deseg_seq, nxtseq+1, tcpd->fwd->multisegment_pdus);
msp->flags|=MSP_FLAGS_REASSEMBLE_ENTIRE_SEGMENT;
} else {
msp = pdu_store_sequencenumber_of_next_pdu(pinfo,
- deseg_seq, nxtseq+pinfo->desegment_len, tcpd);
+ deseg_seq, nxtseq+pinfo->desegment_len, tcpd->fwd->multisegment_pdus);
}
/* add this segment as the first one for this new pdu */
if(tcp_analyze_seq && (!tcp_desegment)){
if(seq || nxtseq){
offset=scan_for_next_pdu(tvb, tcp_tree, pinfo, offset,
- seq, nxtseq, tcpd);
+ seq, nxtseq, tcpd->fwd->multisegment_pdus);
}
}
}
pinfo,
seq,
nxtseq+pinfo->bytes_until_next_pdu,
- tcpd);
+ tcpd->fwd->multisegment_pdus);
}
}
}
pdu_store_sequencenumber_of_next_pdu(pinfo,
seq,
nxtseq+pinfo->bytes_until_next_pdu,
- tcpd);
+ tcpd->fwd->multisegment_pdus);
}
}
}
#define TH_ECN 0x40
#define TH_CWR 0x80
+/* Idea for gt: either x > y, or y is much bigger (assume wrap) */
+#define GT_SEQ(x, y) ((gint32)((y) - (x)) < 0)
+#define LT_SEQ(x, y) ((gint32)((x) - (y)) < 0)
+#define GE_SEQ(x, y) ((gint32)((y) - (x)) <= 0)
+#define LE_SEQ(x, y) ((gint32)((x) - (y)) <= 0)
+#define EQ_SEQ(x, y) ((x) == (y))
/* the tcp header structure, passed to tap listeners */
struct tcpheader {
guint (*get_pdu_len)(packet_info *, tvbuff_t *, int),
dissector_t dissect_pdu);
+extern struct tcp_multisegment_pdu *
+pdu_store_sequencenumber_of_next_pdu(packet_info *pinfo, guint32 seq, guint32 nxtpdu, emem_tree_t *multisegment_pdus);
typedef struct _tcp_unacked_t {
struct _tcp_unacked_t *next;