NS-3
ns3::AnimationInterface Class Reference

Interface to network animator. More...

#include <animation-interface.h>

Collaboration diagram for ns3::AnimationInterface:

List of all members.

Public Types

typedef void(* AnimWriteCallback )(const char *str)
 typedef for WriteCallBack used for listening to AnimationInterface write messages

Public Member Functions

 AnimationInterface ()
 Construct the animator interface. No arguments needed.
 ~AnimationInterface ()
 Destructor for the animator interface.
 AnimationInterface (const std::string filename, bool usingXML=true)
 Constructor.
 AnimationInterface (uint16_t port, bool usingXML=true)
 Constructor.
bool SetOutputFile (const std::string &fn)
 Specify that animation commands are to be written to the specified output file.
void SetXMLOutput ()
 Specify that animation commands are to be written in XML format.
bool SetServerPort (uint16_t port)
 Specify that animation commands are to be written to a socket.
void StartAnimation ()
 Writes the topology information and sets up the appropriate animation packet tx callback.
void StopAnimation ()
 Closes the interface to the animator.
void SetMobilityPollInterval (Time t)
 Set mobility poll interval:WARNING: setting a low interval can cause slowness.
void SetAnimWriteCallback (AnimWriteCallback cb)
 Set a callback function to listen to AnimationInterface write events.
void ResetAnimWriteCallback ()
 Reset the write callback function.

Detailed Description

Interface to network animator.

Provides functions that facilitate communications with an external or internal network animator.


Constructor & Destructor Documentation

ns3::AnimationInterface::AnimationInterface ( const std::string  filename,
bool  usingXML = true 
)

Constructor.

Parameters:
filenameThe Filename for the trace file used by the Animator
usingXMLSet to true if XML output traces are required
ns3::AnimationInterface::AnimationInterface ( uint16_t  port,
bool  usingXML = true 
)

Constructor.

Parameters:
portPort on which ns-3 should listen to for connection from the external netanim application
usingXMLSet to true if XML output traces are required

Member Function Documentation

void ns3::AnimationInterface::SetAnimWriteCallback ( AnimWriteCallback  cb)

Set a callback function to listen to AnimationInterface write events.

Parameters:
cbAddress of callback function
void ns3::AnimationInterface::SetMobilityPollInterval ( Time  t)

Set mobility poll interval:WARNING: setting a low interval can cause slowness.

Parameters:
tTime interval between fetching mobility/position information Default: 0.25s
bool ns3::AnimationInterface::SetOutputFile ( const std::string &  fn)

Specify that animation commands are to be written to the specified output file.

This call is used to write the animation information to a text file that can later be used as input to the network animator tool.

Parameters:
fnThe name of the output file.
Returns:
true if successful open.
bool ns3::AnimationInterface::SetServerPort ( uint16_t  port)

Specify that animation commands are to be written to a socket.

This call is used to set the ns3 process in server mode, waiting for a TCP connection from the animator. This call will not return until the animator connects in, or if the bind to the specified port fails.

Parameters:
portPort number to bind to.
Returns:
true if connection created, false if bind failed.
void ns3::AnimationInterface::SetXMLOutput ( )

Specify that animation commands are to be written in XML format.

Returns:
none
void ns3::AnimationInterface::StartAnimation ( )

Writes the topology information and sets up the appropriate animation packet tx callback.

Writes the topology information to the appropriate output, depending on prior calls to SetOutputFile, SetServerPort, or SetInternalAnimation. Then creates the callbacks needed for the animator to start processing packets.


The documentation for this class was generated from the following file: