/*--- proto_reg_handoff_h501 -------------------------------------------*/
void proto_reg_handoff_h501(void) 
{
  static gboolean h501_prefs_initialized = FALSE;
  static dissector_handle_t h501_udp_handle;
  static dissector_handle_t h501_tcp_handle;
  static guint saved_h501_udp_port;
  static guint saved_h501_tcp_port;

  if (!h501_prefs_initialized) {
    h501_pdu_handle = find_dissector(PFNAME);
    h501_udp_handle = new_create_dissector_handle(dissect_h501_udp, proto_h501);
    h501_tcp_handle = new_create_dissector_handle(dissect_h501_tcp, proto_h501);
    h501_prefs_initialized = TRUE;
  } else {
    dissector_delete("udp.port", saved_h501_udp_port, h501_udp_handle);
    dissector_delete("tcp.port", saved_h501_tcp_port, h501_tcp_handle);
  }

  /* Set our port number for future use */
  saved_h501_udp_port = h501_udp_port;
  dissector_add("udp.port", saved_h501_udp_port, h501_udp_handle);
  saved_h501_tcp_port = h501_tcp_port;
  dissector_add("tcp.port", saved_h501_tcp_port, h501_tcp_handle);

}
Example #2
0
void
proto_reg_handoff_rtsp(void)
{
	static dissector_handle_t rtsp_handle;
	static gboolean rtsp_prefs_initialized = FALSE;
	/*
	 * Variables to allow for proper deletion of dissector registration when
	 * the user changes port from the gui.
	 */
	static guint saved_rtsp_tcp_port;
	static guint saved_rtsp_tcp_alternate_port;

	if (!rtsp_prefs_initialized) {
		rtsp_handle = find_dissector("rtsp");
		rtp_handle = find_dissector("rtp");
		rtcp_handle = find_dissector("rtcp");
		rdt_handle = find_dissector("rdt");
		media_type_dissector_table = find_dissector_table("media_type");
		rtsp_prefs_initialized = TRUE;
	}
	else {
		dissector_delete("tcp.port", saved_rtsp_tcp_port, rtsp_handle);
		dissector_delete("tcp.port", saved_rtsp_tcp_alternate_port, rtsp_handle);
	}
	/* Set our port number for future use */
	dissector_add("tcp.port", global_rtsp_tcp_port, rtsp_handle);
	dissector_add("tcp.port", global_rtsp_tcp_alternate_port, rtsp_handle);

	saved_rtsp_tcp_port = global_rtsp_tcp_port;
	saved_rtsp_tcp_alternate_port = global_rtsp_tcp_alternate_port;

}
void
proto_reg_handoff_t38(void)
{
	static gboolean t38_prefs_initialized = FALSE;
	static guint tcp_port;
	static guint udp_port;

	if (!t38_prefs_initialized) {
		t38_udp_handle=create_dissector_handle(dissect_t38_udp, proto_t38);
		t38_tcp_handle=create_dissector_handle(dissect_t38_tcp, proto_t38);
		t38_tcp_pdu_handle=create_dissector_handle(dissect_t38_tcp_pdu, proto_t38);
		rtp_handle = find_dissector("rtp");
		t30_hdlc_handle = find_dissector("t30.hdlc");
		data_handle = find_dissector("data");
		t38_prefs_initialized = TRUE;
	}
	else {
		dissector_delete("tcp.port", tcp_port, t38_tcp_handle);
		dissector_delete("udp.port", udp_port, t38_udp_handle);
	}
	tcp_port = global_t38_tcp_port;
	udp_port = global_t38_udp_port;

	dissector_add("tcp.port", tcp_port, t38_tcp_handle);
	dissector_add("udp.port", udp_port, t38_udp_handle);

}
Example #4
0
/*! \brief  Set user preferences.
 *
 * Port and template file are currently the only prefs being set.
 * This function is called by Wireshark when
 * 1. The program starts up.
 * 2. Preferences for the plugin have changed.
 */
