⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 obs_stord.pr.c

📁 实验室前辈用OPNET做的光突发交换网络的仿真实验
💻 C
📖 第 1 页 / 共 2 页
字号:
				{
					burst_storded_ptr = (BURST_STORDED *)op_prg_list_access(stored_burst_list_ptr,i);
					if(burst_storded_ptr->id == temp_code)	
					{
						burst_storded_ptr = op_prg_list_remove(stored_burst_list_ptr,i);
						burst_count_send++;
						burst_size_send = op_pk_total_size_get(burst_storded_ptr->pk);
						burst_size_total_send =	burst_size_total_send + burst_size_send;
						burst_avg_size_send = (double)(burst_size_total_send/(double)burst_count_send);
						op_stat_write(burst_count_send_stathandle,burst_count_send);
						op_stat_write(burst_size_send_stathandle,burst_size_send);
						op_stat_write(burst_avg_size_send_stathandle,burst_avg_size_send);
						burst_count_total_send++;
						op_stat_write(burst_count_total_send_stathandle,burst_count_total_send);
						
						
						//op_pk_nfd_get (burst_storded_ptr->pk, "destination address", &e_d);
						//op_pk_nfd_get (burst_storded_ptr->pk, "source address", &e_s);
						//op_pk_nfd_get (burst_storded_ptr->pk, "id", &e_id);
						//op_pk_nfd_get (burst_storded_ptr->pk, "sim time", &e_time);
						op_pk_send(burst_storded_ptr->pk,PK_OUT_STRM);
						//printf("burst_send=%d,s=%d,d=%d,id=%d, time=%f\n",burst_count_total_send,e_s,e_d,e_id,e_time);
						//getchar();
						loop_flag_i = 0;	
					}		
					i++;	
				}
				op_prg_mem_free(burst_storded_ptr);
				//printf("burst:burst send:,sim=%f\n",op_sim_time());
				
				
				
				
				
				
				
				
				//List element
				//for 
					//List access
					//get burst id
					//if(burst id == op_intrpt_code();
						 // remove from List
						 // send burst
				}


			/** state (send) exit executives **/
			FSM_STATE_EXIT_FORCED (3, "send", "OBS_stord () [send exit execs]")
				{
				}


			/** state (send) transition processing **/
			FSM_TRANSIT_FORCE (1, state1_enter_exec, ;, "default", "", "send", "wait")
				/*---------------------------------------------------------*/



			/** state (end) enter executives **/
			FSM_STATE_ENTER_UNFORCED (4, state4_enter_exec, "end", "OBS_stord () [end enter execs]")
				{
				}


			/** blocking after enter executives of unforced state. **/
			FSM_EXIT (9,OBS_stord)


			/** state (end) exit executives **/
			FSM_STATE_EXIT_UNFORCED (4, "end", "OBS_stord () [end exit execs]")
				{
				}


			/** state (end) transition processing **/
			FSM_TRANSIT_MISSING ("end")
				/*---------------------------------------------------------*/



			}


		FSM_EXIT (0,OBS_stord)
		}
	}

#if defined (__cplusplus)
	extern "C" { 
#endif
	extern VosT_Fun_Status Vos_Catmem_Register (const char * , int , VosT_Void_Null_Proc, VosT_Address *);
	extern VosT_Address Vos_Catmem_Alloc (VosT_Address, size_t);
	extern VosT_Fun_Status Vos_Catmem_Dealloc (VosT_Address);
#if defined (__cplusplus)
	}
#endif


Compcode
OBS_stord_init (void ** gen_state_pptr)
	{
	int _block_origin = 0;
	static VosT_Address	obtype = OPC_NIL;

	FIN (OBS_stord_init (gen_state_pptr))

	if (obtype == OPC_NIL)
		{
		/* Initialize memory management */
		if (Vos_Catmem_Register ("proc state vars (OBS_stord)",
			sizeof (OBS_stord_state), Vos_Vnop, &obtype) == VOSC_FAILURE)
			{
			FRET (OPC_COMPCODE_FAILURE)
			}
		}

	*gen_state_pptr = Vos_Catmem_Alloc (obtype, 1);
	if (*gen_state_pptr == OPC_NIL)
		{
		FRET (OPC_COMPCODE_FAILURE)
		}
	else
		{
		/* Initialize FSM handling */
		((OBS_stord_state *)(*gen_state_pptr))->current_block = 0;

		FRET (OPC_COMPCODE_SUCCESS)
		}
	}



void
OBS_stord_diag (void)
	{
	/* No Diagnostic Block */
	}




