📄 atkk1_tx.pr.c
字号:
/* Process model C form file: atkk1_tx.pr.c */
/* Portions of this file copyright 1992-2002 by OPNET Technologies, Inc. */
/* This variable carries the header into the object file */
static const char atkk1_tx_pr_c [] = "MIL_3_Tfile_Hdr_ 90A 30A op_runsim 7 433F9A9A 433F9A9A 1 pc50290 atk016000 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 */
/* Input stream from ideal generator module*/
#define IN_STRM 0
/* Output stream from ideal generator module*/
#define OUT_STRM 0
/* Conditional macros*/
#define PKT_ARVL (op_intrpt_type() == OPC_INTRPT_STRM)
/* Global Variable */
extern int subm_pkts;
/* 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
} atkk1_tx_state;
#define pr_state_ptr ((atkk1_tx_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 atkk1_tx_state *op_sv_ptr = pr_state_ptr;
/* No Function Block */
enum { _block_origin = __LINE__ };
/* 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 atkk1_tx (void);
Compcode atkk1_tx_init (void **);
void atkk1_tx_diag (void);
void atkk1_tx_terminate (void);
void atkk1_tx_svar (void *, const char *, char **);
#if defined (__cplusplus)
} /* end of 'extern "C"' */
#endif
/* Process model interrupt handling procedure */
void
atkk1_tx (void)
{
int _block_origin = 0;
FIN (atkk1_tx ());
if (1)
{
/* Outgoing packet */
Packet* out_pkt;
FSM_ENTER (atkk1_tx)
FSM_BLOCK_SWITCH
{
/*---------------------------------------------------------*/
/** state (idle) enter executives **/
FSM_STATE_ENTER_UNFORCED (0, state0_enter_exec, "idle", "atkk1_tx [idle enter execs]")
FSM_PROFILE_SECTION_IN ("atkk1_tx [idle enter execs]", state0_enter_exec)
{
}
FSM_PROFILE_SECTION_OUT ("atkk1_tx [idle enter execs]", state0_enter_exec)
/** blocking after enter executives of unforced state. **/
FSM_EXIT (1,atkk1_tx)
/** state (idle) exit executives **/
FSM_STATE_EXIT_UNFORCED (0, "idle", "atkk1_tx [idle exit execs]")
FSM_PROFILE_SECTION_IN ("atkk1_tx [idle exit execs]", state0_exit_exec)
{
}
FSM_PROFILE_SECTION_OUT ("atkk1_tx [idle exit execs]", state0_exit_exec)
/** state (idle) transition processing **/
FSM_TRANSIT_ONLY ((PKT_ARVL), 1, state1_enter_exec, ;, "idle", "PKT_ARVL", "", "idle", "tx_pkt")
/*---------------------------------------------------------*/
/** state (tx_pkt) enter executives **/
FSM_STATE_ENTER_FORCED (1, state1_enter_exec, "tx_pkt", "atkk1_tx [tx_pkt enter execs]")
FSM_PROFILE_SECTION_IN ("atkk1_tx [tx_pkt enter execs]", state1_enter_exec)
{
/* A packet has arrived for transmission. Acquire */
/* the packet from the input stream,send the packet */
/* and update the global submitted packet counter */
out_pkt = op_pk_get (IN_STRM);
op_pk_send (out_pkt, OUT_STRM);
++subm_pkts;
/* Compare the total number of packets submitted with*/
/* the maximum set for this simulation run. If equal,*/
/* end the simulation run */
}
FSM_PROFILE_SECTION_OUT ("atkk1_tx [tx_pkt enter execs]", state1_enter_exec)
/** state (tx_pkt) exit executives **/
FSM_STATE_EXIT_FORCED (1, "tx_pkt", "atkk1_tx [tx_pkt exit execs]")
FSM_PROFILE_SECTION_IN ("atkk1_tx [tx_pkt exit execs]", state1_exit_exec)
{
}
FSM_PROFILE_SECTION_OUT ("atkk1_tx [tx_pkt exit execs]", state1_exit_exec)
/** state (tx_pkt) transition processing **/
FSM_TRANSIT_FORCE (0, state0_enter_exec, ;, "default", "", "tx_pkt", "idle")
/*---------------------------------------------------------*/
}
FSM_EXIT (0,atkk1_tx)
}
}
#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
atkk1_tx_init (void ** gen_state_pptr)
{
int _block_origin = 0;
static VosT_Address obtype = OPC_NIL;
FIN (atkk1_tx_init (gen_state_pptr))
if (obtype == OPC_NIL)
{
/* Initialize memory management */
if (Vos_Catmem_Register ("proc state vars (atkk1_tx)",
sizeof (atkk1_tx_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 */
((atkk1_tx_state *)(*gen_state_pptr))->current_block = 0;
FRET (OPC_COMPCODE_SUCCESS)
}
}
void
atkk1_tx_diag (void)
{
/* No Diagnostic Block */
}
void
atkk1_tx_terminate (void)
{
int _block_origin = __LINE__;
FIN (atkk1_tx_terminate (void))
Vos_Catmem_Dealloc (pr_state_ptr);
FOUT
}
void
atkk1_tx_svar (void * gen_ptr, const char * var_name, char ** var_p_ptr)
{
FIN (atkk1_tx_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 + -