Ask Your Question
0

In get_foo_message_len(...) - What value is passed into offset?

asked 2019-09-24 19:09:22 +0000

Kim gravatar image

updated 2019-09-24 19:13:31 +0000

Jaap gravatar image
/* determine PDU length of protocol foo */
static guint
get_foo_message_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{
    /* TODO: change this to your needs */
    return (guint)tvb_get_ntohl(tvb, offset+4); /* e.g. length is at offset 4 */
}

/* The main dissecting routine */
static int
dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
    tcp_dissect_pdus(tvb, pinfo, tree, TRUE, FRAME_HEADER_LEN,
                     get_foo_message_len, dissect_foo_message, data);
    return tvb_captured_length(tvb);
}
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2019-09-24 19:16:48 +0000

Jaap gravatar image

The offset into the tvb where the next PDU begins.

edit flag offensive delete link more
0

answered 2019-09-24 19:15:18 +0000

Guy Harris gravatar image

The offset into the PDU at which the PDU for which the length is to be extracted begins.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2019-09-24 19:09:22 +0000

Seen: 43 times

Last updated: Sep 24 '19