int mainprogram (int argc, char *argv[]) { char *outwavhdrfilename,*outwavdatfilename; int len; int result=0; if (parseArgs(argc,argv)!=0) { printusage(); return 0; } len = strlen(wavtool_args.outputfilename)+4+1; outwavhdrfilename = (char *)malloc(len*sizeof(char)); memset(outwavhdrfilename,0,len*sizeof(char)); outwavdatfilename = (char *)malloc(len*sizeof(char)); memset(outwavdatfilename,0,len*sizeof(char)); _snprintf(outwavhdrfilename,len,"%s.whd",wavtool_args.outputfilename); _snprintf(outwavdatfilename,len,"%s.dat",wavtool_args.outputfilename); if (!isFileExist(outwavhdrfilename)) { wfh_init(outwavhdrfilename); } if (!isFileExist(outwavdatfilename)) { wfd_init(outwavdatfilename); } len = wfd_append(outwavdatfilename,wavtool_args.inputfilename,wavtool_args.offset,wavtool_args.length,wavtool_args.ovr,wavtool_args.p,wavtool_args.v); result = wfh_putlength(outwavhdrfilename,len); return 0; }
/** * wpas_wfd_init - Initialize WFD module for %wpa_supplicant * @global: Pointer to global data from wpa_supplicant_init() * @wpa_s: Pointer to wpa_supplicant data from wpa_supplicant_add_iface() * Returns: 0 on success, -1 on failure */ int wpas_wfd_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) { struct wfd_config wfd; if (global->wfd) return 0; os_memset(&wfd, 0, sizeof(wfd)); wfd.enabled = DEFAULT_WFD_ENABLED; wfd.device_type = DEFAULT_DEVICE_TYPE; wfd.coupled_sink_supported_by_source = WFD_DEFAULT_COUPLED_SINK_SUPPORTED_BY_SOURCE; wfd.coupled_sink_supported_by_sink = WFD_DEFAULT_COUPLED_SINK_SUPPORTED_BY_SINK; wfd.available_for_session = WFD_DEFAULT_AVAILABLE_FOR_SESSION; wfd.service_discovery_supported = WFD_DEFAULT_SERVICE_DISCOVERY_SUPPORTED; wfd.preferred_connectivity = WFD_DEFAULT_PREFERRED_CONNECTIVITY; wfd.content_protection_supported = WFD_DEFAULT_CONTENT_PROTECTION_SUPPORTED; wfd.time_sync_supported = WFD_DEFAULT_TIME_SYNC_SUPPORTED; wfd.session_mgmt_ctrl_port = WFD_DEFAULT_SESSION_MGMT_CTRL_PORT; wfd.device_max_throughput = WFD_DEFAULT_MAX_THROUGHPUT; wfd.primarysink_audio_notsupported = WFD_DEFAULT_PRIMARYSINK_AUDIO_NOTSUPPORTED; wfd.source_audio_only_supported = WFD_DEFAULT_SOURCE_AUDIO_ONLY_SUPPORTED; wfd.tdls_persistent_group_intended = WFD_DEFAULT_TDLS_PERSISTENT_GROUP_INTENTED; wfd.tdls_persistent_group_reinvoke = WFD_DEFAULT_TDLS_PERSISTENT_GROUP_REINVOKE; if (wpas_wfd_parse_config(wpa_s->conf, &wfd)) return -1; global->wfd = wfd_init(&wfd); if (global->wfd == NULL) return -1; p2p_set_wfd_data(global->p2p, global->wfd); return 0; }