void proto_reg_handoff_fast ()
{
  static gboolean initialized = FALSE;
  static guint currentPort = 0;
  static dissector_handle_t fast_handle;
  static char* currentTemplateXML = 0;
  static char* currentPortField = "udp.port";

  setLogSettings(showDialogWindows, logErrors);
  
  /* listen for TCP or UDP, depending on user preference */
  if(protocol){
    config_port_field = "tcp.port";
  } else {
    config_port_field = "udp.port";
  }
  
  if(enabled && !initialized){
    fast_handle = create_dissector_handle(&dissect_fast, proto_fast);
    initialized = TRUE;
  }
  
  if(enabled && initialized){
  
    dissector_delete(currentPortField, currentPort, fast_handle);

    /* Set up port number. */
    if (initialized && config_port_number == 0) {
      config_port_number = 1337;
      fprintf(stderr, "FAST - WARNING: Port is not set, using default %u\n", config_port_number);
    }
    currentPort = config_port_number;
    currentPortField = config_port_field;

    /* Read templates file. */
    if (initialized && config_template_xml_path) {
      fprintf(stderr, "Using xml file %s ...\n",config_template_xml_path);
      if(g_strcmp0(config_template_xml_path, currentTemplateXML)!=0){
        reparse_templates = TRUE;
      }
    }

    /* Tell Wireshark what underlying protocol and port we use. */
    dissector_add(config_port_field, config_port_number, fast_handle);
  
  } else {
    dissector_delete(currentPortField, currentPort, fast_handle);  
  }
  
}
Example #5
0
/* The registration hand-off routine */
void
proto_reg_handoff_beep(void)
{
  static gboolean beep_prefs_initialized = FALSE;
  static dissector_handle_t beep_handle;
  static guint beep_tcp_port;

  if (!beep_prefs_initialized) {

    beep_handle = create_dissector_handle(dissect_beep, proto_beep);

    beep_prefs_initialized = TRUE;

  }
  else {

    dissector_delete("tcp.port", beep_tcp_port, beep_handle);

  }

  /* Set our port number for future use */

  beep_tcp_port = global_beep_tcp_port;

  dissector_add("tcp.port", global_beep_tcp_port, beep_handle);

}
Example #6
0
void
proto_reg_handoff_bvlc(void)
{
	static gboolean bvlc_initialized = FALSE;
	static dissector_handle_t bvlc_handle;
	static guint additional_bvlc_udp_port;
	
	if (!bvlc_initialized)
	{
		bvlc_handle = find_dissector("bvlc");
		dissector_add("udp.port", 0xBAC0, bvlc_handle);
		data_handle = find_dissector("data");
		bvlc_initialized = TRUE;
	}
	else
	{
		if (additional_bvlc_udp_port != 0) {
			dissector_delete("udp.port", additional_bvlc_udp_port, bvlc_handle);
		}
	}

	if (global_additional_bvlc_udp_port != 0) {
		dissector_add("udp.port", global_additional_bvlc_udp_port, bvlc_handle);
	}
	additional_bvlc_udp_port = global_additional_bvlc_udp_port;
}
Example #7
0
/*FUNCTION:------------------------------------------------------
 *  NAME
 *      proto_reg_handoff_zep
 *  DESCRIPTION
 *      Registers the zigbee dissector with Wireshark.
 *      Will be called every time 'apply' is pressed in the preferences menu.
 *  PARAMETERS
 *      none
 *  RETURNS
 *      void
 *---------------------------------------------------------------
 */
