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

📄 trafbuild.pr.c

📁 Model for Opnet. Use this model to generate traffic between source and destination pairs. The resul
💻 C
字号:
/* Process model C form file: trafbuild.pr.c */
/* Portions of this file copyright 1992-2000 by OPNET, Inc. */



/* This variable carries the header into the object file */
static const char trafbuild_pr_c [] = "MIL_3_Tfile_Hdr_ 70B 30A op_mkso 7 3A226673 3A226673 1 wtn10073 jstrohm 0 0 none none 0 0 none 0 0 0 0 0 0                                                                                                                                                                                                                                                                                                                                                                                                                     ";
#include <string.h>



/* OPNET system definitions */
#include <opnet.h>

#if defined (__cplusplus)
extern "C" {
#endif
FSM_EXT_DECS
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif


/* Header Block */

#include "trafbuild.h"

/* End of Header Block */


#if !defined (VOSD_NO_FIN)
#undef	BIN
#undef	BOUT
#define	BIN		FIN_LOCAL_FIELD(last_line_passed) = __LINE__ - _block_origin;
#define	BOUT	BIN
#define	BINIT	FIN_LOCAL_FIELD(last_line_passed) = 0; _block_origin = __LINE__;
#else
#define	BINIT
#endif /* #if !defined (VOSD_NO_FIN) */



/* State variable definitions */
typedef struct
	{
	/* Internal state tracking for FSM */
	FSM_SYS_STATE
	} trafbuild_state;

#define pr_state_ptr            		((trafbuild_state*) SimI_Mod_State_Ptr)

/* This macro definition will define a local variable called	*/
/* "op_sv_ptr" in each function containing a FIN statement.	*/
/* This variable points to the state variable data structure,	*/
/* and can be used from a C debugger to display their values.	*/
#undef FIN_PREAMBLE
#define FIN_PREAMBLE	trafbuild_state *op_sv_ptr = pr_state_ptr;


/* No Function Block */

enum { _block_origin = __LINE__ };

#if defined (__cplusplus)
extern "C" {
#endif
	void trafbuild (void);
	Compcode trafbuild_init (void **);
	void trafbuild_diag (void);
	void trafbuild_terminate (void);
	void trafbuild_svar (void *, const char *, char **);
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif




/* Process model interrupt handling procedure */


void
trafbuild (void)
	{
	int _block_origin = 0;
	FIN (trafbuild ());
	if (1)
		{
		Boolean	traffic_creation;
		List	*specs_list_ptr;
		double	start_time, end_time;


		FSM_ENTER (trafbuild)

		FSM_BLOCK_SWITCH
			{
			/*---------------------------------------------------------*/
			/** state (trafbuild) enter executives **/
			FSM_STATE_ENTER_UNFORCED (0, state0_enter_exec, "trafbuild", "trafbuild () [trafbuild enter execs]")
				{
				/* Check to see if this node is being used to create traffic.	*/
				op_ima_obj_attr_get (op_id_self (), "Traffic Creation", &traffic_creation);
				
				/* Perform further actions only if this node is being used to	*/
				/* create traffic.												*/
				if (traffic_creation == OPC_TRUE)
				{
					/* Parse the conversation specification information.		*/
					specs_list_ptr = trafbuild_specs_parse (&start_time, &end_time);
				
					/* Write out the conversation specification information.	*/
					trafbuild_specs_write (specs_list_ptr, start_time, end_time);
				}
				}


			/** blocking after enter executives of unforced state. **/
			FSM_EXIT (1,trafbuild)


			/** state (trafbuild) exit executives **/
			FSM_STATE_EXIT_UNFORCED (0, state0_exit_exec, "trafbuild", "trafbuild () [trafbuild exit execs]")
				{
				}


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



			}


		FSM_EXIT (0,trafbuild)
		}
	}

#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
trafbuild_init (void ** gen_state_pptr)
	{
	int _block_origin = 0;
	static VosT_Address	obtype = OPC_NIL;

	FIN (trafbuild_init (gen_state_pptr))

	if (obtype == OPC_NIL)
		{
		/* Initialize memory management */
		if (Vos_Catmem_Register ("proc state vars (trafbuild)",
			sizeof (trafbuild_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 */
		((trafbuild_state *)(*gen_state_pptr))->current_block = 0;

		FRET (OPC_COMPCODE_SUCCESS)
		}
	}



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




void
trafbuild_terminate (void)
	{
	int _block_origin = __LINE__;

	FIN (trafbuild_terminate (void))

	if (1)
		{
		Boolean	traffic_creation;
		List	*specs_list_ptr;
		double	start_time, end_time;

		/* Termination Block */


		BINIT
		

		/* End of Termination Block */

		}
	Vos_Catmem_Dealloc (pr_state_ptr);

	FOUT;
	}




void
trafbuild_svar (void * gen_ptr, const char * var_name, char ** var_p_ptr)
	{

	FIN (trafbuild_svar (gen_ptr, var_name, var_p_ptr))

	*var_p_ptr = (char *)OPC_NIL;

	FOUT;
	}

⌨️ 快捷键说明

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