Take a look at packet-ip.c
take a look at packet-udp.c:
Thanks. This is a good example of how to chain protocol dissectors, but
this doesn't solve my problem.
It's similar to the following: I have to dissect some IP fields only if
the higher layer protocol is TCP, and dissection code for these fields
is TCP specific. If I have UDP instead of TCP, the dissection code for
the same fields is different. And I don't have ip.proto field :-(