Exemplo n.º 1
0
static void ssl_cipher_collect_ciphers(const SSL_METHOD *ssl_method,
		int num_of_ciphers, unsigned long mask, unsigned long m256,
		CIPHER_ORDER *co_list, CIPHER_ORDER **head_p,
		CIPHER_ORDER **tail_p)
	{
	int i, co_list_num;
	SSL_CIPHER *c;

	/*
	 * We have num_of_ciphers descriptions compiled in, depending on the
	 * method selected (SSLv2 and/or SSLv3, TLSv1 etc).
	 * These will later be sorted in a linked list with at most num
	 * entries.
	 */

	/* Get the initial list of ciphers */
	co_list_num = 0;	/* actual count of ciphers */
	for (i = 0; i < num_of_ciphers; i++)
		{
		c = ssl_method->get_cipher(i);
#define IS_MASKED(c) ((c)->algorithms & (((c)->alg_bits == 256) ? m256 : mask))
		/* drop those that use any of that is not available */
		if ((c != NULL) && c->valid && !IS_MASKED(c))
			{
			co_list[co_list_num].cipher = c;
			co_list[co_list_num].next = NULL;
			co_list[co_list_num].prev = NULL;
			co_list[co_list_num].active = 0;
			co_list_num++;
#ifdef KSSL_DEBUG
			printk("\t%d: %s %lx %lx\n",i,c->name,c->id,c->algorithms);
#endif	/* KSSL_DEBUG */
			/*
			if (!sk_push(ca_list,(char *)c)) goto err;
			*/
			}
		}

	/*
	 * Prepare linked list from list entries
	 */	
	for (i = 1; i < co_list_num - 1; i++)
		{
		co_list[i].prev = &(co_list[i-1]);
		co_list[i].next = &(co_list[i+1]);
		}
	if (co_list_num > 0)
		{
		(*head_p) = &(co_list[0]);
		(*head_p)->prev = NULL;
		(*head_p)->next = &(co_list[1]);
		(*tail_p) = &(co_list[co_list_num - 1]);
		(*tail_p)->prev = &(co_list[co_list_num - 2]);
		(*tail_p)->next = NULL;
		}
	}
static al_iptv_source_format_t *ui_iptv_gen_source_format(u32 param)
{
    al_iptv_source_format_t *p_data = NULL;

    if (param > 0)
    {
        p_data = (al_iptv_source_format_t *)mtos_malloc(sizeof(al_iptv_source_format_t));
        MT_ASSERT(p_data != NULL);

        p_data->total_format = 0;
        p_data->formatList = (u8 *)mtos_malloc(IPTV_MAX_FORMAT_COUNT);
        MT_ASSERT(p_data->formatList != NULL);

        if (IS_MASKED(param, IPTV_API_FORMAT_NORMAL))
        {
            p_data->formatList[p_data->total_format] = IPTV_API_FORMAT_NORMAL;
            p_data->total_format++;
        }
        if (IS_MASKED(param, IPTV_API_FORMAT_HIGH))
        {
            p_data->formatList[p_data->total_format] = IPTV_API_FORMAT_HIGH;
            p_data->total_format++;
        }
        if (IS_MASKED(param, IPTV_API_FORMAT_SUPER))
        {
            p_data->formatList[p_data->total_format] = IPTV_API_FORMAT_SUPER;
            p_data->total_format++;
        }
        if (IS_MASKED(param, IPTV_API_FORMAT_TOPSPEED))
        {
            p_data->formatList[p_data->total_format] = IPTV_API_FORMAT_TOPSPEED;
            p_data->total_format++;
        }
    }

    return p_data;
}
Exemplo n.º 3
0
//---------------------------------------------------------
void CGrid_Gaps::Tension_Init(int iStep)
{
	int		x, y, i, ix, iy, nx, ny, nz;

	double	z;

	//-----------------------------------------------------
	// 1. Channels...

	pTension_Temp->Assign_NoData();
	pTension_Keep->Assign();

	for(y=0; y<Get_NY(); y+=iStep)
	{
		ny	= y + iStep < Get_NY() ? y + iStep : Get_NY();

		for(x=0; x<Get_NX(); x+=iStep)
		{
			if( !pInput->is_NoData(x, y) || IS_MASKED(x, y) )
			{
				pTension_Temp->Set_Value(x, y, pInput->asDouble(x, y) );
				pTension_Keep->Set_Value(x, y, 1.0);
			}
			else
			{
				nx	= x + iStep < Get_NX() ? x + iStep : Get_NX();
				nz	= 0;
				z	= 0.0;

				for(iy=y; iy<ny; iy++)
				{
					for(ix=x; ix<nx; ix++)
					{
						if( pInput->is_InGrid(ix, iy) )
						{
							z	+= pInput->asDouble(ix, iy);
							nz++;
						}
					}
				}

				if( nz > 0 )
				{
					pTension_Temp->Set_Value(x, y, z / (double)nz );
					pTension_Keep->Set_Value(x, y, 1.0);
				}
			}
		}
	}

	//-----------------------------------------------------
	// 2. Previous Iteration...

	for(y=0; y<Get_NY(); y+=iStep)
	{
		for(x=0; x<Get_NX(); x+=iStep)
		{
			if( pTension_Keep->asByte(x, y) == false )
			{
				if( !pResult->is_NoData(x, y) )
				{
					pTension_Temp->Set_Value(x, y, pResult->asDouble(x, y));
				}
				else
				{
					nz	= 0;
					z	= 0.0;

					for(i=0; i<8; i++)
					{
						ix	= x + iStep * Get_System()->Get_xTo(i);
						iy	= y + iStep * Get_System()->Get_yTo(i);

						if( pResult->is_InGrid(ix, iy) )
						{
							z	+= pResult->asDouble(ix, iy);
							nz++;
						}
					}

					if( nz > 0.0 )
					{
						pTension_Temp->Set_Value(x, y, z / (double)nz);
					}
					else
					{
						pTension_Temp->Set_Value(x, y, pInput->asDouble(x, y));
					}
				}
			}
		}
	}

	//-----------------------------------------------------
	// 3. ...

	pResult->Assign(pTension_Temp);
}