Пример #1
0
/* RTT estimation */
void TrainEngine::RTT_est(uint16_t tcp_sp, uint32_t tcp_seq, uint32_t tcp_timeval)
{
    // TIME-DATA-TRAIN
    tcp_flow_open(tcp_sp, tcp_seq, tcp_timeval);
    gen_tcp_time_data(1, tcp_sp, tcp_timeval + 2);
    send_train();
    linking();
    tcp_flow_close(tcp_sp);
    reporting();
    cleanup();

    // OF-DATA-TRAIN
    gen_tcp_of_data(1, tcp_sp+1, tcp_seq);
    send_train();
    linking();
    reporting();
    cleanup();

    // SYN-DATA-TRAIN
    gen_tcp_syn_data(1, tcp_sp+2, tcp_seq);
    send_train();
    linking();
    reporting();
    cleanup();
}
Пример #2
0
/* ERROR FUNCTION NUMBER - 4 */
Bool conSetConnection(Connector *from, Connector *to)
{
    int i = 0;
    Connector *ptr;
    /* check arguments */
    if(!from || !to)
        return setError(E_WRONG_ARG, 1.04, NULL);

    /* find begining */
    from = conGetBegin(from);
    to   = conGetBegin(to);

    /* check direction - ?*/
    //if(from->ticket->direction == to->ticket->direction)
    //    return setError(E_WRONG_ARG, 1.04, NULL);

    /* check connection possibility */
    if(!conIsEquial(from, to))
        return setError(E_DIFF_TYPE, 1.04, NULL);
    /* check if allready linking */
    while((ptr = getConnection(to, i++)) != NULL) {
        if(ptr == from) return True;
    }
    /* link elements */
    if(!linking(lnkAdd(from),lnkAdd(to)))
        return setError(E_NO_MEMORY, 1.04, NULL);

    return True;
}
Пример #3
0
/* test whether the target prover support SYN_DATA train */
void TrainEngine::test_syn_data(uint16_t tcp_sp, uint32_t tcp_seq)
{
    gen_tcp_syn_data(3, tcp_sp, tcp_seq);
    send_train();
    linking();
    logger->PrintLog("[%s:%d] SYN_DATA: %d, %d\n", __FILE__, __LINE__, request_cnt_, response_cnt_);
    cleanup();
}
Пример #4
0
bool linking(
  contextt &dest_context,
  contextt &new_context,
  message_handlert &message_handler)
{
  linkingt linking(
    dest_context, new_context, message_handler);
  
  return linking.typecheck_main();
}
Пример #5
0
bool linking(
  symbol_tablet &dest_symbol_table,
  symbol_tablet &new_symbol_table,
  message_handlert &message_handler)
{
  linkingt linking(
    dest_symbol_table, new_symbol_table, message_handler);
  
  return linking.typecheck_main();
}
Пример #6
0
void pcnn::calculate_states(const pcnn_stimulus & stimulus) {
	std::vector<double> feeding(size(), 0.0);
	std::vector<double> linking(size(), 0.0);
	std::vector<double> outputs(size(), 0.0);

	for (unsigned int index = 0; index < size(); index++) {
		pcnn_oscillator & current_oscillator = m_oscillators[index];
		std::vector<unsigned int> neighbors;
		get_neighbors(index, neighbors);

		double feeding_influence = 0.0;
		double linking_influence = 0.0;

		for (std::vector<unsigned int>::const_iterator iter = neighbors.begin(); iter != neighbors.end(); iter++) {
			const double output_neighbor = m_oscillators[(*iter)].output;

			feeding_influence += output_neighbor * m_params.M;
			linking_influence += output_neighbor * m_params.W;
		}

		feeding_influence *= m_params.VF;
		linking_influence *= m_params.VL;

		feeding[index] = m_params.AF * current_oscillator.feeding + stimulus[index] + feeding_influence;
		linking[index] = m_params.AL * current_oscillator.linking + linking_influence;

		/* calculate internal activity */
		double internal_activity = feeding[index] * (1.0 + m_params.B * linking[index]);

		/* calculate output of the oscillator */
		if (internal_activity > current_oscillator.threshold) {
			outputs[index] = OUTPUT_ACTIVE_STATE;
		}
		else {
			outputs[index] = OUTPUT_INACTIVE_STATE;
		}
	}

	/* fast linking */
	if (m_params.FAST_LINKING) {
		fast_linking(feeding, linking, outputs);
	}

	/* update states of oscillators */
	for (unsigned int index = 0; index < size(); index++) {
		pcnn_oscillator & oscillator = m_oscillators[index];

		oscillator.feeding = feeding[index];
		oscillator.linking = linking[index];
		oscillator.output = outputs[index];
		oscillator.threshold = m_params.AT * oscillator.threshold + m_params.VT * outputs[index];
	}
}
Пример #7
0
bool ansi_c_languaget::typecheck(
  symbol_tablet &symbol_table,
  const std::string &module)
{
  symbol_tablet new_symbol_table;

  if(ansi_c_typecheck(parse_tree, new_symbol_table, module, get_message_handler()))
    return true;

  remove_internal_symbols(new_symbol_table);
  
  if(linking(symbol_table, new_symbol_table, get_message_handler()))
    return true;
    
  return false;
}
Пример #8
0
/* measure the target prover using SYN_DATA train */
void TrainEngine::measure_syn_data(int train_size, uint16_t tcp_sp, uint32_t tcp_seq)
{
    if (train_size > MAX_SYN_DATA_LEN)
    {
        gen_tcp_of_data(MAX_SYN_DATA_LEN, tcp_sp, tcp_seq);
    }
    else
    {
        gen_tcp_syn_data(train_size, tcp_sp, tcp_seq);
    }
    send_train();
    linking();
    logger->PrintLog("[%s:%d] SYN_DATA: %d, %d\n", __FILE__, __LINE__, request_cnt_, response_cnt_);
    reporting();
    cleanup();
}
Пример #9
0
/* measure the target prover using TIME_DATA train */
void TrainEngine::measure_time_data(int train_size, uint16_t tcp_sp, uint32_t tcp_seq, uint32_t tcp_timeval)
{
    tcp_flow_open(tcp_sp, tcp_seq, tcp_timeval);
    if (train_size > MAX_TIME_DATA_LEN)
    {
        gen_tcp_time_data(MAX_TIME_DATA_LEN, tcp_sp, tcp_timeval + 2);
    }
    else
    {
        gen_tcp_time_data(train_size, tcp_sp, tcp_timeval + 2);
    }
    send_train();
    linking();
    logger->PrintLog("[%s:%d] TIME_DATA: %d, %d\n", __FILE__, __LINE__, request_cnt_, response_cnt_);
    tcp_flow_close(tcp_sp);
    reporting();
    cleanup();
}