Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] basic question

From: Brian Oleksa <oleksab@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Mar 2010 10:39:59 -0400

Wiresharkers

I have been writing all my dissectors based on the port it will be broadcasting on. For example:

static int global_test_port = 11111;

void proto_reg_handoff_test(void) {
   static gboolean isinitialized = FALSE;

       if (!isinitialized) {
           testdata_handle = find_dissector("data");
           test_handle = create_dissector_handle(dissect_test, proto_test);
           dissector_add("udp.port", global_test_port, test_handle);
   }
   isinitialized = TRUE;
}

But what if I just wanted to make this dissector available as "decode as" and not by the port it broadcasts on..??

Can I just pass in a NULL for global_test_port..??

dissector_add("udp.port", NULL, test_handle);

Just wanted to see what the best thing to do is here. I was just simply going to pick a port that it would never be on...such as 11111.

Thanks,
Brian