void plugin_system_init(void) { assert (g_module_supported ()); char *dir; int dirsel = 0; mlpgui_init (& api_table); plugin_registry_load (); #ifndef DISABLE_USER_PLUGIN_DIR scan_plugins (get_path (AUD_PATH_USER_PLUGIN_DIR)); /* * This is in a separate loop so if the user puts them in the * wrong dir we'll still get them in the right order (home dir * first) - Zinx */ while (plugin_dir_list[dirsel]) { dir = g_build_filename (get_path (AUD_PATH_USER_PLUGIN_DIR), plugin_dir_list[dirsel ++], NULL); scan_plugins(dir); g_free(dir); } dirsel = 0; #endif while (plugin_dir_list[dirsel]) { dir = g_build_filename (get_path (AUD_PATH_PLUGIN_DIR), plugin_dir_list[dirsel ++], NULL); scan_plugins(dir); g_free(dir); } plugin_registry_prune (); }
int plug_sys_detect_plugins(void) { index_map_ = (vevo_port_t**) vj_calloc(sizeof(vevo_port_t*) * 1024 ); illegal_plugins_ = vpn( VEVO_ILLEGAL ); char *lvd_path = get_livido_plug_path(); if( lvd_path != NULL ) { add_to_plugin_list( lvd_path ); free(lvd_path); } if(!scan_plugins()) { veejay_msg(VEEJAY_MSG_WARNING, "No plugins found in $HOME/.veejay/plugins.cfg" ); } veejay_msg(VEEJAY_MSG_INFO, "Looking for plugins in common locations ..."); int i; for( i = 0; plugger_paths[i].path != NULL; i ++ ) { add_to_plugin_list( plugger_paths[i].path ); } //@ the freeframe version we use is not compatible with 64 bit systems. So, lets see if long is size 4 //@ For every time there is a void* passed as int a gremlin will be happy if( sizeof(long) == 4 ) { if( n_ff_ > 0 ) { veejay_msg(VEEJAY_MSG_INFO, "FreeFrame - cross-platform real-time video effects (http://freeframe.sourceforge.net)"); veejay_msg(VEEJAY_MSG_INFO, " found %d FreeFrame %s", n_ff_ , n_ff_ == 1 ? "plugin" : "plugins" ); } } if( n_fr_ > 0 ) { veejay_msg(VEEJAY_MSG_INFO, "frei0r - a minimalistic plugin API for video effects (http://www.piksel.org/frei0r)"); veejay_msg(VEEJAY_MSG_INFO, " found %d frei0r %s", n_fr_ , n_fr_ == 1 ? "plugin" : "plugins" ); } if( n_lvd_ > 0 ) { veejay_msg(VEEJAY_MSG_INFO, "Livido - (Linux) Video Dynamic Objects" ); veejay_msg(VEEJAY_MSG_INFO, " found %d Livido %s", n_lvd_, n_lvd_ == 1 ? "plugin" :"plugins" ); } plug_print_all(); return index_; }
void plugin_system_init(void) { assert (g_module_supported ()); audgui_init (& api_table, _AUD_PLUGIN_VERSION); plugin_registry_load (); const char * path = get_path (AUD_PATH_PLUGIN_DIR); for (int i = 0; i < ARRAY_LEN (plugin_dir_list); i ++) { char * dir = filename_build (path, plugin_dir_list[i]); scan_plugins (dir); str_unref (dir); } plugin_registry_prune (); }
void fr_loadplugins(t_pdp_frei0r *x, t_symbol *plugindirsymbol) { char* plugindir = plugindirsymbol->s_name; char libname[PATH_MAX]; int i; char *pluginname; void *plugin_handle; scan_plugins(x, plugindir); x->x_plugin_count = 0; x->plugins = (PLUGIN *)getbytes(x->x_filename_count*sizeof(PLUGIN)); if (x->plugins == NULL) { panic("no memory for loading plugins\n"); } else { post( "allocated plugins : %x", x->plugins ); } for (i=0; i<x->x_filename_count; i++) { pluginname = x->x_filename_list[i]->d_name; snprintf(libname, PATH_MAX, "%s/%s", plugindir, pluginname); post( "pdp_frei0r : opening : %s", pluginname ); plugin_handle = dlopen(libname, RTLD_NOW); dlerror(); // get functions pointers *(void**) (&x->plugins[x->x_plugin_count].f0r_init) = dlsym(plugin_handle, "f0r_init"); *(void**) (&x->plugins[x->x_plugin_count].f0r_get_plugin_info) = dlsym(plugin_handle, "f0r_get_plugin_info"); *(void**) (&x->plugins[x->x_plugin_count].f0r_get_param_info) = dlsym(plugin_handle, "f0r_get_param_info"); *(void**) (&x->plugins[x->x_plugin_count].f0r_construct) = dlsym(plugin_handle, "f0r_construct"); *(void**) (&x->plugins[x->x_plugin_count].f0r_destruct) = dlsym(plugin_handle, "f0r_destruct"); *(void**) (&x->plugins[x->x_plugin_count].f0r_set_param_value) = dlsym(plugin_handle, "f0r_set_param_value"); *(void**) (&x->plugins[x->x_plugin_count].f0r_get_param_value) = dlsym(plugin_handle, "f0r_get_param_value"); *(void**) (&x->plugins[x->x_plugin_count].f0r_update) = dlsym(plugin_handle, "f0r_update"); dlerror(); // check for special function update2 *(void**) (&x->plugins[x->x_plugin_count].f0r_update2) = dlsym(plugin_handle, "f0r_update2"); if (!dlerror()) { // continue; } // init plugin (*x->plugins[x->x_plugin_count].f0r_init)(); // instantiate x->plugins[x->x_plugin_count].instance = (*x->plugins[x->x_plugin_count].f0r_construct)(x->x_width, x->x_height); // get plugin infos (*x->plugins[x->x_plugin_count].f0r_get_plugin_info)(&x->plugins[x->x_plugin_count].plugin_info); strcpy( x->plugins[x->x_plugin_count].name, x->plugins[x->x_plugin_count].plugin_info.name ); x->plugins[x->x_plugin_count].numparameters=x->plugins[x->x_plugin_count].plugin_info.num_params; x->plugins[x->x_plugin_count].plugin_type=x->plugins[x->x_plugin_count].plugin_info.plugin_type; if ( ( x->plugins[x->x_plugin_count].plugin_info.color_model != F0R_COLOR_MODEL_RGBA8888 ) && ( x->plugins[x->x_plugin_count].plugin_info.color_model != F0R_COLOR_MODEL_BGRA8888 ) && ( x->plugins[x->x_plugin_count].plugin_info.color_model != F0R_COLOR_MODEL_PACKED32 ) ) { post( "pdp_frei0r : warning : plugin : %s use unsupported color model (%d) : ignored ...", pluginname, x->plugins[x->x_plugin_count].plugin_info.color_model ); continue; } x->x_plugin_count++; } }
int main(int argc, char **argv) { char *init_progfile_dir_error; char *text; dfilter_t *df; gchar *err_msg; /* * Get credential information for later use. */ init_process_policies(); /* * Attempt to get the pathname of the directory containing the * executable file. */ init_progfile_dir_error = init_progfile_dir(argv[0], main); if (init_progfile_dir_error != NULL) { fprintf(stderr, "dftest: Can't get pathname of directory containing the dftest program: %s.\n", init_progfile_dir_error); g_free(init_progfile_dir_error); } init_report_message(failure_warning_message, failure_warning_message, open_failure_message, read_failure_message, write_failure_message); timestamp_set_type(TS_RELATIVE); timestamp_set_seconds_type(TS_SECONDS_DEFAULT); #ifdef HAVE_PLUGINS /* Register all the plugin types we have. */ epan_register_plugin_types(); /* Types known to libwireshark */ /* Scan for plugins. This does *not* call their registration routines; that's done later. */ scan_plugins(REPORT_LOAD_FAILURE); #endif wtap_init(); /* Register all dissectors; we must do this before checking for the "-g" flag, as the "-g" flag dumps a list of fields registered by the dissectors, and we must do it before we read the preferences, in case any dissectors register preferences. */ if (!epan_init(register_all_protocols, register_all_protocol_handoffs, NULL, NULL)) return 2; /* set the c-language locale to the native environment. */ setlocale(LC_ALL, ""); /* Load libwireshark settings from the current profile. */ epan_load_settings(); /* notify all registered modules that have had any of their preferences changed either from one of the preferences file or from the command line that its preferences have changed. */ prefs_apply_all(); /* Check for filter on command line */ if (argc <= 1) { fprintf(stderr, "Usage: dftest <filter>\n"); exit(1); } /* Get filter text */ text = get_args_as_string(argc, argv, 1); printf("Filter: \"%s\"\n", text); /* Compile it */ if (!dfilter_compile(text, &df, &err_msg)) { fprintf(stderr, "dftest: %s\n", err_msg); g_free(err_msg); epan_cleanup(); exit(2); } printf("\n"); if (df == NULL) printf("Filter is empty\n"); else dfilter_dump(df); dfilter_free(df); epan_cleanup(); exit(0); }
int main(int argc, char *argv[]) { GString *comp_info_str; GString *runtime_info_str; wtap *wth; int err; gchar *err_info; int i; int opt; int overall_error_status; static const struct option long_options[] = { {"help", no_argument, NULL, 'h'}, {"version", no_argument, NULL, 'v'}, {0, 0, 0, 0 } }; #ifdef HAVE_PLUGINS char *init_progfile_dir_error; #endif /* Set the C-language locale to the native environment. */ setlocale(LC_ALL, ""); /* Get the compile-time version information string */ comp_info_str = get_compiled_version_info(NULL, NULL); /* Get the run-time version information string */ runtime_info_str = get_runtime_version_info(NULL); /* Add it to the information to be reported on a crash. */ ws_add_crash_info("Captype (Wireshark) %s\n" "\n" "%s" "\n" "%s", get_ws_vcs_version_info(), comp_info_str->str, runtime_info_str->str); g_string_free(comp_info_str, TRUE); g_string_free(runtime_info_str, TRUE); #ifdef _WIN32 arg_list_utf_16to8(argc, argv); create_app_running_mutex(); #endif /* _WIN32 */ /* * Get credential information for later use. */ init_process_policies(); init_open_routines(); #ifdef HAVE_PLUGINS if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) { g_warning("captype: init_progfile_dir(): %s", init_progfile_dir_error); g_free(init_progfile_dir_error); } else { /* Register all the plugin types we have. */ wtap_register_plugin_types(); /* Types known to libwiretap */ init_report_err(failure_message,NULL,NULL,NULL); /* Scan for plugins. This does *not* call their registration routines; that's done later. Don't report failures to load plugins because most (non-wiretap) plugins *should* fail to load (because we're not linked against libwireshark and dissector plugins need libwireshark). */ scan_plugins(DONT_REPORT_LOAD_FAILURE); /* Register all libwiretap plugin modules. */ register_all_wiretap_modules(); } #endif /* Process the options */ while ((opt = getopt_long(argc, argv, "hv", long_options, NULL)) !=-1) { switch (opt) { case 'h': printf("Captype (Wireshark) %s\n" "Print the file types of capture files.\n" "See https://www.wireshark.org for more information.\n", get_ws_vcs_version_info()); print_usage(stdout); exit(0); break; case 'v': comp_info_str = get_compiled_version_info(NULL, NULL); runtime_info_str = get_runtime_version_info(NULL); show_version("Captype (Wireshark)", comp_info_str, runtime_info_str); g_string_free(comp_info_str, TRUE); g_string_free(runtime_info_str, TRUE); exit(0); break; case '?': /* Bad flag - print usage message */ print_usage(stderr); exit(1); break; } } if (argc < 2) { print_usage(stderr); return 1; } overall_error_status = 0; for (i = 1; i < argc; i++) { wth = wtap_open_offline(argv[i], WTAP_TYPE_AUTO, &err, &err_info, FALSE); if(wth) { printf("%s: %s\n", argv[i], wtap_file_type_subtype_short_string(wtap_file_type_subtype(wth))); wtap_close(wth); } else { if (err == WTAP_ERR_FILE_UNKNOWN_FORMAT) printf("%s: unknown\n", argv[i]); else { fprintf(stderr, "captype: Can't open %s: %s\n", argv[i], wtap_strerror(err)); if (err_info != NULL) { fprintf(stderr, "(%s)\n", err_info); g_free(err_info); } overall_error_status = 1; /* remember that an error has occurred */ } } } return overall_error_status; }