Exemplo n.º 1
0
static int
answer_peer(struct dns_query *query, uint8_t *buf)
{
    uint32_t        address;
    struct tm       tm;
    uint8_t        *p;
    struct dnshdr  *resp;

    get_local_time(&tm);

    address = htonl(((tm.tm_mon + 1) << 24)
                    + (tm.tm_mday << 16)
                    + (tm.tm_hour << 8)
                    + tm.tm_min);

    memcpy(buf, query->packet,
           sizeof(struct dnshdr) + query->qlen + 2 + 2);
    p = buf + sizeof(struct dnshdr) + query->qlen + 2 + 2;

    p += fill_rr_raw(p, sizeof(struct dnshdr),
                     TYPE_A, CLASS_IN,
                     (uint32_t) 0, 4,
                     (uint8_t *) &query->saddr);

    p += fill_rr_raw(p, sizeof(struct dnshdr),
                     TYPE_A, CLASS_IN,
                     (uint32_t) 0, 4,
                     (uint8_t *) &address);

    resp = (struct dnshdr *) buf;
    RESP_SET(resp, 2, RCODE_NOERROR);

    return p - buf;
}
Exemplo n.º 2
0
static void newcamd_redraw_dt(BOOL update)
{
	date_time dt;
	char stringTemp[50];
	
	UINT16 *unistr=NULL;
	UINT16 unistr_dest[50]={0};
	UINT16 uni_string[300]={0};

	get_local_time(&dt);
	memset(unistr_dest,0,sizeof(unistr_dest));
	memset(uni_string,0,sizeof(uni_string));		
	memset(stringTemp,0,sizeof(stringTemp));
	
	unistr = OSD_GetUnicodeString(RS_TIME);        
	sprintf(stringTemp," %02d:%02d",dt.hour,dt.min);
	ComAscStr2Uni(stringTemp,unistr_dest);      
	ComUniStrCopyChar(&uni_string,(UINT16 *)unistr);
	ComUniStrCat(&uni_string,unistr_dest); 

	OSD_SetTextFieldContent(&newcamd_txt_time, STRING_UNICODE,uni_string);

	if(update)
	{
		OSD_DrawObject((POBJECT_HEAD)&newcamd_txt_time,C_DRAW_SIGN_EVN_FLG |C_UPDATE_ALL);
	}
}
Exemplo n.º 3
0
/*********************************************************
* note: write log file
* @param filename[in]: log path
* @param maxsize[in]: log max size
* @param buffer[in]: log content
* @param buf_size[in]: log content size
*********************************************************/
void write_log_file(char* filename, long max_size, char* buffer, unsigned buf_size)
{
	if (filename != NULL && buffer != NULL)
	{
		// log size is biger than max_size, delete log file
		long length = get_file_size(filename);

		if (length > max_size)
		{
			unlink(filename); // 删除文件
		}

		// write buffer in log
		{
			FILE *fp;
			fp = fopen(filename, "at+");
			if (fp != NULL)
			{
				char now[32];
				memset(now, 0, sizeof(now));
				get_local_time(now);
				sprintf(now, "%s\n", now);
				fwrite(now, strlen(now)+1, 1, fp);
				fwrite(buffer, buf_size, 1, fp);

				fclose(fp);
				fp = NULL;
			}
		}
	}
}
Exemplo n.º 4
0
/**
 * @Ex: "2013-01-10T01:09:57+08:00"
 */
static int get_iso8601_time(char *output)
{
	struct timeval tv;
	struct timezone tz;
	char buff[TIMESTAMP_LENGTH] = {0};
	char timestamp[TIMESTAMP_LENGTH + 4] = {0};
	int tz_min = 0;

	if (NULL == output)
		return -1;

	get_local_time(buff);

	gettimeofday(&tv, &tz);

	tz_min = abs(tz.tz_minuteswest);
	if (0 == tz.tz_minuteswest) {
		snprintf(timestamp, sizeof(timestamp), "%sZ", buff);
	} else {
		snprintf(timestamp, sizeof(timestamp), "%s%s%02d:%02d", buff,
				(tz.tz_minuteswest < 0) ? "+" : "-",
				tz_min / 60, tz_min % 60);
	}

	memcpy(output, timestamp, TIMESTAMP_LENGTH + 4);

	return 0;
}
Exemplo n.º 5
0
void win_time_enter_key(POBJECT_HEAD pObj,UINT8 id)
{
    INT32 hoffset, moffset;
    SYSTEM_DATA* p_sys_data=sys_data_get();
    OSD_RECT rect;
    COM_POP_LIST_PARAM_T param;

    rect.uLeft=CON_L+TXTS_L_OF;
    rect.uWidth=TXTS_W;
    rect.uHeight=MENU_TIMESET_GMT_OFFESET_POPUP_H;
    param.selecttype = POP_LIST_SINGLESELECT;
    switch(id)
    {
    case MENU_TIMESET_GMT_OFFESET:
        rect.uHeight = MENU_TIMESET_GMT_OFFESET_POPUP_H;
        rect.uTop=CON_T + (CON_H + CON_GAP)*1;
        param.cur=p_sys_data->local_time.GMToffset_count;
        p_sys_data->local_time.GMToffset_count = win_com_open_sub_list(POP_LIST_MENU_TIME,&rect,&param);
        win_time_set_GMT_Offset_string(p_sys_data->local_time.GMToffset_count);
        OSD_TrackObject(pObj,C_UPDATE_ALL);

        sys_data_gmtoffset_2_hmoffset(&hoffset, &moffset);
        set_STC_offset( hoffset, moffset, 0);
        get_local_time(&win_time_local_time);
        set_time_data();
        set_time_clock();
        OSD_DrawObject((POBJECT_HEAD )&time_item_con4,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con5,C_UPDATE_ALL);

        win_time_set_time_zone_citys(TRUE);
        break;
    }
}
Exemplo n.º 6
0
void power_on_process(void)
{
	date_time dt;	//ctchen
	SYSTEM_DATA* sys_data;
	struct sf_panel_attr panel_attr;
	
	sys_data = sys_data_get();

	pan_io_control(g_pan_dev, PAN_DRIVER_GET_ATTRIBUTE, &panel_attr);

	if (panel_attr.type == SF_PANEL_TYPE_LED)
	{
		sf_panel_display_string("----", 4, TRUE);
	}
	else
	{
		sf_panel_display_string(" REBOOT ", 8, TRUE);
	}

	pan_close(g_pan_dev);

	 if(sys_data->local_time.buseGMT)
	    get_STC_time(&sys_data->sys_dt);
	else
        get_local_time(&sys_data->sys_dt);	//ctchen

    sys_data->bstandmode = 0;
	sys_data_save(1);

    sys_watchdog_reboot();    
}
Exemplo n.º 7
0
void *thread_fun(void *arg)
{
	struct sigaction act,oact;//设置信号
	act.sa_handler = sig_alrm;//
	act.sa_flags = 0;
	sigemptyset(&act.sa_mask);
//	sigaction(SIGALRM, &act, &oact);
	while(1)
	{
		printf("pid=%lu tid=%lu\n", getpid(), pthread_self());
		unsigned long  ret;
		ret=get_file_size("2.cpp");
		
		//sleep(3);
     	struct itimerval itv;
    	itv.it_interval.tv_sec = 5;
        itv.it_interval.tv_usec = 0;
    	itv.it_value.tv_sec = 5;
    	itv.it_value.tv_usec = 0;
    	setitimer(ITIMER_REAL, &itv, &oldtv);

		if(ret>0)
		{
			printf("file  is  too big.....\n");
			get_local_time();
			file_cp("1","2");
		//	sleep(3);
		}
	//	sleep(3);
	}
}
Exemplo n.º 8
0
int get_file_name(char **buffer)
{
	char *buffer_tmp = NULL;
	char srval[5] = {0, 0, 0, 0, 0};
	int  rval = 0;
	int size = 0;

	srand(time(NULL));

	rval = rand_x_y(1000, 9999);

	sprintf(srval, "%d", rval);

	size = get_local_time(&buffer_tmp, 0);

	assert(*buffer == NULL);

	if((*buffer = calloc(size + 1 + 4, sizeof(char))) == NULL)
	{
		perror("calloc");
		return -1;
	} 

	strcpy(*buffer, buffer_tmp);
	strcat(*buffer, srval);

	return (size + 4);
}
Exemplo n.º 9
0
 //! Get the local day as a ymd_type
 static typename date_type::ymd_type local_day_ymd() 
 {
   ::std::tm* curr = get_local_time();
   return ymd_type(curr->tm_year + 1900, 
                   curr->tm_mon + 1, 
                   curr->tm_mday);
 }
