static void test_filterdesc_enable_disable_base(const char* mime, const char* filtername,bool_t is_enc) { MSFilter *filter; ms_init(); if (is_enc) filter = ms_filter_create_encoder(mime); else filter = ms_filter_create_decoder(mime); BC_ASSERT_PTR_NOT_NULL(filter); ms_filter_destroy(filter); BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(ms_factory_get_fallback(),filtername,FALSE)); BC_ASSERT_FALSE(ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),filtername)); if (is_enc) filter = ms_filter_create_encoder(mime); else filter = ms_filter_create_decoder(mime); BC_ASSERT_PTR_NULL(filter); BC_ASSERT_FALSE(ms_factory_enable_filter_from_name(ms_factory_get_fallback(),filtername,TRUE)); BC_ASSERT_TRUE(ms_factory_filter_from_name_enabled(ms_factory_get_fallback(),filtername)); if (is_enc) filter = ms_filter_create_encoder(mime); else filter = ms_filter_create_decoder(mime); BC_ASSERT_PTR_NOT_NULL(filter); ms_filter_destroy(filter); ms_exit(); }
myAudioStream::~myAudioStream() { stop_ticker(); unlink_filters(); /* Destroy RTP session */ ms_message("Destroying RTP session"); rtp_session_destroy(stream->session); ortp_exit(); ms_exit(); }
static void filter_register_tester(void) { MSFilter* filter; ms_init(); ms_init(); CU_ASSERT_PTR_NOT_NULL(ms_filter_lookup_by_name("MSVoidSource")); filter= ms_filter_create_decoder("pcma"); CU_ASSERT_PTR_NOT_NULL(filter); ms_filter_destroy(filter); ms_exit(); CU_ASSERT_PTR_NOT_NULL(ms_filter_lookup_by_name("MSVoidSource")); filter= ms_filter_create_decoder("pcma"); CU_ASSERT_PTR_NOT_NULL(filter); ms_filter_destroy(filter); ms_exit(); CU_ASSERT_PTR_NULL(ms_factory_get_fallback()); }
/*************************************************************************************************** 功能说明:客户端网络线程函数 参数说明: 输入参数: 输出参数:无 返回:无 ***************************************************************************************************/ void c_run_net() { Message *ms = NULL; while(1) while(is_run_net) { ms =ms_init(NULL, NULL, NULL); if(ms_recv_message(g_c_client_socket_fd, ms) == -1) { memset(ms->data, 0, 1024); ms = ms_init("000000", "999999", "cmd_exit"); c_analyse_message(ms); is_run_net = 0; ms_exit(ms); c_client_socket_exit(); } c_analyse_message(ms); ms_exit(ms); } }
void AddFriendReply::on_pushButtonDisagree_clicked() { char req_info[256]; Message *ms = ms_init( (char *)"999999", umw->userinfo->userno, NULL); memset(req_info, 0, 256); sprintf(req_info, "add_disagree+%s", a_userno); memcpy(ms->data+2*USERNO_LEN, req_info, strlen(req_info)); ms_send_message(socket_fd, ms); ms_exit(ms); this->close(); }
/*************************************************************************************************** 功能说明:客户端收到消息后,检查该消息是不是服务器发来的结束消息,如果是,结束程序运行并给出提示信息 参数说明: 输入参数:收到的消息 输出参数:无 返回:无 ***************************************************************************************************/ void c_is_ms_exit(Message *ms) { if(ms == NULL) return; if(ms->data[0] == 0) { ms_exit(ms); printf("\n\tError : Sorry about this.\nThe Server has some exceptions, and disconnection to the client!\nPlease restart the client,and try agian!\n"); is_run_net = 0; is_run_local = 0; //client exit c_client_socket_exit(); } }
int ms_send_message_to_server(int socket_fd, char *ms) { if(socket_fd > 0 && ms != NULL) { Message *ms_s; ms_s = ms_init((char *)"999999", (char *)"000000", ms); ms_send_message(socket_fd, ms_s); ms_exit(ms_s); return 1; } return 0; }
static void clear_mediastreams(MediastreamDatas *args) { MSConnectionHelper h; ms_message("stopping all...\n"); if (args->read) { ms_ticker_detach(args->ticker, args->read); ms_connection_helper_start(&h); ms_connection_helper_unlink(&h, args->read, -1, 0); ms_connection_helper_unlink(&h, args->decoder, 0, 0); ms_connection_helper_unlink(&h, args->write, 0, -1); } rtp_profile_destroy(args->profile); ms_exit(); }
/*************************************************************************************************** 功能说明:客户端发送消息到服务器,dest为“999999”,src位“000000” 参数说明: 输入参数:发送的消息 输出参数:无 返回:无 ***************************************************************************************************/ int c_send_message_to_server(char *ms) { if(g_c_client_socket_fd > 0 || ms == NULL) { Message *ms_s; if(user && user->userno) ms_s = ms_init("999999", user->userno, ms); else ms_s = ms_init("999999", "000000", ms); ms_send_message(g_c_client_socket_fd, ms_s); ms_exit(ms_s); return 1; } return 0; }
void AddFriendReply::on_pushButtonAgree_clicked() { char req_info[256]; memset(req_info, 0, 256); QByteArray ba_nickname = ui->lineEdit->text().toLocal8Bit(); char *aa_nickname = ba_nickname.data(); strcpy(req_info, "add_agree+"); strcpy(req_info+10, a_userno); req_info[10+6] = '+'; memcpy(req_info+17, b_nickname, 64); req_info[17+64] = '+'; strcpy(req_info+17+65, aa_nickname); Message *req_ms = ms_init((char *)"999999", umw->userinfo->userno, NULL); memcpy(req_ms->data+2*USERNO_LEN, req_info, 256); ms_send_message(socket_fd, req_ms); ms_exit(req_ms); QString *str_tmp = new QString(); *str_tmp = QString(aa_nickname) + "(" + QString(a_userno) + ")"; QTreeWidgetItem *child = new QTreeWidgetItem(QStringList(*str_tmp)); umw->itemA->addChild(child); Friend *friend_tmp = (Friend*)malloc(sizeof(Friend)); memcpy(friend_tmp->userno, a_userno, 7); memset(friend_tmp->nickname, 0, 57); strcpy(friend_tmp->nickname, aa_nickname); friendlist_add(umw->fls, friend_tmp); this->close(); }
static int tester_after_all(void) { ortp_exit(); ms_exit(); rtp_profile_clear_all(&rtp_profile); return 0; }
static int sound_card_tester_after_all(void) { ms_exit(); return 0; }
int main(int argc, char *argv[]) { MSFilter *src, *gen, *det, *rec; MSTicker *ticker; ms_init(); ortp_set_log_level_mask (ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); src=ms_filter_new(MS_FILE_PLAYER_ID); rec=ms_filter_new(MS_FILE_REC_ID); gen=ms_filter_new(MS_DTMF_GEN_ID); det=ms_filter_new(MS_TONE_DETECTOR_ID); ms_filter_link(src,0,gen,0); ms_filter_link(gen,0,det,0); //ms_filter_link(gen,0,rec,0); ms_filter_link(det,0,rec,0); ticker=ms_ticker_new(); ms_ticker_attach(ticker,src); ms_filter_call_method(rec,MS_FILE_REC_OPEN,"/tmp/output.wav"); ms_filter_call_method_noarg(rec,MS_FILE_REC_START); { /*generate and detect the tones*/ MSDtmfGenCustomTone tone; MSToneDetectorDef expected_tone; char dtmf='*'; tone.frequency=2000; tone.duration=400; tone.amplitude=0.6; expected_tone.frequency=2000; expected_tone.min_duration=200; expected_tone.min_amplitude=0.5; ms_filter_set_notify_callback(det,(MSFilterNotifyFunc)tone_detected_cb,NULL); ms_filter_set_notify_callback(gen,(MSFilterNotifyFunc)tone_sent_cb,NULL); ms_filter_call_method(det,MS_TONE_DETECTOR_ADD_SCAN,&expected_tone); ms_filter_call_method(gen,MS_DTMF_GEN_PLAY,&dtmf); ms_sleep(1); ms_filter_call_method(gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_sleep(1); ms_filter_call_method(gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_sleep(1); ms_filter_call_method(gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_sleep(1); tone.frequency=1500; tone.amplitude=1.0; ms_filter_call_method(gen,MS_DTMF_GEN_PLAY_CUSTOM,&tone); ms_sleep(1); } ms_filter_call_method_noarg(rec,MS_FILE_REC_CLOSE); ms_ticker_detach(ticker,src); ms_filter_unlink(src,0,gen,0); ms_filter_unlink(gen,0,det,0); //ms_filter_unlink(gen,0,rec,0); ms_filter_unlink(det,0,rec,0); ms_ticker_destroy(ticker); ms_filter_destroy(src); ms_filter_destroy(gen); ms_filter_destroy(det); ms_filter_destroy(rec); ms_exit(); return 0; }
static int tester_cleanup(void) { ms_exit(); rtp_profile_clear_all(&rtp_profile); return 0; }
static int tester_cleanup() { ms_exit(); return 0; }
/*************************************************************************************************** 功能说明:客户端处理申请账号模块,与服务器端协调工作 参数说明: 1.client send apply 2.server send reapply 3.client send start 4.server produce a userno, then send to client 5.client produce Userinfo, then send to server 6.server save Userinfo to file then apply over 输入参数: 输出参数:无 返回:无 ***************************************************************************************************/ int c_apply_id() { Message *ms = NULL; char *src = NULL, *dest = NULL, *info = NULL; char userno[7] = {0}; char username[50]; char name[50]; char passwd[50]; char passwd_bak[50]; char sex[20]; char emaile[50]; Userinfo *user = NULL; int flag = 1; printf("in applyId()\n"); //statge 3 c_send_message_to_server("start"); printf("wait server answer..."); //statge 4 ms = ms_init(src, dest, info); ms_recv_message(g_c_client_socket_fd, ms); c_is_ms_exit(ms); strcpy(userno, ms_get_info(ms)); ms_exit(ms); if( !userinfo_checkUserno(userno) ) printf("\n\t apply id wrong!Try again!\n userno : %s\n\n", userno); printf("\n\tYou userno is : %s\nplease Fill the Infomation\n", userno); //statge 5 printf("\ninput username:"******"%s", username); do { memset(passwd, 0, 50); memset(passwd_bak, 0, 50); printf("\ninput password:"******"%s", passwd); printf("\ninput password again:"); scanf("%s", passwd_bak); if(!strcmp(passwd, passwd_bak)) { if(userinfo_checkPasswd(passwd)) { flag = 0; break; }else{ printf("\npassword length %d - %d! Input again\n", PASSWD_MIN_LEN, PASSWD_MAX_LEN); continue; } } printf("\nThe two password input didnot same!Input again!\n"); }while(flag); do{ memset(sex, 0, 20); printf("\ninput sex(male or female):"); scanf("%s", sex); }while( !userinfo_checkSex(sex) ); do{ printf("\ninput emaile:"); scanf("%s", emaile); }while( !userinfo_checkEmaile(emaile) ); printf("\ninput you name:"); scanf("%s", name); user = userinfo_init(); userinfo_ioctl(user, SET_USERNO, (void*)userno); userinfo_ioctl(user, SET_USERNAME, (void*)username); userinfo_ioctl(user, SET_PASSWD, (void*)passwd); userinfo_ioctl(user, SET_NAME, (void*)name); userinfo_ioctl(user, SET_SEX, (void*)sex); userinfo_ioctl(user, SET_EMAILE, (void*)emaile); ms = ms_init("999999", "000000", NULL); memcpy(ms->data+2*USERNO_LEN, user, sizeof(Userinfo)); ms_send_message(g_c_client_socket_fd, ms); printf("\nuser apply success!\n \tuserno:%s \n\tpasswd:%s \n\tusername : %s\n\tsex:%s\n\tname:%s\n\temaile:%s\n\n", user->userno, user->passwd, user->username, user->sex, user->name, user->emaile); printf("\nyou can use the accounts to login.or for other command!\n"); ms_exit(ms); return 1; }
/*************************************************************************************************** 功能说明:客户端修改个人信息模块 参数说明: 输入参数: 输出参数:无 返回:无 ***************************************************************************************************/ void c_modify_userinfo() { char *buffer; char choice = '0'; Message *ms = NULL; Userinfo *uf = userinfo_init(); //statge 3 recv userinfo from server ms = ms_init(NULL, NULL, NULL); ms_recv_message(g_c_client_socket_fd, ms); c_is_ms_exit(ms); memcpy(uf, ms_get_info(ms), sizeof(Userinfo)); printf("\tuserno : %s\n", uf->userno); //modify passwd do{ getchar(); printf("passwd : %s\tmodify?Y/n", uf->passwd); scanf("%c", &choice); if(choice == 'Y' || choice == 'y') { char passwd[50]; char passwd_bak[50]; memset(passwd, 0, 50); memset(passwd_bak, 0, 50); printf("\tnew passwd:"); scanf("%s", passwd); printf("\tnew passwd again:"); scanf("%s", passwd_bak); if(!userinfo_checkPasswd(passwd) || strcmp(passwd, passwd_bak) ) choice = '0'; else{ strcpy(uf->passwd, passwd); } } }while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n'); //modify username do{ getchar(); printf("username : %s\tmodify?Y/n", uf->username); scanf("%c", &choice); if(choice == 'Y' || choice == 'y') { char username[50]; printf("\tnew username:"******"%s", username); strcpy(uf->username, username); } }while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n'); //name do{ getchar(); printf("name : %s\tmodify?Y/n", uf->name); scanf("%c", &choice); if(choice == 'Y' || choice == 'y') { char name[60]; printf("\tnew name:"); scanf("%s", name); strcpy(uf->name, name); } }while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n'); //modify sex do{ getchar(); printf("sex : %s\tmodify?Y/n", uf->sex); scanf("%c", &choice); if(choice == 'Y' || choice == 'y') { char sex[20]; printf("\tnew sex(male or female):"); scanf("%s", sex); if(!userinfo_checkSex(sex)) { choice = '0'; memset(sex, 0, 20); } else{ strcpy(uf->sex, sex); } } }while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n'); //modify emaile do{ getchar(); printf("emaile : %s\tmodify?Y/n", uf->emaile); scanf("%c", &choice); if(choice == 'Y' || choice == 'y') { char emaile[50]; printf("\tnew emaile:"); scanf("%s", emaile); if(!userinfo_checkEmaile(emaile)) { choice = '0'; memset(emaile, 0, 50); } else{ strcpy(uf->emaile, emaile); } } }while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n'); //commit do{ getchar(); printf("\tcommit?Y/n"); scanf("%c", &choice); ms = ms_init("999999", "000000", NULL); if(choice == 'y' || choice == 'Y') { memcpy(ms->data + 2*USERNO_LEN, (char *)uf, sizeof(Userinfo) ); }else if(choice == 'n' || choice == 'N'){ memcpy(ms->data + 2*USERNO_LEN, (char *)user, sizeof(Userinfo) ); } }while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n'); printf("send userinfo:ms :%s", ms->data); ms_send_message(g_c_client_socket_fd, ms); ms_exit(ms); }
/*************************************************************************************************** 功能说明:客户端登陆模块 参数说明: 输入参数: 输出参数:无 返回:无 ***************************************************************************************************/ int c_login() { int flag = 1, i = 0; char src[20] = {0}; char dest[] = {"999999"}; char info[80] = {0}; Message *ms ; int friend_num = 0; Friend *friend_tmp = NULL; printf("c_login in\n"); do{ memset(src, 0, 20); memset(info, 0, 80); printf("login\n\tuserno:"); scanf("%s", src); printf("\tpasswd:"); scanf("%s", info); for(i = 0; i < strlen(info); i++) printf("\b%c", '*'); for(i = 0; i < 6; i++) if(src[i] <'0' || src[i] >'9') break; if(i != 6) { printf("\nuserno not format!please check and input again!\n"); continue; } for(i = 0; i< 30; i++) if(info[i] == '\0') break; if( i == 0 || i == 30) { printf("\npassword not format!\n"); continue; } flag = 0; }while(flag); ms = ms_init(dest, src, info); ms_send_message(g_c_client_socket_fd, ms); printf("ms->data : %s\n", ms->data); ms_exit(ms); ms = ms_init(NULL, NULL, NULL); ms_recv_message(g_c_client_socket_fd, ms); c_is_ms_exit(ms); if( strncmp(ms_get_info(ms), "login_success", strlen("login_success")) == 0 ) { loginFlag = 1; printf("\nlogin success\n"); /*接受userinfo 信息*/ ms_exit(ms); ms = ms_init(NULL, NULL, NULL); ms_recv_message(g_c_client_socket_fd, ms); c_is_ms_exit(ms); user = userinfo_init(); memcpy(user, ms->data + 2*USERNO_LEN, sizeof(Userinfo)); userStatus = 1; ms_exit(ms); loginFlag = 1; //recv friendlist printf("recv friendlist\n"); fls = friendlist_init(); do{ ms = ms_init(NULL, NULL, NULL); ms_recv_message(g_c_client_socket_fd, ms); c_is_ms_exit(ms); friend_num = ms->data[1] - 1; printf("recv one times recvsize %d \n", friend_num); if(friend_num ) { for(i = 0; i < friend_num; i++); { friend_tmp = (Friend*)malloc(sizeof(Friend)); memcpy(friend_tmp, ms->data + 2 *USERNO_LEN + i * sizeof(Friend), sizeof(Friend)); friendlist_add(fls, friend_tmp); } }else{ printf("no friend list\n"); ms_exit(ms); break; } }while(friend_num == ( 1014 / sizeof(Friend) + 1)); printf("recv friendlist over\n"); return 1; } loginFlag = -1; printf("\nlogin failed!\n\t%s\ntry again\n", ms_get_info(ms)); ms_exit(ms); printf("c_login out\n"); return 1; }
/*************************************************************************************************** 功能说明:客户端分析消息(来自网络) 参数说明: 输入参数:消息的地址 输出参数:无 返回:无 ***************************************************************************************************/ int c_analyse_message(Message *ms) { char dest[7] = {0}; char src[7] = {0}; char *info; c_is_ms_exit(ms); memcpy(dest, ms->data, 6); dest[6] = 0; memcpy(src, ms->data + USERNO_LEN, 6); src[6] = 0; info = ms_get_info(ms); c_is_ms_exit(ms); if( strncmp(src, "999999", 6) == 0) { if( strncmp(info, "re-login", strlen("re-login")) == 0 ) { c_login(); is_run_local = 1; } if( strcmp(info, "re-apply") == 0 ) { //apply id stage 2 c_apply_id(); is_run_local = 1; } if( !strcmp(info, "re-modify") ) { c_modify_userinfo(); is_run_local = 1; } if( !strncmp(info, "add+", 4)) { //接收到添加好友请求 char a_userno[7]; char b_nickname[64]; char a_nickname[64]; char choice = '0'; char req_info[256]; Message *req_ms = NULL; is_run_local = 0; memcpy(a_userno, info + 4, 6); a_userno[6] = 0; memset(b_nickname, 0, 64); memcpy(b_nickname, info + 11, 64); req_ms = ms_init("999999", user->userno, NULL); do{ printf("accept one friend(%s) requeset.\tagree(Y)/disagree(n)?", a_userno); fflush(stdout); scanf("%c", &choice); if(choice == 'Y' || choice == 'y') { memset(a_nickname, 0, 64); memset(req_info, 0, 256); printf("input the nickname you want to set:\n"); scanf("%s", a_nickname); strcpy(req_info, "add_agree+"); strcpy(req_info+10, a_userno); req_info[10+6] = '+'; memcpy(req_info+17, b_nickname, 64); req_info[17+64] = '+'; memcpy(req_info+17+65, a_nickname, 64); printf("\nreq_info : %s\n", req_info); memcpy(req_ms->data+2*USERNO_LEN, req_info, 256); } if( choice == 'n' || choice == 'N') { memset(req_info, 0, 256); sprintf(req_info, "add_disagree+%s", a_userno); memcpy(req_ms->data+2*USERNO_LEN, req_info, strlen(req_info)); } }while(choice != 'Y' && choice != 'y' && choice != 'N' && choice != 'n'); ms_send_message(g_c_client_socket_fd, req_ms); ms_exit(req_ms); is_run_local = 1; } if( !strncmp(info, "add_", 4)) { //添加好友结果 //1.add_agree is_run_local = 0; if( !strncmp(info, "add_agree", 7) ) { char a_userno[7]; char a_nickname[64]; char b_nickname[64]; Friend *fr = NULL; memset(a_nickname, 0, 64); memset(b_nickname, 0, 64); sscanf(info, "add_agree+%s+%s+%s", a_userno, b_nickname, a_nickname); memcpy(a_userno, info+strlen("add_agree+"), 6); a_userno[6] = 0; memcpy(b_nickname, info+strlen("add_agree+") + 7, 64); fr = (Friend *)malloc(sizeof(Friend)); memset(fr, 0, sizeof(Friend)); memcpy(fr->userno, a_userno, 6); memcpy(fr->nickname, b_nickname, 64); if(fls) fls = friendlist_init(); friendlist_add(fls, fr); printf("\nWARNING:\n\t%s is agree your friend-request!\n\n", a_userno); } //2.add_disagree if( !strncmp(info, "add_disagree", 7) ) { char a_userno[7]; memset(a_userno, 0, 7); sscanf(info, "add_disagree+%s", a_userno); printf("\nWARNING:\n\t%s is not agree your friend-request!\n\n", a_userno); } //3.add_error if( !strncmp(info, "add_error", 7) ) { char a_userno[7]; memset(a_userno, 0, 7); sscanf(info, "add_errore+%s", a_userno); printf("\nWARNING:\n\tfriend-request %s error!\n\t%s\n\n", a_userno, info+strlen("add_error+000000")); } is_run_local = 1; } if( !strncmp(info, "Your account in another place was second loginning, you are forced to logout!", 10) ) { printf("\n\nWARNING:\n\t%s", info); printf("\n\nplease restart the program, then re-login!\n\n"); is_run_net = 0; is_run_local = 0; //client exit c_client_socket_exit(); } printf("\nreceve message from server\n\t%s\n", info); return 0; } printf("\nreceve one message\n\tsrc:%s\n\tmessage:%s\n", src, info); return 0; }
int MainWindow::login() { socket_fd = socket_init(ip, port); if(!socket_fd) { return -1; } ms_send_message_to_server(socket_fd, (char *)"login"); Message *ms = ms_init(NULL, NULL, NULL); ms_recv_message(socket_fd, ms); if( ms_is_ms_exit(ms) ) { char *buf = new char[256]; memset(buf, 0, 256); sprintf(buf, "\tSorry about this.\nThe Server has some exceptions, and disconnection to the client!\nPlease restart the client,and try agian!"); QMessageBox::information(NULL, "ERROR", "Server has some expection!"); delete buf; ms_exit(ms); return -1; } if( strcmp(ms_get_info(ms), (char *)"re-login") ) { //server not reply "re-login" QMessageBox::information(NULL, "ERROR", "Server has some expection!"); socket_close(socket_fd); socket_fd = 0; ms_exit(ms); return -1; } ms_exit(ms); bytea_userno = ui->lineEditUserno->text().toLocal8Bit(); char *userno_p = bytea_userno.data(); bytea_passwd = ui->lineEditPasswd->text().toLocal8Bit(); char *passwd_p = bytea_passwd.data(); ms = ms_init((char *)"999999", userno_p, passwd_p); ms_send_message(socket_fd, ms); ms_exit(ms); ms = ms_init(NULL, NULL, NULL); ms_recv_message(socket_fd, ms); if( ms_is_ms_exit(ms) ) { char *buf = new char[256]; memset(buf, 0, 256); sprintf(buf, "\tSorry about this.\nThe Server has some exceptions, and disconnection to the client!\nPlease restart the client,and try agian!"); QMessageBox::information(NULL, "ERROR", "Server has some expection!"); delete buf; ms_exit(ms); return -1; } if( strncmp(ms_get_info(ms), "login_success", strlen("login_success")) == 0 ) { return 1; }else{ return -2; } }
static int basic_audio_tester_after_all(void) { ms_exit(); return 0; }
/*************************************************************************************************** 功能说明:客户端本地线程函数 参数说明: 输入参数: 输出参数:无 返回:无 ***************************************************************************************************/ void c_run_local() { char info[1024]; char src[20] = "000000"; char dest[20] = "999999"; char choice; Message *ms ; while(1) while(is_run_local) { getchar(); memset(src, 0, 20); memset(dest, 0, 6); memset(info, 0, 1024); if(loginFlag == -1) { printf("input command:\n"); scanf("%s", info); strncpy(dest, "000000", 6); }else if(loginFlag == 1) { do { getchar(); printf("\tinput choice:\n\t1.command;\n\t2.talk with friend\n\t3.add friend by userno\n\t4.modify userno infomatin\n"); scanf("%c", &choice); switch(choice) { case '1': printf("input Command:"); scanf("%s",info); strncpy(dest, "000000", 6); break; case '2': printf("input friend number:"); scanf("%s", dest); printf("input info:"); scanf("%s", info); break; case '3': //add friend strncpy(dest, "999999", 6); strcpy(info, "add"); break; case '4': //modify user infomation strncpy(dest, "999999", 6); strcpy(info, "modify"); break; default: printf("Error: cannot regconise command!"); } }while(choice < '1' || choice > '4'); } if(loginFlag == 1) strcpy(src, user->userno); else strcpy(src, "000000"); ms = ms_init(dest, src, info); c_analyse_cmd(ms); ms_exit(ms); printf("\npress ENTER key to continue...\n"); getchar(); } }
static int sound_card_tester_cleanup(void) { ms_exit(); return 0; }
static int basic_audio_tester_cleanup(void) { ms_exit(); return 0; }