diff options
author | Guy Harris <guy@alum.mit.edu> | 2009-07-08 00:57:01 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2009-07-08 00:57:01 +0000 |
commit | d5289354aba4144de252609fe7822038ffc48f33 (patch) | |
tree | 9d95241b30c35a615feb1b5347e29982157bcf21 /doc | |
parent | 98c1ca42c920e94ab26485b3f2b4b4e23e76210e (diff) |
Recommend the expert mechanism, rather than DISSECTOR_ASSERT(), for
checks that really check whether the packet is valid; DISSECTOR_ASSERT()
should only be used for cases where the dissector is making an
assumption about its internal state.
svn path=/trunk/; revision=29006
Diffstat (limited to 'doc')
-rw-r--r-- | doc/README.developer | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/doc/README.developer b/doc/README.developer index c79703c8bd..e0530484df 100644 --- a/doc/README.developer +++ b/doc/README.developer @@ -528,8 +528,15 @@ Do *NOT* use "g_assert()" or "g_assert_not_reached()" in dissectors. that it's a problem with the dissector if found; if it cannot do anything else with a particular value from a packet's data, the dissector should put into the protocol tree an indication that the -value is invalid, and should return. You can use the DISSECTOR_ASSERT -macro for that purpose. +value is invalid, and should return. The "expert" mechanism should be +used for that purpose. + +If there is a case where you are checking not for an invalid data item +in the packet, but for a bug in the dissector (for example, an +assumption being made at a particular point in the code about the +internal state of the dissector), use the DISSECTOR_ASSERT macro for +that purpose; this will put into the protocol tree an indication that +the dissector has a bug in it, and will not crash the application. If you are allocating a chunk of memory to contain data from a packet, or to contain information derived from data in a packet, and the size of |