pub trait ExtcapApplication {
    // Required methods
    fn metadata(&self) -> &Metadata;
    fn interfaces(&self) -> &[Interface];
    fn toolbar_controls(&self) -> Vec<&dyn ToolbarControl>;
    fn configs(&self, interface: &Interface) -> Vec<&dyn ConfigTrait>;

    // Provided methods
    fn list_interfaces(&self) { ... }
    fn list_configs(&self, interface: &str) -> Result<(), ListConfigError> { ... }
    fn reload_config(
        &self,
        interface: &str,
        config: &str
    ) -> Result<(), ReloadConfigError> { ... }
    fn print_dlt(&self, interface: &str) -> Result<(), PrintDltError> { ... }
}
Expand description

The main entry point to implementing an extcap program. This application can be run by passing it into ExtcapArgs::run.

Required Methods§

source

fn metadata(&self) -> &Metadata

Returns the metadata like version info and help URL for this program. This is used by Wireshark to display in the UI.

The cargo_metadata macro can be used to create this from data in Cargo.toml.

source

fn interfaces(&self) -> &[Interface]

List the interfaces supported by this application. Wireshark calls this when the application starts up to populate the list of available interfaces. Since that interface list is cached and the interface names can be used later when the user tries to start a capture session, the interface list should stay as consistent as possible. If the list of interfaces can change, the extcap program must be prepared to handle UnknownInterface from the result.

source

fn toolbar_controls(&self) -> Vec<&dyn ToolbarControl>

List the toolbar controls for this interface. In Wireshark, this is presented to the user in View > Interface Toolbars. See the documentation in controls for details.

source

fn configs(&self, interface: &Interface) -> Vec<&dyn ConfigTrait>

List the configurable UI elements for this interface. This is presented to the user when they click on the gear icon next to the capture interface name, or if they try to start a capture that is lacking a required config value.

Provided Methods§

source

fn list_interfaces(&self)

List the interfaces and toolbar controls supported by this extcap implementation in stdout for Wireshark’s consumption. Corresponds to the --extcap-interfaces argument in extcap.

source

fn list_configs(&self, interface: &str) -> Result<(), ListConfigError>

List the configs available for the given interface in stdout for Wireshark’s consumption. Corresponds to the --extcap-config argument in extcap.

source

fn reload_config( &self, interface: &str, config: &str ) -> Result<(), ReloadConfigError>

Reloads the available options for a given config and prints them out for Wireshark’s consumption. The default implementation looks up config returned from configs and calls its reload function. Corresponds to the --extcap-reload-option argument in extcap.

source

fn print_dlt(&self, interface: &str) -> Result<(), PrintDltError>

Prints the DLT to stdout for consumption by Wireshark. The default implementation provided takes the DLT from the interfaces returned from interfaces and prints out the correct one. Corresponds to the --extcap-dlts argument in extcap.

Implementors§