www.pudn.com > baojiaohuan.rar > initials_pksw_hub_proc.pr.c, change:2014-07-09,size:6756b


/* Process model C form file: initials_pksw_hub_proc.pr.c */ 
/* Portions of this file copyright 1986-2008 by OPNET Technologies, Inc. */ 
 
 
 
/* This variable carries the header into the object file */ 
const char initials_pksw_hub_proc_pr_c [] = "MIL_3_Tfile_Hdr_ 145A 30A op_runsim 7 526A301D 526A301D 1 PC0913-48427 Administrator 0 0 none none 0 0 none 0 0 0 0 0 0 0 0 1d79 5                                                                                                                                                                                                                                                                                                                                                                                             "; 
#include <string.h> 
 
 
 
/* OPNET system definitions */ 
#include <opnet.h> 
 
 
 
/* Header Block */ 
 
#define PK_ARRVL (op_intrpt_type()==OPC_INTRPT_STRM) 
 
/* End of Header Block */ 
 
#if !defined (VOSD_NO_FIN) 
#undef	BIN 
#undef	BOUT 
#define	BIN		FIN_LOCAL_FIELD(_op_last_line_passed) = __LINE__ - _op_block_origin; 
#define	BOUT	BIN 
#define	BINIT	FIN_LOCAL_FIELD(_op_last_line_passed) = 0; _op_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 
	/* State Variables */ 
	int	                    		op_pk_sent                                      ; 
	} initials_pksw_hub_proc_state; 
 
#define op_pk_sent              		op_sv_ptr->op_pk_sent 
 
/* These macro definitions 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_DEC 
#undef FIN_PREAMBLE_CODE 
#define FIN_PREAMBLE_DEC	initials_pksw_hub_proc_state *op_sv_ptr; 
#define FIN_PREAMBLE_CODE	\ 
		op_sv_ptr = ((initials_pksw_hub_proc_state *)(OP_SIM_CONTEXT_PTR->_op_mod_state_ptr)); 
 
 
/* Function Block */ 
 
#if !defined (VOSD_NO_FIN) 
enum { _op_block_origin = __LINE__ + 2}; 
#endif 
 
static void route_pk(void) 
	{ 
	int dest_address; 
	Packet*pkptr; 
	FIN(route_pk()); 
	pkptr=op_pk_get(op_intrpt_strm()); 
	op_pk_nfd_get(pkptr,"dest_address",&dest_address); 
	op_pk_sent(pkptr,dest_address); 
	} 
 
/* End of Function Block */ 
 
/* Undefine optional tracing in FIN/FOUT/FRET */ 
/* The FSM has its own tracing code and the other */ 
/* functions should not have any tracing.		  */ 
#undef FIN_TRACING 
#define FIN_TRACING 
 
#undef FOUTRET_TRACING 
#define FOUTRET_TRACING 
 
#if defined (__cplusplus) 
extern "C" { 
#endif 
	void initials_pksw_hub_proc (OP_SIM_CONTEXT_ARG_OPT); 
	VosT_Obtype _op_initials_pksw_hub_proc_init (int * init_block_ptr); 
	void _op_initials_pksw_hub_proc_diag (OP_SIM_CONTEXT_ARG_OPT); 
	void _op_initials_pksw_hub_proc_terminate (OP_SIM_CONTEXT_ARG_OPT); 
	VosT_Address _op_initials_pksw_hub_proc_alloc (VosT_Obtype, int); 
	void _op_initials_pksw_hub_proc_svar (void *, const char *, void **); 
 
 
#if defined (__cplusplus) 
} /* end of 'extern "C"' */ 
#endif 
 
 
 
 
/* Process model interrupt handling procedure */ 
 
 
void 
initials_pksw_hub_proc (OP_SIM_CONTEXT_ARG_OPT) 
	{ 
#if !defined (VOSD_NO_FIN) 
	int _op_block_origin = 0; 
#endif 
	FIN_MT (initials_pksw_hub_proc ()); 
 
		{ 
 
 
		FSM_ENTER ("initials_pksw_hub_proc") 
 
		FSM_BLOCK_SWITCH 
			{ 
			/*---------------------------------------------------------*/ 
			/** state (idle) enter executives **/ 
			FSM_STATE_ENTER_UNFORCED (0, "idle", state0_enter_exec, "initials_pksw_hub_proc [idle enter execs]") 
 
			/** blocking after enter executives of unforced state. **/ 
			FSM_EXIT (1,"initials_pksw_hub_proc") 
 
 
			/** state (idle) exit executives **/ 
			FSM_STATE_EXIT_UNFORCED (0, "idle", "initials_pksw_hub_proc [idle exit execs]") 
 
 
			/** state (idle) transition processing **/ 
			FSM_PROFILE_SECTION_IN ("initials_pksw_hub_proc [idle trans conditions]", state0_trans_conds) 
			FSM_INIT_COND (PK_ARRVL) 
			FSM_DFLT_COND 
			FSM_TEST_LOGIC ("idle") 
			FSM_PROFILE_SECTION_OUT (state0_trans_conds) 
 
			FSM_TRANSIT_SWITCH 
				{ 
				FSM_CASE_TRANSIT (0, 0, state0_enter_exec, route_pk();, "PK_ARRVL", "route_pk()", "idle", "idle", "(PK_ARRVL)/route_pk()", "initials_pksw_hub_proc [idle -> idle : PK_ARRVL / route_pk()]") 
				FSM_CASE_TRANSIT (1, 0, state0_enter_exec, ;, "default", "", "idle", "idle", "(default)", "initials_pksw_hub_proc [idle -> idle : default / ]") 
				} 
				/*---------------------------------------------------------*/ 
 
 
 
			} 
 
 
		FSM_EXIT (0,"initials_pksw_hub_proc") 
		} 
	} 
 
 
 
 
