I am attempting to write my first dissector for Ethereal. The most efficient way that I can work out to do this particular dissector isto define a structure that is the right shape for the elements of the protocol. Then simply assign a pointer of this type to the start of the buffer. Can I do this in Ethereal?
 
Example:
 
struct udp
{
    unsigned short source_port;
    unsigned short destination_port
    unsigned short length;
    unsigned short checksum;
}
 
struct udp_header *udp_hdr;
 
udp_hdr=(struct udp_header*)data_buffer
 
I cannot work out if I can do this (with tvb_get_ptr??). Everything I tried didn't work.
 
By using this method, if I want to read the UDP source port, I can simply access "udp_hdr->source_port".
 
For complex protocols, this saves me LOADS of effort using the tvb_get type access mechanisms.
 
Thanks in advance for any help/advice you can give

Reply via email to