* env \
* G_DEBUG=gc-friendly \
* G_SLICE=always-malloc \
- * WIRESHARK_DEBUG_EP_NO_CHUNKS=1 \
- * WIRESHARK_DEBUG_SE_NO_CHUNKS=1 \
- * WIRESHARK_DEBUG_SE_USE_CANARY=1 \
- * WIRESHARK_EP_VERIFY_POINTERS=1 \
- * WIRESHARK_SE_VERIFY_POINTERS=1 \
* valgrind --leak-check=full --show-reachable=yes ./reassemble_test
*
* 2. Debug functions have been added which will print information
#include "config.h"
-#include <epan/emem.h>
#include <epan/packet.h>
#include <epan/packet_info.h>
#include <epan/proto.h>
printf("Starting test test_simple_fragment_add_seq\n");
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE, 0);
/* start another pdu (just to confuse things) */
pinfo.fd->flags.visited = 0;
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 15, &pinfo, 13, NULL,
0, 60, TRUE, 0);
ASSERT_EQ(2,g_hash_table_size(test_reassembly_table.fragment_table));
ASSERT_EQ(NULL,fd_head);
/* now we add the terminal fragment of the first datagram */
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
2, 60, FALSE, 0);
ASSERT_EQ(NULL,fd_head);
/* finally, add the missing fragment */
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 15, &pinfo, 12, NULL,
1, 60, TRUE, 0);
/* what happens if we revisit the packets now? */
fdh0 = fd_head;
pinfo.fd->flags.visited = 1;
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE, 0);
/*
*/
ASSERT_EQ(fdh0,fd_head);
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
2, 60, FALSE, 0);
ASSERT_EQ(fdh0,fd_head);
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 15, &pinfo, 12, NULL,
1, 60, TRUE, 0);
ASSERT_EQ(fdh0,fd_head);
/* generally it's probably fair to assume that we will be called with
* more_frags=FALSE.
*/
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, FALSE, 0);
* check on the state of things), we're going to set the more_frags flag
* here
*/
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 0, &pinfo, 12, NULL,
1, 40, TRUE, 0);
/* Another copy of the second segment.
*/
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 0, &pinfo, 12, NULL,
1, 40, TRUE, 0);
/* have another go at wrapping things up */
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 20, &pinfo, 12, NULL,
2, 100, FALSE, 0);
fragment_set_partial_reassembly(&test_reassembly_table, &pinfo, 12, NULL);
- pinfo.fd->num = 5;
+ pinfo.num = 5;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 0, &pinfo, 12, NULL,
3, 40, FALSE, 0);
printf("Starting test test_fragment_add_seq_duplicate_first\n");
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* Add the 2nd segment */
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
1, 60, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* Add the last fragment */
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
2, 40, FALSE, 0);
ASSERT_NE(NULL,fd_head);
/* Add the first fragment again */
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE, 0);
printf("Starting test test_fragment_add_seq_duplicate_middle\n");
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* Add the 2nd segment */
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
1, 60, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* Now, add the 2nd segment again (but in a different frame) */
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
1, 60, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* finally, add the last fragment */
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
2, 40, FALSE, 0);
printf("Starting test test_fragment_add_seq_duplicate_last\n");
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* Add the 2nd segment */
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
1, 60, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* Add the last fragment */
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
2, 40, FALSE, 0);
ASSERT_NE(NULL,fd_head);
/* Add the last fragment again */
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
2, 40, FALSE, 0);
printf("Starting test test_fragment_add_seq_duplicate_conflict\n");
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* Add the 2nd segment */
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
1, 60, TRUE, 0);
/* Now, add the 2nd segment again (but in a different frame and with
* different data)
*/
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 15, &pinfo, 12, NULL,
1, 60, TRUE, 0);
ASSERT_EQ(NULL,fd_head);
/* finally, add the last fragment */
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
2, 40, FALSE, 0);
{
fragment_head *fd_head;
- pinfo.fd -> num = 1;
+ pinfo.num = 1;
fd_head=fn(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE);
ASSERT_EQ(NULL,fd_head);
/* start another pdu (just to confuse things) */
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fn(&test_reassembly_table, tvb, 15, &pinfo, 13, NULL,
0, 60, TRUE);
ASSERT_EQ(2,g_hash_table_size(test_reassembly_table.fragment_table));
ASSERT_EQ(NULL,fd_head);
/* add the terminal fragment of the first datagram */
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fn(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
2, 60, FALSE);
ASSERT_EQ(NULL,fd_head);
/* finally, add the missing fragment */
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fn(&test_reassembly_table, tvb, 15, &pinfo, 12, NULL,
1, 60, TRUE);
printf("Starting test test_fragment_add_seq_check_1\n");
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq_check(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
1, 50, FALSE);
ASSERT_EQ(NULL,fd_head);
/* Now add the missing segment */
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq_check(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
0, 60, TRUE);
/* the 802.11 hack is that some non-fragmented datagrams have non-zero
* fragment_number; test for this. */
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq_802_11(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
10, 50, FALSE);
test_fragment_add_seq_check_multiple(void) {
fragment_head *fd_head;
- pinfo.fd -> num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq_check(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
0, 50, TRUE);
/* add the terminal fragment of the first datagram */
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq_check(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
1, 20, FALSE);
print_tables();
/* Now: start a second datagram with the first fragment in frame #2 */
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq_check(&test_reassembly_table, tvb, 25, &pinfo, 12, NULL,
0, 25, TRUE);
/* add the terminal fragment of the second datagram */
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq_check(&test_reassembly_table, tvb, 0, &pinfo, 12, NULL,
1, 60, FALSE);
printf("Starting test test_simple_fragment_add_seq_next\n");
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head= fragment_add_seq_next(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
50, TRUE);
/* start another pdu (just to confuse things) */
pinfo.fd->flags.visited = 0;
- pinfo.fd->num = 2;
+ pinfo.num = 2;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 15, &pinfo, 13, NULL,
60, TRUE);
ASSERT_EQ(2,g_hash_table_size(test_reassembly_table.fragment_table));
/* now we add the terminal fragment of the first datagram */
- pinfo.fd->num = 3;
+ pinfo.num = 3;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
60, FALSE);
printf("Starting test test_missing_data_fragment_add_seq_next\n");
/* attempt to add a fragment which is longer than the data available */
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
DATA_LEN-9, TRUE);
ASSERT_EQ(NULL,fd_head->next);
/* add another fragment (with all data present) */
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
60, FALSE);
/* check what happens when we revisit the packets */
pinfo.fd->flags.visited = TRUE;
- pinfo.fd->num = 1;
+ pinfo.num = 1;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 10, &pinfo, 12, NULL,
DATA_LEN-9, TRUE);
ASSERT_EQ(0,g_hash_table_size(test_reassembly_table.reassembled_table));
ASSERT_EQ(NULL,fd_head);
- pinfo.fd->num = 4;
+ pinfo.num = 4;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 5, &pinfo, 12, NULL,
60, FALSE);
ASSERT_EQ(1,g_hash_table_size(test_reassembly_table.fragment_table));
printf("Starting test test_missing_data_fragment_add_seq_next_2\n");
- pinfo.fd->num = 11;
+ pinfo.num = 11;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 10, &pinfo, 24, NULL,
50, TRUE);
ASSERT_EQ(0,g_hash_table_size(test_reassembly_table.reassembled_table));
ASSERT_EQ(NULL,fd_head);
- pinfo.fd->num = 12;
+ pinfo.num = 12;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 5, &pinfo, 24, NULL,
DATA_LEN-4, FALSE);
/* check what happens when we revisit the packets */
pinfo.fd->flags.visited = TRUE;
- pinfo.fd->num = 11;
+ pinfo.num = 11;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 10, &pinfo, 24, NULL,
50, TRUE);
ASSERT_EQ(0,g_hash_table_size(test_reassembly_table.reassembled_table));
ASSERT_EQ(NULL,fd_head);
- pinfo.fd->num = 12;
+ pinfo.num = 12;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 5, &pinfo, 24, NULL,
DATA_LEN-4, FALSE);
ASSERT_EQ(0,g_hash_table_size(test_reassembly_table.fragment_table));
printf("Starting test test_missing_data_fragment_add_seq_next_3\n");
- pinfo.fd->num = 20;
+ pinfo.num = 20;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 5, &pinfo, 30, NULL,
DATA_LEN-4, FALSE);
/* revisiting the packet ought to produce the same result. */
pinfo.fd->flags.visited = TRUE;
- pinfo.fd->num = 20;
+ pinfo.num = 20;
fd_head=fragment_add_seq_next(&test_reassembly_table, tvb, 5, &pinfo, 30, NULL,
DATA_LEN-4, FALSE);
#endif
};
- /* initialise stuff */
- emem_init();
-
/* a tvbuff for testing with */
data = (char *)g_malloc(DATA_LEN);
/* make sure it's full of stuff */
/* other test stuff */
pinfo.fd = &fd;
fd.flags.visited = 0;
- SET_ADDRESS(&pinfo.src,AT_IPv4,4,src);
- SET_ADDRESS(&pinfo.dst,AT_IPv4,4,dst);
+ set_address(&pinfo.src,AT_IPv4,4,src);
+ set_address(&pinfo.dst,AT_IPv4,4,dst);
/*************************************************************************/
for(i=0; i < sizeof(tests)/sizeof(tests[0]); i++ ) {