Exemplo n.º 10
0
 //! Get the local day as a ymd_type
 static typename date_type::ymd_type local_day_ymd() 
 {
   ::std::tm result;
   ::std::tm* curr = get_local_time(result);
   return ymd_type(static_cast<unsigned short>(curr->tm_year + 1900),
                   static_cast<unsigned short>(curr->tm_mon + 1),
                   static_cast<unsigned short>(curr->tm_mday));
 }
Exemplo n.º 11
0
void win_timerset_set_currenttime(BOOL update)
{
	TEXT_FIELD* txt;
	char  str[30];
	date_time dt;

	get_local_time(&dt);
	txt = &timer_cur_datetime;
	sprintf(str,"%d:%02d %04d-%02d-%02d",dt.hour,dt.min,dt.year,dt.month,dt.day);
	OSD_SetTextFieldContent(txt, STRING_ANSI, (UINT32)str);
	if(update)
		OSD_DrawObject((POBJECT_HEAD)txt, C_UPDATE_ALL);
}
Exemplo n.º 12
0
void set_kaon_ttx_time(UINT8 * temp)
{
	date_time dt;
	get_local_time(&dt);
    	temp[0] = dt.hour/10 + '0';
    	temp[1] = dt.hour % 10 + '0';
    	temp[2] = ':';
    	temp[3] = dt.min /10 + '0';
    	temp[4] = dt.min% 10 + '0';
    	temp[5] = ':';
    	temp[6] = dt.sec / 10 + '0';
    	temp[7] = dt.sec % 10 + '0';
}
Exemplo n.º 13
0
static int get_index_file_name(char* filename, int index, char* path, char* ext)
{
	struct tm tm;
	int hour, minute;
	
	get_local_time(&tm);
	
	hour = tm.tm_hour;
	minute = tm.tm_min;
	
	sprintf(filename, "%s/%02d%02d%04d.%s", path, hour, minute, index, ext);
	
	return 0;
}
Exemplo n.º 14
0
Arquivo: main.c Projeto: T-bagwell/su
int main(int argc, char *argv[])
{
    int local_time = 0;
    int remote_time = 0;
    int ret = 0;

    local_time = get_local_time();
    remote_time = time_str2int(time_string);
    
    ret = check_time_val(local_time, remote_time);
    fprintf(stderr, "localtime = [%d], remote_time = [%d], the ret = [%d]\n", 
            local_time, remote_time, ret);
    return 0;
}
Exemplo n.º 15
0
int main()
{
	pthread_t thread;
	pthread_create(&thread, NULL, thread_fun, NULL);
	unsigned long  ret    =	get_file_size("1.cpp");
	printf("file size is  %d\n",ret);
	get_local_time();
	signal(SIGALRM, signal_handler);
	//sleep(3);
	//raise(SIGALRM);//向某一进程发送信号,由进程处理
     //	pthread_kill(thread, SIGALRM);//向某一线程发送信号,由接受线程处理
	pthread_join(thread, NULL);
	//进程接受信号和线程接受信号不同
}
Exemplo n.º 16
0
static int get_index_folder_name(char* foldername, int index, char* path)
{
	struct tm tm;
	int year,month,day;

	get_local_time(&tm);
	
	year = tm.tm_year % 10;
	month = tm.tm_mon + 1;
	day = tm.tm_mday;
	
	sprintf(foldername, "%s/%03d%d%02d%02d", path, index, year, month, day);
	
	return 0;
}
Exemplo n.º 17
0
static int get_date_folder_name(char* foldername, char* path)
{
	struct tm tm;
	int year,month,day;
	
	get_local_time(&tm);
	
	year = tm.tm_year + 1900;
	month = tm.tm_mon + 1;
	day = tm.tm_mday;
	
	sprintf(foldername, "%s/%4d%02d%02d", path, year, month, day);
	
	return 0;
}
Exemplo n.º 18
0
void msg_send(void)
{
//	if ((msg.root_id == 0xFFFF) && (++heart_beats >= ROOT_TIMEOUT))
//	{
//		PRINTF("FTSP root timeout, declaring myself the root\n");
//		seq_num = 0;
//		msg.root_id = node_id;
//	}
//
	if ((msg.root_id != 0xFFFF) && ((state & STATE_SENDING) == 0))
	{
		state |= STATE_SENDING;
		rtimer_long_clock_t local_time, global_time;
		local_time = get_local_time();
		global_time = local_to_global(local_time);
		
		if (msg.root_id == node_id)
		{
			if ((long)(local_time - local_average) >= 0x20000000)
			{
				local_average = local_time;
				offset_average = global_time - local_time;
			}
		}
//		else
//		{
//			if (heart_beats >= ROOT_TIMEOUT)
//			{
//				PRINTF("FTSP: root timeout, declaring myself the root\n");
//				heart_beats = 0;
//				msg.root_id = node_id;
//				++seq_num;
//			}
//		}
		
		if ((num_entries < ENTRY_SEND_LIMIT) && (msg.root_id != node_id))
		{
			++heart_beats;
			state &= ~STATE_SENDING;
		}
		else
		{
			process_post(&ftsp_send_process, send_ready, NULL);
		}
	}
}
Exemplo n.º 19
0
static int get_time_file_name(char* filename, char* path, char* postfix, char* ext)
{
	struct tm tm;
	int hour, minute, second;
	
	get_local_time(&tm);
	
	hour = tm.tm_hour;
	minute = tm.tm_min;
	second = tm.tm_sec;
	
	if (postfix)
		sprintf(filename, "%s/%02d%02d%02d%s.%s", path, hour, minute, second, postfix, ext);
	else
		sprintf(filename, "%s/%02d%02d%02d.%s", path, hour, minute, second, ext);
	
	return 0;
}
Exemplo n.º 20
0
void * create_new_elem_hist(char *url, char *ipcli,
							int staterr)
{
	struct elem_hist *elem = NULL;

	if((elem = calloc(1, sizeof(struct elem_hist))) == NULL)
	{
		perror("calloc");
		return NULL;
	}

	// Création et initialisation du champs q_url.
	if((elem->q_url = calloc(strlen(url) + 1, sizeof(char))) == NULL)
	{
		perror("calloc");
		return NULL;
	}

	strcpy(elem->q_url, url);

	// Création et initialisation du champs q_ipcli.
	if((elem->q_ipcli = calloc(strlen(ipcli) + 1, sizeof(char))) == NULL)
	{
		perror("calloc");
		return NULL;
	}

	strcpy(elem->q_ipcli, ipcli);

	// Initialisation du champs q_staterr.
	elem->q_staterr = staterr;

	if(get_local_time(&(elem->q_date), 0) == -1)
	{
		fprintf(stderr, "L'appel à get_local_time a échoué.\n");
		return NULL;
	}

	// Initialisation du champs q_next.
	elem->q_next = NULL;

	return (void *)elem;
}
Exemplo n.º 21
0
static PRESULT time_con_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
    PRESULT ret = PROC_PASS;
    UINT32 i;
    UINT8	unact;
    CONTAINER* cont = (CONTAINER*)pObj;
    UINT8	id = OSD_GetObjID(pObj);
    SYSTEM_DATA* p_sys_data;
    p_sys_data=sys_data_get();

    switch(event)
    {
    case EVN_PRE_OPEN:
        wincom_open_subtitle((POBJECT_HEAD)&win_time_con,RS_SYS_LOCAL_TIMER_SET/*RS_SYSTEM_TIME*/, 0);
        win_time_set_GMT_enable_string(p_sys_data->local_time.buseGMT);
        win_time_set_Summer_string(p_sys_data->local_time.SummerTime);
        win_time_set_Display_string(p_sys_data->local_time.TimeDisplay);
        win_time_set_GMT_Offset_string(p_sys_data->local_time.GMToffset_count);
        get_local_time(&win_time_local_time);
        set_time_data();
        set_time_clock();
        win_time_switch_GMT_Type(p_sys_data->local_time.buseGMT);
        win_time_set_time_zone_citys(FALSE);
        OSD_SetContainerFocus((CONTAINER*)pObj,1);
        break;

    case EVN_POST_OPEN:
        break;

    case EVN_PRE_CLOSE:
        sys_data_save(1);
        enable_summer_time(p_sys_data->local_time.buseGMT && p_sys_data->local_time.SummerTime);
        /* Make OSD not flickering */
        *((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG;
        break;

    case EVN_POST_CLOSE:
        wincom_close_subtitle();
        OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL);
        break;
    }
    return ret;
}
Exemplo n.º 22
0
void LogFile::write(const string& error)
{
	get_local_time();
	path_initialization();

	stringstream buf;
	char* day = new char [2];
	buf << struct_local_time.tm_mday;
	buf >> day;
	
	ofstream fout(path + "\\" + day + ".log", ios_base::app);

		delete[] day;

		fout << struct_local_time.tm_mday << "-" << struct_local_time.tm_mon + 1 << "-" << struct_local_time.tm_year + 1900 << "\n"
			 << struct_local_time.tm_hour << ":" << struct_local_time.tm_min << ":" << struct_local_time.tm_sec << "\n"
			 << error << "\n\n";
		
	fout.close();
}
Exemplo n.º 23
0
/*
return value:
	 -1 :   wakeup_year  <= 2000 || wakeup_year>2100
	 -2 :   wakeup_month<0 || wakeup_month>12
	 -3 :   wakeup_day not valied in the wakeup_year & wakeup_month
	 -4 :   on time hour > 23
	 -5 :   on timer minute > 59	 
	 -6 :   duration minute > 59
	 -7 :   add timer the wakeup date & time < current time
	 -8:    add timer conflict with other timers
*/
INT32  win_timerset_check_and_save(void)
{
	EDIT_FIELD	*edf;
	UINT16 ch_idx,ch_cnt;
	P_NODE p_node;
	date_time dt,wkdt;
	UINT32 val,duration;
	INT32 ret;
	
	TIMER_SET_CONTENT* timer;
	
	timer = &timer_set;

	timer->timer_mode = TIMER_MODE;
	timer->timer_service = TIMER_SERVICE_TYPE;
	if(timer->timer_service == TIMER_SERVICE_MESSAGE)
		timer->wakeup_message = TIMER_SERVICE_INFO;
	else
	{
		get_prog_at(TIMER_SERVICE_INFO,&p_node);
		timer->wakeup_channel = p_node.prog_id;
#ifdef DVR_PVR_SUPPORT
 		if(timer->timer_service == TIMER_SERVICE_DVR_RECORD)
 		{
 			timer->wakeup_message = TIMER_REC_TYPE;
 		}
#endif
	}

	edf = &timer_edf_wakeupdate;
	OSD_GetEditFieldIntValue(edf,&val);
	wkdt.year = val / 10000;
	val -= wkdt.year*10000;
	wkdt.month = val / 100;
	val -= wkdt.month*100;
	wkdt.day = val;

	
	wkdt.weekday = OSD_GetMultiselSel(&timer_msel_wakeupweekday);

	
	edf = &timer_edf_wakeuptime;
	OSD_GetEditFieldIntValue(edf,&val);
	wkdt.hour = val/100;
	val -= wkdt.hour*100;
	wkdt.min = val;
	wkdt.sec = 0;
	
	ret = api_check_valid_date(wkdt.year,wkdt.month,wkdt.day);
	if(ret != 0)
		return ret;
	
	if(wkdt.hour > 23)
		return -4;	
	if(wkdt.min>59)
		return -5;

	if(timer_set_check_starttime_flag)
	{
		if(timer->timer_mode != TIMER_MODE_OFF)
		{
			get_local_time(&dt);
			if(api_compare_day_time(&wkdt,&dt) < 0)
				return -7;
		}
	}
	else
	{
		if(timer->timer_mode != TIMER_MODE_OFF)
		{
/*		
			if(timer->wakeup_state == TIMER_STATE_RUNING)
			{
			}
*/			
		}		
	}

	
	if(timer->timer_mode != TIMER_MODE_OFF)
	{

		timer->wakeup_year = wkdt.year;
		timer->wakeup_month= wkdt.month;
		timer->wakeup_day = wkdt.day;
		timer->wakeup_time =  wkdt.hour*60 + wkdt.min;			
	}
	
	
	edf = &timer_edf_duration;
	OSD_GetEditFieldIntValue(edf,&val);
	duration = val/100*60 + val%100;
	
	if(timer->timer_service ==  TIMER_SERVICE_MESSAGE)
		timer->wakeup_duration_time = 0;
	else
	{
		if(val % 100>59)
			return -6;
		timer->wakeup_duration_time = duration;
	}

	ret = IsValidTimer(timer);
	if(ret==0)
		return -8;
	
	return 0;
}
Exemplo n.º 24
0
BOOL win_timerset_open(TIMER_SET_CONTENT* settimer,TIMER_SET_CONTENT* rettimer,BOOL check_starttime)
{
	POBJECT_HEAD pObj = (POBJECT_HEAD)&g_win_timerset;
	PRESULT bResult = PROC_LOOP;
	UINT32 hkey;
	UINT8 cur_mode,mode;
	UINT8 group_idx;
	date_time dt,dt1;

    BOOL old_value = ap_enable_key_task_get_key(TRUE);
	sys_data_check_channel_groups();
	cur_mode  = sys_data_get_cur_chan_mode();
	group_idx = sys_data_get_cur_group_index();
	
	
	timer_set_ok_cancel_flag = 0;

	MEMSET(&timer_set,0,sizeof(TIMER_SET_CONTENT));

	if(settimer != NULL)
		MEMCPY(&timer_set,settimer,sizeof(TIMER_SET_CONTENT));
	
	if(timer_set.timer_mode != TIMER_MODE_OFF 
		&& timer_set.timer_service !=TIMER_SERVICE_MESSAGE) 
	{
		if(timer_set.wakeup_chan_mode>1)
			timer_set.wakeup_chan_mode = 1;
		
		mode = timer_set.wakeup_chan_mode;
	}
	else
	{
		mode = cur_mode;
		timer_set.wakeup_chan_mode = cur_mode;
	}
	if(timer_set.timer_mode == TIMER_MODE_OFF)
	{
		timer_set_modify_add_flag = TIMER_ADD;
		timer_set_check_starttime_flag = 1;
	}
	else
	{
		timer_set_modify_add_flag = TIMER_MODIFY;
		timer_set_check_starttime_flag = 1;
	}
	
	get_local_time(&dt1);

	dt1.min = dt1.min/10*10;
	dt1.sec = 0;
	convert_time_by_offset(&dt,&dt1,0,10);	
	
	if(timer_set_modify_add_flag ==  TIMER_ADD)
	{
		timer_set.wakeup_year 	= dt.year;
		timer_set.wakeup_month	= dt.month;
		timer_set.wakeup_day	= dt.day;
		timer_set.wakeup_time  = dt.hour * 60 + dt.min;
		timer_set.wakeup_state = TIMER_STATE_READY;
	}
	if(timer_set.timer_service == TIMER_SERVICE_MESSAGE)
		timer_set.wakeup_duration_time = 0;
		

	sys_data_set_cur_chan_mode(mode);
	sys_data_change_group(0);  
	
	OSD_SetContainerFocus(&g_win_timerset, TIMER_MODE_ID);
	OSD_ObjOpen(pObj, MENU_OPEN_TYPE_OTHER);

	while(bResult != PROC_LEAVE)
	{

		hkey = ap_get_key_msg();
	    if(hkey == INVALID_HK || hkey == INVALID_MSG)
	    {
	    	win_timerset_set_currenttime(TRUE);
	        continue;
	    }
		
		bResult = OSD_ObjProc(pObj, (MSG_TYPE_KEY<<16),hkey, 0);		
	}

	if(timer_set_ok_cancel_flag)
		MEMCPY(rettimer,&timer_set,sizeof(TIMER_SET_CONTENT));
	
	sys_data_set_cur_chan_mode(cur_mode);
	sys_data_change_group(group_idx);  
	sys_data_save(1);
    ap_enable_key_task_get_key(old_value);
	return timer_set_ok_cancel_flag;

}
Exemplo n.º 25
0
void krb_tgsreq_send(KRB_CONTEXT* krb_ctx, uint8 errcode)
{
	KrbTGSREQ* krb_tgsreq;
	KrbAPREQ* krb_apreq;
	PAData** pa_data;
	Authenticator* krb_auth;
	STREAM* s;
	STREAM* sapreq;
	rdpBlob msg;
	uint32 curlen, totlen, tmp;
	uint8 *bm;
	bm = NULL;
	totlen = tmp = 0;
	krb_tgsreq = krb_tgsreq_new(krb_ctx, errcode);
	krb_auth = xnew(Authenticator);
	pa_data = krb_tgsreq->padata;
	s = stream_new(4096);
	sapreq = stream_new(2048);
	
	//Begin write asn1 data reversely into stream
	stream_seek(s, 4095);
	stream_seek(sapreq, 2047);
	
	/* KDC-REQ-BODY (TAG 4) */
	totlen += krb_encode_req_body(s, &(krb_tgsreq->req_body), krb_tgsreq->type);
	stream_get_mark(s, bm);
	tmp = totlen;
	totlen += krb_encode_contextual_tag(s, 4, totlen);

	msg.data = bm;
	msg.length = tmp;

	/* Authenticator */
	krb_auth->avno = KRB_VERSION;
	krb_auth->cname = krb_ctx->cname;
	krb_auth->crealm = krb_ctx->realm;
	krb_auth->cksumtype = get_cksum_type(krb_ctx->enctype);
	krb_auth->cksum = crypto_kdcmsg_cksum(&msg, krb_ctx->askey, 6); //RFC4757 section 3 for msgtype (T=6)
	krb_auth->ctime = krb_tgsreq->req_body.from;
	krb_auth->cusec = 0;
	crypto_nonce((uint8*)&(krb_auth->seqno), 4);

	/* PA-TGS-REQ */
	krb_apreq = krb_apreq_new(krb_ctx, &(krb_ctx->asticket), krb_auth);
	curlen = krb_encode_apreq(sapreq, krb_apreq);
	msg.data = sapreq->p;
	msg.length = curlen;
	(*pa_data)->type = 1;
	(*pa_data)->value = msg;

	/* PA-DATA (TAG 3) */
	curlen = krb_encode_padata(s, pa_data);
	totlen += curlen + krb_encode_contextual_tag(s, 3, curlen);

	/* MSGTYPE (TAG 2) */
	totlen += krb_encode_uint8(s, 2, krb_tgsreq->type);

	/* VERSION NO (TAG 1) */
	totlen += krb_encode_uint8(s, 1, krb_tgsreq->pvno);

	totlen += krb_encode_sequence_tag(s, totlen);
	totlen += krb_encode_application_tag(s, krb_tgsreq->type, totlen);
	totlen += krb_encode_recordmark(s, totlen);

	/* READY SEND */
	krb_tcp_send(krb_ctx, s->p, totlen);
	
	/* save stuff */
	krb_ctx->nonce = krb_tgsreq->req_body.nonce;
	xfree(krb_ctx->sname);
	krb_ctx->sname = xstrdup(krb_tgsreq->req_body.sname);
	krb_ctx->ctime = get_local_time(krb_tgsreq->req_body.from);
	krb_ctx->state = KRB_TGSREQ_OK;

	/* clean up */
	freerdp_blob_free(krb_auth->cksum);
	xfree(krb_auth->cksum);
	xfree(krb_auth);
	krb_free_tgsreq(krb_tgsreq);
	xfree(krb_tgsreq);
	stream_free(sapreq);
	stream_free(s);
}
Exemplo n.º 26
0
void krb_asreq_send(KRB_CONTEXT* krb_ctx, uint8 errcode)
{
	KrbASREQ* krb_asreq;
	PAData** pa_data;
	KrbENCData enc_data;
	KrbENCKey* enckey;
	STREAM* s;
	STREAM* paenc;
	rdpBlob msg;
	rdpBlob* encmsg;
	uint32 curlen, totlen, pai;
	uint8 *bm;
	bm = NULL;
	totlen = pai = 0;
	krb_asreq = krb_asreq_new(krb_ctx, errcode);
	pa_data = krb_asreq->padata;
	enckey = NULL;
	s = stream_new(2048);
	paenc = stream_new(100);
	
	//Begin write asn1 data reversely into stream
	stream_seek(s, 1024);
	stream_seek(paenc, 99);
	
	/* KDC-REQ-BODY (TAG 4) */
	totlen += krb_encode_req_body(s, &(krb_asreq->req_body), krb_asreq->type);
	totlen += krb_encode_contextual_tag(s, 4, totlen);

	/* padata = PA-ENC-TIMESTAMP */
	if(errcode != 0)
	{
		freerdp_blob_alloc(&msg, 21);
		memcpy(msg.data, "\x30\x13\xa0\x11\x18\x0f", 6); // PA-ENC-TS-ENC without optional pausec
		memcpy(((uint8*) msg.data) + 6, krb_asreq->req_body.from, 15);
		enckey = string2key(&(krb_ctx->passwd), krb_ctx->enctype);
		encmsg = crypto_kdcmsg_encrypt(&msg, enckey, 1); //RFC4757 section 3 for msgtype (T=1)
		enc_data.enctype = enckey->enctype;
		enc_data.kvno = -1;
		enc_data.encblob.data = encmsg->data;
		enc_data.encblob.length = encmsg->length;
		curlen = krb_encode_encrypted_data(paenc, &enc_data);
		freerdp_blob_free(&msg);
		msg.data = paenc->p;
		msg.length = curlen;

		/* padata = PA-ENC-TIMESTAMP */
		(*(pa_data + pai))->type = 2;
		(*(pa_data + pai))->value = msg;
		pai++;
		freerdp_blob_free(encmsg);
		xfree(encmsg);
	}
	
	freerdp_blob_alloc(&msg, 7);
	memcpy(msg.data, "\x30\x05\xa0\03\x01\x01", 6); // asn1 data
	*((uint8*)msg.data + 6) = krb_asreq->pa_pac_request;

	/* padata = PA-PAC-REQUEST */
	(*(pa_data + pai))->type = 128;
	(*(pa_data + pai))->value = msg;

	*(pa_data + ++pai) = NULL;

	/* padata (TAG 3) */
	curlen = krb_encode_padata(s, pa_data);
	totlen += curlen + krb_encode_contextual_tag(s, 3, curlen);

	/* MSGTYPE = AS-REQ (TAG 2) */
	totlen += krb_encode_uint8(s, 2, krb_asreq->type);

	/* KERBEROS PROTOCOL VERSION NO (TAG 1)*/
	totlen += krb_encode_uint8(s, 1, krb_asreq->pvno);

	totlen += krb_encode_sequence_tag(s, totlen);
	totlen += krb_encode_application_tag(s, krb_asreq->type, totlen);
	totlen += krb_encode_recordmark(s, totlen);

	/* READY SEND */
	krb_tcp_send(krb_ctx, s->p, totlen);

	/* save stuff */
	krb_ctx->askey = enckey;
	krb_ctx->nonce = krb_asreq->req_body.nonce;
	xfree(krb_ctx->sname);
	krb_ctx->sname = xstrdup(krb_asreq->req_body.sname);
	krb_ctx->ctime = get_local_time(krb_asreq->req_body.from);
	krb_ctx->state = KRB_ASREQ_OK;

	/* clean up */
	freerdp_blob_free(&msg);
	stream_free(s);
	stream_free(paenc);
	krb_free_asreq(krb_asreq);
	xfree(krb_asreq);
}
Exemplo n.º 27
0
time_t get_clock_skew(char* str)
{
	time_t ctime;
	ctime = time(NULL);
	return (get_local_time(str) - ctime);
}
Exemplo n.º 28
0
void win_progname_draw_infor(void)
{
	UINT16 group_name[MAX_SERVICE_NAME_LENGTH + 1 + 10];
	UINT8   group_type,av_mode;

	UINT16 cur_channel;
	P_NODE p_node;
	S_NODE s_node;
//	T_NODE t_node;
	char string[100];
	char prog_name[MAX_SERVICE_NAME_LENGTH + 1];
	INT32 ret,len;
	UINT32 i,j;
	BITMAP* bmp;
	TEXT_FIELD* txt;
	UINT16 icon;
	date_time dt;
	prog_txt_t* p_prog_txt;
	prog_bmp_t* p_prog_bmp;
	eit_event_info_t *pe=NULL,*fe=NULL;
	UINT8 *s1=NULL,*s2=NULL;
	INT32 strlen;
	struct ACTIVE_SERVICE_INFO service;

	struct t_ttx_lang *ttx_lang_list;
	UINT8 ttx_lang_num;
	struct t_subt_lang* sub_lang_list;
	UINT8 sub_lang_num;

	bmp = &prog_bmp;
	txt = &prog_text;
	UINT32 fav_mask;

	fav_mask = 0;
	for(i=0;i<MAX_FAVGROUP_NUM;i++)
		fav_mask |= (0x01<<i);


	av_mode = sys_data_get_cur_chan_mode();
	cur_channel = sys_data_get_cur_group_cur_mode_channel();
	ret = get_prog_at(cur_channel,&p_node);
	get_sat_by_id(p_node.sat_id, &s_node);
	get_cur_group_name((char*)group_name,&group_type);
	get_local_time(&dt);
/*
#ifdef _EPG_MULTI_SERVICE
#ifdef EPG_FAST_PARSE			
	epg_fast_pasrse_set(FALSE,NULL,NULL);
#endif
	get_tp_by_id(p_node.tp_id, &t_node);
	api_epg_parse(p_node.tp_id, t_node.network_id, t_node.t_s_id, p_node.prog_number, epg_type_pf);

	struct active_service_t service;
	service.tp_id = p_node.tp_id;
	service.orig_network_id = t_node.network_id;
	service.ts_id = t_node.t_s_id;
	service.service_id = p_node.prog_number;
	api_epg_set_active_service(&service, 1);

	api_epg_parse(p_node.tp_id, t_node.network_id, t_node.t_s_id, p_node.prog_number, epg_type_pf);
#endif
*/
	service.tp_id = p_node.tp_id;
	service.service_id = p_node.prog_number;
	epg_set_active_service(&service, 1);

	/*current next epg info */
	pe=epg_get_cur_service_event((INT32)cur_channel, PRESENT_EVENT, NULL,NULL,NULL, /*event_update*/TRUE);
	fe=epg_get_cur_service_event((INT32)cur_channel, FOLLOWING_EVENT, NULL,NULL,NULL, event_update);
    if(event_update==FALSE)
    {
        if(pe==NULL || fe==NULL)
        {
            event_update = TRUE;    
        }
    }
    else
    {
        if(pe!=NULL && fe!=NULL)
        {
            event_update = FALSE;
        }
    }
	s1=epg_get_event_name(pe, &len);
//	s1=(UINT8*)epg_get_event_name(pe, present_name, 32);
	s2=epg_get_event_name(fe, &len);
//	s2=(UINT8*)epg_get_event_name(fe, following_name, 32);

	TTXEng_GetInitLang(&ttx_lang_list, &ttx_lang_num);
	subt_get_language(&sub_lang_list ,&sub_lang_num);
	if(sub_lang_num == 0)
		TTXEng_GetSubtLang(&ttx_lang_list,&sub_lang_num);

		
	for(i=0;i<PROG_BMP_NUM;i++)
	{
	    p_prog_bmp = &prog_bmps[i];
	    icon = INVALID_ID;
	    switch(p_prog_bmp->bmp_type)
	    {
	     case PROG_BMP_STATIC:
	        icon = prog_bmps[i].icon;
	       break;
#ifndef MODIFY_FOR_EGYPT_CUSTOMER	   
	    case PROG_BMP_AV_TYPE:
	        if(av_mode==TV_CHAN)
	            icon = IM_INFO_BAR_TV;
	        else
	            icon = IM_INFO_BAR_RADIO;            
	        break;
#endif
	    case PROG_BMP_EPG:
	        if( (s1||s2) )
	            icon = prog_bmps[i].icon;
	        break;
	    case PROG_BMP_TTX:
			if(ttx_lang_num>0)
	            icon = prog_bmps[i].icon;
	        break;
	    case PROG_BMP_SUBT:
			if(sub_lang_num>0)
	            icon = prog_bmps[i].icon;
	        break;			
	    case PROG_BMP_LOCK:
	        if(p_node.lock_flag)
	            icon = prog_bmps[i].icon;
	        break;
	    case PROG_BMP_FAV:
			if(p_node.fav_group[0] & fav_mask)
				icon = prog_bmps[i].icon;
	       break;
	    case PROG_BMP_CA:
			{
#if 0				
				BOOL			b,bFlag;

				INT8 level,quality,lock;
				signal_lock_status lock_flag;
				signal_scramble_status scramble_flag;
				signal_lnbshort_status lnbshort_flag;
				signal_parentlock_status parrentlock_flag;

				bFlag = GetSignalStatus(&lock_flag, &scramble_flag,&lnbshort_flag,&parrentlock_flag);  
				if(bFlag && lock_flag== SIGNAL_STATUS_LOCK
					&& lnbshort_flag==SIGNAL_STATUS_LNBNORMAL 
					&& parrentlock_flag==SIGNAL_STATUS_PARENT_UNLOCK
					&& scramble_flag == SIGNAL_STATUS_SCRAMBLED)
					icon = prog_bmps[i].icon;
#else
				if(p_node.ca_mode)
					icon = prog_bmps[i].icon;
#endif				
					
        	}
			break;
        default:
            break;
        }
	OSD_SetBitmapContent(bmp, icon);
	OSD_SetRect(&bmp->head.frame, p_prog_bmp->left, p_prog_bmp->top, p_prog_bmp->width,p_prog_bmp->height);
	OSD_DrawObject( (OBJECT_HEAD*) bmp, C_UPDATE_ALL);
    }
    
    for(i=0;i<PROG_TXT_NUM;i++)
    {
        p_prog_txt = &prog_txts[i];
        
        string[0] = '\0';
        switch(p_prog_txt->txt_type)
        {
        case PROG_TXT_PROG_NAME: 
#ifndef DB_USE_UNICODE_STRING  
            STRCPY(prog_name,p_node.service_name);
            for(j=0;j<STRLEN(prog_name);j++)
                if(prog_name[j] >= 0x80)
                {
                    prog_name[j] = '\0';
                    break;
                }
            if(p_node.ca_mode==0)
                sprintf(string,"%s(%s)",prog_name,s_node.sat_name);
            else
                sprintf(string,"$%s(%s)",prog_name,s_node.sat_name);

#else
            if(p_node.ca_mode==0)
                STRCPY(string,"");
            else
                STRCPY(string,"$");
			
            ComAscStr2Uni(string,len_display_str);
            strlen = ComUniStrLen( len_display_str);
            //strcpy_uni(&len_display_str[strlen],p_node.service_name);
            ComUniStrCopyChar((UINT8 * )&len_display_str[strlen],p_node.service_name);
            strlen = ComUniStrLen( len_display_str);
            ComAscStr2Uni("(",&len_display_str[strlen]);
            strlen = ComUniStrLen( len_display_str);
            ComUniStrCopyChar((UINT8 * )&len_display_str[strlen],s_node.sat_name);
            strlen = ComUniStrLen( len_display_str);
            ComAscStr2Uni(")",&len_display_str[strlen]);
#endif            
            
            break;
        case PROG_TXT_DATE:
            sprintf(string,"%02d/%02d",dt.month,dt.day);
            ComAscStr2Uni(string, (UINT16 *)len_display_str);
            break;
        case PROG_TXT_TIME:
            sprintf(string,"%02d:%02d",dt.hour,dt.min);
            ComAscStr2Uni(string, (UINT16 *)len_display_str);
            break;
        case PROG_TXT_PROG_NUM:
            sprintf(string,"%04d",cur_channel + 1);
            ComAscStr2Uni(string, (UINT16 *)len_display_str);
            break;
        case PROG_TXT_EPG_NOW:
            if (s1 )				
			{
				sprintf(string,"Now: ");
				ComAscStr2Uni(string, (UINT16 *)len_display_str);
				len =ComUniStrLen(len_display_str);
				ComUniStrCopyChar((UINT8*)&len_display_str[len],s1);
			}
            else
			{
                        OSD_SetTextFieldStrPoint(txt,NULL);
                        OSD_SetTextFieldContent(txt,STRING_ID,RS_EPG_NO_INFORMATION);
			}
            break;
        case PROG_TXT_EPG_NEXT:
            if (s2)				
			{
				sprintf(string,"Next: ");
				ComAscStr2Uni(string, (UINT16 *)len_display_str);
				len =ComUniStrLen(len_display_str);
				ComUniStrCopyChar((UINT8*)&len_display_str[len],s2);		
			}
            else
			{
	            sprintf(string," ");
	            ComAscStr2Uni(string, (UINT16 *)len_display_str);
			}
    	     break;
        case PROG_TXT_PROG_GROUP:
#ifndef DB_USE_UNICODE_STRING  
            sprintf(string,"%s",group_name);
#else
            ComUniStrCopy(len_display_str, group_name);
#endif
            break;
        default:
            ;
        }  

#ifndef DB_USE_UNICODE_STRING
        ComAscStr2Uni(string, (UINT16 *)len_display_str);
#else

/*
        if(p_prog_txt->txt_type != PROG_TXT_PROG_NAME 
            && p_prog_txt->txt_type != PROG_TXT_PROG_GROUP
                        &&p_prog_txt->txt_type != PROG_TXT_EPG_NOW
            &&p_prog_txt->txt_type != PROG_TXT_EPG_NEXT)
            ComAscStr2Uni(string, (UINT16 *)len_display_str);
*/
	if(p_prog_txt->txt_type == PROG_TXT_PROG_NUM) 
		txt->head.bFont = 2;
	else
		txt->head.bFont = 0;
 
#endif

	OSD_SetRect(&txt->head.frame, p_prog_txt->left, p_prog_txt->top, p_prog_txt->width,p_prog_txt->height);
	//txt->pText = (UINT8*)len_display_str;
	txt->head.style.bShowIdx = p_prog_txt->shidx;
	OSD_DrawObject( (OBJECT_HEAD *)txt, C_UPDATE_ALL);
	OSD_SetTextFieldContent(txt,STRING_ID,0);
	OSD_SetTextFieldStrPoint(txt,len_display_str);
    }
#ifdef MODIFY_FOR_EGYPT_CUSTOMER
	progname_signal_refresh(TRUE);
#endif

}
Exemplo n.º 29
0
void win_time_right_key(POBJECT_HEAD pObj,UINT8 id)
{
    INT32 hoffset, moffset;
    SYSTEM_DATA* p_sys_data=sys_data_get();
    switch(id)
    {
    case MENU_TIMESET_GMT_ENABLE:
        p_sys_data->local_time.buseGMT=1-p_sys_data->local_time.buseGMT;
        win_time_set_GMT_enable_string(p_sys_data->local_time.buseGMT);
        OSD_TrackObject(pObj,C_UPDATE_ALL);
        win_time_switch_GMT_Type(p_sys_data->local_time.buseGMT);
        if(p_sys_data->local_time.buseGMT)
        {
            get_UTC(&win_time_local_time);
            set_STC_time(&win_time_local_time);
            set_time_data();
            set_time_clock();
        }
        else
        {
            p_sys_data->local_time.GMToffset_count = 23;
            win_time_set_GMT_Offset_string(p_sys_data->local_time.GMToffset_count);
            p_sys_data->local_time.SummerTime=0;
            enable_summer_time(0);
            win_time_set_Summer_string(p_sys_data->local_time.SummerTime);
        }
        OSD_DrawObject((POBJECT_HEAD )&time_item_con2,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con3,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con4,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con5,C_UPDATE_ALL);
        win_time_set_time_zone_citys(TRUE);
        break;
    case MENU_TIMESET_SUMMER:
        p_sys_data->local_time.SummerTime=1-p_sys_data->local_time.SummerTime;
        win_time_set_Summer_string(p_sys_data->local_time.SummerTime);
        OSD_TrackObject(pObj,C_UPDATE_ALL);
        enable_summer_time(p_sys_data->local_time.buseGMT && p_sys_data->local_time.SummerTime);
        get_local_time(&win_time_local_time);
        set_time_data();
        set_time_clock();
        OSD_DrawObject((POBJECT_HEAD )&time_item_con4,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con5,C_UPDATE_ALL);
        break;
    case MENU_TIMESET_DISPLAY:
        p_sys_data->local_time.TimeDisplay=1-p_sys_data->local_time.TimeDisplay;
        win_time_set_Display_string(p_sys_data->local_time.TimeDisplay);
        OSD_TrackObject(pObj,C_UPDATE_ALL);
        break;
    case MENU_TIMESET_GMT_OFFESET:
        if(p_sys_data->local_time.GMToffset_count==47)
        {
            p_sys_data->local_time.GMToffset_count=0;
        }
        else
        {
            p_sys_data->local_time.GMToffset_count++;
        }
        win_time_set_GMT_Offset_string(p_sys_data->local_time.GMToffset_count);
        OSD_TrackObject(pObj,C_UPDATE_ALL);

        sys_data_gmtoffset_2_hmoffset(&hoffset, &moffset);
        set_STC_offset( hoffset, moffset, 0);
        get_local_time(&win_time_local_time);
        set_time_data();
        set_time_clock();
        OSD_DrawObject((POBJECT_HEAD )&time_item_con4,C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD )&time_item_con5,C_UPDATE_ALL);

        win_time_set_time_zone_citys(TRUE);
        break;
    }
}
Exemplo n.º 30
0
void cti_chnchg_function()
{
	UINT16 chn_idx=0xffff;
	date_time local_time;
	CTI_CHN_CHG_CONTENT chnchg_data;
	UINT8 save;
	BOOL need_change = TRUE,info_changed = FALSE;
	win_popup_choice_t sel;
	UINT16 string[CHANNEL_JUMP_STR_LEN_MAX/2+1];

	INT sec = 0;
	if(pre_channel_index!=sys_data_get_cur_group_cur_mode_channel())//换台了
	{
		cti_chnchg_para_reset();
	}

	if(!get_cti_chnchg_flg())
	{
		return;
	}

	MEMSET(&local_time,0,sizeof(date_time));
	get_local_time(&local_time);

	MEMSET(&chnchg_data,0,sizeof(CTI_CHN_CHG_CONTENT));
	get_cti_chnchg_data(&chnchg_data);

	//显示内容有没有变化
	if(MEMCMP(pre_info,chnchg_data.pString,sizeof(chnchg_data.pString))==0)
	{
		info_changed = FALSE;
	}
	else
	{
		info_changed = TRUE;
	}

	chn_idx=GetPlayChannelID(chnchg_data.bType,chnchg_data.wPart1,
							chnchg_data.wPart2,chnchg_data.wPart3,chnchg_data.wPart4);

	if((chnchg_data.bStatus==0)
		||(chnchg_data.bStatus==2))//立即跳转
	{
		set_cti_chnchg_flg(FALSE);
	}
	else//时间跳转
	{
		if(api_compare_day_time_ext(&(chnchg_data.stStartTime),&local_time)>=0)	//跳转时间没有到
		{
			need_change = FALSE;
		}
		else if(api_compare_day_time_ext(&(chnchg_data.stEndTime),&local_time)>=0)	//正常跳转
		{
			sec = cti_mktime(&(chnchg_data.stEndTime),&local_time);
		}
		else//控制时间已过
		{
			need_change = FALSE;
			set_cti_chnchg_flg(FALSE);
			return;
		}
	}

	if((chn_idx!=0xffff)
		&&(chn_idx!=sys_data_get_cur_group_cur_mode_channel())
		&&need_change)
	{

		if(chnchg_data.bStatus==0)//强制立即跳转
		{
			BackToFullScrPlay();
			win_compopup_init ( WIN_POPUP_TYPE_SMSG );
			win_compopup_set_frame ( 100, 140, 400, 120);
			//win_compopup_set_frame(100, 180, 400, 80);
			win_compopup_set_msg_ext(NULL,NULL, RS_CTI_CHANNEL_JUMP);
			win_compopup_open_ext ( &save );
			osal_task_sleep(3000);
			win_compopup_close();
		}
		else if(chnchg_data.bStatus==1)//强制时间跳转
		{
			if(!info_showed)
			{
				BackToFullScrPlay();
				win_compopup_init ( WIN_POPUP_TYPE_SMSG );
				win_compopup_set_frame ( 100, 140, 400, 120);
				//win_compopup_set_frame(100, 180, 400, 80);
				win_compopup_set_msg_ext(NULL,NULL, RS_CTI_CHANNEL_JUMP);
				win_compopup_open_ext ( &save );
				osal_task_sleep(3000);
				win_compopup_close();
				info_showed = TRUE;
			}
		}
		else if(chnchg_data.bStatus==2)//用户选择立即跳转
		{
			if((sys_data_get_cur_group_cur_mode_channel()==chn_idx_sel_no)
				&&(!info_changed))
			{
				return;
			}
			else
			{
				BackToFullScrPlay();

				MEMSET(string,0,sizeof(string));
				MEMSET(pre_info,0,sizeof(pre_info));
#ifdef GB2312_SUPPORT
				convert_gb2312_to_unicode(chnchg_data.pString, 
				sizeof(chnchg_data.pString),string, CHANNEL_JUMP_STR_LEN_MAX/2);
#else
				dvb_to_unicode(chnchg_data.pString, 
				sizeof(chnchg_data.pString),string, CHANNEL_JUMP_STR_LEN_MAX/2, 0);
#endif
				MEMCPY(pre_info,chnchg_data.pString,sizeof(chnchg_data.pString));
				win_compopup_init ( WIN_POPUP_TYPE_OKNO);				
				//win_compopup_set_frame ( 100, 120, 400, 160);
				win_compopup_set_frame ( 100, 100, 400, 160);
				win_compopup_set_msg_ext(NULL, string, 0);
				win_compopup_set_default_choice(WIN_POP_CHOICE_YES);
				sel = win_compopup_open_ext_timeout(&save, 5);
				if (sel == WIN_POP_CHOICE_NO)
				{
					chn_idx_sel_no = sys_data_get_cur_group_cur_mode_channel();
					return;//do not change
				}	
				//choice yes,so change channel
			}
		}
		else if(chnchg_data.bStatus==3)//用户选择按时间跳转
		{
			if((!info_showed)||info_changed)//没有显示过或者字符变化了
			{
				BackToFullScrPlay();

				MEMSET(string,0,sizeof(string));
				MEMSET(pre_info,0,sizeof(pre_info));
#ifdef GB2312_SUPPORT				
				convert_gb2312_to_unicode(chnchg_data.pString, 
				sizeof(chnchg_data.pString),string, CHANNEL_JUMP_STR_LEN_MAX/2);
#else
				dvb_to_unicode(chnchg_data.pString, 
				sizeof(chnchg_data.pString),string, CHANNEL_JUMP_STR_LEN_MAX/2, 0);
#endif
				MEMCPY(pre_info,chnchg_data.pString,sizeof(chnchg_data.pString));
				win_compopup_init ( WIN_POPUP_TYPE_OKNO);
				win_compopup_set_frame ( 100, 100, 400, 160);
				win_compopup_set_msg_ext(NULL, string, 0);
				win_compopup_set_default_choice(WIN_POP_CHOICE_YES);
				sel = win_compopup_open_ext_timeout(&save, sec);
				choiced_yes = FALSE;
				info_showed = TRUE;
				if ((sel == WIN_POP_CHOICE_NO) || (sel == WIN_POP_CHOICE_TIMEOUT))
				{
					return;//do not change
				}	
				choiced_yes = TRUE;
			}
			else if(choiced_yes==TRUE)//用户选择yes,则继续判断是否需要跳转
			{

			}
			else
			{
				return;//提示过,不再提醒,也不换台
			}

		}

		api_play_channel(chn_idx, TRUE, TRUE, FALSE);
	}
}