void 
_op_initials_pksw_hub_proc_diag (OP_SIM_CONTEXT_ARG_OPT) 
	{ 
	/* No Diagnostic Block */ 
	} 
 
 
 
 
void 
_op_initials_pksw_hub_proc_terminate (OP_SIM_CONTEXT_ARG_OPT) 
	{ 
 
	FIN_MT (_op_initials_pksw_hub_proc_terminate ()) 
 
 
	/* No Termination Block */ 
 
	Vos_Poolmem_Dealloc (op_sv_ptr); 
 
	FOUT 
	} 
 
 
/* Undefine shortcuts to state variables to avoid */ 
/* syntax error in direct access to fields of */ 
/* local variable prs_ptr in _op_initials_pksw_hub_proc_svar function. */ 
#undef op_pk_sent 
 
#undef FIN_PREAMBLE_DEC 
#undef FIN_PREAMBLE_CODE 
 
#define FIN_PREAMBLE_DEC 
#define FIN_PREAMBLE_CODE 
 
VosT_Obtype 
_op_initials_pksw_hub_proc_init (int * init_block_ptr) 
	{ 
	VosT_Obtype obtype = OPC_NIL; 
	FIN_MT (_op_initials_pksw_hub_proc_init (init_block_ptr)) 
 
	obtype = Vos_Define_Object_Prstate ("proc state vars (initials_pksw_hub_proc)", 
		sizeof (initials_pksw_hub_proc_state)); 
	*init_block_ptr = 0; 
 
	FRET (obtype) 
	} 
 
VosT_Address 
_op_initials_pksw_hub_proc_alloc (VosT_Obtype obtype, int init_block) 
	{ 
#if !defined (VOSD_NO_FIN) 
	int _op_block_origin = 0; 
#endif 
	initials_pksw_hub_proc_state * ptr; 
	FIN_MT (_op_initials_pksw_hub_proc_alloc (obtype)) 
 
	ptr = (initials_pksw_hub_proc_state *)Vos_Alloc_Object (obtype); 
	if (ptr != OPC_NIL) 
		{ 
		ptr->_op_current_block = init_block; 
#if defined (OPD_ALLOW_ODB) 
		ptr->_op_current_state = "initials_pksw_hub_proc [idle enter execs]"; 
#endif 
		} 
	FRET ((VosT_Address)ptr) 
	} 
 
 
 
void 
_op_initials_pksw_hub_proc_svar (void * gen_ptr, const char * var_name, void ** var_p_ptr) 
	{ 
	initials_pksw_hub_proc_state		*prs_ptr; 
 
	FIN_MT (_op_initials_pksw_hub_proc_svar (gen_ptr, var_name, var_p_ptr)) 
 
	if (var_name == OPC_NIL) 
		{ 
		*var_p_ptr = (void *)OPC_NIL; 
		FOUT 
		} 
	prs_ptr = (initials_pksw_hub_proc_state *)gen_ptr; 
 
	if (strcmp ("op_pk_sent" , var_name) == 0) 
		{ 
		*var_p_ptr = (void *) (&prs_ptr->op_pk_sent); 
		FOUT 
		} 
	*var_p_ptr = (void *)OPC_NIL; 
 
	FOUT 
	}