void
OBS_stord_terminate (void)
	{
	int _block_origin = __LINE__;

	FIN (OBS_stord_terminate (void))

	if (1)
		{
		Packet*		pkptr;
		double		pk_size;
		double		ete_delay;
		double		duration_time;
		int 		i;
		int			strm_num;
		int			list_element_num;
		int 		loop_flag_i;
		int 		temp_code;
		BURST_STORDED *	burst_storded;
		BURST_STORDED *	burst_storded_ptr;
		double		temp_time;
		
		int  e_s;
		int  e_d;
		int  e_id;
		double e_time;
			

		/* No Termination Block */

		}
	Vos_Catmem_Dealloc (pr_state_ptr);

	FOUT;
	}


/* Undefine shortcuts to state variables to avoid */
/* syntax error in direct access to fields of */
/* local variable prs_ptr in OBS_stord_svar function. */
#undef bits_rcvd_stathandle
#undef bitssec_rcvd_stathandle
#undef pkts_rcvd_stathandle
#undef pktssec_rcvd_stathandle
#undef ete_delay_stathandle
#undef bits_rcvd_gstathandle
#undef bitssec_rcvd_gstathandle
#undef pkts_rcvd_gstathandle
#undef pktssec_rcvd_gstathandle
#undef ete_delay_gstathandle
#undef stored_burst_list_ptr
#undef code
#undef burst_count_send
#undef burst_count_send_stathandle
#undef burst_size_send
#undef burst_size_send_stathandle
#undef burst_avg_size_send
#undef burst_avg_size_send_stathandle
#undef burst_size_total_send
#undef burst_count_total_send_stathandle
#undef burst_count_total_stay_stathandle



void
OBS_stord_svar (void * gen_ptr, const char * var_name, char ** var_p_ptr)
	{
	OBS_stord_state		*prs_ptr;

	FIN (OBS_stord_svar (gen_ptr, var_name, var_p_ptr))

	if (var_name == OPC_NIL)
		{
		*var_p_ptr = (char *)OPC_NIL;
		FOUT;
		}
	prs_ptr = (OBS_stord_state *)gen_ptr;

	if (strcmp ("bits_rcvd_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->bits_rcvd_stathandle);
		FOUT;
		}
	if (strcmp ("bitssec_rcvd_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->bitssec_rcvd_stathandle);
		FOUT;
		}
	if (strcmp ("pkts_rcvd_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->pkts_rcvd_stathandle);
		FOUT;
		}
	if (strcmp ("pktssec_rcvd_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->pktssec_rcvd_stathandle);
		FOUT;
		}
	if (strcmp ("ete_delay_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->ete_delay_stathandle);
		FOUT;
		}
	if (strcmp ("bits_rcvd_gstathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->bits_rcvd_gstathandle);
		FOUT;
		}
	if (strcmp ("bitssec_rcvd_gstathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->bitssec_rcvd_gstathandle);
		FOUT;
		}
	if (strcmp ("pkts_rcvd_gstathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->pkts_rcvd_gstathandle);
		FOUT;
		}
	if (strcmp ("pktssec_rcvd_gstathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->pktssec_rcvd_gstathandle);
		FOUT;
		}
	if (strcmp ("ete_delay_gstathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->ete_delay_gstathandle);
		FOUT;
		}
	if (strcmp ("stored_burst_list_ptr" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->stored_burst_list_ptr);
		FOUT;
		}
	if (strcmp ("code" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->code);
		FOUT;
		}
	if (strcmp ("burst_count_send" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_count_send);
		FOUT;
		}
	if (strcmp ("burst_count_send_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_count_send_stathandle);
		FOUT;
		}
	if (strcmp ("burst_size_send" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_size_send);
		FOUT;
		}
	if (strcmp ("burst_size_send_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_size_send_stathandle);
		FOUT;
		}
	if (strcmp ("burst_avg_size_send" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_avg_size_send);
		FOUT;
		}
	if (strcmp ("burst_avg_size_send_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_avg_size_send_stathandle);
		FOUT;
		}
	if (strcmp ("burst_size_total_send" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_size_total_send);
		FOUT;
		}
	if (strcmp ("burst_count_total_send_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_count_total_send_stathandle);
		FOUT;
		}
	if (strcmp ("burst_count_total_stay_stathandle" , var_name) == 0)
		{
		*var_p_ptr = (char *) (&prs_ptr->burst_count_total_stay_stathandle);
		FOUT;
		}
	*var_p_ptr = (char *)OPC_NIL;

	FOUT;
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -