public class TCPPacketTransmitter extends OutputDevice
This actor should be directly connected to a network output port and be used with a PTIDES director.
This actor is expected to be used in pairs with the TCPPacketReceiver
.
TCPPacketTransmitter
builds TCP packets containing PTIDES events,
where each PTIDES event itself is assigned a data length in bits by the user.
The bits/event parameter is constant right now and is an actor Parameter.
At the destination platform, TCPPacketReceiver
consumes packages produced
by this actor and releases PTIDES events into its enclosing director.
This actor consumes frameSize number of input tokens and creates a RecordToken with two fields labeled as TCPlabel and tokens. Here, tokens itself is an array of RecordTokens, where each of the entries is a PTIDES RecordToken with labels: timestamp, microstep and payload. Once the number of received tokens equals frameSize, the RecordToken simulating the TCP Packet is sent to output port. During wrapup, the remaining tokens(if any) are sent to the output.
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
Parameter |
defaultFrameSize
The default TCP Packet size parameter.
|
PortParameter |
frameSize
User-Defined frame size port parameter.
|
TypedIOPort |
input
The data input port.
|
TypedIOPort |
output
The data output port, which is a RecordToken.
|
Parameter |
priority
Default TCP Packet priority parameter.
|
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
TCPPacketTransmitter(CompositeEntity container,
java.lang.String name)
Construct a TCPPacketTransmitter.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.Set<Inequality> |
_defaultTypeConstraints()
Do not establish the usual default type constraints.
|
void |
attributeChanged(Attribute attribute)
If the argument is the defaultFrameSize or
priority, then set the specified values.
|
void |
fire()
Create a RecordToken with two labels: TCPlabel and tokens
tokens is a token array that contains the input tokens consumed
TCPlabel is the TCP Header structure containing the fields defined
in getTCPHeader()
Once the number of received tokens equals specified frame size,
an output packet is sent to the output port.
|
RecordToken |
getTCPHeader()
Fill-in and return fields of the TCP header as a RecordToken.
|
void |
preinitialize()
Perform a check to see if this device is connected to a network
port on the outside.
|
void |
wrapup()
Send the remaining tokens to the output port during wrapup.
|
_containedTypeConstraints, _customTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, initialize, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, initialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public TypedIOPort input
public TypedIOPort output
public Parameter defaultFrameSize
public Parameter priority
public PortParameter frameSize
public TCPPacketTransmitter(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- the container of the TCPPacketTransmitter.name
- the name of the TCPPacketTransmitter.IllegalActionException
- If the TCPPacketTransmitter cannot be constructed.NameDuplicationException
- If there is a name collision.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If value is less than zero.public RecordToken getTCPHeader() throws IllegalActionException
IllegalActionException
- If the RecordToken cannot be
created.public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- Thrown in case of no director,
input token cannot be read or output token cannot be
sent.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- If there are no outside sink
ports, or if any of the outside sink ports is not a network
port.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.protected java.util.Set<Inequality> _defaultTypeConstraints()
_defaultTypeConstraints
in class TypedAtomicActor