Ethereal-dev: Re: [Ethereal-dev] Creating a new Dissector

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "pevee" <clkuan@xxxxxxxxxxxxxxx>
Date: Mon, 7 Oct 2002 09:29:54 +0800
Hi,

   Here is a segment of code...I did used tvb_get_ntohl();

=============================================
static int ac_user_ip = -1;

guint32         user_ip;        //user ip defined

 tvb_memcpy(tvb, (guint8 *)&iph, offset, sizeof(e_ip));
        iph.ip_len = g_ntohs(iph.ip_len);
        iph.ip_id  = g_ntohs(iph.ip_id);
        iph.ip_off = g_ntohs(iph.ip_off);
        iph.ip_sum = g_ntohs(iph.ip_sum);

 //retrieve the User IP Address from the packet
        user_ip = tvb_get_ntohl(tvb, offset);
        proto_tree_add_ipv4 (ac_tree, ac_user_ip, tvb, offset + 4, -4,
user_ip);

=================================================

tq