/* Process model C form file: xxx_splitter_DP_tx_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 xxx_splitter_DP_tx_proc_pr_c [] = "MIL_3_Tfile_Hdr_ 145A 30A op_runsim 7 59052F54 59052F54 1 winxpvm FEKT 0 0 none none 0 0 none 0 0 0 0 0 0 0 0 1e80 8                                                                                                                                                                                                                                                                                                                                                                                                           ";
#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	                    		ID                                              ;
	int	                    		parent_ID                                       ;
	int	                    		MAC                                             ;
	} xxx_splitter_DP_tx_proc_state;

#define ID                      		op_sv_ptr->ID
#define parent_ID               		op_sv_ptr->parent_ID
#define MAC                     		op_sv_ptr->MAC

/* 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	xxx_splitter_DP_tx_proc_state *op_sv_ptr;
#define FIN_PREAMBLE_CODE	\
		op_sv_ptr = ((xxx_splitter_DP_tx_proc_state *)(OP_SIM_CONTEXT_PTR->_op_mod_state_ptr));


/* No Function Block */

#if !defined (VOSD_NO_FIN)
enum { _op_block_origin = __LINE__ };
#endif

/* 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 xxx_splitter_DP_tx_proc (OP_SIM_CONTEXT_ARG_OPT);
	VosT_Obtype _op_xxx_splitter_DP_tx_proc_init (int * init_block_ptr);
	void _op_xxx_splitter_DP_tx_proc_diag (OP_SIM_CONTEXT_ARG_OPT);
	void _op_xxx_splitter_DP_tx_proc_terminate (OP_SIM_CONTEXT_ARG_OPT);
	VosT_Address _op_xxx_splitter_DP_tx_proc_alloc (VosT_Obtype, int);
	void _op_xxx_splitter_DP_tx_proc_svar (void *, const char *, void **);


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




/* Process model interrupt handling procedure */


void
xxx_splitter_DP_tx_proc (OP_SIM_CONTEXT_ARG_OPT)
	{
#if !defined (VOSD_NO_FIN)
	int _op_block_origin = 0;
#endif
	FIN_MT (xxx_splitter_DP_tx_proc ());

		{


		FSM_ENTER_NO_VARS ("xxx_splitter_DP_tx_proc")

		FSM_BLOCK_SWITCH
			{
			/*---------------------------------------------------------*/
			/** state (idle) enter executives **/
			FSM_STATE_ENTER_UNFORCED (0, "idle", state0_enter_exec, "xxx_splitter_DP_tx_proc [idle enter execs]")

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


			/** state (idle) exit executives **/
			FSM_STATE_EXIT_UNFORCED (0, "idle", "xxx_splitter_DP_tx_proc [idle exit execs]")


			/** state (idle) transition processing **/
			FSM_TRANSIT_ONLY ((PK_ARRVL), 1, state1_enter_exec, ;, idle, "PK_ARRVL", "", "idle", "pk_send", "tr_0", "xxx_splitter_DP_tx_proc [idle -> pk_send : PK_ARRVL / ]")
				/*---------------------------------------------------------*/



			/** state (pk_send) enter executives **/
			FSM_STATE_ENTER_FORCED (1, "pk_send", state1_enter_exec, "xxx_splitter_DP_tx_proc [pk_send enter execs]")
				FSM_PROFILE_SECTION_IN ("xxx_splitter_DP_tx_proc [pk_send enter execs]", state1_enter_exec)
				{
				Packet * pk_arrived;
				
				pk_arrived = op_pk_get (op_intrpt_strm ());
				
				
				op_pk_send (pk_arrived, 0);
				}
				FSM_PROFILE_SECTION_OUT (state1_enter_exec)

			/** state (pk_send) exit executives **/
			FSM_STATE_EXIT_FORCED (1, "pk_send", "xxx_splitter_DP_tx_proc [pk_send exit execs]")


			/** state (pk_send) transition processing **/
			FSM_TRANSIT_FORCE (0, state0_enter_exec, ;, "default", "", "pk_send", "idle", "tr_1", "xxx_splitter_DP_tx_proc [pk_send -> idle : default / ]")
				/*---------------------------------------------------------*/



			}


		FSM_EXIT (0,"xxx_splitter_DP_tx_proc")
		}
	}




void
_op_xxx_splitter_DP_tx_proc_diag (OP_SIM_CONTEXT_ARG_OPT)
	{
	/* No Diagnostic Block */
	}




void
_op_xxx_splitter_DP_tx_proc_terminate (OP_SIM_CONTEXT_ARG_OPT)
	{

	FIN_MT (_op_xxx_splitter_DP_tx_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_xxx_splitter_DP_tx_proc_svar function. */
#undef ID
#undef parent_ID
#undef MAC

#undef FIN_PREAMBLE_DEC
#undef FIN_PREAMBLE_CODE

#define FIN_PREAMBLE_DEC
#define FIN_PREAMBLE_CODE

VosT_Obtype
_op_xxx_splitter_DP_tx_proc_init (int * init_block_ptr)
	{
	VosT_Obtype obtype = OPC_NIL;
	FIN_MT (_op_xxx_splitter_DP_tx_proc_init (init_block_ptr))

	obtype = Vos_Define_Object_Prstate ("proc state vars (xxx_splitter_DP_tx_proc)",
		sizeof (xxx_splitter_DP_tx_proc_state));
	*init_block_ptr = 0;

	FRET (obtype)
	}

VosT_Address
_op_xxx_splitter_DP_tx_proc_alloc (VosT_Obtype obtype, int init_block)
	{
#if !defined (VOSD_NO_FIN)
	int _op_block_origin = 0;
#endif
	xxx_splitter_DP_tx_proc_state * ptr;
	FIN_MT (_op_xxx_splitter_DP_tx_proc_alloc (obtype))

	ptr = (xxx_splitter_DP_tx_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 = "xxx_splitter_DP_tx_proc [idle enter execs]";
#endif
		}
	FRET ((VosT_Address)ptr)
	}



void
_op_xxx_splitter_DP_tx_proc_svar (void * gen_ptr, const char * var_name, void ** var_p_ptr)
	{
	xxx_splitter_DP_tx_proc_state		*prs_ptr;

	FIN_MT (_op_xxx_splitter_DP_tx_proc_svar (gen_ptr, var_name, var_p_ptr))

	if (var_name == OPC_NIL)
		{
		*var_p_ptr = (void *)OPC_NIL;
		FOUT
		}
	prs_ptr = (xxx_splitter_DP_tx_proc_state *)gen_ptr;

	if (strcmp ("ID" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->ID);
		FOUT
		}
	if (strcmp ("parent_ID" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->parent_ID);
		FOUT
		}
	if (strcmp ("MAC" , var_name) == 0)
		{
		*var_p_ptr = (void *) (&prs_ptr->MAC);
		FOUT
		}
	*var_p_ptr = (void *)OPC_NIL;

	FOUT
	}