void proto_reg_handoff_zep(void)
{
    static dissector_handle_t  zep_handle;
    static int                 lastPort;
    static gboolean            inited = FALSE;

    if ( !inited) {
        dissector_handle_t h;
        /* Get dissector handles. */
        if ( !(h = find_dissector("wpan")) ) { /* Try use built-in 802.15.4 disector */
            h = find_dissector("ieee802154");  /* otherwise use older 802.15.4 plugin disector */
        }
        ieee802154_handle = h;
        if ( !(h = find_dissector("wpan_cc24xx")) ) { /* Try use built-in 802.15.4 (Chipcon) disector */
            h = find_dissector("ieee802154_ccfcs");   /* otherwise use older 802.15.4 (Chipcon) plugin disector */
        }
        ieee802154_ccfcs_handle = h;
        zep_handle = find_dissector("zep");
        data_handle = find_dissector("data");
        inited = TRUE;
    } else {
        /* If we were already registered, de-register our dissector
         * to free the port. */
        dissector_delete("udp.port", lastPort, zep_handle);
    }

    /* Register our dissector. */
    dissector_add("udp.port", gPREF_zep_udp_port, zep_handle);
    lastPort = gPREF_zep_udp_port;
} /* proto_reg_handoff_zep */
Example #8
0
void
proto_reg_handoff_lge_monitor(void)
{
    static dissector_handle_t lge_monitor_handle;
    static guint saved_udp_port;
    static gboolean lge_monitor_prefs_initialized = FALSE;

    if (!lge_monitor_prefs_initialized) {
        lge_monitor_handle = create_dissector_handle(dissect_lge_monitor, proto_lge_monitor);
        dissector_add_handle("udp.port", lge_monitor_handle);  /* for 'decode-as' */
        mtp3_handle  = find_dissector("mtp3");
        m3ua_handle  = find_dissector("m3ua");
        sccp_handle  = find_dissector("sccp");
        sctp_handle  = find_dissector("sctp");
        lge_monitor_prefs_initialized = TRUE;
    }
    else {
        if (saved_udp_port != 0) {
            dissector_delete("udp.port", saved_udp_port, lge_monitor_handle);
        }
    }

    if (LGEMonitorUDPPort != 0) {
        dissector_add("udp.port", LGEMonitorUDPPort, lge_monitor_handle);
    }
    saved_udp_port = LGEMonitorUDPPort;
}
Example #9
0
void
proto_reg_handoff_m2pa(void)
{
  static gboolean prefs_initialized = FALSE;
  static dissector_handle_t m2pa_handle;
  static guint sctp_port;

  /* Port preferences code shamelessly copied from packet-beep.c */
  if (!prefs_initialized) {
    m2pa_handle   = find_dissector("m2pa");
    mtp3_handle   = find_dissector("mtp3");

    dissector_add("sctp.ppi", M2PA_PAYLOAD_PROTOCOL_ID, m2pa_handle);

    prefs_initialized = TRUE;

  } else {

    dissector_delete("sctp.port", sctp_port, m2pa_handle);

  }

  /* Set our port number for future use */
  sctp_port = global_sctp_port;

  dissector_add("sctp.port", sctp_port, m2pa_handle);
}
void proto_reg_handoff_ismacryp(void)
{
	static gboolean ismacryp_prefs_initialized=FALSE;
	static dissector_handle_t ismacryp_handle;
	static guint dynamic_payload_type;
	
	if (!ismacryp_prefs_initialized) {
		dissector_handle_t ismacryp_v11_handle;
		dissector_handle_t ismacryp_v20_handle;
		ismacryp_handle = create_dissector_handle(dissect_ismacryp, proto_ismacryp);
		ismacryp_v11_handle = create_dissector_handle(dissect_ismacryp_v11, proto_ismacryp);
		ismacryp_v20_handle = create_dissector_handle(dissect_ismacryp_v20, proto_ismacryp);
		ismacryp_prefs_initialized = TRUE;
		dissector_add_string("rtp_dyn_payload_type", "ISMACRYP", ismacryp_handle);
		dissector_add_string("rtp_dyn_payload_type", "enc-mpeg4-generic", ismacryp_v11_handle);
		dissector_add_string("rtp_dyn_payload_type", "enc-isoff-generic", ismacryp_v20_handle);
	  }
	else { /* ismacryp_prefs_initialized = TRUE */
		/* delete existing association of ismacryp with payload_type */
		if ( dynamic_payload_type > 95 ){
			dissector_delete("rtp.pt", dynamic_payload_type, ismacryp_handle);
		}
	}
	/* always do the following */
	dynamic_payload_type = pref_dynamic_payload_type; /*update payload_type to new value */
	if ( dynamic_payload_type > 95 ){
		dissector_add("rtp.pt", dynamic_payload_type, ismacryp_handle);
	}
	
}
Example #11
0
void
proto_reg_handoff_llt(void)
{
	static gboolean initialized = FALSE;
	static dissector_handle_t llt_handle;
	static guint preference_alternate_ethertype_last;

	if (!initialized) {
		llt_handle = create_dissector_handle(dissect_llt, proto_llt);
		dissector_add("ethertype", ETHERTYPE_LLT, llt_handle);
		initialized = TRUE;
	} else {
		if (preference_alternate_ethertype_last != 0x0) {
			dissector_delete("ethertype", preference_alternate_ethertype_last, llt_handle);
		}
	}

	/* Save the setting to see if it has changed later */
	preference_alternate_ethertype_last = preference_alternate_ethertype;

	if (preference_alternate_ethertype != 0x0) {
 		/* Register the new ethertype setting */
		dissector_add("ethertype", preference_alternate_ethertype, llt_handle);
	}
}
Example #12
0
void
proto_reg_handoff_ccn(void)
{
    static gboolean initialized = FALSE;
    static int current_ccn_port = -1;
    int global_ccn_port = atoi(CCN_DEFAULT_UNICAST_PORT);
    
    if (!initialized) {
        ccn_handle = new_create_dissector_handle(dissect_ccn, proto_ccn);
        heur_dissector_add("udp", dissect_ccn_heur, proto_ccn);
        heur_dissector_add("tcp", dissect_ccn_heur, proto_ccn);
        if (ccn_register_dtls)
            heur_dissector_add("dtls", dissect_ccn_heur, proto_ccn);
        initialized = TRUE;
    }
    if (current_ccn_port != -1) {
        dissector_delete("udp.port", current_ccn_port, ccn_handle);
        dissector_delete("tcp.port", current_ccn_port, ccn_handle);
    }
    dissector_add("udp.port", global_ccn_port, ccn_handle);
    dissector_add("tcp.port", global_ccn_port, ccn_handle);
    current_ccn_port = global_ccn_port;
}
void prefs_register_dop(void) {
  static guint tcp_port = 0;

  /* de-register the old port */
  /* port 102 is registered by TPKT - don't undo this! */
  if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
    dissector_delete("tcp.port", tcp_port, tpkt_handle);

  /* Set our port number for future use */
  tcp_port = global_dop_tcp_port;

  if((tcp_port > 0) && (tcp_port != 102) && tpkt_handle)
    dissector_add("tcp.port", tcp_port, tpkt_handle);

}
/* If this dissector uses sub-dissector registration add a registration routine.
   This format is required because a script is used to find these routines and
   create the code that calls these routines.
*/
void
proto_reg_handoff_mdshdr(void)
{
    static dissector_handle_t mdshdr_handle;
    static gboolean registered_for_zero_etype = FALSE;
    static gboolean mdshdr_prefs_initialized = FALSE;

    if (!mdshdr_prefs_initialized) {
        /*
         * This is the first time this has been called (i.e.,
         * Wireshark/TShark is starting up), so create a handle for
         * the MDS Header dissector, register the dissector for
         * ethertype ETHERTYPE_FCFT, and fetch the data and Fibre
         * Channel handles.
         */
        mdshdr_handle = create_dissector_handle (dissect_mdshdr, proto_mdshdr);
        dissector_add ("ethertype", ETHERTYPE_FCFT, mdshdr_handle);
        data_handle = find_dissector ("data");
        fc_dissector_handle = find_dissector ("fc");
        mdshdr_prefs_initialized = TRUE;
    }

    /*
     * Only register the dissector for ethertype 0 if the preference
     * is set to do so.
     */
    if (decode_if_zero_etype) {
        /*
         * The preference to register for ethertype ETHERTYPE_UNK (0)
         * is set; if we're not registered for ethertype ETHERTYPE_UNK,
         * do so.
         */
        if (!registered_for_zero_etype) {
            dissector_add ("ethertype", ETHERTYPE_UNK, mdshdr_handle);
            registered_for_zero_etype = TRUE;
        }
    } else {
        /*
         * The preference to register for ethertype ETHERTYPE_UNK (0)
         * is not set; if we're registered for ethertype ETHERTYPE_UNK,
         * undo that registration.
         */
        if (registered_for_zero_etype) {
            dissector_delete ("ethertype", ETHERTYPE_UNK, mdshdr_handle);
            registered_for_zero_etype = FALSE;
        }
    }
}
Example #15
0
void proto_reg_handoff_packetbb(void) {
  static gboolean packetbb_prefs_initialized = FALSE;
  static dissector_handle_t packetbb_handle;
  static guint packetbb_udp_port;

  if (!packetbb_prefs_initialized) {
    packetbb_handle = create_dissector_handle(dissect_packetbb, proto_packetbb);
    packetbb_prefs_initialized = TRUE;
  }
  else {
    dissector_delete("udp.port", global_packetbb_port, packetbb_handle);
  }

  packetbb_udp_port = global_packetbb_port;
  dissector_add("udp.port", packetbb_udp_port, packetbb_handle);
}
/* If this dissector uses sub-dissector registration add a registration routine.
   This exact format is required because a script is used to find these routines 
   and create the code that calls these routines.
   
   This function is also called by preferences whenever "Apply" is pressed 
   (see prefs_register_protocol above) so it should accommodate being called 
   more than once.
*/
void proto_reg_handoff_cc2420(void)
{
  static dissector_handle_t cc2420_handle;
  static gboolean inited = FALSE;
 
  if (!inited) {
    cc2420_handle = create_dissector_handle(dissect_cc2420, proto_cc2420);
    dissector_add("t2sf.type", serial_type_cc2420, cc2420_handle);
    inited = TRUE;
  } else {
    dissector_delete("t2sf.type", serial_type_cc2420, cc2420_handle);
  }
  
  setChannel_cc2420();
  dissector_add("t2sf.type", global_serial_type_cc2420, cc2420_handle);
  data_handle = find_dissector("data");
}
Example #17
0
void
proto_reg_handoff_pcli(void) {
  static gboolean pcli_initialized = FALSE;
  static dissector_handle_t pcli_handle;
  static guint udp_port_pcli;

  if(!pcli_initialized) {
    pcli_handle = create_dissector_handle(dissect_pcli,proto_pcli);
    ip_handle = find_dissector("ip");
    pcli_initialized = TRUE;
  } else {
    dissector_delete("udp.port",udp_port_pcli,pcli_handle);
  }

  udp_port_pcli = global_udp_port_pcli;
  
  dissector_add("udp.port",global_udp_port_pcli,pcli_handle);
}
void
proto_reg_handoff_itdm(void)
{
	static gboolean Initialized=FALSE;
	static dissector_handle_t itdm_handle;
	static guint ItdmMPLSLabel;

	if (!Initialized) {
		itdm_handle = find_dissector("itdm");;
		data_handle = find_dissector("data");
		Initialized=TRUE;
	} else {
		dissector_delete("mpls.label", ItdmMPLSLabel, itdm_handle);
	}

	ItdmMPLSLabel = gbl_ItdmMPLSLabel;
	dissector_add("mpls.label", gbl_ItdmMPLSLabel, itdm_handle);
}
Example #19
0
void
proto_reg_handoff_tcpencap(void)
{
	static dissector_handle_t tcpencap_handle;
	static gboolean initialized = FALSE;
	static guint tcpencap_tcp_port;

	if (!initialized) {
		tcpencap_handle = new_create_dissector_handle(dissect_tcpencap, proto_tcpencap);
		esp_handle = find_dissector("esp");
		udp_handle = find_dissector("udp");
		initialized = TRUE;
	} else {
		dissector_delete("tcp.port", tcpencap_tcp_port, tcpencap_handle);
	}

	tcpencap_tcp_port = global_tcpencap_tcp_port;
	dissector_add("tcp.port", global_tcpencap_tcp_port, tcpencap_handle);
}
void
proto_reg_handoff_kismet(void)
{
	static gboolean kismet_prefs_initialized = FALSE;
	static dissector_handle_t kismet_handle;
	static guint tcp_port;

	if (!kismet_prefs_initialized) {
		kismet_handle = new_create_dissector_handle(dissect_kismet, proto_kismet);
		data_handle = find_dissector("data");
		kismet_prefs_initialized = TRUE;
	} else {
		dissector_delete("tcp.port", tcp_port, kismet_handle);
	}

	/* Set our port number for future use */
	tcp_port = global_kismet_tcp_port;

	dissector_add("tcp.port", global_kismet_tcp_port, kismet_handle);
}
/* If this dissector uses sub-dissector registration add a registration routine.
   This exact format is required because a script is used to find these routines 
   and create the code that calls these routines.
   
   This function is also called by preferences whenever "Apply" is pressed 
   (see prefs_register_protocol above) so it should accommodate being called 
   more than once.
*/
void proto_reg_handoff_t2sf(void)
{
  static dissector_handle_t t2sf_handle;
  static dissector_handle_t t2sf_tcp_handle;
  static gboolean inited = FALSE;
        
  if (!inited) {
    t2sf_handle = create_dissector_handle(dissect_t2sf, proto_t2sf);
    t2sf_tcp_handle = create_dissector_handle(dissect_t2sf_tcp, proto_t2sf);
    /* for dissection based upon tcp */
    dissector_add("tcp.port", tcp_port_t2sf, t2sf_tcp_handle);
    inited = TRUE;
  } else {
    dissector_delete("tcp.port", tcp_port_t2sf, t2sf_tcp_handle);
  }

  tcp_port_t2sf = global_tcp_port_t2sf;
  
  dissector_add("tcp.port", tcp_port_t2sf, t2sf_tcp_handle);
  data_handle = find_dissector("data");
}
void proto_reg_handoff_netdump(void)
{
	static gboolean initalized = FALSE;
	static dissector_handle_t netdump_handle;
	static int CurrentPort;

	if (!initalized) {
		netdump_handle = create_dissector_handle(dissect_netdump,
				proto_netdump);

		dissector_add_handle("udp.port", netdump_handle); /* For Decode As */
		initalized = TRUE;
	} else {
		if (CurrentPort != 0)
			dissector_delete("udp.port", CurrentPort, netdump_handle);
	}

	CurrentPort = gPORT_PREF;

	if (CurrentPort != 0)
		dissector_add("udp.port", CurrentPort, netdump_handle);
}
Example #23
0
void proto_reg_handoff_eth_esp(void)
{
	static gboolean inited = FALSE;
	static unsigned int old_eth_esp_ethertype;

	if (!inited) {
		eth_esp_handle = create_dissector_handle(dissect_eth_esp, proto_eth_esp_plugin);

		data_handle = find_dissector("data");

		eth_esp_tap = register_tap("eth_esp");
		eth_esp_follow_tap = register_tap("eth_esp_follow");

		register_heur_dissector_list("eth_esp", &heur_subdissector_list);

		inited = TRUE;
	} else {
		dissector_delete("ethertype", old_eth_esp_ethertype, eth_esp_handle);
	}

	old_eth_esp_ethertype = eth_esp_ethertype;
	dissector_add("ethertype", eth_esp_ethertype, eth_esp_handle);
}
/* The registration hand-off routine */
void proto_reg_handoff_actrace(void)
{
	static gboolean actrace_prefs_initialized = FALSE;
	static dissector_handle_t actrace_handle;
	static guint actrace_udp_port;

	if (!actrace_prefs_initialized)
	{
		actrace_handle = new_create_dissector_handle(dissect_actrace, proto_actrace);
		/* Get a handle for the lapd dissector. */
		lapd_handle = find_dissector("lapd");
		actrace_prefs_initialized = TRUE;
	}
	else
	{
		dissector_delete("udp.port", actrace_udp_port, actrace_handle);
	}

	/* Set our port number for future use */
	actrace_udp_port = global_actrace_udp_port;

	dissector_add("udp.port", global_actrace_udp_port, actrace_handle);
}
static void range_delete_callback(guint32 ssn)
{
    if ( ssn ) {
        dissector_delete("sccp.ssn", ssn, pcap_handle);
    }
}
static void range_delete_callback(guint32 ssn)
{
    if ( ssn && !get_ansi_tcap_subdissector(ssn) && !get_itu_tcap_subdissector(ssn) ) {
        dissector_delete("sccp.ssn", ssn, tcap_handle);
    }
}
extern void delete_itu_tcap_subdissector(guint32 ssn, dissector_handle_t dissector _U_) {
    g_hash_table_remove(itu_sub_dissectors,GUINT_TO_POINTER(ssn));
    if (!get_ansi_tcap_subdissector(ssn))
      dissector_delete("sccp.ssn", ssn,tcap_handle);
}