Actually the correct way to detect how/why a subdissector is being called is to use the pinfo->match_uint or match_string fields. These will tell you, to quote the comment in packet_info.h, the "matched uint for calling subdissector from table".