Q: conversation_add_proto_data() & friends

Axel Schwenke <[email protected]>
Newsgroups gmane.network.ethereal.devel
Message-ID <[email protected]>
Hi /all,

I'm adding connection state information to my dissector using the
conversation_*_proto_data() functions. Unfortunately there is no
documentation for those functions so I looked into other dissectors to
get an idea how to use them. Actually I looked into packet_rsync.c.

Now I have a few questions:

1. In packet_rsync.c conversation_add_proto_data() is called everytime
after having changed a member of the data structure. I guess this is an
error, because conversation_get_proto_data() delivers just a pointer to
the data structure, so all modifications are done in place. Correct?

2. I wonder how to deallocate memory that has been allocated for the
data structure. Clearly one can free() the pointer to my structure when
a conversation is dropped, but what happens if I use pointers in there?
Example:

struct conn_data {
  int foo;
  char* bar;
}

here foo can be deallocated but the content of *bar is lost.

3. How should I handle out of memory condition in my dissector?
Currently I use g_malloc() but I guess this is wrong.



mfg, XL
-- 
Axel Schwenke, Senior Software Developer
MySQL GmbH, Oberursel Germany, www.mysql.com

Are you MySQL certified?  www.mysql.com/certification

_______________________________________________
Ethereal-dev mailing list
[email protected]
http://www.ethereal.com/mailman/listinfo/ethereal-dev
signature.asc (application/pgp-signature, 256 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEYcPViud2X8AHBpsRArBDAJ9hwQtSJfy6+fqPhUwqXXWO5KDeygCfVmW/
gehhUL5SrhYHN5M8JkY2BhM=
=BOfW
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.