0% found this document useful (0 votes)
170 views642 pages

QualNet 5.2 APIReferenceGuide

nnnnnnnnnnnnnnnnn

Uploaded by

123r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
170 views642 pages

QualNet 5.2 APIReferenceGuide

nnnnnnnnnnnnnnnnn

Uploaded by

123r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 642

QualNet 5.

2
API Reference Guide

October 2011

Scalable Network Technologies, Inc.


6100 Center Drive, Suite 1250
Los Angeles, CA 90045
Phone: 310-338-3318
Fax: 310-338-7213

http://www.scalable-networks.com

Copyright Information
2011 Scalable Network Technologies, Inc. All rights reserved.
QualNet and EXata are registered trademarks of Scalable Network Technologies, Inc.
All other trademarks and trade names used are property of their respective companies.
Scalable Network Technologies, Inc.
6100 Center Drive, Suite 1250
Los Angeles, CA 90045
Phone: 310-338-3318
Fax: 310-338-7213
http://www.scalable-networks.com

ii

API Reference Guide

QualNet 5.2 API Reference

QualNet 5.2 API Reference


QualNet API
3D_MATH

This file describes data structures and functions used to model 3D weather patterns in conjunction with the
Weather package.
ANTENNA

This file describes data structures and functions used by antenna models.
ANTENNA_GLOBAL

This file describes additional data structures and functions used by antenna models.
API

This file enumerates the basic message/events exchanged during the simulation process and the various layer
functions (initialize, finalize, and event handling functions) and other miscellaneous routines and data structure
definitions.
APP_UTIL

This file describes Application Layer utility functions.


APPLICATION LAYER

This file describes data structures and functions used by the Application Layer.
BUFFER

This file describes data structures and functions to implement buffers.


CIRCULAR-BUFFER

This file describes data structures and functions used for circular buffer implementation.
CLOCK

This file describes data structures and functions used for time-related operations.
COORDINATES

This file describes data structures and functions used for coordinates-related operations.
ERROR

This file defines data structures and functions used in error-handling.


EXTERNAL

This file defines the generic interface to external modules.


EXTERNAL_SOCKET

This file describes utilities for managing socket connections to external programs.
EXTERNAL_UTILITIES

This file describes utilities for external interfaces.


FILEIO

This file describes data strucutres and functions used for reading from input files and printing to output files.
GUI

This file describes data structures and functions for interfacing with the QualNet GUI and the other graphical
tools.
IP

This file contains data structures and prototypes of functions used by IP.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/index.html[10/28/2011 1:22:05 PM]

QualNet 5.2 API Reference

IPv6

Data structures and parameters used in network layer are defined here.
LIST

This file describes the data structures and functions used in the implementation of lists.
MAC LAYER

This file describes data structures and functions used by the MAC Layer.
MAIN

This file contains some common definitions.


MAPPING

This file describes data structures and functions for mapping between node pointers, node identifiers, and node
addresses.
MEMORY

This file describes the memory management data structures and functions.
MESSAGE

This file describes the message structure used to implement events and functions for message operations.
MOBILITY

This file describes data structures and functions used by mobility models.
MUTEX

This file describes objects for use in creating critical regions (synchronized access) for global variables or data
structures that have to be shared between threads.
NETWORK LAYER

This file describes the data structures and functions used by the Network Layer.
NODE

This file defines the Node data structure and some generic operations on nodes.
PARALLEL

This file describes data structures and functions used for parallel programming.
PARTITION

This file contains declarations of some functions for partition threads.


PHYSICAL LAYER

This file describes data structures and functions used by the Physical Layer. Most of this functionality is
enabled/used in the Wireless library.
PROPAGATION

This file describes data structures and functions used by propagation models.
QUEUES

This file describes the member functions of the queue base class.
RANDOM NUMBERS

This file describes functions to generate pseudo-random number streams.


SCHEDULERS

This file describes the member functions of the scheduler base class.
SLIDING-WINDOW

This file describes data structures and functions to implement a sliding window.
TRACE

This file describes data structures and functions used for packet tracing.
TRANSPORT LAYER

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/index.html[10/28/2011 1:22:05 PM]

QualNet 5.2 API Reference

This file describes data structures and functions used by the Tansport Layer.
USER

This file describes data structures and functions used by the User Layer.
WALLCLOCK

This file describes methods of the WallClock class whose primary use is to keep track of the amount of real
time that has passed during the simulation.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/index.html[10/28/2011 1:22:05 PM]

3D_MATH

QualNet 5.2 API Reference


3D_MATH
This file describes data structures and functions used to model 3D weather patterns in conjunction with the Weather package.
Constant / Data Structure Summary
Type

Name

STRUCT

Vector3

This is used to hold 3D points and vectors. This will eventually be added upon to create a robust class with operator overloading. For
now we just need an x, y, z.

STRUCT

Triangle3

This struture will hold information for one triangle.

Function / Macro Summary


Return Type

Summary

Vector3

MATH_CrossProduct(Vector3vector1, Vector3vector2)

Returns a perpendicular vector from 2 given vectors by taking the cross product.
Vector3

MATH_Vector(Vector3point1, Vector3point2)

Returns a vector between 2 points


double

MATH_Magnitude(Vector3vector)

Returns the magnitude of a normal (or any other vector)


Vector3

MATH_Normalize(Vector3vector)

Returns a normalized vector (of exactly length 1)


Vector3

MATH_Normal(Vector3[]triangle)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/3D_MATH.html[10/28/2011 1:24:17 PM]

3D_MATH

Returns the direction the polygon is facing


double

MATH_PlaneDistance(Vector3vector, Vector3point)

Returns the distance the plane is from the origin (0, 0, 0). It takes the normal to the plane, along with ANY point that lies on the plane
(any corner)
BOOL

MATH_IntersectedPlane(Vector3[]polygon, Vector3[]line, Vector3&normal, double&originDistance)

Takes a triangle (plane) and line and returns true if they intersected
double

MATH_DotProduct(Vector3vector1, Vector3vector2)

Returns the dot product between 2 vectors.


double

MATH_AngleBetweenVectors(Vector3vector1, Vector3vector2)

This returns the angle between 2 vectors


Vector3

MATH_IntersectionPoint(Vector3normal, Vector3[]line, doubledistance)

Returns an intersection point of a polygon and a line (assuming intersects the plane)
BOOL

MATH_InsidePolygon(Vector3intersection, Vector3[]polygon, intverticeCount)

Returns true if the intersection point is inside of the polygon


BOOL

MATH_IntersectedPolygon(Vector3[]polygon, Vector3[]line, intverticeCount)

Tests collision between a line and polygon


double

MATH_Distance(Vector3point1, Vector3point2)

Returns the distance between 2 3D points


BOOL

MATH_LineIntersects(Vector3[]line1, Vector3[]line2)

Checks whether two lines intersect each other or not.


Vector3

MATH_ReturnLineToLineIntersectionPoint(Vector3[]line1, Vector3[]line2)

Returns the point of intersection between two lines.


BOOL

MATH_IsPointOnLine(Vector3point, Vector3[]line)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/3D_MATH.html[10/28/2011 1:24:17 PM]

3D_MATH

Returns the whether the given point lies on Line or not.


void

MATH_ConvertXYToLatLong(doublex1, doubley1, doublelatitude, doublelongitude)

Converts given cartesian coordinates to Latitide and Longitude

Constant / Data Structure Detail

Structure

Vector3

Structure

This is used to hold 3D points and vectors. This will eventually be added upon to create a robust class with operator overloading. For now
we just need an x, y, z.
Triangle3

This struture will hold information for one triangle.

Function / Macro Detail


Function / Macro
MATH_CrossProduct

Format
Vector3 MATH_CrossProduct (Vector3vector1, Vector3vector2)

Parameters:

Returns a perpendicular vector from 2 given


vectors by taking the cross product.

vector1

- the first vector

vector2

- the second vector

Returns:
Vector3

- the cross product

MATH_Vector

Vector3 MATH_Vector (Vector3point1, Vector3point2)

Parameters:

Returns a vector between 2 points

point1

- the first point

point2

- the second point

Returns:
Vector3

- a vector between the two points

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/3D_MATH.html[10/28/2011 1:24:17 PM]

3D_MATH

MATH_Magnitude

double MATH_Magnitude (Vector3vector)

Parameters:

Returns the magnitude of a normal (or any


other vector)

vector

- a vector

Returns:
- the magnitude of the vector

double

MATH_Normalize

Vector3 MATH_Normalize (Vector3vector)

Parameters:

Returns a normalized vector (of exactly length


1)

vector

- a vector

Returns:
- a normalized vector

Vector3

MATH_Normal

Vector3 MATH_Normal (Vector3[]triangle)

Parameters:

Returns the direction the polygon is facing

triangle

- an array of vectors representing a polygon

Returns:
Vector3

- the direction vector

MATH_PlaneDistance

double MATH_PlaneDistance (Vector3vector, Vector3point)

Parameters:

Returns the distance the plane is from the


origin (0, 0, 0). It takes the normal to the
plane, along with ANY point that lies on the
plane (any corner)

vector
point

- a vector

- a point

Returns:
- the plane's distance from the origin (0,0,0)

double

MATH_IntersectedPlane

BOOL MATH_IntersectedPlane (Vector3[]polygon, Vector3[]line, Vector3&normal, double&originDistance)

Parameters:

Takes a triangle (plane) and line and returns


true if they intersected

polygon
line

- a polygon

- a line

normal

- a normalized vector

originDistance

- the distance

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/3D_MATH.html[10/28/2011 1:24:17 PM]

3D_MATH

Returns:
BOOL

- True if they intersect

MATH_DotProduct

double MATH_DotProduct (Vector3vector1, Vector3vector2)

Parameters:

Returns the dot product between 2 vectors.

vector1

- the first vector

vector2

- the second vector

Returns:
- the dot product of the two vectors

double

MATH_AngleBetweenVectors

double MATH_AngleBetweenVectors (Vector3vector1, Vector3vector2)

Parameters:

This returns the angle between 2 vectors

vector1

- the first vector

vector2

- the second vector

Returns:
- None

double

MATH_IntersectionPoint

Vector3 MATH_IntersectionPoint (Vector3normal, Vector3[]line, doubledistance)

Parameters:

Returns an intersection point of a polygon and


a line (assuming intersects the plane)

normal
line

- a polygon

- a line

distance

- the distance between?

Returns:
Vector3

- None

MATH_InsidePolygon

BOOL MATH_InsidePolygon (Vector3intersection, Vector3[]polygon, intverticeCount)

Parameters:

Returns true if the intersection point is inside


of the polygon

intersection
polygon

- an intersection point

- a polygon

verticeCount

- number of points in polygon

Returns:
BOOL

- True if the intersection point is in the polygon

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/3D_MATH.html[10/28/2011 1:24:17 PM]

3D_MATH

MATH_IntersectedPolygon

BOOL MATH_IntersectedPolygon (Vector3[]polygon, Vector3[]line, intverticeCount)

Parameters:

Tests collision between a line and polygon

polygon
line

- a polygon

- a line

verticeCount

- number of points in polygon

Returns:
BOOL

- True if the polygon and line intersect

MATH_Distance

double MATH_Distance (Vector3point1, Vector3point2)

Parameters:

Returns the distance between 2 3D points

point1

- the first point

point2

- the second point

Returns:
double

- the distance between the two points

MATH_LineIntersects

BOOL MATH_LineIntersects (Vector3[]line1, Vector3[]line2)

Parameters:

Checks whether two lines intersect each other


or not.

line1

- the first line

line2

- the second line

Returns:
BOOL

- True if the lines intersect

MATH_ReturnLineToLineIntersectionPoint

Vector3 MATH_ReturnLineToLineIntersectionPoint (Vector3[]line1, Vector3[]line2)

Parameters:

Returns the point of intersection between two


lines.

line1

- the first line

line2

- the second line

Returns:
Vector3

- the intersection point

MATH_IsPointOnLine

BOOL MATH_IsPointOnLine (Vector3point, Vector3[]line)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/3D_MATH.html[10/28/2011 1:24:17 PM]

3D_MATH

Returns the whether the given point lies on


Line or not.

point
line

- the point which we are checking.

- the line on which the point might lie.

Returns:
BOOL

- TRUE if the point lies on line

MATH_ConvertXYToLatLong

void MATH_ConvertXYToLatLong (doublex1, doubley1, doublelatitude, doublelongitude)

Parameters:

Converts given cartesian coordinates to


Latitide and Longitude

x1

- Specifies X value on X-Axis

y1

- Specifies Y value on Y-Axis

latitude

- Will store the converted latitude value

longitude

- Will store the converted longitude value

Returns:
void

- NULL

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/3D_MATH.html[10/28/2011 1:24:17 PM]

ANTENNA

QualNet 5.2 API Reference


ANTENNA
This file describes data structures and functions used by antenna models.
Constant / Data Structure Summary
Type

Name

CONSTANT

ANTENNA_DEFAULT_HEIGHT

Default height of the antenna

CONSTANT

ANTENNA_DEFAULT_GAIN_dBi

Default gain of the antenna

CONSTANT

ANTENNA_DEFAULT_EFFICIENCY

Default efficiency of the antenna

CONSTANT

ANTENNA_DEFAULT_MISMATCH_LOSS_dB

Default mismatch loss of the antenna

CONSTANT

ANTENNA_DEFAULT_CONNECTION_LOSS_dB

Default connection loss of the antenna

CONSTANT

ANTENNA_DEFAULT_CABLE_LOSS_dB

Default cable loss of the antenna

CONSTANT

ANTENNA_LOWEST_GAIN_dBi

Default minimum gain of the antenna

CONSTANT

ANTENNA_DEFAULT_PATTERN

Default Pattern

CONSTANT

ANTENNA_OMNIDIRECTIONAL_PATTERN

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

OMNIDIRECTIONAL PATTERN

CONSTANT

ANTENNA_PATTERN_NOT_SET

Const for Pattern of antenna not set

CONSTANT

AZIMUTH_INDEX

Const for azimuth index of antenna Pattern

CONSTANT

ELEVATION_INDEX

Const for elevation index of antenna Pattern

CONSTANT

MAX_ANTENNA_NUM_LINES

Const for the line number in the antennaModelInput

CONSTANT

AZIMUTH_ELEVATION_INDEX

Const for the memory allocation of azimuth and elevation gain array.

CONSTANT

NSMA_PATTERN_START_LINE_NUMBER

Const represents the basic pattern starting point in NSMA file

CONSTANT

NSMA_MAX_STARTLINE

Const represents the Revised pattern max line number where the revised NSMA pattern can start.

Function / Macro Summary


Return Type

Summary

void

ANTENNA_Init(Node*node, intphyIndex, const NodeInput*nodeInput)

Initialize antennas.
void

ANTENNA_ReadPatterns(Node*node, intphyIndex, const NodeInput*antennaInput, int*numPatterns,


int*steerablePatternSetRepeatSectorAngle, float***pattern_dB, BOOLazimuthPlane)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

Read in the azimuth pattern file.


void

ANTENNA_ReadNsmaPatterns(Node*node, intphyIndex)

Read in the NSMA pattern file.


void

ANTENNA_ReadRevisedNsmaPatterns(Node*node, intphyIndex)

Read in the Revised NSMA pattern file.


void

ANTENNA_Read3DAsciiPatterns(Node*node, intphyIndex)

Used to read ASCII 3D pattern file.


void

ANTENNA_Read2DAsciiPatterns(Node*node, intphyIndex)

Used to read ASCII 2D pattern file.


void

ANTENNA_OmniDirectionalInit(Node*node, const NodeInput*nodeInput, intphyIndex, const


AntennaModelGlobal*antennaModel)

Initialize omnidirectional antenna from the antenna model file.


void

ANTENNA_OmniDirectionalInitFromConfigFile(Node*node, intphyIndex, const NodeInput*nodeInput)

Initialize omnidirectional antenna from the default.config file.


void

ANTENNA_InitFromConfigFile(Node*node, intphyIndex, const NodeInput*nodeInput)

Initialize antenna from the default.config file.


BOOL

ANTENNA_IsInOmnidirectionalMode(Node*node, intphyIndex)

Is antenna in omnidirectional mode.


int

ANTENNA_ReturnPatternIndex(Node*node, intphyIndex)

Return nodes current pattern index.


float

ANTENNA_ReturnHeight(Node*node, intphyIndex)

Return nodes antenna height.


double

ANTENNA_ReturnSystemLossIndB(Node*node, intphyIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

Return systen loss in dB.


float

ANTENNA_GainForThisDirection(Node*node, intphyIndex, OrientationDOA)

Return gain for this direction in dB.


float

ANTENNA_GainForThisDirectionWithPatternIndex(Node*node, intphyIndex, intpatternIndex, OrientationDOA)

Return gain for this direction for the specified pattern in dB.
float

ANTENNA_GainForThisSignal(Node*node, intphyIndex, PropRxInfo*propRxInfo)

Return gain in dB.


float

ANTENNA_DefaultGainForThisSignal(Node*node, intphyIndex, PropRxInfo*propRxInfo)

Return default gain in dB.


void

ANTENNA_LockAntennaDirection(Node*node, intphyIndex)

Lock antenna to current direction.


void

ANTENNA_UnlockAntennaDirection(Node*node, intphyIndex)

Unlock antenna.
BOOL

ANTENNA_DirectionIsLocked(Node*node, intphyIndex)

Return if direction antenna is locked.


BOOL

ANTENNA_IsLocked(Node*node, intphyIndex)

Return if antenna is locked.


void

ANTENNA_SetToDefaultMode(Node*node, intphyIndex)

Set default antenna mode (usally omni).


void

ANTENNA_SetToBestGainConfigurationForThisSignal(Node*node, intphyIndex, PropRxInfo*propRxInfo)

Set antenna for best gain using the Rx info.


void

ANTENNA_SetBestConfigurationForAzimuth(Node*node, intphyIndex, doubleazimuth)

Set antenna for best gain using the azimuth.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

void

ANTENNA_GetSteeringAngle(Node*node, intphyIndex, Orientation*angle)

Get steering angle of the antenna.


void

ANTENNA_SetSteeringAngle(Node*node, intphyIndex, Orientationangle)

Set the steering angle of the antenna


void

ANTENNA_ReturnAsciiPatternFile(Node*node, intphyIndex, const NodeInput*antennaModelInput)

Read in the ASCII pattern .


void

ANTENNA_ReturnNsmaPatternFile(Node*node, intphyIndex, const NodeInput*antennaModelInput,


AntennaPatterns*antennaPatterns)

Read in the NSMA pattern .


void

ANTENNA_ReturnTraditionalPatternFile(Node*node, intphyIndex, const NodeInput*antennaModelInput)

Used to read Qualnet Traditional pattern file


NodeInput *

ANTENNA_MakeAntennaModelInput(Node*node, char*buf)

Reads the antenna configuration parameters into the NodeInput structure.

Constant / Data Structure Detail

Constant

ANTENNA_DEFAULT_HEIGHT1.5

Constant

Default height of the antenna


ANTENNA_DEFAULT_GAIN_dBi0.0

Constant

Default gain of the antenna


ANTENNA_DEFAULT_EFFICIENCY0.8

Constant

Default efficiency of the antenna


ANTENNA_DEFAULT_MISMATCH_LOSS_dB0.3

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

Constant

Default mismatch loss of the antenna


ANTENNA_DEFAULT_CONNECTION_LOSS_dB0.2

Constant

Default connection loss of the antenna


ANTENNA_DEFAULT_CABLE_LOSS_dB0.0

Constant

Default cable loss of the antenna


ANTENNA_LOWEST_GAIN_dBi-10000.0

Constant

Default minimum gain of the antenna


ANTENNA_DEFAULT_PATTERN0

Constant

Default Pattern
ANTENNA_OMNIDIRECTIONAL_PATTERN-1

Constant

OMNIDIRECTIONAL PATTERN
ANTENNA_PATTERN_NOT_SET-2

Constant

Const for Pattern of antenna not set


AZIMUTH_INDEX0

Constant

Const for azimuth index of antenna Pattern


ELEVATION_INDEX1

Constant

Const for elevation index of antenna Pattern


MAX_ANTENNA_NUM_LINES30

Constant

Const for the line number in the antennaModelInput


AZIMUTH_ELEVATION_INDEX2

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

Constant

Const for the memory allocation of azimuth and elevation gain array.
NSMA_PATTERN_START_LINE_NUMBER10

Constant

Const represents the basic pattern starting point in NSMA file


NSMA_MAX_STARTLINE41

Const represents the Revised pattern max line number where the revised NSMA pattern can start.

Function / Macro Detail


Function / Macro
ANTENNA_Init

Format
void ANTENNA_Init (Node*node, intphyIndex, const NodeInput*nodeInput)

Parameters:

Initialize antennas.

node

- node being initialized.

phyIndex

- interface for which physical to be

nodeInput

- structure containing contents of input

Returns:
void

ANTENNA_ReadPatterns

- NULL

void ANTENNA_ReadPatterns (Node*node, intphyIndex, const NodeInput*antennaInput, int*numPatterns,


int*steerablePatternSetRepeatSectorAngle, float***pattern_dB, BOOLazimuthPlane)

Parameters:
Read in the azimuth pattern file.
node

- node being used.

phyIndex

- interface for which physical to be

antennaInput
numPatterns

- structure containing contents of

- contains the number of patterns

steerablePatternSetRepeatSectorAngle
pattern_dB

- array used to store the gain values

azimuthPlane

- shows whether the file is azimuth

Returns:
void

- contains

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

ANTENNA_ReadNsmaPatterns

void ANTENNA_ReadNsmaPatterns (Node*node, intphyIndex)

Parameters:

Read in the NSMA pattern file.

node

- node being used.

phyIndex

- interface for which physical

Returns:
void

- NULL

ANTENNA_ReadRevisedNsmaPatterns

void ANTENNA_ReadRevisedNsmaPatterns (Node*node, intphyIndex)

Parameters:

Read in the Revised NSMA pattern file.

node

- node being used.

phyIndex

- interface for which physical

Returns:
void

- NULL

ANTENNA_Read3DAsciiPatterns

void ANTENNA_Read3DAsciiPatterns (Node*node, intphyIndex)

Parameters:

Used to read ASCII 3D pattern file.

node

- node being used.

phyIndex

- interface for which physical

Returns:
void

- NULL

ANTENNA_Read2DAsciiPatterns

void ANTENNA_Read2DAsciiPatterns (Node*node, intphyIndex)

Parameters:

Used to read ASCII 2D pattern file.

node

- node being used.

phyIndex

- interface for which physical

Returns:
void

ANTENNA_OmniDirectionalInit

- NULL

void ANTENNA_OmniDirectionalInit (Node*node, const NodeInput*nodeInput, intphyIndex, const


AntennaModelGlobal*antennaModel)

Parameters:
Initialize omnidirectional antenna from the antenna model
file.

node

- node being initialized.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

nodeInput
phyIndex

- pointer to node input

- interface for which physical to be

antennaModel

- pointer to AntennaModelGlobal

Returns:
void

- NULL

ANTENNA_OmniDirectionalInitFromConfigFile

void ANTENNA_OmniDirectionalInitFromConfigFile (Node*node, intphyIndex, const NodeInput*nodeInput)

Parameters:

Initialize omnidirectional antenna from the default.config


file.

node

- node being initialized.

phyIndex

- interface for which physical to be

nodeInput

- structure containing contents of input

Returns:
void

- NULL

ANTENNA_InitFromConfigFile

void ANTENNA_InitFromConfigFile (Node*node, intphyIndex, const NodeInput*nodeInput)

Parameters:

Initialize antenna from the default.config file.

node

- node being initialized.

phyIndex

- interface for which physical to be

nodeInput

- structure containing contents of input

Returns:
void

- NULL

ANTENNA_IsInOmnidirectionalMode

BOOL ANTENNA_IsInOmnidirectionalMode (Node*node, intphyIndex)

Parameters:

Is antenna in omnidirectional mode.

node

- node being used

phyIndex

- interface for which physical to be use

Returns:
BOOL

- returns TRUE if antenna is in omnidirectional mode

ANTENNA_ReturnPatternIndex

int ANTENNA_ReturnPatternIndex (Node*node, intphyIndex)

Parameters:

Return nodes current pattern index.

node

- node being used

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

phyIndex

- interface for which physical to use

Returns:
- returns pattern index

int

ANTENNA_ReturnHeight

float ANTENNA_ReturnHeight (Node*node, intphyIndex)

Parameters:

Return nodes antenna height.

node

- node being used

phyIndex

- interface for which physical to be used

Returns:
float

- height in meters

ANTENNA_ReturnSystemLossIndB

double ANTENNA_ReturnSystemLossIndB (Node*node, intphyIndex)

Parameters:

Return systen loss in dB.

node

- node being used

phyIndex

- interface for which physical to be used

Returns:
double

- loss in dB

ANTENNA_GainForThisDirection

float ANTENNA_GainForThisDirection (Node*node, intphyIndex, OrientationDOA)

Parameters:

Return gain for this direction in dB.

node

- node being used

phyIndex
DOA

- interface for which physical to be used

- direction of antenna

Returns:
float

ANTENNA_GainForThisDirectionWithPatternIndex

- gain in dB

float ANTENNA_GainForThisDirectionWithPatternIndex (Node*node, intphyIndex, intpatternIndex,


OrientationDOA)

Parameters:
Return gain for this direction for the specified pattern in
dB.

node

- node being used

phyIndex

- interface for which physical to be used

patternIndex

- pattern index to use

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

DOA

- direction of antenna

Returns:
float

- gain in dB

ANTENNA_GainForThisSignal

float ANTENNA_GainForThisSignal (Node*node, intphyIndex, PropRxInfo*propRxInfo)

Parameters:

Return gain in dB.

node

- node being used

phyIndex

- interface for which physical to be used

propRxInfo

- receiver propagation info

Returns:
float

- gain in dB

ANTENNA_DefaultGainForThisSignal

float ANTENNA_DefaultGainForThisSignal (Node*node, intphyIndex, PropRxInfo*propRxInfo)

Parameters:

Return default gain in dB.

node

- node being used

phyIndex

- interface for which physical to be used

propRxInfo

- receiver propagation info

Returns:
float

- gain in dB

ANTENNA_LockAntennaDirection

void ANTENNA_LockAntennaDirection (Node*node, intphyIndex)

Parameters:

Lock antenna to current direction.

node

- node being used

phyIndex

- interface for which physical to be used

Returns:
void

- NULL

ANTENNA_UnlockAntennaDirection

void ANTENNA_UnlockAntennaDirection (Node*node, intphyIndex)

Parameters:

Unlock antenna.

node

- node being used

phyIndex

- interface for which physical to be used

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

Returns:
void

- NULL

ANTENNA_DirectionIsLocked

BOOL ANTENNA_DirectionIsLocked (Node*node, intphyIndex)

Parameters:

Return if direction antenna is locked.

node

- node being used

phyIndex

- interface for which physical to be used

Returns:
BOOL

- returns TRUE if the antenna direction is locked

ANTENNA_IsLocked

BOOL ANTENNA_IsLocked (Node*node, intphyIndex)

Parameters:

Return if antenna is locked.

node

- node being used

phyIndex

- interface for which physical to be used

Returns:
BOOL

- Returns TRUE if antenna is locked.

ANTENNA_SetToDefaultMode

void ANTENNA_SetToDefaultMode (Node*node, intphyIndex)

Parameters:

Set default antenna mode (usally omni).

node

- node being used

phyIndex

- interface for which physical to be used

Returns:
void

ANTENNA_SetToBestGainConfigurationForThisSignal

- NULL

void ANTENNA_SetToBestGainConfigurationForThisSignal (Node*node, intphyIndex,


PropRxInfo*propRxInfo)

Parameters:
Set antenna for best gain using the Rx info.
node

- node being used

phyIndex

- interface for which physical to be used

propRxInfo

- receiver propagation info

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

ANTENNA_SetBestConfigurationForAzimuth

void ANTENNA_SetBestConfigurationForAzimuth (Node*node, intphyIndex, doubleazimuth)

Parameters:

Set antenna for best gain using the azimuth.

node

- node being used

phyIndex
azimuth

- interface for which physical to be used

- the azimuth

Returns:
- NULL

void

ANTENNA_GetSteeringAngle

void ANTENNA_GetSteeringAngle (Node*node, intphyIndex, Orientation*angle)

Parameters:

Get steering angle of the antenna.

node

- node being used

phyIndex
angle

- interface for which physical to be used

- For returning the angle

Returns:
- NULL

void

ANTENNA_SetSteeringAngle

void ANTENNA_SetSteeringAngle (Node*node, intphyIndex, Orientationangle)

Parameters:

Set the steering angle of the antenna

node

- node being used

phyIndex
angle

- interface for which physical to be used

- Steering angle to be

Returns:
void

- NULL

ANTENNA_ReturnAsciiPatternFile

void ANTENNA_ReturnAsciiPatternFile (Node*node, intphyIndex, const NodeInput*antennaModelInput)

Parameters:

Read in the ASCII pattern .

node

- node being used

phyIndex

- interface for which physical

antennaModelInput

- structure containing

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

ANTENNA_ReturnNsmaPatternFile

void ANTENNA_ReturnNsmaPatternFile (Node*node, intphyIndex, const NodeInput*antennaModelInput,


AntennaPatterns*antennaPatterns)

Parameters:
Read in the NSMA pattern .
node

- node being used

phyIndex

- interface for which

antennaModelInput
antennaPatterns

- structure containing

- Pointer to

Returns:
void

- NULL

ANTENNA_ReturnTraditionalPatternFile

void ANTENNA_ReturnTraditionalPatternFile (Node*node, intphyIndex, const NodeInput*antennaModelInput)

Parameters:

Used to read Qualnet Traditional pattern file

node

- node being used

phyIndex

- interface for which

antennaModelInput

- structure containing

Returns:
void

- NULL

ANTENNA_MakeAntennaModelInput

NodeInput * ANTENNA_MakeAntennaModelInput (Node*node, char*buf)

Parameters:

Reads the antenna configuration parameters into the


NodeInput structure.

node
buf

- node being used

- Path to input file.

Returns:
NodeInput *

- pointer to nodeInput structure

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA.html[10/28/2011 1:24:24 PM]

ANTENNA_GLOBAL

QualNet 5.2 API Reference


ANTENNA_GLOBAL
This file describes additional data structures and functions used by antenna models.
Constant / Data Structure Summary
Type

Name

CONSTANT

MAX_ANTENNA_MODELS

Maximum number of models to allow.

CONSTANT

MAX_ANTENNA_PATTERNS

Maximum number of antenna patterns to allow.

ENUMERATION

AntennaModelType

Different types of antenna models supported.

ENUMERATION

AntennaPatternType

Different types of antenna pattern types supported.

ENUMERATION

NSMAPatternVersion

Different types of NSMA pattern versions supported.

ENUMERATION

AntennaGainUnit

Different types of antenna gain units supported.

ENUMERATION

AntennaPatternUnit

Different types of antenna pattern units supported.

STRUCT

struct_antenna_pattern_element

Structure for antenna pattern elements

STRUCT

struct_antenna_pattern

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA_GLOBAL.html[10/28/2011 1:24:53 PM]

ANTENNA_GLOBAL

Structure for antenna pattern

STRUCT

struct_antenna_Global_model

Structure for antenna model

Function / Macro Summary


Return Type

Summary

void

ANTENNA_GlobalAntennaModelPreInitialize(PartitionData*partitionData)

Preinitalize the global antenna structs.


void

ANTENNA_GlobalAntennaPatternPreInitialize(PartitionData*partitionData)

Preinitalize the global antenna structs.


AntennaPattern*

ANTENNA_GlobalModelAssignPattern(Node*node, intphyIndex, const NodeInput*antennaModelInput)

used to assign global radiation pattern for each antenna.


void

ANTENNA_GlobalAntennaModelInit(Node*node, intphyIndex, const NodeInput*antennaModelInput)

Reads the antenna configuration parameters into the global antenna model structure.
Void

ANTENNA_GlobalAntennaPatternInitFromConfigFile(Node*node, intphyIndex, const char*antennaPatternName,


BOOLsteer)

Init the antenna pattern structure for pattern name for the Old antenna model.
Void

ANTENNA_GlobalAntennaPatternInit(Node*node, intphyIndex, const NodeInput*antennaModelInput, const


char*antennaPatternName)

Init the antenna pattern structure for pattern name.


AntennaModelGlobal*

ANTENNA_GlobalAntennaModelAlloc(PartitionData*partitionData)

Alloc a new model.


AntennaModelGlobal*

ANTENNA_GlobalAntennaModelGet(PartitionData*partitionData, const char*antennaModelName)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA_GLOBAL.html[10/28/2011 1:24:53 PM]

ANTENNA_GLOBAL

Return the model based on the name.


AntennaPattern*

ANTENNA_GlobalAntennaPatternGet(PartitionData*partitionData, const char*antennaPatternName)

Return the antenna pattern based on the name.


void

ANTENNA_GeneratePatterName(Node*node, intphyIndex, const NodeInput*antennaModelInput, char*


patternTypepatternType, char*antennaPatternName)

Generate the Pattern name base on Pattern type.

Constant / Data Structure Detail

Constant

MAX_ANTENNA_MODELS50

Constant

Maximum number of models to allow.


MAX_ANTENNA_PATTERNS50

Enumeration

Maximum number of antenna patterns to allow.


AntennaModelType

Enumeration

Different types of antenna models supported.


AntennaPatternType

Enumeration

Different types of antenna pattern types supported.


NSMAPatternVersion

Enumeration

Different types of NSMA pattern versions supported.


AntennaGainUnit

Enumeration

Different types of antenna gain units supported.


AntennaPatternUnit

Different types of antenna pattern units supported.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA_GLOBAL.html[10/28/2011 1:24:53 PM]

ANTENNA_GLOBAL

Structure

struct_antenna_pattern_element

Structure

Structure for antenna pattern elements


struct_antenna_pattern

Structure

Structure for antenna pattern


struct_antenna_Global_model

Structure for antenna model

Function / Macro Detail


Function / Macro
ANTENNA_GlobalAntennaModelPreInitialize

Format
void ANTENNA_GlobalAntennaModelPreInitialize (PartitionData*partitionData)

Parameters:

Preinitalize the global antenna structs.

partitionData

- Pointer to partition data.

Returns:
void

- NULL

ANTENNA_GlobalAntennaPatternPreInitialize

void ANTENNA_GlobalAntennaPatternPreInitialize (PartitionData*partitionData)

Parameters:

Preinitalize the global antenna structs.

partitionData

- Pointer to partition data.

Returns:
void

ANTENNA_GlobalModelAssignPattern

- NULL

AntennaPattern* ANTENNA_GlobalModelAssignPattern (Node*node, intphyIndex, const


NodeInput*antennaModelInput)

Parameters:
used to assign global radiation pattern for each antenna.
node

- node being used.

phyIndex

- interface for which physical to be

antennaModelInput

- structure containing

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA_GLOBAL.html[10/28/2011 1:24:53 PM]

ANTENNA_GLOBAL

AntennaPattern*

- Pointer to the global antenna pattern structure.

ANTENNA_GlobalAntennaModelInit

void ANTENNA_GlobalAntennaModelInit (Node*node, intphyIndex, const NodeInput*antennaModelInput)

Parameters:

Reads the antenna configuration parameters into the


global antenna model structure.

node

- node being used.

phyIndex

- interface for which physical to be

antennaModelInput

- structure containing

Returns:
- NULL

void

ANTENNA_GlobalAntennaPatternInitFromConfigFile

Void ANTENNA_GlobalAntennaPatternInitFromConfigFile (Node*node, intphyIndex, const


char*antennaPatternName, BOOLsteer)

Parameters:
Init the antenna pattern structure for pattern name for the
Old antenna model.

node

- node being used.

phyIndex

- interface for which physical to be

antennaPatternName
steer

- antenna pattern name to be

- A boolean variable to differntiate which

Returns:
Void

ANTENNA_GlobalAntennaPatternInit

- NULL

Void ANTENNA_GlobalAntennaPatternInit (Node*node, intphyIndex, const NodeInput*antennaModelInput,


const char*antennaPatternName)

Parameters:
Init the antenna pattern structure for pattern name.
node

- node being used.

phyIndex

- interface for which physical to be

antennaModelInput

- structure containing

antennaPatternName

- antenna pattern name to be

Returns:
Void

- NULL

ANTENNA_GlobalAntennaModelAlloc

AntennaModelGlobal* ANTENNA_GlobalAntennaModelAlloc (PartitionData*partitionData)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA_GLOBAL.html[10/28/2011 1:24:53 PM]

ANTENNA_GLOBAL

Alloc a new model.

partitionData

- Pointer to partition data.

Returns:
AntennaModelGlobal*

ANTENNA_GlobalAntennaModelGet

- Pointer to the global antenna model structure.

AntennaModelGlobal* ANTENNA_GlobalAntennaModelGet (PartitionData*partitionData, const


char*antennaModelName)

Parameters:
Return the model based on the name.
partitionData

- Pointer to partition data.

antennaModelName

- contains the name of the

Returns:
AntennaModelGlobal*

ANTENNA_GlobalAntennaPatternGet

- Pointer to the global antenna model structure.

AntennaPattern* ANTENNA_GlobalAntennaPatternGet (PartitionData*partitionData, const


char*antennaPatternName)

Parameters:
Return the antenna pattern based on the name.
partitionData

- Pointer to partition data.

antennaPatternName

- contains the name of the

Returns:
AntennaPattern*

ANTENNA_GeneratePatterName

- Pointer to the global antenna pattern structure.

void ANTENNA_GeneratePatterName (Node*node, intphyIndex, const NodeInput*antennaModelInput, char*


patternTypepatternType, char*antennaPatternName)

Parameters:
Generate the Pattern name base on Pattern type.
node

- node being used.

phyIndex

- interface for which physical to be

antennaModelInput
patternType

- structure containing

- Type of Pattern

antennaPatternName

- antenna pattern name to be

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA_GLOBAL.html[10/28/2011 1:24:53 PM]

ANTENNA_GLOBAL

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ANTENNA_GLOBAL.html[10/28/2011 1:24:53 PM]

API

QualNet 5.2 API Reference


API
This file enumerates the basic message/events exchanged during the simulation process and the various layer functions (initialize, finalize, and event handling functions) and other
miscellaneous routines and data structure definitions.
Constant / Data Structure Summary
Type

Name

ENUMERATION

MESSAGE/EVENT

Event/message types exchanged in the simulation

ENUMERATION

TransportType

Transport type to check reliable, unreliable or TADIL network for Link16 or Link11

ENUMERATION

DestinationType

Interface IP address type

STRUCT

PhyBatteryPower

Used by App layer and Phy layer to exchange battery power

STRUCT

PacketNetworkToApp

Network to application layer packet structure

STRUCT

NetworkToTransportInfo

Network To Transport layer Information structure

STRUCT

PacketTransportNetwork

Transport to network layer packet structure

STRUCT

TcpTimerPacket

TCP timer packet

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

STRUCT

AppToUdpSend

Additional information given to UDP from applications. This information is saved in the info field of a message.

STRUCT

UdpToAppRecv

Additional information given to applications from UDP. This information is saved in the info field of a message.

STRUCT

AppToRsvpSend

send response structure from application layer

STRUCT

TransportToAppListenResult

Report the result of application's listen request.

STRUCT

TransportToAppOpenResult

Report the result of opening a connection.

STRUCT

TransportToAppDataSent

Report the result of sending application data.

STRUCT

TransportToAppDataReceived

Deliver data to application.

STRUCT

TransportToAppCloseResult

Report the result of closing a connection.

STRUCT

AppToTcpListen

Application announces willingness to accept connections on given port.

STRUCT

AppToTcpOpen

Application attempts to establish a connection

STRUCT

AppToTcpSend

Application wants to send some data over the connection

STRUCT

AppToTcpClose

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

Application wants to release the connection

STRUCT

AppToTcpConnSetup

Application sets up connection at the local end Needed for NS TCP to fake connection setup

STRUCT

AppQosToNetworkSend

Application uses this structure in its info field to perform the initialization of a new QoS connection with its QoS requirements.

STRUCT

NetworkToAppQosConnectionStatus

Q-OSPF uses this structure to report status of a session requested by the application for Quality of Service.

Function / Macro Summary


Return Type

Summary

void

CHANNEL_Initialize(Node*node, const NodeInput*nodeInput)

Initialization function for channel


void

PHY_Init(Node*node, const NodeInput*nodeInput)

Initialization function for physical layer


void

MAC_Initialize(Node*node, const NodeInput*nodeInput)

Initialization function for the MAC layer


void

NETWORK_PreInit(Node*node, const NodeInput*nodeInput)

Pre-Initialization function for Network layer


void

NETWORK_Initialize(Node*node, const NodeInput*nodeInput)

Initialization function for Network layer


void

TRANSPORT_Initialize(Node*node, const NodeInput*nodeInput)

Initialization function for transport layer


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

void

APP_Initialize(Node*node, const NodeInput*nodeInput)

Initialization function for Application layer


void

USER_Initialize(Node*node, const NodeInput*nodeInput)

Initialization function for User layer


void

APP_InitializeApplications(Node*firstNode, const NodeInput*nodeInput)

Initialization function for applications in APPLICATION layer


void

ATMLAYER2_Initialize(Node*node, const NodeInput*nodeInput)

Initialization function for the ATM Layer2.


void

ADAPTATION_Initialize(Node*node, const NodeInput*nodeInput)

Initialization function for Adaptation layer


void

CHANNEL_Finalize(Node *node)

To collect results of simulation at the end for channels


void

PHY_Finalize(Node *node)

To collect results of simulation at the end for the PHYSICAL layer


void

MAC_Finalize(Node *node)

To collect results of simulation at the end for the mac layers


void

NETWORK_Finalize(Node *node)

To collect results of simulation at the end for network layers


void

TRANSPORT_Finalize(Node *node)

To collect results of simulation at the end for transport layers


void

APP_Finalize(Node *node)

To collect results of simulation at the end for application layers


void

USER_Finalize(Node *node)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

To collect results of simulation at the end for user layers


void

ATMLAYER2_Finalize(Node *node)

To collect results at the end of the simulation.


void

ADAPTATION_Finalize(Node *node)

To collect results of simulation at the end for network layers


void

CHANNEL_ProcessEvent(Node*node, Message*msg)

Processes the message/event of physical layer received by the node thus simulating the PHYSICAL layer behaviour
void

PHY_ProcessEvent(Node*node, Message*msg)

Processes the message/event of physical layer received by the node thus simulating the PHYSICAL layer behaviour
void

MAC_ProcessEvent(Node*node, Message*msg)

Processes the message/event of MAC layer received by the node thus simulating the MAC layer behaviour
void

NETWORK_ProcessEvent(Node*node, Message*msg)

Processes the message/event received by the node thus simulating the NETWORK layer behaviour
void

TRANSPORT_ProcessEvent(Node*node, Message*msg)

Processes the message/event received by the node thus simulating the TRANSPORT layer behaviour
void

APP_ProcessEvent(Node*node, Message*msg)

Processes the message/event received by the node thus simulating the APPLICATION layer behaviour
void

USER_ProcessEvent(Node*node, Message*msg)

Processes the message/event received by the node thus simulating the USER layer behaviour
void

ATMLAYER2_ProcessEvent(Node*node, Message*msg)

Processes the message/event of ATM_LAYER2 layer received by the node thus simulating the ATM_LAYER2 layer behaviour
void

ADAPTATION_ProcessEvent(Node*node, Message*msg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

Processes the message/event received by the node thus simulating the ADAPTATION layer behaviour
void

MAC_RunTimeStat(Node*node)

To print runtime statistics for the MAC layer


void

NETWORK_RunTimeStat(Node*node)

To print runtime statistics for the NETWORK layer


void

TRANSPORT_RunTimeStat(Node*node)

To print runtime statistics for the TRANSPORT layer


void

APP_RunTimeStat(Node*node)

To print runtime statistics for the APPLICATION layer

Constant / Data Structure Detail

Enumeration

MESSAGE/EVENT

Enumeration

Event/message types exchanged in the simulation


TransportType

Enumeration

Transport type to check reliable, unreliable or TADIL network for Link16 or Link11
DestinationType

Structure

Interface IP address type


PhyBatteryPower

Structure

Used by App layer and Phy layer to exchange battery power


PacketNetworkToApp

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

Structure

Network to application layer packet structure


NetworkToTransportInfo

Structure

Network To Transport layer Information structure


PacketTransportNetwork

Structure

Transport to network layer packet structure


TcpTimerPacket

Structure

TCP timer packet


AppToUdpSend

Structure

Additional information given to UDP from applications. This information is saved in the info field of a message.
UdpToAppRecv

Structure

Additional information given to applications from UDP. This information is saved in the info field of a message.
AppToRsvpSend

Structure

send response structure from application layer


TransportToAppListenResult

Structure

Report the result of application's listen request.


TransportToAppOpenResult

Structure

Report the result of opening a connection.


TransportToAppDataSent

Structure

Report the result of sending application data.


TransportToAppDataReceived

Structure

Deliver data to application.


TransportToAppCloseResult

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

Structure

Report the result of closing a connection.


AppToTcpListen

Structure

Application announces willingness to accept connections on given port.


AppToTcpOpen

Structure

Application attempts to establish a connection


AppToTcpSend

Structure

Application wants to send some data over the connection


AppToTcpClose

Structure

Application wants to release the connection


AppToTcpConnSetup

Structure

Application sets up connection at the local end Needed for NS TCP to fake connection setup
AppQosToNetworkSend

Structure

Application uses this structure in its info field to perform the initialization of a new QoS connection with its QoS requirements.
NetworkToAppQosConnectionStatus

Q-OSPF uses this structure to report status of a session requested by the application for Quality of Service.

Function / Macro Detail


Function / Macro
CHANNEL_Initialize

Format
void CHANNEL_Initialize (Node*node, const NodeInput*nodeInput)

Parameters:

Initialization function for channel

node

- node being intialized

nodeInput

- structure containing all the

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

Returns:
void

- None

PHY_Init

void PHY_Init (Node*node, const NodeInput*nodeInput)

Parameters:

Initialization function for physical layer

node

- node being intialized

nodeInput

- structure containing config file details

Returns:
void

- None

MAC_Initialize

void MAC_Initialize (Node*node, const NodeInput*nodeInput)

Parameters:

Initialization function for the MAC layer

node

- node being intialized

nodeInput

- structure containing input file details

Returns:
void

- None

NETWORK_PreInit

void NETWORK_PreInit (Node*node, const NodeInput*nodeInput)

Parameters:

Pre-Initialization function for Network layer

node

- node being intialized

nodeInput

- structure containing input file details

Returns:
void

- None

NETWORK_Initialize

void NETWORK_Initialize (Node*node, const NodeInput*nodeInput)

Parameters:

Initialization function for Network layer

node

- node being intialized

nodeInput

- structure containing input file details

Returns:
void

TRANSPORT_Initialize

- None

void TRANSPORT_Initialize (Node*node, const NodeInput*nodeInput)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

Initialization function for transport layer

Parameters:
node

- node being intialized

nodeInput

- structure containing input file details

Returns:
void

- None

APP_Initialize

void APP_Initialize (Node*node, const NodeInput*nodeInput)

Parameters:

Initialization function for Application layer

node

- node being intialized

nodeInput

- structure containing input file details

Returns:
void

- None

USER_Initialize

void USER_Initialize (Node*node, const NodeInput*nodeInput)

Parameters:

Initialization function for User layer

node

- node being intialized

nodeInput

- structure containing input file details

Returns:
void

- None

APP_InitializeApplications

void APP_InitializeApplications (Node*firstNode, const NodeInput*nodeInput)

Parameters:

Initialization function for applications in


APPLICATION layer

firstNode

- first node being intialized

nodeInput

- structure containing input file details

Returns:
void

- None

ATMLAYER2_Initialize

void ATMLAYER2_Initialize (Node*node, const NodeInput*nodeInput)

Parameters:

Initialization function for the ATM Layer2.

node

- node being intialized

nodeInput

- structure containing input file details

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

void

- None

ADAPTATION_Initialize

void ADAPTATION_Initialize (Node*node, const NodeInput*nodeInput)

Parameters:

Initialization function for Adaptation layer

node

- node being intialized

nodeInput

- structure containing input file details

Returns:
void

- None

CHANNEL_Finalize

void CHANNEL_Finalize (Node *node)

Parameters:

To collect results of simulation at the end for


channels

node

- Node for which data is collected

Returns:
void

- None

PHY_Finalize

void PHY_Finalize (Node *node)

Parameters:

To collect results of simulation at the end for


the PHYSICAL layer

node

- Node for which finalization function is called

Returns:
void

- None

MAC_Finalize

void MAC_Finalize (Node *node)

Parameters:

To collect results of simulation at the end for


the mac layers

node

- Node for which finalization function is called

Returns:
void

- None

NETWORK_Finalize

void NETWORK_Finalize (Node *node)

Parameters:

To collect results of simulation at the end for


network layers

node

- Node for which finalization function is called

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

TRANSPORT_Finalize

void TRANSPORT_Finalize (Node *node)

Parameters:

To collect results of simulation at the end for


transport layers

node

- Node for which finalization function is called

Returns:
void

- None

APP_Finalize

void APP_Finalize (Node *node)

Parameters:

To collect results of simulation at the end for


application layers

node

- Node for which finalization function is called

Returns:
void

- None

USER_Finalize

void USER_Finalize (Node *node)

Parameters:

To collect results of simulation at the end for


user layers

node

- Node for which finalization function is called

Returns:
void

- None

ATMLAYER2_Finalize

void ATMLAYER2_Finalize (Node *node)

Parameters:

To collect results at the end of the simulation.

node

- Node for which finalization function is called

Returns:
void

- None

ADAPTATION_Finalize

void ADAPTATION_Finalize (Node *node)

Parameters:

To collect results of simulation at the end for


network layers

node

- Node for which finalization function is called

Returns:
void

- None

CHANNEL_ProcessEvent

void CHANNEL_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event of physical layer

node

- node which receives the message

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

received by the node thus simulating the


PHYSICAL layer behaviour

msg

- Received message structure

Returns:
void

- None

PHY_ProcessEvent

void PHY_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event of physical layer


received by the node thus simulating the
PHYSICAL layer behaviour

node
msg

- node which receives the message

- Received message structure

Returns:
void

- None

MAC_ProcessEvent

void MAC_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event of MAC layer


received by the node thus simulating the
MAC layer behaviour

node
msg

- node which receives the message

- Received message structure

Returns:
void

- None

NETWORK_ProcessEvent

void NETWORK_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event received by the


node thus simulating the NETWORK layer
behaviour

node
msg

- node which receives the message

- Received message structure

Returns:
void

- None

TRANSPORT_ProcessEvent

void TRANSPORT_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event received by the


node thus simulating the TRANSPORT layer
behaviour

node
msg

- node which receives the message

- Received message structure

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

APP_ProcessEvent

void APP_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event received by the


node thus simulating the APPLICATION
layer behaviour

node
msg

- node which receives the message

- Received message structure

Returns:
void

- None

USER_ProcessEvent

void USER_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event received by the


node thus simulating the USER layer
behaviour

node
msg

- node which receives the message

- Received message structure

Returns:
void

- None

ATMLAYER2_ProcessEvent

void ATMLAYER2_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event of


ATM_LAYER2 layer received by the node
thus simulating the ATM_LAYER2 layer
behaviour

node
msg

- node which receives the message

- Received message structure

Returns:
void

- None

ADAPTATION_ProcessEvent

void ADAPTATION_ProcessEvent (Node*node, Message*msg)

Parameters:

Processes the message/event received by the


node thus simulating the ADAPTATION
layer behaviour

node
msg

- node which receives the message

- Received message structure

Returns:
void

- None

MAC_RunTimeStat

void MAC_RunTimeStat (Node*node)

Parameters:

To print runtime statistics for the MAC layer

node

- node for which statistics to be printed

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

API

void

- None

NETWORK_RunTimeStat

void NETWORK_RunTimeStat (Node*node)

Parameters:

To print runtime statistics for the NETWORK


layer

node

- node for which statistics to be printed

Returns:
void

- None

TRANSPORT_RunTimeStat

void TRANSPORT_RunTimeStat (Node*node)

Parameters:

To print runtime statistics for the


TRANSPORT layer

node

- node for which statistics to be printed

Returns:
void

- None

APP_RunTimeStat

void APP_RunTimeStat (Node*node)

Parameters:

To print runtime statistics for the


APPLICATION layer

node

- node for which statistics to be printed

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/API.html[10/28/2011 1:25:04 PM]

APP_UTIL

QualNet 5.2 API Reference


APP_UTIL
This file describes Application Layer utility functions.
Function / Macro Summary
Return Type

Summary

MACRO

APP_GetTimerType(x)

Get the timerType for a received App Layer Timer.


AppInfo*

APP_RegisterNewApp(Node*node, AppTypeappType, void *dataPtr)

Insert a new application into the list of apps on this node.


void

APP_SetTimer(Node*node, AppTypeappType, intconnId, shortsourcePort, inttimerType, clocktypedelay)

Set a new App Layer Timer and send to self after delay.
void

APP_UdpSendNewData(Node *node, AppTypeappType, NodeAddresssourceAddr, shortsourcePort, NodeAddressdestAddr,


char *payload, intpayloadSize, clocktypedelay, TraceProtocolTypetraceProtocol)

Allocate data and send to UDP.


void

APP_UdpSendNewDataWithPriority(Node *node, AppTypeappType, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, intoutgoingInterface, char*payload, intpayloadSize, TosTypepriority, clocktypedelay,
TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32uniqueId, char*mdpDataObjectInfo,
UInt16mdpDataInfosize)

Allocate data with specified priority and send to UDP.


Message*

APP_UdpSendNewDataWithPriority(Node *node, AppTypeappType, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, intoutgoingInterface, char*payload, intpayloadSize, TosTypepriority, clocktypedelay,
TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32uniqueId)

Allocate data with specified priority and send to UDP (For IPv6).
void

APP_UdpSendNewHeaderData(Node *node, AppTypeappType, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, char*header, intheaderSize, char*payload, intpayloadSize, clocktypedelay,
TraceProtocolTypetraceProtocol)

Allocate header and data and send to UDP..


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

void

APP_UdpSendNewHeaderDataWithPriority(Node *node, AppTypeappType, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, intoutgoingInterface, char*header, intheaderSize, char*payload, intpayloadSize,
TosTypepriority, clocktypedelay, TraceProtocolTypetraceProtocol)

Allocate header and data with specified priority and send to UDP
void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, AppTypeappType, NodeAddresssourceAddr,


shortsourcePort, NodeAddressdestAddr, char*header, intheaderSize, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32mdpUniqueId)

Allocate header + virtual data with specified priority and send to UDP
void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, shortdestinationPort, char*infoData, intinfoSize, intinfoType, intpayloadSize,
TosTypepriority, clocktypedelay, TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32mdpUniqueId)

Allocate header + virtual data with specified priority and send to UDP. Data is sent to a non-default destination port (port number may
not have same value as the AppType).
void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, AddresssourceAddr, shortsourcePort, AddressdestAddr,


shortdestinationPort, char*infoData, intinfoSize, intinfoType, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol, char*appname, BOOLisMdpEnabled, Int32mdpUniqueId)

(Overloaded for IPv6) Allocate header + virtual data with specified priority and send to UDP. Data is sent to a non-default destination
port (port number may not have same value as the AppType).
void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, AddresssourceAddr, shortsourcePort, AddressdestAddr,


shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority, clocktypedelay,
TraceProtocolTypetraceProtocol, char*infoData, intinfoSize, intinfoType, BOOLisMdpEnabled,
Int32mdpUniqueId)

(Overloaded for IPv6) Allocate header + virtual data with specified priority and send to UDP. Data is sent to a non-default destination
port (port number may not have same value as the AppType).
void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol)

Allocate header + virtual data with specified priority and send to UDP. Data is sent to a non-default destination port (port number may
not have same value as the AppType).
void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, AppTypeappType, AddresssourceAddr, shortsourcePort,


AddressdestAddr, char*header, intheaderSize, intpayloadSize, TosTypepriority, clocktypedelay,
char*mdpInfo, TraceProtocolTypetraceProtocol, Message*theMsgPtr)

(Overloaded for MDP) Allocate actual + virtual data with specified priority and send to UDP. Data is sent to a non-default destination
port (port number may not have same value as the AppType).
void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, AddresssourceAddr, shortsourcePort, AddressdestAddr,


shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority, clocktypedelay,
TraceProtocolTypetraceProtocol)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

(Overloaded for IPv6) Allocate header + virtual data with specified priority and send to UDP. Data is sent to a non-default destination
port (port number may not have same value as the AppType).
void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, AddresssourceAddr, shortsourcePort, AddressdestAddr,


shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority, clocktypedelay,
TraceProtocolTypetraceProtocol)

(Overloaded for IPv6) Allocate header + virtual data with specified priority and send to UDP. Data is sent to a non-default destination
port (port number may not have same value as the AppType).
Message *

APP_UdpCreateNewHeaderVirtualDataWithPriority.(Node *node, AddresssourceAddr, shortsourcePort,


AddressdestAddr, shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority,
TraceProtocolTypetraceProtocol)

Create the message.


void

APP_UdpSendNewHeaderVirtualDataWithPriority(Node *node, AddresssourceAddr, shortsourcePort, AddressdestAddr,


shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority, clocktypedelay,
TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32mdpUniqueId)

(Overloaded for IPv6) Allocate header + virtual data with specified priority and send to UDP. Data is sent to a non-default destination
port (port number may not have same value as the AppType).
void

APP_TcpServerListen.(Node *node, AppTypeappType, NodeAddressserverAddr, shortserverPort)

Listen on a server port.


void

APP_TcpServerListen.(Node *node, AppTypeappType, AddressserverAddr, shortserverPort)

(Overloaded for IPv6) Listen on a server port.


void

APP_TcpServerListenWithPriority.(Node *node, AppTypeappType, NodeAddressserverAddr, shortserverPort,


TosTypepriority)

Listen on a server port with specified priority.


void

APP_TcpServerListenWithPriority.(Node *node, AppTypeappType, AddressserverAddr, shortserverPort,


TosTypepriority)

Listen on a server port with specified priority. (Overloaded for IPv6)


void

APP_TcpOpenConnection.(Node *node, appTypeappType, NodeAddresslocalAddr, shortlocalPort,


NodeAddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime)

Open a connection.
void

APP_TcpOpenConnection.(Node *node, appTypeappType, AddresslocalAddr, shortlocalPort, AddressremoteAddr,


shortremotePort, intuniqueId, clocktypewaitTime)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

(Overloaded for IPv6) Open a connection.


void

APP_TcpOpenConnection.(Node *node, appTypeappType, NodeAddresslocalAddr, shortlocalPort,


NodeAddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime, intoutgoingInterface)

Open a connection.
void

APP_TcpOpenConnection.(Node *node, appTypeappType, AddresslocalAddr, shortlocalPort, AddressremoteAddr,


shortremotePort, intuniqueId, clocktypewaitTime, intoutgoingInterface)

(Overloaded for IPv6) Open a connection.


void

APP_TcpOpenConnectionWithPriority.(Node *node, appTypeappType, NodeAddresslocalAddr, shortlocalPort,


NodeAddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime, TosTypepriority)

Open a connection with specified priority.


void

APP_TcpOpenConnectionWithPriority..(Node *node, appTypeappType, AddresslocalAddr, shortlocalPort,


AddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime, TosTypepriority)

Open a connection with specified priority. (Overloaded for IPv6)


Message *

App_TcpCreateMessage.(Node *node, intconnId, char *payload, intlength, traceProtocolTypetraceProtocol)

Create the message.


void

APP_TcpSendData.(Node *node, intconnId, char *payload, intlength, raceProtocolTypetraceProtocol)

send an application data unit.


Message*

APP_TcpSendNewHeaderVirtualData.(Node *node, intconnId, char *header, intheaderLength, intpayloadSize,


raceProtocolTypetraceProtocol)

Send header and virtual data using TCP.


void

APP_TcpCloseConnection(Node *node, intconnId)

Close the connection.


void

APP_InitMulticastGroupMembershipIfAny(Node *node, const NodeInputnodeInput)

Start process of joining multicast group if need to do so.


void

APP_CheckMulticastByParsingSourceAndDestString(Node *node, const char *inputString, const char *sourceString,


NodeAddress *sourceNodeId, NodeAddress *sourceAddr, const char *destString, NodeAddress *destNodeId,
NodeAddress *destAddr, BOOL *isDestMulticast)

Application input parsing API. Parses the source and destination strings.At the same time validates those strings for multicast address.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

void

APP_ParsingSourceAndDestString(Node *node, const char *inputString, const char *sourceString, NodeAddress


*sourceNodeId, NodeAddress *sourceAddr, const char *destString, NodeAddress *destNodeId, NodeAddress
*destAddr, DestinationType *destType)

API to parse the input source and destination strings read from the *.app file.At the same time checks and fills the destination type
parameter.
void

APP_ParsingSourceAndDestString(Node *node, const char *inputString, const char *sourceString, NodeId


*sourceNodeId, Address *sourceAddr, const char *destString, NodeId *destNodeId, Address *destAddr,
DestinationType *destType)

API to parse the input source and destination strings read from the *.app file. At the same time checks and fills the destination type
parameter.
AppInfo*

APP_RegisterNewApp(Node*node, AppTypeappType, void *dataPtr, shortmyPort)

Also inserts the port number being used for this app in the port table.
BOOL

APP_IsFreePort(Node*node, shortportNumber)

there is an application running at the node that uses an AppType that has been assigned the same value as this port number. This is done
since applications such as CBR use the value of AppType as destination port.
short

APP_GetFreePort(Node*node)

void

APP_InserInPortTable(Node*node, AppTypeappType, shortmyPort)

unsigned short

APP_GetProtocolType(Node*node, Message*msg)

BOOL

APP_AssignTos(char arraytosString, char arraytosValString, unsigned *tosVal)

Application input parsing API. Parses the tos string and tos value strings.At the same time validates those strings for proper ranges.
Message*

APP_UdpCreateNewHeaderVirtualDataWithPriority(Node *node, AppTypeappType, NodeAddresssourceAddr,


shortsourcePort, NodeAddressdestAddr, char*header, intheaderSize, intpayloadSize, TosTypepriority,
TraceProtocolTypetraceProtocol)

Allocate header + virtual data with specified priority and send to UDP. Generally used with messenger app.
Message*

APP_UdpCreateNewHeaderVirtualDataWithPriority(Node *node, AppTypeappType, AddresssourceAddr,


shortsourcePort, AddressdestAddr, char*header, intheaderSize, intpayloadSize, TosTypepriority,
TraceProtocolTypetraceProtocol)

Allocate header + virtual data with specified priority and send to UDP. Generally used with messenger app.
void

APP_UnregisterApp(Node*node, void *dataPtr, boolfreeData)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Remove an application from list of apps on this node.


void

APP_UnregisterApp(Node*node, AppTypeappType, void *dataPtr, shortmyPort)

Also Remove the port number being used for this app in the port table.
BOOL

APP_IsFreePort(Node*node, shortportNumber)

there is an application running at the node that uses an AppType that has been assigned the same value as this port number. This is done
since applications such as CBR use the value of AppType as destination port.
void

APP_RemoveFromPortTable(Node*node, shortmyPort)

SequenceNumber

APP_ReportStatsDbReceiveEvent(Node*node, Message*msg, SequenceNumber**seqCache, Int64seqNo, clocktypedelay,


clocktypejitter, intsize, intnumRcvd, AppMsgStatusmsgStatus)

Report receive event to StatsDB app event table This function will check duplicate and out of order msgs

Function / Macro Detail


Function / Macro
APP_GetTimerType(x)

Format
Get the timerType for a received App Layer Timer.

APP_RegisterNewApp

AppInfo* APP_RegisterNewApp (Node*node, AppTypeappType, void *dataPtr)

Parameters:

Insert a new application into the list of apps on this


node.

node

- node that is registering the application.

appType

- application type

dataPtr

- pointer to the data space for this app

Returns:
AppInfo*

- pointer to the new AppInfo data structure for this app

APP_SetTimer

void APP_SetTimer (Node*node, AppTypeappType, intconnId, shortsourcePort, inttimerType, clocktypedelay)

Parameters:

Set a new App Layer Timer and send to self after delay.

node

- node that is issuing the Timer.

appType

- application type

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

connId

- if applicable, the TCP connectionId for this timer

sourcePort
timerType
delay

- the source port of the application setting

- an integer value that can be used to

- send the timer to self after this delay.

Returns:
- None

void

APP_UdpSendNewData

void APP_UdpSendNewData (Node *node, AppTypeappType, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, char *payload, intpayloadSize, clocktypedelay, TraceProtocolTypetraceProtocol)

Parameters:
Allocate data and send to UDP.
node

- node that is sending the data.

appType

- application type, to be used as destination port.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr
payload

- the destination node Id data is sent to.

- pointer to the data.

payloadSize
delay

- size of the data in bytes.

- send the data after this delay.

traceProtocol

- specify the type of application used for

Returns:
void

APP_UdpSendNewDataWithPriority

Allocate data with specified priority and send to UDP.

- None

void APP_UdpSendNewDataWithPriority (Node *node, AppTypeappType, NodeAddresssourceAddr,


shortsourcePort, NodeAddressdestAddr, intoutgoingInterface, char*payload, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32uniqueId, char*mdpDataObjectInfo,
UInt16mdpDataInfosize)
Parameters:
node

- node that is sending the data.

appType

- application type, to be used as

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

outgoingInterface
payload

- pointer to the data.

payloadSize
priority
delay

- interface used to send data.

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol
isMdpEnabled
uniqueId

- specify the type of application

- specify whether MDP is enabled.

- specify uniqueId related to MDP.

mdpDataObjectInfo
mdpDataInfosize

- specify the mdp data object info if any.

- specify the mdp data info size.

Returns:
- None

void

APP_UdpSendNewDataWithPriority

Allocate data with specified priority and send to UDP


(For IPv6).

Message* APP_UdpSendNewDataWithPriority (Node *node, AppTypeappType, NodeAddresssourceAddr,


shortsourcePort, NodeAddressdestAddr, intoutgoingInterface, char*payload, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32uniqueId)
Parameters:
node

- node that is sending the data.

appType

- application type, to be used as

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

outgoingInterface
payload

- pointer to the data.

payloadSize
priority
delay

- interface used to send data.

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol
isMdpEnabled
uniqueId

- specify the type of application

- specify whether MDP is enabled.

- specify uniqueId related to MDP.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Returns:
Message*

APP_UdpSendNewHeaderData

- The sent message

void APP_UdpSendNewHeaderData (Node *node, AppTypeappType, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, char*header, intheaderSize, char*payload, intpayloadSize, clocktypedelay,
TraceProtocolTypetraceProtocol)

Allocate header and data and send to UDP..

Parameters:
node

- node that is sending the data.

appType

- application type, to be used as

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr
header

- the destination node Id data

- header of the payload.

headerSize
payload

- size of the header.

- pointer to the data.

payloadSize
delay

- size of the data in bytes.

- send the data after this delay.

traceProtocol

- specify the type of application

Returns:
void

APP_UdpSendNewHeaderDataWithPriority

Allocate header and data with specified priority and send


to UDP

- None

void APP_UdpSendNewHeaderDataWithPriority (Node *node, AppTypeappType, NodeAddresssourceAddr,


shortsourcePort, NodeAddressdestAddr, intoutgoingInterface, char*header, intheaderSize, char*payload,
intpayloadSize, TosTypepriority, clocktypedelay, TraceProtocolTypetraceProtocol)
Parameters:
node

- node that is sending the data.

appType

- application type, to be used as

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

outgoingInterface

- interface used to send data.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

header

- header of the payload.

headerSize
payload

- size of the header.

- pointer to the data.

payloadSize
priority
delay

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol

- specify the type of application

Returns:
- None

void

APP_UdpSendNewHeaderVirtualDataWithPriority

Allocate header + virtual data with specified priority and


send to UDP

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, AppTypeappType,


NodeAddresssourceAddr, shortsourcePort, NodeAddressdestAddr, char*header, intheaderSize, intpayloadSize,
TosTypepriority, clocktypedelay, TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32mdpUniqueId)
Parameters:
node

- node that is sending the data.

appType

- application type, to be used as

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr
header

- the destination node Id data

- header of the payload.

headerSize

- size of the header.

payloadSize
priority
delay

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol
isMdpEnabled
mdpUniqueId

- specify the type of application

- status of MDP layer.

- unique id for MPD session.

Returns:
void

APP_UdpSendNewHeaderVirtualDataWithPriority

- None

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, NodeAddresssourceAddr, shortsourcePort,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Allocate header + virtual data with specified priority and


send to UDP. Data is sent to a non-default destination
port (port number may not have same value as the
AppType).

NodeAddressdestAddr, shortdestinationPort, char*infoData, intinfoSize, intinfoType, intpayloadSize,


TosTypepriority, clocktypedelay, TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32mdpUniqueId)
Parameters:
node

- node that is sending the data.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

destinationPort

- the destination port

infoData

- UDP header to be added in info.

infoSize

- size of the UDP header.

infoType

- info type of the UDP header.

payloadSize
priority
delay

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol
isMdpEnabled
mdpUniqueId

- specify the type of application

- status of MDP layer.

- unique id for MPD session.

Returns:
void

APP_UdpSendNewHeaderVirtualDataWithPriority

(Overloaded for IPv6) Allocate header + virtual data


with specified priority and send to UDP. Data is sent to a
non-default destination port (port number may not have
same value as the AppType).

- None

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, AddresssourceAddr, shortsourcePort,


AddressdestAddr, shortdestinationPort, char*infoData, intinfoSize, intinfoType, intpayloadSize,
TosTypepriority, clocktypedelay, TraceProtocolTypetraceProtocol, char*appname, BOOLisMdpEnabled,
Int32mdpUniqueId)
Parameters:
node

- node that is sending the data.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

destinationPort
infoData

- the destination port

- UDP header to be added.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

infoSize

- size of the UDP header.

infoType

- info type of the UDP header

payloadSize
priority
delay

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol
appname

- specify the type of application

- Application name.

isMdpEnabled
mdpUniqueId

- status of MDP layer.

- unique id for MPD session.

Returns:
- None

void

APP_UdpSendNewHeaderVirtualDataWithPriority

(Overloaded for IPv6) Allocate header + virtual data


with specified priority and send to UDP. Data is sent to a
non-default destination port (port number may not have
same value as the AppType).

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, AddresssourceAddr, shortsourcePort,


AddressdestAddr, shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol, char*infoData, intinfoSize, intinfoType, BOOLisMdpEnabled,
Int32mdpUniqueId)
Parameters:
node

- node that is sending the data.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

destinationPort
header

- header of the payload.

headerSize

- size of the header.

payloadSize
priority
delay

- the destination port

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol

- specify the type of application

infoData

- UDP header to be added.

infoSize

- size of the UDP header.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

infoType

- info type of the UDP header

isMdpEnabled
mdpUniqueId

- status of MDP layer.

- unique id for MPD session.

Returns:
- None

void

APP_UdpSendNewHeaderVirtualDataWithPriority

Allocate header + virtual data with specified priority and


send to UDP. Data is sent to a non-default destination
port (port number may not have same value as the
AppType).

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, NodeAddresssourceAddr, shortsourcePort,


NodeAddressdestAddr, shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol)
Parameters:
node

- node that is sending the data.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

destinationPort
header

- header of the payload.

headerSize

- size of the header.

payloadSize
priority
delay

- the destination port

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol

- specify the type of application

Returns:
void

APP_UdpSendNewHeaderVirtualDataWithPriority

(Overloaded for MDP) Allocate actual + virtual data


with specified priority and send to UDP. Data is sent to a
non-default destination port (port number may not have
same value as the AppType).

- None

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, AppTypeappType, AddresssourceAddr,


shortsourcePort, AddressdestAddr, char*header, intheaderSize, intpayloadSize, TosTypepriority,
clocktypedelay, char*mdpInfo, TraceProtocolTypetraceProtocol, Message*theMsgPtr)
Parameters:
node

- node that is sending the data.

appType

- specify the application type.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

destAddr
header

- the destination node on which

- pointer to the payload.

headerSize

- size of the payload.

payloadSize
priority
delay

- size of the virtual data in bytes.

- priority of data.

- send the data after this delay.

mdpInfo

- persistent info for Mdp.

traceProtocol
theMsgPtr

- specify the type of application

- pointer the original message to copy

Returns:
- None

void

APP_UdpSendNewHeaderVirtualDataWithPriority

(Overloaded for IPv6) Allocate header + virtual data


with specified priority and send to UDP. Data is sent to a
non-default destination port (port number may not have
same value as the AppType).

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, AddresssourceAddr, shortsourcePort,


AddressdestAddr, shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol)
Parameters:
node

- node that is sending the data.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

destinationPort
header

- header of the payload.

headerSize

- size of the header.

payloadSize
priority
delay

- the destination port

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol

- specify the type of application

Returns:
void

APP_UdpSendNewHeaderVirtualDataWithPriority

- None

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, AddresssourceAddr, shortsourcePort,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

(Overloaded for IPv6) Allocate header + virtual data


with specified priority and send to UDP. Data is sent to a
non-default destination port (port number may not have
same value as the AppType).

AddressdestAddr, shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority,


clocktypedelay, TraceProtocolTypetraceProtocol)
Parameters:
node

- node that is sending the data.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

destinationPort
header

- header of the payload.

headerSize

- size of the header.

payloadSize
priority
delay

- the destination port

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol

- specify the type of application

Returns:
void

APP_UdpCreateNewHeaderVirtualDataWithPriority.

- None

Message * APP_UdpCreateNewHeaderVirtualDataWithPriority. (Node *node, AddresssourceAddr,


shortsourcePort, AddressdestAddr, shortdestinationPort, char*header, intheaderSize, intpayloadSize,
TosTypepriority, TraceProtocolTypetraceProtocol)

Create the message.

Parameters:
node

- node that is sending the data.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

destinationPort
header

- the destination port

- header of the payload.

headerSize

- size of the header.

payloadSize
priority

- size of the data in bytes.

- priority of data.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

traceProtocol

- specify the type of application

Returns:
Message *

APP_UdpSendNewHeaderVirtualDataWithPriority

(Overloaded for IPv6) Allocate header + virtual data


with specified priority and send to UDP. Data is sent to a
non-default destination port (port number may not have
same value as the AppType).

- message created in the function

void APP_UdpSendNewHeaderVirtualDataWithPriority (Node *node, AddresssourceAddr, shortsourcePort,


AddressdestAddr, shortdestinationPort, char*header, intheaderSize, intpayloadSize, TosTypepriority,
clocktypedelay, TraceProtocolTypetraceProtocol, BOOLisMdpEnabled, Int32mdpUniqueId)
Parameters:
node

- node that is sending the data.

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr

- the destination node Id data

destinationPort
header

- header of the payload.

headerSize

- size of the header.

payloadSize
priority
delay

- the destination port

- size of the data in bytes.

- priority of data.

- send the data after this delay.

traceProtocol
isMdpEnabled
mdpUniqueId

- specify the type of application

- status of MDP layer.

- unique id for MPD session.

Returns:
void

- None

APP_TcpServerListen.

void APP_TcpServerListen. (Node *node, AppTypeappType, NodeAddressserverAddr, shortserverPort)

Parameters:

Listen on a server port.

node

- Node pointer that the protocol is

appType

- which application initiates this request

serverAddr

- server address

serverPort

- server port number

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

void

- None

APP_TcpServerListen.

void APP_TcpServerListen. (Node *node, AppTypeappType, AddressserverAddr, shortserverPort)

Parameters:

(Overloaded for IPv6) Listen on a server port.

node

- Node pointer that the protocol is

appType

- which application initiates this request

serverAddr

- server address

serverPort

- server port number

Returns:
void

APP_TcpServerListenWithPriority.

- None

void APP_TcpServerListenWithPriority. (Node *node, AppTypeappType, NodeAddressserverAddr,


shortserverPort, TosTypepriority)

Parameters:
Listen on a server port with specified priority.
node

- Node pointer that the protocol is

appType

- which application initiates this request

serverAddr

- server address

serverPort

- server port number

priority

- priority of this data for

Returns:
void

APP_TcpServerListenWithPriority.

- None

void APP_TcpServerListenWithPriority. (Node *node, AppTypeappType, AddressserverAddr, shortserverPort,


TosTypepriority)

Parameters:
Listen on a server port with specified priority.
(Overloaded for IPv6)

node

- Node pointer that the protocol is

appType

- which application initiates this request

serverAddr

- server address

serverPort

- server port number

priority

- priority of this data for

Returns:
void
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

- None
APP_TcpOpenConnection.

void APP_TcpOpenConnection. (Node *node, appTypeappType, NodeAddresslocalAddr, shortlocalPort,


NodeAddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime)

Parameters:
Open a connection.
node

- Node pointer that the protocol is

appType

- which application initiates this request

localAddr

- address of the source node.

localPort

- port number on the source node.

remoteAddr

- address of the remote node.

remotePort

- port number on the remote node (server port).

uniqueId

- used to determine which client is requesting

waitTime

- time until the session starts.

Returns:
void

APP_TcpOpenConnection.

- None

void APP_TcpOpenConnection. (Node *node, appTypeappType, AddresslocalAddr, shortlocalPort,


AddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime)

Parameters:
(Overloaded for IPv6) Open a connection.
node

- Node pointer that the protocol is

appType

- which application initiates this request

localAddr

- address of the source node.

localPort

- port number on the source node.

remoteAddr

- address of the remote node.

remotePort

- port number on the remote node (server port).

uniqueId

- used to determine which client is requesting

waitTime

- time until the session starts.

Returns:
void

APP_TcpOpenConnection.

- None

void APP_TcpOpenConnection. (Node *node, appTypeappType, NodeAddresslocalAddr, shortlocalPort,


NodeAddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime, intoutgoingInterface)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Parameters:
Open a connection.
node

- Node pointer that the protocol is

appType

- which application initiates this request

localAddr

- address of the source node.

localPort

- port number on the source node.

remoteAddr

- address of the remote node.

remotePort

- port number on the remote node (server port).

uniqueId

- used to determine which client is requesting

waitTime

- time until the session starts.

outgoingInterface

- User specific outgoing Interface.

Returns:
void

APP_TcpOpenConnection.

- None

void APP_TcpOpenConnection. (Node *node, appTypeappType, AddresslocalAddr, shortlocalPort,


AddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime, intoutgoingInterface)

Parameters:
(Overloaded for IPv6) Open a connection.
node

- Node pointer that the protocol is

appType

- which application initiates this request

localAddr

- address of the source node.

localPort

- port number on the source node.

remoteAddr

- address of the remote node.

remotePort

- port number on the remote node (server port).

uniqueId

- used to determine which client is requesting

waitTime

- time until the session starts.

outgoingInterface

- User specific outgoing Interface.

Returns:
void

APP_TcpOpenConnectionWithPriority.

- None

void APP_TcpOpenConnectionWithPriority. (Node *node, appTypeappType, NodeAddresslocalAddr,


shortlocalPort, NodeAddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime, TosTypepriority)

Parameters:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Open a connection with specified priority.


node

- Node pointer that the protocol is

appType

- which application initiates this request

localAddr

- address of the source node.

localPort

- port number on the source node.

remoteAddr

- address of the remote node.

remotePort

- port number on the remote node (server port).

uniqueId

- used to determine which client is requesting

waitTime

- time until the session starts.

priority

- priority of the data.

Returns:
void

APP_TcpOpenConnectionWithPriority..

- None

void APP_TcpOpenConnectionWithPriority.. (Node *node, appTypeappType, AddresslocalAddr, shortlocalPort,


AddressremoteAddr, shortremotePort, intuniqueId, clocktypewaitTime, TosTypepriority)

Parameters:
Open a connection with specified priority. (Overloaded
for IPv6)

node

- Node pointer that the protocol is

appType

- which application initiates this request

localAddr

- address of the source node.

localPort

- port number on the source node.

remoteAddr

- address of the remote node.

remotePort

- port number on the remote node (server port).

uniqueId

- used to determine which client is requesting

waitTime

- time until the session starts.

priority

- priority of the data.

Returns:
void

App_TcpCreateMessage.

- None

Message * App_TcpCreateMessage. (Node *node, intconnId, char *payload, intlength,


traceProtocolTypetraceProtocol)

Parameters:
Create the message.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

node

- Node pointer that the protocol is

connId

- connection id.

payload
length

- data to send.

- length of the data to send.

traceProtocol

- specify the type of application

Returns:
Message *

- message created in the function

APP_TcpSendData.

void APP_TcpSendData. (Node *node, intconnId, char *payload, intlength, raceProtocolTypetraceProtocol)

Parameters:

send an application data unit.

node

- Node pointer that the protocol is

connId

- connection id.

payload
length

- data to send.

- length of the data to send.

traceProtocol

- specify the type of application

Returns:
void

APP_TcpSendNewHeaderVirtualData.

- None

Message* APP_TcpSendNewHeaderVirtualData. (Node *node, intconnId, char *header, intheaderLength,


intpayloadSize, raceProtocolTypetraceProtocol)

Parameters:
Send header and virtual data using TCP.
node

- Node pointer that the protocol is

connId

- connection id.

header

- header to send.

headerLength
payloadSize

- length of the header to send.

- size of data to send along with header.

traceProtocol

- specify the type of application

Returns:
Message*

APP_TcpCloseConnection

- Sent message

void APP_TcpCloseConnection (Node *node, intconnId)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Close the connection.

Parameters:
node

- Node pointer that the protocol is

connId

- connection id.

Returns:
void

- None

APP_InitMulticastGroupMembershipIfAny

void APP_InitMulticastGroupMembershipIfAny (Node *node, const NodeInputnodeInput)

Parameters:

Start process of joining multicast group if need to do so.

node

- node - node that is joining a group.

nodeInput

- used to access configuration file.

Returns:
void

APP_CheckMulticastByParsingSourceAndDestString

Application input parsing API. Parses the source and


destination strings.At the same time validates those
strings for multicast address.

- None

void APP_CheckMulticastByParsingSourceAndDestString (Node *node, const char *inputString, const char


*sourceString, NodeAddress *sourceNodeId, NodeAddress *sourceAddr, const char *destString, NodeAddress
*destNodeId, NodeAddress *destAddr, BOOL *isDestMulticast)
Parameters:
node

- A pointer to Node.

inputString

- The input string.

sourceString

- The source string.

sourceNodeId

- A pointer to NodeAddress.

sourceAddr

- A pointer to NodeAddress.

destString

- The destination string.

destNodeId

- A pointer to NodeAddress.

destAddr

- A pointer to NodeAddress.

isDestMulticast

- Pointer to multicast checking flag.

Returns:
void

APP_ParsingSourceAndDestString

- None

void APP_ParsingSourceAndDestString (Node *node, const char *inputString, const char *sourceString,
NodeAddress *sourceNodeId, NodeAddress *sourceAddr, const char *destString, NodeAddress *destNodeId,
NodeAddress *destAddr, DestinationType *destType)

API to parse the input source and destination strings read

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

from the *.app file.At the same time checks and fills the
destination type parameter.

node

- A pointer to Node.

inputString

- The input string.

sourceString

- The source string.

sourceNodeId

- A pointer to NodeAddress.

sourceAddr

- A pointer to NodeAddress.

destString

- The destination string.

destNodeId

- A pointer to NodeAddress.

destAddr

- A pointer to NodeAddress.

destType

- A pointer to Destinationtype.

Returns:
void

APP_ParsingSourceAndDestString

API to parse the input source and destination strings read


from the *.app file. At the same time checks and fills the
destination type parameter.

- None

void APP_ParsingSourceAndDestString (Node *node, const char *inputString, const char *sourceString, NodeId
*sourceNodeId, Address *sourceAddr, const char *destString, NodeId *destNodeId, Address *destAddr,
DestinationType *destType)
Parameters:
node

- A pointer to Node.

inputString

- The input string.

sourceString

- The source string.

sourceNodeId

- A pointer to NodeAddress.

sourceAddr

- A pointer to NodeAddress.

destString

- The destination string.

destNodeId

- A pointer to NodeAddress.

destAddr

- A pointer to NodeAddress.

destType

- A pointer to DestinationType.

Returns:
void

- None

APP_RegisterNewApp

AppInfo* APP_RegisterNewApp (Node*node, AppTypeappType, void *dataPtr, shortmyPort)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Also inserts the port number being used for this app in
the port table.

node

- node that is registering the application.

appType

- application type

dataPtr

- pointer to the data space for this app

myPort

- port number to be inserted in the port table

Returns:
AppInfo*

- pointer to the new AppInfo data structure

APP_IsFreePort

BOOL APP_IsFreePort (Node*node, shortportNumber)

Parameters:

there is an application running at the node that uses an


AppType that has been assigned the same value as this
port number. This is done since applications such as
CBR use the value of AppType as destination port.

node

- node that is checking it's port table

portNumber

- port number to check

Returns:
- indicates if the port is free

BOOL

APP_GetFreePort

short APP_GetFreePort (Node*node)

Parameters:
node

- node that is requesting a free port

Returns:
- returns a free port

short

APP_InserInPortTable

void APP_InserInPortTable (Node*node, AppTypeappType, shortmyPort)

Parameters:
node

- node that needs to be insert in port table

appType
myPort

- application running at the port

- port number to check

Returns:
void

- None

APP_GetProtocolType

unsigned short APP_GetProtocolType (Node*node, Message*msg)

Parameters:
node
msg

- node that received the message

- pointer to the message received

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Returns:
unsigned short

- protocol which will receive the message

APP_AssignTos

BOOL APP_AssignTos (char arraytosString, char arraytosValString, unsigned *tosVal)

Parameters:

Application input parsing API. Parses the tos string and


tos value strings.At the same time validates those strings
for proper ranges.

tosString

- The tos string.

tosValString
tosVal

- The tos value string.

- A pointer to equivalent 8-bit TOS value.

Returns:
BOOL

APP_UdpCreateNewHeaderVirtualDataWithPriority

Allocate header + virtual data with specified priority and


send to UDP. Generally used with messenger app.

- None

Message* APP_UdpCreateNewHeaderVirtualDataWithPriority (Node *node, AppTypeappType,


NodeAddresssourceAddr, shortsourcePort, NodeAddressdestAddr, char*header, intheaderSize, intpayloadSize,
TosTypepriority, TraceProtocolTypetraceProtocol)
Parameters:
node

- node that is sending the data.

appType

- type of application data

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr
header

- the destination node Id data

- header of the payload.

headerSize

- size of the header.

payloadSize
priority

- size of the data in bytes.

- priority of data.

traceProtocol

- specify the type of application

Returns:
Message*

APP_UdpCreateNewHeaderVirtualDataWithPriority

Allocate header + virtual data with specified priority and


send to UDP. Generally used with messenger app.

- Pointer to allocated message structure

Message* APP_UdpCreateNewHeaderVirtualDataWithPriority (Node *node, AppTypeappType,


AddresssourceAddr, shortsourcePort, AddressdestAddr, char*header, intheaderSize, intpayloadSize,
TosTypepriority, TraceProtocolTypetraceProtocol)
Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

node

- node that is sending the data.

appType

- type of application data

sourceAddr

- the source sending the data.

sourcePort

- the application source port.

destAddr
header

- the destination node Id data

- header of the payload.

headerSize

- size of the header.

payloadSize
priority

- size of the data in bytes.

- priority of data.

traceProtocol

- specify the type of application

Returns:
Message*

- Pointer to allocated message structure

APP_UnregisterApp

void APP_UnregisterApp (Node*node, void *dataPtr, boolfreeData)

Parameters:

Remove an application from list of apps on this node.

node

- node that is unregistering the application.

dataPtr

- pointer to the data space for this app.

freeData

- if true, free (via MEM_free) the dataPtr

Returns:
void

- None

APP_UnregisterApp

void APP_UnregisterApp (Node*node, AppTypeappType, void *dataPtr, shortmyPort)

Parameters:

Also Remove the port number being used for this app in
the port table.

node

- node that is registering the application.

appType

- application type

dataPtr

- pointer to the data space for this app

myPort

- port number to be inserted in the port table

Returns:
void

APP_IsFreePort

- None

BOOL APP_IsFreePort (Node*node, shortportNumber)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

there is an application running at the node that uses an


AppType that has been assigned the same value as this
port number. This is done since applications such as
CBR use the value of AppType as destination port.

Parameters:
node

- node that is checking it's port table.

portNumber

- port number to check.

Returns:
- indicates if the port is free.

BOOL

APP_RemoveFromPortTable

void APP_RemoveFromPortTable (Node*node, shortmyPort)

Parameters:
node

- node that needs to be remove from port table

myPort

- port number to check

Returns:
- None

void

APP_ReportStatsDbReceiveEvent

SequenceNumber APP_ReportStatsDbReceiveEvent (Node*node, Message*msg, SequenceNumber**seqCache,


Int64seqNo, clocktypedelay, clocktypejitter, intsize, intnumRcvd, AppMsgStatusmsgStatus)

Parameters:
Report receive event to StatsDB app event table This
function will check duplicate and out of order msgs

node
msg

- Pointer to a node who recieves the msg

- The received message or fragment

seqCache

- Pointer to the sequence number cache

seqNo

- Sequence number of the message or fragment

delay

- Delay of the message/fragment

jitter
size

- Smoothed jitter of the received message

- Size of msg/fragment to be report to db

numRcvd

- # of msgs/frags received so far

msgStatus

- This is for performance optimization. If

Returns:
SequenceNumber

- Status or out of order or new

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APP_UTIL

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APP_UTIL.html[10/28/2011 1:25:10 PM]

APPLICATION LAYER

QualNet 5.2 API Reference


APPLICATION LAYER
This file describes data structures and functions used by the Application Layer.
Constant / Data Structure Summary
Type

Name

CONSTANT

APP_DEFAULT_TOS

Application default tos value

CONSTANT

APP_MAX_DATA_SIZE

Maximum size of data unit

CONSTANT

DEFAULT_APP_QUEUE_SIZE

Default size of Application layer queue (in byte)

CONSTANT

PORT_TABLE_HASH_SIZE

Prime number indicating port table size

CONSTANT

MAC_LINK16_FRAG_SIZE

Maximum fragment size supported by LINK16 MAC protocol. For Link16, it seems the fragment size should be 8 * 9 bytes = 72 bytes

CONSTANT

MAC_DEFAULT_INTERFACE

Default interface of MAC layer. ASSUMPTION :: Source and Destination node must have only one interface with TADIL network.

ENUMERATION

AppType

Enumerates the type of application protocol

STRUCT

Link16GatewayData

Store Link16/IP gateway forwarding table

STRUCT

AppInfo

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APPLICATION LAYER.html[10/28/2011 1:25:17 PM]

APPLICATION LAYER

Information relevant to specific app layer protocol

STRUCT

PortInfo

Store port related information

STRUCT

AppMultimedia

Store multimedia signalling related information

STRUCT

AppData

Details of application data structure in node structure

STRUCT

AppTimer

Timer structure used by applications

Function / Macro Summary


Return Type

Summary

void

InitiateConnectionType(Node*node, void*voip)

Multimedia callback funtion to open request for a TCP connection from the initiating terminal
void

TerminateConnectionType(Node*node, void*voip)

Multimedia callback funtion to close TCP connection as requested by VOIP application


BOOL

IsHostCallingType(Node*node)

Multimedia callback funtion to check whether node is in initiator mode


BOOL

IsHostCalledType(Node*node)

Multimedia callback funtion to check whether node is in receiver mode

Constant / Data Structure Detail


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APPLICATION LAYER.html[10/28/2011 1:25:17 PM]

APPLICATION LAYER

Constant

APP_DEFAULT_TOSOx00

Constant

Application default tos value


APP_MAX_DATA_SIZEIP_MAXPACKET-MSG_MAX_HDR_SIZE

Constant

Maximum size of data unit


DEFAULT_APP_QUEUE_SIZE640000

Constant

Default size of Application layer queue (in byte)


PORT_TABLE_HASH_SIZE503

Constant

Prime number indicating port table size


MAC_LINK16_FRAG_SIZE72

Constant

Maximum fragment size supported by LINK16 MAC protocol. For Link16, it seems the fragment size should be 8 * 9 bytes = 72 bytes
MAC_DEFAULT_INTERFACE0

Enumeration

Default interface of MAC layer. ASSUMPTION :: Source and Destination node must have only one interface with TADIL network.
AppType

Structure

Enumerates the type of application protocol


Link16GatewayData

Structure

Store Link16/IP gateway forwarding table


AppInfo

Structure

Information relevant to specific app layer protocol


PortInfo

Store port related information

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APPLICATION LAYER.html[10/28/2011 1:25:17 PM]

APPLICATION LAYER

Structure

AppMultimedia

Structure

Store multimedia signalling related information


AppData

Structure

Details of application data structure in node structure


AppTimer

Timer structure used by applications

Function / Macro Detail


Function / Macro
InitiateConnectionType

Format
void InitiateConnectionType (Node*node, void*voip)

Parameters:

Multimedia callback funtion to open request


for a TCP connection from the initiating
terminal

node

- Pointer to the node

voip

- Pointer to the voip application

Returns:
void

- NULL

TerminateConnectionType

void TerminateConnectionType (Node*node, void*voip)

Parameters:

Multimedia callback funtion to close TCP


connection as requested by VOIP application

node

- Pointer to the node

voip

- Pointer to the voip application

Returns:
void

- NULL

IsHostCallingType

BOOL IsHostCallingType (Node*node)

Parameters:

Multimedia callback funtion to check whether


node is in initiator mode

node

- Pointer to the node

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APPLICATION LAYER.html[10/28/2011 1:25:17 PM]

APPLICATION LAYER

BOOL

- TRUE if the node is initiator, FALSE otherwise

IsHostCalledType

BOOL IsHostCalledType (Node*node)

Parameters:

Multimedia callback funtion to check whether


node is in receiver mode

node

- Pointer to the node

Returns:
BOOL

- TRUE if the node is receiver, FALSE otherwise

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/APPLICATION LAYER.html[10/28/2011 1:25:17 PM]

BUFFER

QualNet 5.2 API Reference


BUFFER
This file describes data structures and functions to implement buffers.
Constant / Data Structure Summary
Type

Name

STRUCT

DataBuffer

structure for the data buffer

STRUCT

ReassemblyBuffer

Format for the Reassembly buffer

STRUCT

PacketBuffer

structure for the packet buffer

Function / Macro Summary


Return Type

Summary

MACRO

BUFFER_GetCurrentSize(x)

Returns the current size of the buffer


MACRO

BUFFER_GetMaxSize(x)

Returns maximum allowable size of the buffer


MACRO

BUFFER_GetData(x)

Returns a pointer to the data in the buffer


MACRO

BUFFER_GetAnticipatedSize(x)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

BUFFER

Returns the intial size of the buffer


MACRO

BUFFER_SetCurrentSize(x,y)

Sets current size of the buffer


MACRO

BUFFER_GetFreeSpace(x)

Get free space available in the buffer


MACRO

BUFFER_ReturnTop(x)

Returns top of the buffer


MACRO

BUFFER_NumberOfBlocks(X)

Returns the no. of blocks in the buffer


void

BUFFER_InitializeDataBuffer(DataBuffer*buffer, intsize)

Initializing Data buffer. Keeping in mind that buffer will be initialized once and the guess for initial size is a good one. For all the other
manipulation of the buffer will try to allocate in the initial if not asked to increase size and this size will remain until end of program for
re-using unless the buffer is closed completely.
void

BUFFER_AddSpaceToDataBuffer(DataBuffer*buffer, intsize)

Adding memory space to the buffer


void

BUFFER_ClearDataFromDataBuffer(DataBuffer*buffer, char *startLocation, intsize, BOOLdestroy)

clear data from the buffer(already used portion of buffer Not any unused portion unless u clear till end)
void

BUFFER_DestroyDataBuffer(DataBuffer*buffer)

To Destroy a buffer
void

BUFFER_AddDataToDataBuffer(DataBuffer*buffer, char *data, intsize)

Add data to databuffer


void

BUFFER_RemoveDataFromDataBuffer(DataBuffer*buffer, char*startLocation, intsize)

To remove data from the data buffer


void

InitializeReassemblyBuffer(ReassemblyBuffer*buffer, intsize)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

BUFFER

Initialize Reassembly buffer


void

BUFFER_AddDataToAssemblyBuffer(ReassemblyBuffer*buffer, char*data, intsize, BOOLallowOverflow)

Appending data to the reassembly buffer


void

BUFFER_ClearAssemblyBuffer(ReassemblyBuffer*buffer, intmax, BOOLsetSize)

clear the buffer


void

BUFFER_SetAnticipatedSizeForAssemblyBuffer(ReassemblyBuffer*buffer, intsize)

To set the anticipated size of the assemblyBuffer


PacketBuffer *

BUFFER_AllocatePacketBuffer(intinitialSize, intanticipatedHeaderMax, BOOLallowOverflow, char **dataPtr)

To allocate packet buffer


PacketBuffer *

BUFFER_AllocatePacketBufferWithInitialHeader(intinitialSize, intinitialHeaderSize, intanticipatedHeaderMax,


BOOLallowOverflow, char **dataPtr, char **headerPtr)

To allocate buffer with Intial header


void

BUFFER_AddHeaderToPacketBuffer(PacketBuffer*buffer, intheaderSize, char**headerPtr)

To add header to buffer


void

BUFFER_RemoveHeaderFromPacketBuffer(PacketBuffer*buffer, intheaderSize, char**dataPtr)

To remove header from packet buffer


void

BUFFER_ClearPacketBufferData(PacketBuffer*buffer)

To clear data from current buffer


void

BUFFER_FreePacketBuffer(PacketBuffer*buffer)

Free the packet buffer passed as argument


void

BUFFER_ConcatenatePacketBuffer(const PacketBuffer*source, PacketBuffer*dest)

Add useful contents of source buffer as header to to the destination buffer

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

BUFFER

Constant / Data Structure Detail

Structure

DataBuffer

Structure

structure for the data buffer


ReassemblyBuffer

Structure

Format for the Reassembly buffer


PacketBuffer

structure for the packet buffer

Function / Macro Detail


Function / Macro
BUFFER_GetCurrentSize(x)

Format
Returns the current size of the buffer

BUFFER_GetMaxSize(x)

Returns maximum allowable size of the buffer

BUFFER_GetData(x)

Returns a pointer to the data in the buffer

BUFFER_GetAnticipatedSize(x)

Returns the intial size of the buffer

BUFFER_SetCurrentSize(x,y)

Sets current size of the buffer

BUFFER_GetFreeSpace(x)

Get free space available in the buffer

BUFFER_ReturnTop(x)

Returns top of the buffer

BUFFER_NumberOfBlocks(X)

Returns the no. of blocks in the buffer

BUFFER_InitializeDataBuffer

void BUFFER_InitializeDataBuffer (DataBuffer*buffer, intsize)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

BUFFER

Initializing Data buffer. Keeping in mind that buffer


will be initialized once and the guess for initial size
is a good one. For all the other manipulation of the
buffer will try to allocate in the initial if not asked to
increase size and this size will remain until end of
program for re-using unless the buffer is closed
completely.

buffer
size

- buffer to be intialized

- intial size of the buffer

Returns:
void

- None

BUFFER_AddSpaceToDataBuffer

void BUFFER_AddSpaceToDataBuffer (DataBuffer*buffer, intsize)

Parameters:

Adding memory space to the buffer

buffer
size

- buffer to which to add space

- size to be added

Returns:
void

- None

BUFFER_ClearDataFromDataBuffer

void BUFFER_ClearDataFromDataBuffer (DataBuffer*buffer, char *startLocation, intsize, BOOLdestroy)

Parameters:

clear data from the buffer(already used portion of


buffer Not any unused portion unless u clear till end)

buffer

- buffer from which data is cleared

startLocation
size

- starting location

- intial size of the buffer

destroy

- destroy or not

Returns:
void

- None

BUFFER_DestroyDataBuffer

void BUFFER_DestroyDataBuffer (DataBuffer*buffer)

Parameters:

To Destroy a buffer

buffer

- buffer to be destroyed

Returns:
void

- None

BUFFER_AddDataToDataBuffer

void BUFFER_AddDataToDataBuffer (DataBuffer*buffer, char *data, intsize)

Parameters:

Add data to databuffer

buffer
data

- buffer to which data is added

- pointer to data that is added

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

BUFFER

size

- initial size of the buffer

Returns:
void

- None

BUFFER_RemoveDataFromDataBuffer

void BUFFER_RemoveDataFromDataBuffer (DataBuffer*buffer, char*startLocation, intsize)

Parameters:

To remove data from the data buffer

buffer

- buffer from which data is to be removed

startLocation
size

- starting location from whcih data is removed

- size of the buffer

Returns:
void

- None

InitializeReassemblyBuffer

void InitializeReassemblyBuffer (ReassemblyBuffer*buffer, intsize)

Parameters:

Initialize Reassembly buffer

buffer
size

- ReassemblyBuffer to be initialized

- maximum allowable size of the buffer

Returns:
void

- None

BUFFER_AddDataToAssemblyBuffer

void BUFFER_AddDataToAssemblyBuffer (ReassemblyBuffer*buffer, char*data, intsize, BOOLallowOverflow)

Parameters:

Appending data to the reassembly buffer

buffer

- Pointer to ReassemblyBuffer

data

- data to be added

size

- size of the data

allowOverflow

- To allow overflow or not

Returns:
void

- None

BUFFER_ClearAssemblyBuffer

void BUFFER_ClearAssemblyBuffer (ReassemblyBuffer*buffer, intmax, BOOLsetSize)

Parameters:

clear the buffer

buffer
max

- Pointer to ReassemblyBuffer

- the maximum size you want to set, if setSize is TRUE

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

BUFFER

setSize

- TRUE, if the buffer max-size is to be re-set

Returns:
void

- None

BUFFER_SetAnticipatedSizeForAssemblyBuffer

void BUFFER_SetAnticipatedSizeForAssemblyBuffer (ReassemblyBuffer*buffer, intsize)

Parameters:

To set the anticipated size of the assemblyBuffer

buffer
size

- Pointer to ReassemblyBuffer

- size to be set

Returns:
void

BUFFER_AllocatePacketBuffer

- None

PacketBuffer * BUFFER_AllocatePacketBuffer (intinitialSize, intanticipatedHeaderMax, BOOLallowOverflow, char


**dataPtr)

Parameters:
To allocate packet buffer
initialSize

- intial size of buffer

anticipatedHeaderMax
allowOverflow
dataPtr

- expected max header size

- if overflow is allowed

- pointer to data array

Returns:
PacketBuffer *

BUFFER_AllocatePacketBufferWithInitialHeader

- Pointer to packetbuffer

PacketBuffer * BUFFER_AllocatePacketBufferWithInitialHeader (intinitialSize, intinitialHeaderSize,


intanticipatedHeaderMax, BOOLallowOverflow, char **dataPtr, char **headerPtr)

Parameters:
To allocate buffer with Intial header
initialSize

- intial buffer size

initialHeaderSize

- initial header size

anticipatedHeaderMax
allowOverflow
dataPtr

- expected max header size

- if overflow is allowed

- pointer to array

headerPtr

- pointer to array

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

BUFFER

PacketBuffer *

- Pointer to packetbuffer

BUFFER_AddHeaderToPacketBuffer

void BUFFER_AddHeaderToPacketBuffer (PacketBuffer*buffer, intheaderSize, char**headerPtr)

Parameters:

To add header to buffer

buffer

- Pointer to PacketBuffer

headerSize
headerPtr

- size of header

- Pointer to an array of strings

Returns:
void

- None

BUFFER_RemoveHeaderFromPacketBuffer

void BUFFER_RemoveHeaderFromPacketBuffer (PacketBuffer*buffer, intheaderSize, char**dataPtr)

Parameters:

To remove header from packet buffer

buffer

- Pointer to PacketBuffer

headerSize
dataPtr

- size of header

- Pointer to an strings array

Returns:
void

- None

BUFFER_ClearPacketBufferData

void BUFFER_ClearPacketBufferData (PacketBuffer*buffer)

Parameters:

To clear data from current buffer

buffer

- Pointer to PacketBuffer

Returns:
void

- None

BUFFER_FreePacketBuffer

void BUFFER_FreePacketBuffer (PacketBuffer*buffer)

Parameters:

Free the packet buffer passed as argument

buffer

- Pointer to PacketBuffer

Returns:
void

- None

BUFFER_ConcatenatePacketBuffer

void BUFFER_ConcatenatePacketBuffer (const PacketBuffer*source, PacketBuffer*dest)

Parameters:

Add useful contents of source buffer as header to to

source

- Pointer to PacketBuffer

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

BUFFER

the destination buffer


dest

- Pointer to PacketBuffer

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/BUFFER.html[10/28/2011 1:25:29 PM]

CIRCULAR-BUFFER

QualNet 5.2 API Reference


CIRCULAR-BUFFER
This file describes data structures and functions used for circular buffer implementation.
Constant / Data Structure Summary
Type

Name

CONSTANT

CIR_BUF_SIZE

ENUMERATION

Default Circular Buffer Size

ENUMERATION

Type of Circular Buffer Operation

Type of Wrap operation

Function / Macro Summary


Return Type

Summary

bool

CircularBuffer.incPos(Int32increment, Int32operation)

increment read/write position based on operation


None

CircularBuffer.CircularBuffer()

Constructor
None

CircularBuffer.CircularBuffer(Int32queueSize)

Constructor
None

CircularBuffer.CircularBuffer(unsigned shortindex)

Constructor
None

CircularBuffer.CircularBuffer(unsigned shortindex, Int32queueSize)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CIRCULAR-BUFFER.html[10/28/2011 1:25:37 PM]

CIRCULAR-BUFFER

Constructor
Node

CircularBuffer.~CircularBuffer()

Destructor
bool

CircularBuffer.create(Int32queueSize)

Memory allocation for Circular Buffer


void

CircularBuffer.release(void)

To free the allocated memory


void

CircularBuffer.reset(void)

reset position and wrap values


bool

CircularBuffer.getCount(Int32&count, Int32operation)

gets the number of bytes to read


Int32

CircularBuffer.lengthToEnd(Int32operation)

get the circular buffer's allocated size


bool

CircularBuffer.readWithCount(unsigned char*data, Int32&length)

Read data from Buffer and pass the length of data read
bool

CircularBuffer.readFromBuffer(unsigned char*data, Int32length, boolnoIncrement)

Reading the required no. of bytes from the circular buffer


bool

CircularBuffer.write(unsigned char*data, Int32length)

Write to the circular buffer


bool

CircularBuffer.read(unsigned char*buffer)

To Read data from Buffer


Int32

CircularBuffer.getIndex(Int32operation)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CIRCULAR-BUFFER.html[10/28/2011 1:25:37 PM]

CIRCULAR-BUFFER

get the circular buffer's allocated size


Int32

CircularBuffer.getCirBufSize(voidnone)

get the circular buffer's allocated size


unsigned short

CircularBuffer.getIndex(voidnone)

get the circular buffer's unique index

Constant / Data Structure Detail

Constant

CIR_BUF_SIZE256

Enumeration

Default Circular Buffer Size

Enumeration

Type of Circular Buffer Operation

Type of Wrap operation

Function / Macro Detail


Function / Macro
CircularBuffer.incPos

Format
bool CircularBuffer.incPos (Int32increment, Int32operation)

Parameters:

increment read/write position based on


operation

increment

- How much will be incremented

operation

- Type of Operation (Read or Write )

Returns:
bool

- Successful or not

CircularBuffer.CircularBuffer

None CircularBuffer.CircularBuffer ()

Parameters:

Constructor

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CIRCULAR-BUFFER.html[10/28/2011 1:25:37 PM]

CIRCULAR-BUFFER

None

- None

CircularBuffer.CircularBuffer

None CircularBuffer.CircularBuffer (Int32queueSize)

Parameters:

Constructor

queueSize

- Size of the Queue

Returns:
None

- None

CircularBuffer.CircularBuffer

None CircularBuffer.CircularBuffer (unsigned shortindex)

Parameters:

Constructor

index

- Circular Buffer Index

Returns:
None

- None

CircularBuffer.CircularBuffer

None CircularBuffer.CircularBuffer (unsigned shortindex, Int32queueSize)

Parameters:

Constructor

index

- Circular Buffer Index

queueSize

- Size of the queue

Returns:
None

- None

CircularBuffer.~CircularBuffer

Node CircularBuffer.~CircularBuffer ()

Parameters:

Destructor

Returns:
Node

- None

CircularBuffer.create

bool CircularBuffer.create (Int32queueSize)

Parameters:

Memory allocation for Circular Buffer

queueSize

- Size of queue

Returns:
bool

CircularBuffer.release

- Successful or not

void CircularBuffer.release (void)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CIRCULAR-BUFFER.html[10/28/2011 1:25:37 PM]

CIRCULAR-BUFFER

To free the allocated memory

Parameters:
- None
Returns:
- None

void

CircularBuffer.reset

void CircularBuffer.reset (void)

Parameters:

reset position and wrap values

- None
Returns:
- None

void

CircularBuffer.getCount

bool CircularBuffer.getCount (Int32&count, Int32operation)

Parameters:

gets the number of bytes to read

count

- the parameter to be filled up

operation

- Type of Operation (Read or Write)

Returns:
- successful or not

bool

CircularBuffer.lengthToEnd

Int32 CircularBuffer.lengthToEnd (Int32operation)

Parameters:

get the circular buffer's allocated size

operation

- Read or Write Operation

Returns:
- Total length of data to be read

Int32

CircularBuffer.readWithCount

bool CircularBuffer.readWithCount (unsigned char*data, Int32&length)

Parameters:

Read data from Buffer and pass the length of


data read

data

- Container to which data will be read

length

- length of data read

Returns:
bool

- Successful or not

CircularBuffer.readFromBuffer

bool CircularBuffer.readFromBuffer (unsigned char*data, Int32length, boolnoIncrement)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CIRCULAR-BUFFER.html[10/28/2011 1:25:37 PM]

CIRCULAR-BUFFER

Reading the required no. of bytes from the


circular buffer

data

- Container to which data will be read

length

- length of data to be read

noIncrement

- Whether the read pointer is to be incremented or not

Returns:
- successful or not

bool

CircularBuffer.write

bool CircularBuffer.write (unsigned char*data, Int32length)

Parameters:

Write to the circular buffer

data

- Container to which data will be written

length

- Length of data to be written

Returns:
- successful or not

bool

CircularBuffer.read

bool CircularBuffer.read (unsigned char*buffer)

Parameters:

To Read data from Buffer

buffer

- Container to which data will be read

Returns:
- Succesful or not

bool

CircularBuffer.getIndex

Int32 CircularBuffer.getIndex (Int32operation)

Parameters:

get the circular buffer's allocated size

operation

- Read or Write Operation

Returns:
Int32

- Current operation Position

CircularBuffer.getCirBufSize

Int32 CircularBuffer.getCirBufSize (voidnone)

Parameters:

get the circular buffer's allocated size

none

- None

Returns:
Int32

CircularBuffer.getIndex

- circular buffer's allocated size

unsigned short CircularBuffer.getIndex (voidnone)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CIRCULAR-BUFFER.html[10/28/2011 1:25:37 PM]

CIRCULAR-BUFFER

get the circular buffer's unique index

Parameters:
none

- None

Returns:
unsigned short

- unique index

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CIRCULAR-BUFFER.html[10/28/2011 1:25:37 PM]

CLOCK

QualNet 5.2 API Reference


CLOCK
This file describes data structures and functions used for time-related operations.
Constant / Data Structure Summary
Type

Name

CONSTANT

CLOCKTYPE_MAX

CLOCKTYPE_MAX is the maximum value of clocktype. This value can be anything as long as it is less than or equal to the maximum
value of the type which is typedefed to clocktype. Users can simulate the model up to CLOCKTYPE_MAX - 1.

CONSTANT

NANO_SECOND

Defined as basic unit of clocktype

CONSTANT

MICRO_SECOND

Defined as 1000 times the basic unit of clocktype

CONSTANT

MILLI_SECOND

unit of time equal to 1000 times MICRO_SECOND

CONSTANT

SECOND

simulation unit of time =1000 times MILLI_SECOND

CONSTANT

MINUTE

unit of simulation time = 60 times SECOND

CONSTANT

HOUR

unit of simulation time = 60 times MINUTE

CONSTANT

DAY

unit of simulation time = 24 times HOUR

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CLOCK.html[10/28/2011 1:25:46 PM]

CLOCK

CONSTANT

PROCESS_IMMEDIATELY

Used to prioratize a process

Function / Macro Summary


Return Type

Summary

MACRO

ctoa

like sprintf, prints a clocktype to a string


MACRO

atoc

like atoi or atof, converts a string to a clocktype


MACRO

getSimTime(node)

To get the simulation time of a node


MACRO

getSimStartTime(node)

To get the simulation start time of a node


MACRO

TIME_getSimTime(node)

Gets current simulation time of a node


clocktype

TIME_ConvertToClock(char*buf)

Read the string in "buf" and provide the corresponding clocktype value for the string using the following conversions: NS - nanoseconds MS - milli-seconds S - seconds (default if no specification) H - hours D - days
void

TIME_PrintClockInSecond(clocktypeclock, char *stringInSecond)

Print a clocktype value in second.The result is copied to string in Seconds


void

TIME_PrintClockInSecond(clocktypeclock, char *stringInSecond, Node *node)

Print a clocktype value in second.The result is copied to string in Seconds


void

TIME_PrintClockInSecond(clocktypeclock, char *stringInSecond, PartitionData *partition)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CLOCK.html[10/28/2011 1:25:46 PM]

CLOCK

Print a clocktype value in second.The result is copied to string in Seconds


clocktype

TIME_ReturnMaxSimClock(Node*node)

Return the maximum simulation clock


clocktype

TIME_ReturnStartSimClock(Node*node)

Return the simulation start clock

Constant / Data Structure Detail

Constant

CLOCKTYPE_MAXPlatform dependent

Constant

CLOCKTYPE_MAX is the maximum value of clocktype. This value can be anything as long as it is less than or equal to the maximum
value of the type which is typedefed to clocktype. Users can simulate the model up to CLOCKTYPE_MAX - 1.
NANO_SECOND((clocktype) 1)

Constant

Defined as basic unit of clocktype


MICRO_SECOND(1000 * NANO_SECOND)

Constant

Defined as 1000 times the basic unit of clocktype


MILLI_SECOND(1000 * MICRO_SECOND)

Constant

unit of time equal to 1000 times MICRO_SECOND


SECOND(1000 * MILLI_SECOND)

Constant

simulation unit of time =1000 times MILLI_SECOND


MINUTE(60 * SECOND)

Constant

unit of simulation time = 60 times SECOND


HOUR(60 * MINUTE)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CLOCK.html[10/28/2011 1:25:46 PM]

CLOCK

Constant

unit of simulation time = 60 times MINUTE


DAY(24 * HOUR)

Constant

unit of simulation time = 24 times HOUR


PROCESS_IMMEDIATELY0

Used to prioratize a process

Function / Macro Detail


Function / Macro
ctoa

Format
like sprintf, prints a clocktype to a string

atoc

like atoi or atof, converts a string to a clocktype

getSimTime(node)

To get the simulation time of a node

getSimStartTime(node)

To get the simulation start time of a node

TIME_getSimTime(node)

Gets current simulation time of a node

TIME_ConvertToClock

clocktype TIME_ConvertToClock (char*buf)

Parameters:
- The time string

Read the string in "buf" and provide the


corresponding clocktype value for the string
using the following conversions: NS - nanoseconds MS - milli-seconds S - seconds
(default if no specification) H - hours D days
TIME_PrintClockInSecond

void TIME_PrintClockInSecond (clocktypeclock, char *stringInSecond)

Parameters:

Print a clocktype value in second.The result


is copied to string in Seconds

buf

Returns:
clocktype

clock

- Time in clocktype

- Time in clocktype

stringInSecond

- string containing time in seconds

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CLOCK.html[10/28/2011 1:25:46 PM]

CLOCK

- None

void

TIME_PrintClockInSecond

void TIME_PrintClockInSecond (clocktypeclock, char *stringInSecond, Node *node)

Parameters:

Print a clocktype value in second.The result


is copied to string in Seconds

clock

- Time in clocktype

stringInSecond
node

- string containing time in seconds

- Input node

Returns:
- None

void

TIME_PrintClockInSecond

void TIME_PrintClockInSecond (clocktypeclock, char *stringInSecond, PartitionData *partition)

Parameters:

Print a clocktype value in second.The result


is copied to string in Seconds

clock

- Time in clocktype

stringInSecond
partition

- string containing time in seconds

- Input partition

Returns:
void

- None

TIME_ReturnMaxSimClock

clocktype TIME_ReturnMaxSimClock (Node*node)

Parameters:

Return the maximum simulation clock

node

- Input node

Returns:
clocktype

- Returns maximum simulation time

TIME_ReturnStartSimClock

clocktype TIME_ReturnStartSimClock (Node*node)

Parameters:

Return the simulation start clock

node

- Input node

Returns:
clocktype

- Returns simulation start time

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CLOCK.html[10/28/2011 1:25:46 PM]

CLOCK

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/CLOCK.html[10/28/2011 1:25:46 PM]

COORDINATES

QualNet 5.2 API Reference


COORDINATES
This file describes data structures and functions used for coordinates-related operations.
Constant / Data Structure Summary
Type

Name

CONSTANT

PI

Defines the value of constant PI

CONSTANT

ANGLE_RESOLUTION

Defines ANGLE_RESOLUTION

CONSTANT

IN_RADIAN

Defines the constant IN_RADIAN

CONSTANT

EARTH_RADIUS

Defines the above constant EARTH_RADIUS

ENUMERATION

EarthRepresentationType

Defines the type of Earth that is represented Replaces coordinate_system_type

ENUMERATION

CoordinateRepresentationType

Defines the coordinate system that a coordinate is given in reference to

ENUMERATION

coordinate_system_type

Defines the type of coordinate system

STRUCT

cartesian_coordinates

Defines the three cartesian coordinates

STRUCT

latlonalt_coordinates

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

Defines the three latlonalt coordinates

STRUCT

common_coordinates

Defines the three common coordinates

STRUCT

Coordinates

Defines coordinates

STRUCT

Orientation

Defines the orientation structure

Function / Macro Summary


Return Type

Summary

MACRO

MAX(X, Y)

Finds the maximum of two entries


MACRO

MIN(X, Y)

Finds the minimum of two entries


MACRO

COORD_ShortestPropagationDelay(dist)

Calculate the shortest propagation delay. Shortest delay is assumed with light speed. Actual delay could be longer if propagation
medium is not eletromegnatic waves, such as acoustic wave.
BOOL

COORD_CoordinatesAreTheSame(const Coordinatesc1, const Coordinatesc2)

To compare two coordinates and determine if they are the same


BOOL

COORD_OrientationsAreTheSame(const Orientationo1, const Orientationo2)

To compare two coordinates and determine if they have the same orientation
static int

COORD_NormalizeAzimuthAngle(intangle)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

To normalize the azimuth angle


static int

COORD_NormalizeElevationAngle(intangle)

To normalize the elevation angle


static int

COORD_NormalizeAngleIndex(intangleIndex, intangleResolution)

To normalize the angleIndex


BOOL

COORD_CalcDistance(intcoordinateSystemType, const Coordinates*position1, const Coordinates*position2,


CoordinateTypedistance)

To calculate the distance between two nodes(points) given the coordinateSystemType and the coordinates of the two points
static void

COORD_CalcDistanceAndAngle(intcoordinateSystemType, constposition1, constposition2, double*distance,


Orientation*DOA1, Orientation*DOA2)

To calculate the Distance and Angle


static void

COORD_ChangeCoordinateSystem(const CoordinateRepresentationTypesource_type, const Coordinates* constsource,


const CoordinateRepresentationTypetarget_type, Coordinates* consttarget)

Re-calculate coordinate in a new coordinate system


static void

COORD_ChangeCoordinateSystem(const Coordinates* constsource, const CoordinateRepresentationTypetarget_type,


Coordinates* consttarget)

Re-calculate coordinate in a new coordinate system


static void

COORD_GeodeticToGeocentricCartesian(const Coordinates* constsource, Coordinates* consttarget)

Convert coordinate from GEODETIC to GEOCENTRIC_CARTESIAN


static void

COORD_GeocentricCartesianToGeodetic(const Coordinates* constsource, Coordinates* consttarget)

Convert coordinate from GEOCENTRIC_CARTESIAN to GEODETIC


static void

COORD_JGISToGeodetic(const Coordinates* constsource, Coordinates* consttarget)

Convert coordinate from JGIS to GEODETIC


static void

COORD_JGISToUnreferencedCartesian(const Coordinates* constsource, Coordinates* consttarget)

Convert coordinate from JGIS to UNREFERENCED_CARTESIAN


static void

COORD_ConvertToCoordinates(char*buf, Coordinates*coordinates)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

Read the string in "buf" and provide the corresponding coordinates for the string.
static void

COORD_MapCoordinateSystemToType(intcoordinateSystem, Coordinates*coordinates)

Set coordinates type field (CoordinateRepresentationType) based on the user-provided coordinate system (coordinate_system_type)
static void

COORD_NormalizeLongitude(Coordinates*coordinates)

Correct the longitude value to between -180 and 180. This function assumes the coordinate system is LLA.
bool

COORD_PointWithinRange(intcoordinateSystemType, Coordinates*sw, Coordinates*ne, Coordinates*point)

Is the point within the given range. Assume -90 <= lat <= 90 and -180 <= long <= 180 for all inputs.
bool

COORD_RegionsOverlap(intcoordinateSystemType, Coordinates*sw1, Coordinates*ne1, Coordinates*sw2,


Coordinates*ne2)

Determine whether the given regions overlap at all.


void

COORD_LongitudeDelta(CoordinateTypelong1, CoordinateTypelong2)

Convenience function for geodetic that, given two longitudes, returns the difference (in degrees) in the shorter direction.
void

COORD_PrintCoordinates(intcoordinateSystemType, Coordinates*point)

Prints the coordinates in a human readable format.

Constant / Data Structure Detail

Constant

PI3.14159265358979323846264338328

Constant

Defines the value of constant PI


ANGLE_RESOLUTION360

Constant

Defines ANGLE_RESOLUTION
IN_RADIAN(PI / 180.0)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

Constant

Defines the constant IN_RADIAN


EARTH_RADIUS6375000.0

Enumeration

Defines the above constant EARTH_RADIUS


EarthRepresentationType

Enumeration

Defines the type of Earth that is represented Replaces coordinate_system_type


CoordinateRepresentationType

Enumeration

Defines the coordinate system that a coordinate is given in reference to


coordinate_system_type

Structure

Defines the type of coordinate system


cartesian_coordinates

Structure

Defines the three cartesian coordinates


latlonalt_coordinates

Structure

Defines the three latlonalt coordinates


common_coordinates

Structure

Defines the three common coordinates


Coordinates

Structure

Defines coordinates
Orientation

Defines the orientation structure

Function / Macro Detail


Function / Macro

Format

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

MAX(X, Y)

Finds the maximum of two entries

MIN(X, Y)

Finds the minimum of two entries

COORD_ShortestPropagationDelay(dist)

Calculate the shortest propagation delay. Shortest delay is assumed with light speed. Actual delay could be longer if propagation
medium is not eletromegnatic waves, such as acoustic wave.

COORD_CoordinatesAreTheSame

BOOL COORD_CoordinatesAreTheSame (const Coordinatesc1, const Coordinatesc2)

Parameters:

To compare two coordinates and determine if


they are the same

c1

- coordinates of a point

c2

- coordinates of a point

Returns:
BOOL

- whether the points are the same

COORD_OrientationsAreTheSame

BOOL COORD_OrientationsAreTheSame (const Orientationo1, const Orientationo2)

Parameters:

To compare two coordinates and determine if


they have the same orientation

o1

- orientation of a point

o2

- orientation of a point

Returns:
BOOL

- whether the points have the same orientation

COORD_NormalizeAzimuthAngle

static int COORD_NormalizeAzimuthAngle (intangle)

Parameters:

To normalize the azimuth angle

angle

- azimuth angle

Returns:
static int

- None

COORD_NormalizeElevationAngle

static int COORD_NormalizeElevationAngle (intangle)

Parameters:

To normalize the elevation angle

angle

- Angle of elevation

Returns:
static int

COORD_NormalizeAngleIndex

- None

static int COORD_NormalizeAngleIndex (intangleIndex, intangleResolution)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

To normalize the angleIndex

Parameters:
angleIndex

- angleIndex

angleResolution

- angleResolution

Returns:
static int

COORD_CalcDistance

- Return normalized angleIndex

BOOL COORD_CalcDistance (intcoordinateSystemType, const Coordinates*position1, const Coordinates*position2,


CoordinateTypedistance)

Parameters:
To calculate the distance between two
nodes(points) given the
coordinateSystemType and the coordinates of
the two points

coordinateSystemType

- type of coordinate system

position1

- coordinates of a point

position2

- coordinates of a point

distance

- distance between two points

Returns:
BOOL

COORD_CalcDistanceAndAngle

- whether the distance is calculated from position1 to position2

static void COORD_CalcDistanceAndAngle (intcoordinateSystemType, constposition1, constposition2, double*distance,


Orientation*DOA1, Orientation*DOA2)

Parameters:
To calculate the Distance and Angle
coordinateSystemType

- coordinateSystem Type

position1

- Coordinates*

position2

- Coordinates*

distance

- distance

DOA1

- DOA 1

DOA2

- DOA 2

Returns:
static void

COORD_ChangeCoordinateSystem

- None

static void COORD_ChangeCoordinateSystem (const CoordinateRepresentationTypesource_type, const Coordinates*


constsource, const CoordinateRepresentationTypetarget_type, Coordinates* consttarget)

Parameters:
Re-calculate coordinate in a new coordinate
system

source_type

- coordinate system of

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

source

- coordinates of point to convert

target_type
target

- coordinate system to

- coordinate in new coordinate system

Returns:
static void

COORD_ChangeCoordinateSystem

- None

static void COORD_ChangeCoordinateSystem (const Coordinates* constsource, const


CoordinateRepresentationTypetarget_type, Coordinates* consttarget)

Parameters:
Re-calculate coordinate in a new coordinate
system

source

- coordinates of point to convert

target_type
target

- coordinate systme to

- coordinate in new coordinate system

Returns:
static void

- None

COORD_GeodeticToGeocentricCartesian

static void COORD_GeodeticToGeocentricCartesian (const Coordinates* constsource, Coordinates* consttarget)

Parameters:

Convert coordinate from GEODETIC to


GEOCENTRIC_CARTESIAN

source

- coordinate in GEODETIC

target

- new coordinate in GEOCENTRIC_CARTESIAN

Returns:
static void

- None

COORD_GeocentricCartesianToGeodetic

static void COORD_GeocentricCartesianToGeodetic (const Coordinates* constsource, Coordinates* consttarget)

Parameters:

Convert coordinate from


GEOCENTRIC_CARTESIAN to
GEODETIC

source

- coordinate in GEOCENTRIC_CARTESIAN

target

- new coordinate in GEODETIC

Returns:
static void

- None

COORD_JGISToGeodetic

static void COORD_JGISToGeodetic (const Coordinates* constsource, Coordinates* consttarget)

Parameters:

Convert coordinate from JGIS to GEODETIC

source

- coordinate in JGIS

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

target

- new coordinate in GEODETIC

Returns:
static void

- None

COORD_JGISToUnreferencedCartesian

static void COORD_JGISToUnreferencedCartesian (const Coordinates* constsource, Coordinates* consttarget)

Parameters:

Convert coordinate from JGIS to


UNREFERENCED_CARTESIAN

source

- coordinate in JGIS

target

- new coordinate in UNREFERENCED_CARTESIAN

Returns:
static void

- None

COORD_ConvertToCoordinates

static void COORD_ConvertToCoordinates (char*buf, Coordinates*coordinates)

Parameters:

Read the string in "buf" and provide the


corresponding coordinates for the string.

buf

- input string to be converted to coordinates

coordinates

- Pointer to the coordinates

Returns:
static void

- None

COORD_MapCoordinateSystemToType

static void COORD_MapCoordinateSystemToType (intcoordinateSystem, Coordinates*coordinates)

Parameters:

Set coordinates type field


(CoordinateRepresentationType) based on the
user-provided coordinate system
(coordinate_system_type)

coordinateSystem
coordinates

- enum value indicating coordinate system

- Pointer to the coordinates

Returns:
static void

- None

COORD_NormalizeLongitude

static void COORD_NormalizeLongitude (Coordinates*coordinates)

Parameters:

Correct the longitude value to between -180


and 180. This function assumes the
coordinate system is LLA.

coordinates

Returns:
static void

COORD_PointWithinRange

- Pointer to the coordinates

- None

bool COORD_PointWithinRange (intcoordinateSystemType, Coordinates*sw, Coordinates*ne, Coordinates*point)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

Is the point within the given range. Assume 90 <= lat <= 90 and -180 <= long <= 180 for
all inputs.

Parameters:
coordinateSystemType

- Cartesian or Geodetic

sw

- Pointer to the SW corner (0,0) if Cartesian

ne

- Pointer to the NE corner (dimensions if Cartesian)

point

- Pointer to the coordinates

Returns:
bool

COORD_RegionsOverlap

- True if within range

bool COORD_RegionsOverlap (intcoordinateSystemType, Coordinates*sw1, Coordinates*ne1, Coordinates*sw2,


Coordinates*ne2)

Parameters:
Determine whether the given regions overlap
at all.

coordinateSystemType

- Cartesian or Geodetic

sw1

- Pointer to the SW corner of the first region

ne1

- Pointer to the NE corner of the first region

sw2

- Pointer to the SW corner of the second region

ne2

- Pointer to the NE corner of the second region

Returns:
bool

- true if the regions overlap at all.

COORD_LongitudeDelta

void COORD_LongitudeDelta (CoordinateTypelong1, CoordinateTypelong2)

Parameters:

Convenience function for geodetic that, given


two longitudes, returns the difference (in
degrees) in the shorter direction.

long1

- coordinate 1

long2

- coordinate 2

Returns:
void

- None

COORD_PrintCoordinates

void COORD_PrintCoordinates (intcoordinateSystemType, Coordinates*point)

Parameters:

Prints the coordinates in a human readable


format.

coordinateSystemType
point

- Cartesian or Geodetic

- Pointer to the coordinates

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

COORDINATES

void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/COORDINATES.html[10/28/2011 1:25:54 PM]

ERROR

QualNet 5.2 API Reference


ERROR
This file defines data structures and functions used in error-handling.
Constant / Data Structure Summary
Type

Name

CONSTANT

ERROR_ASSERTION

Defines the ERROR_ASSERTION constant

CONSTANT

ERROR_ERROR

Defines the ERROR_ERROR constant

CONSTANT

ERROR_WARNING

Defines the ERROR_WARNING constant

Function / Macro Summary


Return Type

Summary

MACRO

ERROR_Assert(expr, str)

May be used in place of assert,to include an error message


MACRO

assert(expr)

In DEBUG mode assert macro will be replaced by ERROR_WriteError with ERROR_ASSERTION type
MACRO

ERROR_ReportError(str)

Function call used to report an error condition in QualNet, and notify GUI of such.
MACRO

ERROR_ReportWarning(str)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ERROR.html[10/28/2011 1:26:03 PM]

ERROR

Function call used to report a recoverable error condition. This macro in turns calls ERROR_WriteError with ERROR_WARNING type.
It reports a warning message in QualNet, and notify GUI of such
extern BOOL

ERROR_WriteError(inttype, char*condition, char*msg, char*file, intlineno)

Function call used to report failed assertions, errors, and warnings, and notify the GUI of such. The user should not call this function
directly, but should use one of the previously defined macros.
void

ERROR_InstallHandler(inttype, char*condition, char*msg, char*file, intlineno,


QErrorHandlerfunctionPointer)

Function used to register a callback function. The callback function will be invoked by ERROR_ when ERROR_WriteError () is
invoked. For example - logging error messages into a log file or send the error messages to another application (e.g. to the Qualnet IDE
that started the simulation.)
void

ERROR_ReportMissingAddon(const char*model, const char*addon)

Reports an error when user attempts to use a model that hasn't been installed, either because the customer hasn't purchased that feature,
or they haven't downloaded and compiled it.
void

ERROR_ReportMissingInterface(const char*model, const char*iface)

Reports an error when user attempts to use a model that hasn't been installed, either because the customer hasn't purchased that feature,
or they haven't downloaded and compiled it.
void

ERROR_ReportMissingLibrary(const char*model, const char*library)

Reports an error when user attempts to use a model that hasn't been installed, either because the customer hasn't purchased that feature,
or they haven't downloaded and compiled it.

Constant / Data Structure Detail

Constant

ERROR_ASSERTION0

Constant

Defines the ERROR_ASSERTION constant


ERROR_ERROR1

Constant

Defines the ERROR_ERROR constant


ERROR_WARNING2

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ERROR.html[10/28/2011 1:26:03 PM]

ERROR

Defines the ERROR_WARNING constant

Function / Macro Detail


Function / Macro
ERROR_Assert(expr, str)

Format
May be used in place of assert,to include an error message

assert(expr)

In DEBUG mode assert macro will be replaced by ERROR_WriteError with ERROR_ASSERTION type

ERROR_ReportError(str)

Function call used to report an error condition in QualNet, and notify GUI of such.

ERROR_ReportWarning(str)

Function call used to report a recoverable error condition. This macro in turns calls ERROR_WriteError with ERROR_WARNING
type. It reports a warning message in QualNet, and notify GUI of such

ERROR_WriteError

extern BOOL ERROR_WriteError (inttype, char*condition, char*msg, char*file, intlineno)

Parameters:

Function call used to report failed assertions,


errors, and warnings, and notify the GUI of
such. The user should not call this function
directly, but should use one of the previously
defined macros.

type

- assertion, error, or warning

condition
msg

- a string representing the failed boolean condition

- an error message

file

- the file name in which the assertion failed

lineno

- the line on which the assertion failed.

Returns:
extern BOOL

- None

ERROR_InstallHandler

void ERROR_InstallHandler (inttype, char*condition, char*msg, char*file, intlineno, QErrorHandlerfunctionPointer)

Parameters:

Function used to register a callback function.


The callback function will be invoked by
ERROR_ when ERROR_WriteError () is
invoked. For example - logging error
messages into a log file or send the error
messages to another application (e.g. to the
Qualnet IDE that started the simulation.)

type

- assertion, error, or warning

condition
msg

- a string representing the failed boolean condition

- an error message

file

- the file name in which the assertion failed

lineno

- the line on which the assertion failed.

functionPointer

- pointer to a function with signature

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ERROR.html[10/28/2011 1:26:03 PM]

ERROR

Returns:
void

- None

ERROR_ReportMissingAddon

void ERROR_ReportMissingAddon (const char*model, const char*addon)

Parameters:

Reports an error when user attempts to use a


model that hasn't been installed, either
because the customer hasn't purchased that
feature, or they haven't downloaded and
compiled it.

model

- the name of the model/protocol being used.

addon

- the name of the addon to which the model belongs

Returns:
void

- None

ERROR_ReportMissingInterface

void ERROR_ReportMissingInterface (const char*model, const char*iface)

Parameters:

Reports an error when user attempts to use a


model that hasn't been installed, either
because the customer hasn't purchased that
feature, or they haven't downloaded and
compiled it.

model

- the name of the model/protocol being used.

iface

- the name of the interface to which the model belongs

Returns:
void

- None

ERROR_ReportMissingLibrary

void ERROR_ReportMissingLibrary (const char*model, const char*library)

Parameters:

Reports an error when user attempts to use a


model that hasn't been installed, either
because the customer hasn't purchased that
feature, or they haven't downloaded and
compiled it.

model

- the name of the model/protocol being used.

library

- the name of the library to which the model belongs

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ERROR.html[10/28/2011 1:26:03 PM]

ERROR

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/ERROR.html[10/28/2011 1:26:03 PM]

EXTERNAL

QualNet 5.2 API Reference


EXTERNAL
This file defines the generic interface to external modules.
Constant / Data Structure Summary
Type

Name

CONSTANT

EXTERNAL_MAX_TIME

The maximum possible time

CONSTANT

EXTERNAL_NUM_CPU_TIMING_INTERVAL_GUESSES

The number of guesses to make for the cpu timing interval

CONSTANT

EXTERNAL_MAPPING_TABLE_SIZE

The size of an interface's mapping hash table

CONSTANT

EXTERNAL_NUM_FUNCTIONS

The number of functions an interface may implement

ENUMERATION

ExternalInterfaceType

Enumeration of different types of external interfaces

STRUCT

EXTERNAL_ThreadedMessage

A struct containing data needed to send a message from an external thread to the main thread.

STRUCT

EXTERNAL_ThreadedForwarded

A struct containing data needed to send a forwarded packet from the main thread to an external forward function

STRUCT

EXTERNAL_Mapping

A linked list node containing one mapping. The key may be of any size, specified by keySize. The value the key maps to is a pointer to
some piece of data. It is assumed that whoever created the mapping will know what to do with the pointer. The user will not use this

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

structure directly.
STRUCT

EXTERNAL_MobilityEvent

A linked list of mobility events

STRUCT

EXTERNAL_MobilityEventBuffer

A buffer containing all mobility events yet to be added to the simulation.

STRUCT

EXTERNAL_InterfaceList

A list containing all of the registered external entities

STRUCT

EXTERNAL_Interface

The information pertaining to one external interface

Function / Macro Summary


Return Type

Summary

EXTERNAL_Interface *

EXTERNAL_RegisterExternalInterface(EXTERNAL_InterfaceList*list, char*name,
EXTERNAL_PerformanceParametersparams)

This function will register a new external interface with QualNet and create the necessary data structures. This function must be called
before any other function that requires an EXTERNAL_Interface* argument.
EXTERNAL_Interface *

EXTERNAL_RegisterExternalInterface(EXTERNAL_InterfaceList*list, char*name,
EXTERNAL_PerformanceParametersparams, ExternalInterfaceTypetype)

This function is an overloaded variation. for registering a new external interface with QualNet
void

EXTERNAL_RegisterFunction(EXTERNAL_Interface*iface, EXTERNAL_FunctionTypetype, EXTERNALfunction)

Register a new function for an interface.


void

EXTERNAL_SetTimeManagementRealTime(EXTERNAL_Interface*iface, clocktypelookahead)

Turns time management on and specifies the lookahead value. The lookahead value may be changed later by calling
EXTERNAL_ChangeRealTimeLookahead().
void

EXTERNAL_ChangeRealTimeLookahead(EXTERNAL_Interface*iface, clocktypelookahead)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

Modifies the lookahead value. Must be called after EXTERNAL_SetTimeManagementRealTime(). May be called during the simulation.
void

EXTERNAL_InitializeWarmupParams(EXTERNAL_Interface*iface, NodeInput*nodeInput)

void

EXTERNAL_SetWarmupTime(EXTERNAL_Interface*iface, clocktypewarmup)

Sets this interface's warmup time. The actual warmup time used is the maximum of all interface's. The default is no warmup time
(warmup == -1). This function must be called before or during the initialize nodes step. It will have no effect during the simulation.
void

EXTERNAL_BeginWarmup(EXTERNAL_Interface*iface)

Each interface that calls EXTERNAL_SetWarmupTime must call EXTERNAL_BeginWarmup when it is ready to enter warmup time.
clocktype

EXTERNAL_QueryWarmupTime(EXTERNAL_Interface*iface)

Get the warmup time for the entire simulation. Interfaces should use this function to test when warmup time is over.
BOOL

EXTERNAL_IsInWarmup(EXTERNAL_Interface*iface)

Check if QualNet is in the warmup phase


BOOL

EXTERNAL_IsInWarmup(PartitionData*partitionData)

Check if QualNet is in the warmup phase


void

EXTERNAL_Pause(EXTERNAL_Interface*iface)

Pause every interface. Only usable when running in real-time.


void

EXTERNAL_Resume(EXTERNAL_Interface*iface)

Resume every interface. Only usable when running in real-time, and after calling pause.
clocktype

EXTERNAL_QueryExternalTime(EXTERNAL_Interface*iface)

This function will return the External Time of an external interface


clocktype

EXTERNAL_QuerySimulationTime(EXTERNAL_Interface*iface)

This function will return the Simulation Time


void

EXTERNAL_Sleep(clocktypeamount)

This function will sleep for a minimum amount of time as indicated by the amount parameter. Depending on which platform it is called
on the amount of time spent sleeping could be greater.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

void

EXTERNAL_SetReceiveDelay(EXTERNAL_Interface*iface, clocktypedelay)

This function will set the minimum delay between two consecutive calls to the receive function. The time used is the simulation time.
void

EXTERNAL_SendMessage(EXTERNAL_Interface*iface, Node*node, Message*msg, clocktypetimestamp)

This function will send a message from the external interface. This function is thread-safe.
void

EXTERNAL_ForwardData(EXTERNAL_Interface*iface, Node*node, void*forwardData, intforwardSize,


EXTERNAL_ForwardData_ReceiverOptFwdReceiverOpt)

Send data back to the external source with no time stamp. The user defined Forward function will receive this message and process it.
This will handle threading issues if necessary.
void

EXTERNAL_RemoteForwardData(EXTERNAL_Interface*iface, Node*node, void*forwardData, intforwardSize,


intpartitionId)

Send data back to the external source with no time stamp. This function is similar to EXTERNAL_ForwardData, except that this
function can forward the message to and external interface on a different partition.
void

EXTERNAL_ForwardDataTimeStamped(EXTERNAL_Interface*iface, Node*node, Message*message, clocktypetimestamp)

Send data in the form of a message back to the external source with a time stamp. The user defined Forward function will receive this
message and process it. This will handle threading issues if necessary.
void

EXTERNAL_UserFunctionRegistration(EXTERNAL_InterfaceList *list, NodeInput*nodeInput)

This function will give a convenient place for users to add their function registration code. This is the only part of the External Interface
API code that the user is expected to modify.
void

EXTERNAL_InitializeInterface(EXTERNAL_Interface*iface)

This function will initialize an external interface


void

EXTERNAL_FinalizeExternalInterface(EXTERNAL_Interface*iface)

This function will free an external interface, as well as call the finalize function registered by EXTERNAL_RegisterFinalizeFunction()
void

EXTERNAL_InitializeInterfaceList(EXTERNAL_InterfaceList*list, PartitionData*partition)

This function will initialize an external interface list


void

EXTERNAL_Bootstrap(intargc, char*argv [])

This function will be called early in the simulation initialization process (after MPI_Init(), but before partitions are created, and before
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

EXTERNAL_InitializeInterfaceList (). In a shared parallel simulation the threads for partitions won't be created yet.
void

EXTERNAL_PreBootstrap(intargc, char*argv [])

This function will be called early in the simulation initialization process (after MPI_Init(), but before partitions are created, and before
EXTERNAL_InitializeInterfaceList (). In a shared parallel simulation the threads for partitions won't be created yet. This function
handles the mini-configuration file conversion, and make sures that if simProps needs to change it is changed and then a broadcast
message is sent to other partitions.
void

EXTERNAL_FinalizeInterfaceList(EXTERNAL_InterfaceList*list)

This function will finalize all ExternalInterfaces in the list, as well as the list itself
EXTERNAL_Interface*

EXTERNAL_GetInterfaceByName(EXTERNAL_InterfaceList*list, char*name)

This function will search an interface list for an interface with the given name
void

EXTERNAL_CallInitializeFunctions(EXTERNAL_InterfaceList*list, NodeInput*nodeInput)

This function will call all initialize functions


void

EXTERNAL_CallInitializeNodesFunctions(EXTERNAL_InterfaceList*list, NodeInput*nodeInput)

This function will call all intialize nodes functions


void

EXTERNAL_StartThreads(EXTERNAL_InterfaceList*list)

This function will start the receive/forward threads for all threaded interfaces. Called after EXTERNAL_CallInitializeNodesFunctions.
clocktype

EXTERNAL_CalculateMinSimulationHorizon(EXTERNAL_InterfaceList*list, clocktypenow)

This function will call all simulation horizon functions to determine how far into the future the simulation can run. An individual
simulation horizon function will only be called if the current time (now) is >= that interface's current horizon.
void

EXTERNAL_CallReceiveFunctions(EXTERNAL_InterfaceList*list)

This function will call all receive function that were not started in a thread
void

EXTERNAL_CallFinalizeFunctions(EXTERNAL_InterfaceList*list)

This function will call all finalize functions


void

EXTERNAL_InitializeExternalInterfaces(partitionData*partitionData)

Function used to initialize a generic interface to an external source of messages, e.g. an HLA federate. Called before nodes are created.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

void

EXTERNAL_PostInitialize(partitionData*partitionData)

Function used to initialize a generic interface to an external source of messages, e.g. an HLA federate.Called after nodes are created.
The developer can use either this function, the preceding one or both.
void

EXTERNAL_GetExternalMessages(partitionData*partitionData, clocktypenextInternalEventTime)

Function used to retrieve messages from a remote source, such as a DIS gateway or HLA federation. Called before events at time X are
executed. Many events at time X may be executed before the next call
void

EXTERNAL_Finalize(partitionData*partitionData)

Shuts down interfaces to external simulators


void

EXTERNAL_SetActive(partitionData*partitionData)

Sets isActive parameter based on interface registration


void

EXTERNAL_DeactivateInterface(EXTERNAL_Interface*ifaceToDeactivate)

Remove the indicated interface for the list of currently activateed interfaces.
void

EXTERNAL_ProcessEvent(Node*node, Message*msg)

Process events meant for external code.


clocktype

GetNextInternalEventTime(PartitionData*partitionData)

Get the next internal event on the given partition. This includes both regular events and mobility events.

Constant / Data Structure Detail

Constant

EXTERNAL_MAX_TIME

Constant

The maximum possible time


EXTERNAL_NUM_CPU_TIMING_INTERVAL_GUESSES4

Constant

The number of guesses to make for the cpu timing interval


EXTERNAL_MAPPING_TABLE_SIZE31

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

Constant

The size of an interface's mapping hash table


EXTERNAL_NUM_FUNCTIONS8

Enumeration

The number of functions an interface may implement


ExternalInterfaceType

Structure

Enumeration of different types of external interfaces


EXTERNAL_ThreadedMessage

Structure

A struct containing data needed to send a message from an external thread to the main thread.
EXTERNAL_ThreadedForwarded

Structure

A struct containing data needed to send a forwarded packet from the main thread to an external forward function
EXTERNAL_Mapping

Structure

A linked list node containing one mapping. The key may be of any size, specified by keySize. The value the key maps to is a pointer to
some piece of data. It is assumed that whoever created the mapping will know what to do with the pointer. The user will not use this
structure directly.
EXTERNAL_MobilityEvent

Structure

A linked list of mobility events


EXTERNAL_MobilityEventBuffer

Structure

A buffer containing all mobility events yet to be added to the simulation.


EXTERNAL_InterfaceList

Structure

A list containing all of the registered external entities


EXTERNAL_Interface

The information pertaining to one external interface

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

Function / Macro Detail


Function / Macro
EXTERNAL_RegisterExternalInterface

Format
EXTERNAL_Interface * EXTERNAL_RegisterExternalInterface (EXTERNAL_InterfaceList*list, char*name,
EXTERNAL_PerformanceParametersparams)

Parameters:
This function will register a new external
interface with QualNet and create the necessary
data structures. This function must be called
before any other function that requires an
EXTERNAL_Interface* argument.

list

- The list of external interfaces

name

- The name of the external interface.

params

- The performance parameters

Returns:
EXTERNAL_Interface *

EXTERNAL_RegisterExternalInterface

- A pointer to the newly registered external interface

EXTERNAL_Interface * EXTERNAL_RegisterExternalInterface (EXTERNAL_InterfaceList*list, char*name,


EXTERNAL_PerformanceParametersparams, ExternalInterfaceTypetype)

Parameters:
This function is an overloaded variation. for
registering a new external interface with QualNet

list

- The list of external interfaces

name

- The name of the external interface.

params
type

- The performance parameters

- PartitionData's interfaceTable will be

Returns:
EXTERNAL_Interface *

EXTERNAL_RegisterFunction

- A pointer to the newly registered external interface

void EXTERNAL_RegisterFunction (EXTERNAL_Interface*iface, EXTERNAL_FunctionTypetype,


EXTERNALfunction)

Parameters:
Register a new function for an interface.
iface
type

- The external interface

- the type of function

function

- Function pointer to be called

Returns:
void

EXTERNAL_SetTimeManagementRealTime

- None

void EXTERNAL_SetTimeManagementRealTime (EXTERNAL_Interface*iface, clocktypelookahead)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

Turns time management on and specifies the


lookahead value. The lookahead value may be
changed later by calling
EXTERNAL_ChangeRealTimeLookahead().

Parameters:
iface

- The external interface

lookahead

- How far into the future the simulation is

Returns:
void

- None

EXTERNAL_ChangeRealTimeLookahead

void EXTERNAL_ChangeRealTimeLookahead (EXTERNAL_Interface*iface, clocktypelookahead)

Parameters:

Modifies the lookahead value. Must be called


after
EXTERNAL_SetTimeManagementRealTime().
May be called during the simulation.

iface

- The external interface

lookahead

- The new lookahead value

Returns:
void

- None

EXTERNAL_InitializeWarmupParams

void EXTERNAL_InitializeWarmupParams (EXTERNAL_Interface*iface, NodeInput*nodeInput)

Parameters:
iface

- The external interface

nodeInput

- The configuration file.

Returns:
void

- None

EXTERNAL_SetWarmupTime

void EXTERNAL_SetWarmupTime (EXTERNAL_Interface*iface, clocktypewarmup)

Parameters:

Sets this interface's warmup time. The actual


warmup time used is the maximum of all
interface's. The default is no warmup time
(warmup == -1). This function must be called
before or during the initialize nodes step. It will
have no effect during the simulation.

iface

- The external interface

warmup

- The warmup time for this interface

Returns:
void

- None

EXTERNAL_BeginWarmup

void EXTERNAL_BeginWarmup (EXTERNAL_Interface*iface)

Parameters:

Each interface that calls


EXTERNAL_SetWarmupTime must call
EXTERNAL_BeginWarmup when it is ready to
enter warmup time.

iface

- The external interface

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

EXTERNAL_QueryWarmupTime

clocktype EXTERNAL_QueryWarmupTime (EXTERNAL_Interface*iface)

Parameters:

Get the warmup time for the entire simulation.


Interfaces should use this function to test when
warmup time is over.

iface

- The external interface

Returns:
clocktype

- The inclusive end of warmup time. -1 if no warmup time.

EXTERNAL_IsInWarmup

BOOL EXTERNAL_IsInWarmup (EXTERNAL_Interface*iface)

Parameters:

Check if QualNet is in the warmup phase

iface

- The external interface

Returns:
- TRUE if in warmup, FALSE if not This is now a wrapper function ONLY. It passes a pointer to partition data. We
overload this function in order to check if simulator is in warm-up phase even when we do not have access to External
interface
BOOL

EXTERNAL_IsInWarmup

BOOL EXTERNAL_IsInWarmup (PartitionData*partitionData)

Parameters:

Check if QualNet is in the warmup phase

partitionData

- pointer to partition's data structure

Returns:
BOOL

- TRUE if in warmup, FALSE if not

EXTERNAL_Pause

void EXTERNAL_Pause (EXTERNAL_Interface*iface)

Parameters:

Pause every interface. Only usable when running


in real-time.

iface

- The external interface

Returns:
void

- None

EXTERNAL_Resume

void EXTERNAL_Resume (EXTERNAL_Interface*iface)

Parameters:

Resume every interface. Only usable when


running in real-time, and after calling pause.

iface

- The external interface

Returns:
void

EXTERNAL_QueryExternalTime

- None

clocktype EXTERNAL_QueryExternalTime (EXTERNAL_Interface*iface)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

This function will return the External Time of an


external interface

Parameters:
iface

- The external interface

Returns:
clocktype

- The External Time. Returns EXTERNAL_MAX_TIME if no time function is defined.

EXTERNAL_QuerySimulationTime

clocktype EXTERNAL_QuerySimulationTime (EXTERNAL_Interface*iface)

Parameters:

This function will return the Simulation Time

iface

- The external interface

Returns:
clocktype

- The Simulation Time

EXTERNAL_Sleep

void EXTERNAL_Sleep (clocktypeamount)

Parameters:

This function will sleep for a minimum amount


of time as indicated by the amount parameter.
Depending on which platform it is called on the
amount of time spent sleeping could be greater.

amount

- The amount of time to sleep

Returns:
- None

void

EXTERNAL_SetReceiveDelay

void EXTERNAL_SetReceiveDelay (EXTERNAL_Interface*iface, clocktypedelay)

Parameters:

This function will set the minimum delay


between two consecutive calls to the receive
function. The time used is the simulation time.

iface

- The external interface

delay

- The minimum delay

Returns:
- None

void

EXTERNAL_SendMessage

void EXTERNAL_SendMessage (EXTERNAL_Interface*iface, Node*node, Message*msg, clocktypetimestamp)

Parameters:

This function will send a message from the


external interface. This function is thread-safe.

iface
node
msg

- The external interface

- Node sending the message

- The message to send

timestamp

- The timestamp for this message. Since this message is

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

EXTERNAL_ForwardData

void EXTERNAL_ForwardData (EXTERNAL_Interface*iface, Node*node, void*forwardData, intforwardSize,


EXTERNAL_ForwardData_ReceiverOptFwdReceiverOpt)

Parameters:
Send data back to the external source with no
time stamp. The user defined Forward function
will receive this message and process it. This
will handle threading issues if necessary.

iface
node

- The external interface

- The node that is forwarding the data

forwardData

- The data to forward

forwardSize

- The size of the data to forward

FwdReceiverOpt

- Whether to store the

Returns:
- None

void

EXTERNAL_RemoteForwardData

void EXTERNAL_RemoteForwardData (EXTERNAL_Interface*iface, Node*node, void*forwardData, intforwardSize,


intpartitionId)

Parameters:
Send data back to the external source with no
time stamp. This function is similar to
EXTERNAL_ForwardData, except that this
function can forward the message to and external
interface on a different partition.

iface
node

- The external interface

- The node that is forwarding the data

forwardData

- The data to forward

forwardSize

- The size of the data to forward

partitionId

- The partition Id to forward the message to

Returns:
- None

void

EXTERNAL_ForwardDataTimeStamped

void EXTERNAL_ForwardDataTimeStamped (EXTERNAL_Interface*iface, Node*node, Message*message,


clocktypetimestamp)

Parameters:
Send data in the form of a message back to the
external source with a time stamp. The user
defined Forward function will receive this
message and process it. This will handle
threading issues if necessary.

iface
node

- The external interface

- The node that is forwarding the data

message

- The message

timestamp

- The time stamp. This value is in external

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

EXTERNAL_UserFunctionRegistration

void EXTERNAL_UserFunctionRegistration (EXTERNAL_InterfaceList *list, NodeInput*nodeInput)

Parameters:

This function will give a convenient place for


users to add their function registration code. This
is the only part of the External Interface API
code that the user is expected to modify.

list

- The list of external interfaces

nodeInput

- The configuration file

Returns:
- None

void

EXTERNAL_InitializeInterface

void EXTERNAL_InitializeInterface (EXTERNAL_Interface*iface)

Parameters:

This function will initialize an external interface

iface

- The external interface

Returns:
- None

void

EXTERNAL_FinalizeExternalInterface

void EXTERNAL_FinalizeExternalInterface (EXTERNAL_Interface*iface)

Parameters:

This function will free an external interface, as


well as call the finalize function registered by
EXTERNAL_RegisterFinalizeFunction()

iface

- The external interface

Returns:
void

- None

EXTERNAL_InitializeInterfaceList

void EXTERNAL_InitializeInterfaceList (EXTERNAL_InterfaceList*list, PartitionData*partition)

Parameters:

This function will initialize an external interface


list

list

- The external interface list

partition

- The partition it will run on

Returns:
void

- None

EXTERNAL_Bootstrap

void EXTERNAL_Bootstrap (intargc, char*argv [])

Parameters:

This function will be called early in the


simulation initialization process (after
MPI_Init(), but before partitions are created, and
before EXTERNAL_InitializeInterfaceList (). In
a shared parallel simulation the threads for
partitions won't be created yet.

argc

- The command line argument count

argv []

- The command line arguments

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

void

- None

EXTERNAL_PreBootstrap

void EXTERNAL_PreBootstrap (intargc, char*argv [])

Parameters:

This function will be called early in the


simulation initialization process (after
MPI_Init(), but before partitions are created, and
before EXTERNAL_InitializeInterfaceList (). In
a shared parallel simulation the threads for
partitions won't be created yet. This function
handles the mini-configuration file conversion,
and make sures that if simProps needs to change
it is changed and then a broadcast message is
sent to other partitions.
EXTERNAL_FinalizeInterfaceList

This function will finalize all ExternalInterfaces


in the list, as well as the list itself

argc

- The command line argument count

argv []

- The command line arguments

Returns:
void

- None

void EXTERNAL_FinalizeInterfaceList (EXTERNAL_InterfaceList*list)


Parameters:
list

- The external interface list

Returns:
void

- None

EXTERNAL_GetInterfaceByName

EXTERNAL_Interface* EXTERNAL_GetInterfaceByName (EXTERNAL_InterfaceList*list, char*name)

Parameters:

This function will search an interface list for an


interface with the given name

list

- The external interface list

name

- The interface's name

Returns:
EXTERNAL_Interface*

- The interface, NULL if not found

EXTERNAL_CallInitializeFunctions

void EXTERNAL_CallInitializeFunctions (EXTERNAL_InterfaceList*list, NodeInput*nodeInput)

Parameters:

This function will call all initialize functions

list

- The list of external interfaces

nodeInput

- The input configuration file

Returns:
void

- None

EXTERNAL_CallInitializeNodesFunctions

void EXTERNAL_CallInitializeNodesFunctions (EXTERNAL_InterfaceList*list, NodeInput*nodeInput)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

This function will call all intialize nodes


functions

list

- The list of external interfaces

nodeInput

- The input configuration file

Returns:
void

- None

EXTERNAL_StartThreads

void EXTERNAL_StartThreads (EXTERNAL_InterfaceList*list)

Parameters:

This function will start the receive/forward


threads for all threaded interfaces. Called after
EXTERNAL_CallInitializeNodesFunctions.

list

- The list of external interfaces

Returns:
void

- None

EXTERNAL_CalculateMinSimulationHorizon

clocktype EXTERNAL_CalculateMinSimulationHorizon (EXTERNAL_InterfaceList*list, clocktypenow)

Parameters:

This function will call all simulation horizon


functions to determine how far into the future the
simulation can run. An individual simulation
horizon function will only be called if the current
time (now) is >= that interface's current horizon.

list
now

- The list of external interfaces

- The current time

Returns:
clocktype

- The minimum Simulation Horizon, or EXTERNAL_MAX_TIME if no horizon.

EXTERNAL_CallReceiveFunctions

void EXTERNAL_CallReceiveFunctions (EXTERNAL_InterfaceList*list)

Parameters:

This function will call all receive function that


were not started in a thread

list

- The list of external interfaces

Returns:
void

- None

EXTERNAL_CallFinalizeFunctions

void EXTERNAL_CallFinalizeFunctions (EXTERNAL_InterfaceList*list)

Parameters:

This function will call all finalize functions

list

- The list of external interfaces

Returns:
void

- None

EXTERNAL_InitializeExternalInterfaces

void EXTERNAL_InitializeExternalInterfaces (partitionData*partitionData)

Parameters:

Function used to initialize a generic interface to

partitionData

- pointer to data for this partition

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

an external source of messages, e.g. an HLA


federate. Called before nodes are created.

Returns:
void

- None

EXTERNAL_PostInitialize

void EXTERNAL_PostInitialize (partitionData*partitionData)

Parameters:

Function used to initialize a generic interface to


an external source of messages, e.g. an HLA
federate.Called after nodes are created. The
developer can use either this function, the
preceding one or both.

Returns:

EXTERNAL_GetExternalMessages

void EXTERNAL_GetExternalMessages (partitionData*partitionData, clocktypenextInternalEventTime)

Parameters:

Function used to retrieve messages from a


remote source, such as a DIS gateway or HLA
federation. Called before events at time X are
executed. Many events at time X may be
executed before the next call

partitionData

void

- pointer to data for this partition

- None

partitionData

- pointer to data for this partition

nextInternalEventTime

- the time of the next event,

Returns:
void

- None

EXTERNAL_Finalize

void EXTERNAL_Finalize (partitionData*partitionData)

Parameters:

Shuts down interfaces to external simulators

partitionData

- pointer to data for this partition

Returns:
void

- None

EXTERNAL_SetActive

void EXTERNAL_SetActive (partitionData*partitionData)

Parameters:

Sets isActive parameter based on interface


registration

partitionData

- pointer to data for this partition

Returns:
void

- None

EXTERNAL_DeactivateInterface

void EXTERNAL_DeactivateInterface (EXTERNAL_Interface*ifaceToDeactivate)

Parameters:

Remove the indicated interface for the list of


currently activateed interfaces.

ifaceToDeactivate

- Pointer to the interface

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL

void

- None

EXTERNAL_ProcessEvent

void EXTERNAL_ProcessEvent (Node*node, Message*msg)

Parameters:

Process events meant for external code.

node
msg

- Pointer to node data structure.

- Message to be processed.

Returns:
void

- None

GetNextInternalEventTime

clocktype GetNextInternalEventTime (PartitionData*partitionData)

Parameters:

Get the next internal event on the given partition.


This includes both regular events and mobility
events.

partitionData

- Pointer to the partition

Returns:
clocktype

- The next internal event

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL.html[10/28/2011 1:26:12 PM]

EXTERNAL_SOCKET

QualNet 5.2 API Reference


EXTERNAL_SOCKET
This file describes utilities for managing socket connections to external programs.
Constant / Data Structure Summary
Type

Name

CONSTANT

EXTERNAL_DEFAULT_VAR_ARRAY_SIZE

The default size of a VarArray

CONSTANT

THREADED_BUFFER_SIZE

The thread buffer size

ENUMERATION

EXTERNAL_SocketErrorType

A listing of error types that could occur.

STRUCT

EXTERNAL_VarArray

A variable sized array. This structure is primarily used to assemble data to be sent on a socket connection.

STRUCT

EXTERNAL_Socket

The socket data structure

Function / Macro Summary


Return Type

Summary

void

EXTERNAL_VarArrayInit(EXTERNAL_VarArray*array, unsigned intsize)

This function will initialize a VarArray and allocate memory for the array. When the array is finished being used, call
EXTERNAL_VarArrayFree to free the memory.
void

EXTERNAL_VarArrayAccomodateSize(EXTERNAL_VarArray*array, unsigned intsize)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_SOCKET

This function will increase the maximum size of the VarArray so that it can contain at least "size" bytes.
void

EXTERNAL_VarArrayAppendData(EXTERNAL_VarArray*array, char*data, unsigned intsize)

This function will add data to the end of the VarArray. The size of the VarArray will be increased if necessary.
void

EXTERNAL_VarArrayConcatString(EXTERNAL_VarArray*array, char*string)

This function will add a string to the end of the VarArray including the terminating NULL character. This function ASSUMES that the
previous data in the VarArray is also a string -- ie, several bytes of data terminated with a NULL character. If this is not the case then
the function EXTERNAL_VarArrayAppendData should be used instead.
void

EXTERNAL_VarArrayFree(EXTERNAL_VarArray*array)

This function will free all memory allocated to the VarArray


void

EXTERNAL_hton(void*ptr, unsignedsize)

Convert data from host byte order to network byte order


void

EXTERNAL_ntoh(void*ptr, unsignedsize)

Convert data from network byte order to host byte order


void

EXTERNAL_swapBitfield(void*ptr, unsignedsize)

void

EXTERNAL_SocketInit(EXTERNAL_Socket*socket)

Initialize a socket. Must be called before all other socket API calls on the individual socket.
EXTERNAL_SocketErrorType

EXTERNAL_SocketInitUDP(EXTERNAL_Socket*socket)

Initialize a UDP socket. Must be called before all other socket API calls on the individual socket.
BOOL

EXTERNAL_SocketValid(EXTERNAL_Socket*socket)

Check if a socket connection is valid and no errors have occurred.


EXTERNAL_SocketErrorType

EXTERNAL_SocketListen(EXTERNAL_Socket*listenSocket, intport, EXTERNAL_Socket*connectSocket)

Listen and accept a connections on a socket. This function is a wrapper for EXTERNAL_SocketInitListen and
EXTERNAL_SocketAccept.
EXTERNAL_SocketErrorType

EXTERNAL_SocketInitListen(EXTERNAL_Socket*listenSocket, intport)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_SOCKET

Initialize an input socket and have it listen on the given port. Call EXTERNAL_SocketAccept to accept connections on the socket. Call
EXTERNAL_SocketDataAvailable to see if there is an incoming connection that has not been accepted.
EXTERNAL_SocketErrorType

EXTERNAL_SocketAccept(EXTERNAL_Socket*listenSocket, EXTERNAL_Socket*connectSocket)

Accept a connection on a listening socket. This operation may block if there is no incoming connection, use
EXTERNAL_SocketDataAvailable to check if there is an incoming connection.
EXTERNAL_SocketErrorType

EXTERNAL_SocketDataAvailable(EXTERNAL_Socket*s, BOOL*available)

Test if a socket has readable data. For a listening socket this will test for an incoming connection. For a data socket this will test if there
is incoming data.
EXTERNAL_SocketErrorType

EXTERNAL_SocketConnect(EXTERNAL_Socket*socket, char*address, intport, intmaxAttempts)

Connect to a listening socket. The socket is set to non-blocking mode.


EXTERNAL_SocketErrorType

EXTERNAL_SocketSend(EXTERNAL_Socket*socket, char*data, unsigned intsize, BOOLblock)

Send data on a connected socket. Since the socket is non-blocking, it is possible that the send would result in a block: If the "block"
parameter is FALSE, then EXTERNAL_DataNotSent is returned, and no data is sent.
EXTERNAL_SocketErrorType

EXTERNAL_SocketSend(EXTERNAL_Socket*socket, EXTERNAL_VarArray*data, BOOLblock)

This is a wrapper for the above overloaded function.


EXTERNAL_SocketErrorType

EXTERNAL_SocketRecv(EXTERNAL_Socket*socket, char*data, unsigned intsize, unsigned int*size, BOOLblock)

Receive data on a connected socket. Since the socket is non-blocking, it is possible that the send would result in a block: If the "block"
parameter is FALSE, the "receiveSize" parameter will be set to the amount of data received before the blocking operation. This amount
could be any value between 0 and size - 1.
EXTERNAL_SocketErrorType

EXTERNAL_SocketClose(EXTERNAL_Socket*socket)

Close a socket. Must be called for each socket that is listening or connected.

Constant / Data Structure Detail

Constant

EXTERNAL_DEFAULT_VAR_ARRAY_SIZE512

The default size of a VarArray

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_SOCKET

Constant

THREADED_BUFFER_SIZE2000000

Enumeration

The thread buffer size


EXTERNAL_SocketErrorType

Structure

A listing of error types that could occur.


EXTERNAL_VarArray

Structure

A variable sized array. This structure is primarily used to assemble data to be sent on a socket connection.
EXTERNAL_Socket

The socket data structure

Function / Macro Detail


Function / Macro
EXTERNAL_VarArrayInit

Format
void EXTERNAL_VarArrayInit (EXTERNAL_VarArray*array, unsigned intsize)

Parameters:

This function will initialize a VarArray and


allocate memory for the array. When the
array is finished being used, call
EXTERNAL_VarArrayFree to free the
memory.

array
size

- Pointer to the uninitialized VarArray

- The initial size of the array in bytes . Defaults

Returns:
- None

void

EXTERNAL_VarArrayAccomodateSize

void EXTERNAL_VarArrayAccomodateSize (EXTERNAL_VarArray*array, unsigned intsize)

Parameters:

This function will increase the maximum size


of the VarArray so that it can contain at least
"size" bytes.

array
size

- Pointer to the VarArray

- The new minimum size of the VarArray

Returns:
void

- None

EXTERNAL_VarArrayAppendData

void EXTERNAL_VarArrayAppendData (EXTERNAL_VarArray*array, char*data, unsigned intsize)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_SOCKET

This function will add data to the end of the


VarArray. The size of the VarArray will be
increased if necessary.

array

- Pointer to the VarArray

data

- Pointer to the data to add

size

- The size of the data to add

Returns:
- None

void

EXTERNAL_VarArrayConcatString

void EXTERNAL_VarArrayConcatString (EXTERNAL_VarArray*array, char*string)

Parameters:

This function will add a string to the end of


the VarArray including the terminating
NULL character. This function ASSUMES
that the previous data in the VarArray is also
a string -- ie, several bytes of data terminated
with a NULL character. If this is not the case
then the function
EXTERNAL_VarArrayAppendData should
be used instead.
EXTERNAL_VarArrayFree

void EXTERNAL_VarArrayFree (EXTERNAL_VarArray*array)

Parameters:

This function will free all memory allocated


to the VarArray

array

- Pointer to the VarArray

string

- The string

Returns:
- None

void

array

- Pointer to the VarArray

Returns:
void

- None

EXTERNAL_hton

void EXTERNAL_hton (void*ptr, unsignedsize)

Parameters:

Convert data from host byte order to network


byte order

ptr

- Pointer to the data

size

- Size of the data

Returns:
void

- None

EXTERNAL_ntoh

void EXTERNAL_ntoh (void*ptr, unsignedsize)

Parameters:

Convert data from network byte order to host


byte order

ptr

- Pointer to the data

size

- Size of the data

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_SOCKET

void

- None

EXTERNAL_swapBitfield

void EXTERNAL_swapBitfield (void*ptr, unsignedsize)

Parameters:
ptr

- Pointer to the data

size

- Size of the data (in bytes)

Returns:
void

- None

EXTERNAL_SocketInit

void EXTERNAL_SocketInit (EXTERNAL_Socket*socket)

Parameters:

Initialize a socket. Must be called before all


other socket API calls on the individual
socket.

socket

- Pointer to the socket

Returns:
void

- None

EXTERNAL_SocketInitUDP

EXTERNAL_SocketErrorType EXTERNAL_SocketInitUDP (EXTERNAL_Socket*socket)

Parameters:

Initialize a UDP socket. Must be called


before all other socket API calls on the
individual socket.

socket

- Pointer to the socket

Returns:
EXTERNAL_SocketErrorType

- Error type **/

EXTERNAL_SocketValid

BOOL EXTERNAL_SocketValid (EXTERNAL_Socket*socket)

Parameters:

Check if a socket connection is valid and no


errors have occurred.

socket

- Pointer to the socket

Returns:
BOOL

EXTERNAL_SocketListen

- TRUE if valid, FALSE if closed or errors

EXTERNAL_SocketErrorType EXTERNAL_SocketListen (EXTERNAL_Socket*listenSocket, intport,


EXTERNAL_Socket*connectSocket)

Parameters:
Listen and accept a connections on a socket.
This function is a wrapper for
EXTERNAL_SocketInitListen and
EXTERNAL_SocketAccept.

listenSocket
port

- Pointer to the socket to listen on

- The port to listen on

connectSocket

- Pointer to the socket that will

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_SOCKET

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.


EXTERNAL_SocketInitListen

EXTERNAL_SocketErrorType EXTERNAL_SocketInitListen (EXTERNAL_Socket*listenSocket, intport)

Parameters:

Initialize an input socket and have it listen on


the given port. Call
EXTERNAL_SocketAccept to accept
connections on the socket. Call
EXTERNAL_SocketDataAvailable to see if
there is an incoming connection that has not
been accepted.
EXTERNAL_SocketAccept

listenSocket
port

- Pointer to the socket to listen on

- The port to listen on

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.


EXTERNAL_SocketErrorType EXTERNAL_SocketAccept (EXTERNAL_Socket*listenSocket,
EXTERNAL_Socket*connectSocket)

Parameters:
Accept a connection on a listening socket.
This operation may block if there is no
incoming connection, use
EXTERNAL_SocketDataAvailable to check
if there is an incoming connection.

listenSocket

- Pointer to the socket to listen on.

connectSocket

- Pointer to the newly created socket

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.


EXTERNAL_SocketDataAvailable

EXTERNAL_SocketErrorType EXTERNAL_SocketDataAvailable (EXTERNAL_Socket*s, BOOL*available)

Parameters:

Test if a socket has readable data. For a


listening socket this will test for an incoming
connection. For a data socket this will test if
there is incoming data.

- Pointer to the socket

available

- TRUE if data is available

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.


EXTERNAL_SocketConnect

EXTERNAL_SocketErrorType EXTERNAL_SocketConnect (EXTERNAL_Socket*socket, char*address, intport,


intmaxAttempts)

Parameters:
Connect to a listening socket. The socket is
set to non-blocking mode.

socket

- Pointer to the socket

address

- String represent the address to connect to

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_SOCKET

port

- The port to connect to

maxAttempts

- Number of times to attempt connecting before an

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.


EXTERNAL_SocketSend

EXTERNAL_SocketErrorType EXTERNAL_SocketSend (EXTERNAL_Socket*socket, char*data, unsigned intsize,


BOOLblock)

Parameters:
Send data on a connected socket. Since the
socket is non-blocking, it is possible that the
send would result in a block: If the "block"
parameter is FALSE, then
EXTERNAL_DataNotSent is returned, and
no data is sent.

socket

- Pointer to the socket

data

- Pointer to the data

size

- Size of the data

block

- If this call may block. Defaults to TRUE.

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.


EXTERNAL_SocketSend

EXTERNAL_SocketErrorType EXTERNAL_SocketSend (EXTERNAL_Socket*socket, EXTERNAL_VarArray*data,


BOOLblock)

Parameters:
This is a wrapper for the above overloaded
function.

socket
data

- Pointer to the socket

- Pointer to the VarArray to send

block

- If this call may block. Defaults to TRUE.

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.


EXTERNAL_SocketRecv

EXTERNAL_SocketErrorType EXTERNAL_SocketRecv (EXTERNAL_Socket*socket, char*data, unsigned intsize, unsigned


int*size, BOOLblock)

Parameters:
Receive data on a connected socket. Since the
socket is non-blocking, it is possible that the
send would result in a block: If the "block"
parameter is FALSE, the "receiveSize"
parameter will be set to the amount of data
received before the blocking operation. This
amount could be any value between 0 and

socket

- Pointer to the socket

data

- Pointer to the destination

size

- The amount of data to receive in bytes

size

- The number of bytes received. This could be less

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_SOCKET

size - 1.
block

- TRUE if the call can block, FALSE if non-blocking.

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.


EXTERNAL_SocketClose

EXTERNAL_SocketErrorType EXTERNAL_SocketClose (EXTERNAL_Socket*socket)

Parameters:

Close a socket. Must be called for each


socket that is listening or connected.

socket

- Pointer to the socket

Returns:
EXTERNAL_SocketErrorType

- EXTERNAL_NoSocketError if successful, different error if not successful which could be

due to a number of reasons.

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_SOCKET.html[10/28/2011 1:27:05 PM]

EXTERNAL_UTILITIES

QualNet 5.2 API Reference


EXTERNAL_UTILITIES
This file describes utilities for external interfaces.
Constant / Data Structure Summary
Type

Name

ENUMERATION

ExternalScheduleType

Enumeration of allowed scheduling operations - e.g. EXTERNAL_ActivateNode

STRUCT

EXTERNAL_TreeNode

Structure of each node of a Splaytree

STRUCT

EXTERNAL_Tree

Structure of a Splaytree

STRUCT

EXTERNAL_ForwardInstantiate

Info field used for instantiating a forward app

STRUCT

EXTERNAL_ForwardSendUdpData

Info field used for sending a UDP forward app

STRUCT

EXTERNAL_ForwardSendTcpData

Info field used for sending a UDP forward app

STRUCT

EXTERNAL_TableRecord

A record in the table. Contains a pointer value and a timestamp, as well as information for maintaining a linked list.

STRUCT

EXTERNAL_SimulationDurationInfo

A duration of simulation time

STRUCT

EXTERNAL_TableOverflow

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

A overflow record.

STRUCT

EXTERNAL_Table

A table. Generally used for storing external packet data, but can be used for anything.

STRUCT

EXTERNAL_NetworkLayerPacket

A packet that will be sent at the network layer. Created by EXTERNAL_SendDataNetworkLayer, sent by
EXTERNAL_SendNetworkLayerPacket

Function / Macro Summary


Return Type

Summary

void

EXTERNAL_TreeInitialize(EXTERNAL_Tree*tree, BOOLuseStore, intmaxStore)

To initialize the splaytree


void

SCHED_SplayTreeInsert(EXTERNAL_Tree*tree, EXTERNAL_TreeNode*treeNode)

To insert a node into the Splaytree


void

EXTERNAL_TreePeekMin(EXTERNAL_Tree*tree)

To look up a node in the Splaytree


void

EXTERNAL_InitializeTable(EXTERNAL_Table*table, intsize)

This function will initialize the table. The size parameter represents the number of records that will be allocated in one block.
void

EXTERNAL_FinalizeTable(EXTERNAL_Table*table)

This function will finalize the table


EXTERNAL_TableRecord*

EXTERNAL_GetUnusedRecord(EXTERNAL_Table*table)

This function will retrieve an unused record from the table. If the packet table is full it will allocate a new block of records. The user
may fill in the record's contents. It will never return NULL.
EXTERNAL_TableRecord*

EXTERNAL_GetEarliestRecord(EXTERNAL_Table*table)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

This function will retrieve the earliest record in the table or NULL if the table is empty.
BOOL

EXTERNAL_GetEarliestRecord(EXTERNAL_Table*table, char*data)

This function will check if a data pointer is still in the table.


EXTERNAL_TableRecord*

EXTERNAL_FreeRecord(EXTERNAL_Table*table)

This function frees a record previously returned from EXTERNAL_GetUnusedRecord(). The memory contained in the data portion of
the record is the user's responsiblity to free.
void

EXTERNAL_SendDataAppLayerUDP(EXTERNAL_Interface*iface, NodeAddressfrom, NodeAddressto, char*data,


intdataSize, clocktypetimestamp, AppTypeapp, TraceProtocolTypetrace, TosTypepriority)

Sends data originating from the app layer using UDP. When the packet reaches its destination it will call the forward function of the
external interface, if it exists.
void

EXTERNAL_SendDataAppLayerUDP(EXTERNAL_Interface*iface, NodeAddressfrom, NodeAddressto, char*header,


intheaderSize, intvirtualDataSize, clocktypetimestamp, AppTypeapp, TraceProtocolTypetrace,
TosTypepriority)

Sends virtual data originating from the app layer using UDP. When the packet reaches its destination it will call the forward forward
function of the external interface, if it exists.
void

EXTERNAL_SendDataAppLayerTCP(EXTERNAL_Interface*iface, NodeAddressfrom, NodeAddressto, char*data,


intdataSize, clocktypetimestamp)

Sends data originating from the app layer using TCP. When the last byte of data reaches its destination it will call the forward function
of the external interface, if it exists.
void

EXTERNAL_SendDataNetworkLayer(EXTERNAL_Interface*iface, NodeAddressfrom, NodeAddresssrcAddr,


NodeAddressdestAddr, TosTypetos, unsigned charprotocol, unsigned intttl, char*payload, intpayloadSize,
clocktypetimestamp)

Sends data originating from network layer. No provisions are made for handling this data once it enters the QualNet network. This is the
responsibility of the external interface or protocols the data is sent to.
void

EXTERNAL_SendDataNetworkLayerOnInterface(EXTERNAL_Interface*iface, NodeAddressfrom, NodeAddresssrcAddr,


NodeAddressdestAddr, unsigned shortidentification, BOOLdontFragment, BOOLmoreFragments, unsigned
shortfragmentOffset, TosTypetos, unsigned charprotocol, unsigned intttl, char*payload, intpayloadSize,
intinterfaceIndex, clocktypetimestamp)

Sends data originating from network layer on a specific interface of the node. No provisions are made for handling this data once it
enters the QualNet network. This is the responsibility of the external interface or protocols the data is sent to.
void

EXTERNAL_SendVirtualDataNetworkLayer(EXTERNAL_Interface*iface, NodeAddressfrom, NodeAddresssrcAddr,


NodeAddressdestAddr, TosTypetos, unsigned charprotocol, unsigned intttl, char*payload, intdataSize,
intvirtualSize, clocktypetimestamp)

Sends data originating from network layer. No provisions are made for handling this data once it enters the QualNet network. This is the
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

responsibility of the external interface or protocols the data is sent to.


void

EXTERNAL_SendDataNetworkLayer(EXTERNAL_Interface*iface, NodeAddressfrom, NodeAddresssrcAddr,


NodeAddressdestAddr, unsigned shortidentification, BOOLdontFragment, BOOLmoreFragments, unsigned
shortfragmentOffset, TosTypetos, unsigned charprotocol, unsigned intttl, char*payload, intpayloadSize,
intipHeaderLength, char*ipOptions, clocktypetimestamp)

Sends data originating from network layer. No provisions are made for handling this data once it enters the QualNet network. This is the
responsibility of the external interface or protocols the data is sent to.
void

EXTERNAL_SendNetworkLayerPacket(Node*node, Message*msg)

Sends the packet from EXTERNAL_SendDataNetworkLayer after some delay. This function should never be called directly.
void

EXTERNAL_CreateMapping(EXTERNAL_Interface*iface, char*key, intkeySize, char*value, intvalueSize)

Creates a mapping between a key and a value. The key may be any value and any length, such as an IP address, a MAC address, or a
generic string. The value may be anything and is the responsibility of the user. Memory will be allocated for the key and the value.
int

EXTERNAL_ResolveMapping(EXTERNAL_Interface*iface, char*key, intkeySize, char**value, int*valueSize)

Resolves a mapping created by EXTERNAL_CreateMapping. If it exists it is placed in the value and valueSize parameters and returns 0.
The returned value will point to the memory block allocated by EXTERNAL_CreateMapping. If it does not exist it returns non-zero and
the value and valueSize parameters are invalid.
int

EXTERNAL_DeleteMapping(EXTERNAL_Interface*iface, char*key, intkeySize)

Deletes a mapping created by EXTERNAL_CreateMapping.


void

EXTERNAL_ActivateNode(EXTERNAL_Interface*iface, Node*node)

Activate a node so that it can begin processing events.


void

EXTERNAL_DectivateNode(EXTERNAL_Interface*iface, Node*node)

Dectivate a node so that it stops processing events.


void

EXTERNAL_PHY_SetTxPower(Node*node, intphyIndex, doublenewTxPower)

Just like PHY_SetTxPower (), but able to handle setting transmission power when node is owned by a remote partition. Change to
TxPower will be scheduled as "best-effort" for remote nodes. The range of coordinate values depends on the terrain data.
void

EXTERNAL_PHY_GetTxPower(Node*node, intphyIndex, double *txPowerPtr)

Just like PHY_GetTxPower (), but able to handle getting transmission power when node is owned by a remote partition.
void

EXTERNAL_ChangeNodePosition(EXTERNAL_Interface*iface, Node*node, doublec1, doublec2, doublec3)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

Change the position of a node. This function will work using both coordinate systems. Orientation is not changed. Coordinate values are
checked to be in the proper range, and are converted if they are not. The range of coordinate values depends on the terrain data.
void

EXTERNAL_ChangeNodeOrientation(EXTERNAL_Interface*iface, Node*node, shortazimuth, shortelevation)

Change the orientation of a node. Position is not changed. Azimuth/elevation are checked to be in the proper range, and are converted if
they are not.
void

EXTERNAL_ChangeNodePositionAndOrientation(EXTERNAL_Interface*iface, Node*node, doublec1, doublec2,


doublec3, shortazimuth, shortelevation)

Change both the position and orientation of a node. This function will work using both coordinate systems. Coordinate values and
Azimuth/elevation values are checked to be in the proper range, and are converted if they are not. The range of coordinate values
depends on the terrain data.
void

EXTERNAL_ChangeNodePositionOrientationAndSpeedAtTime(EXTERNAL_Interface*iface, Node*node,
clocktypemobilityEventTime, doublec1, doublec2, doublec3, shortazimuth, shortelevation, doublespeed)

Change the position, orientation, and speed of a node at a user-specified time. This function will work using both coordinate systems.
Coordinate values, azimuth/elevation, and speed values are checked to be in the proper range, and are converted if they are not. The
range of coordinate values depends on the terrain data.
void

EXTERNAL_ChangeNodePositionOrientationAndVelocityAtTime(EXTERNAL_Interface*iface, Node*node,
clocktypemobilityEventTime, doublec1, doublec2, doublec3, shortazimuth, shortelevation, doublespeed,
doublec1Speed, doublec2Speed, doublec3Speed)

Update the position, orientation, and velocity vector of a node at a user-specified time. The velocity vector is expected to be in the same
distance units used for the the position, per one second. The speed parameter must also be provided, accurate for the provided velocity
vector, and always in meters per second. Coordinate values, azimuth/elevation, and speed values are checked to be in the proper range,
and are converted if they are not. The range of coordinate values depends on the terrain data.
void

EXTERNAL_ChangeNodePositionOrientationAndVelocityAtTime(EXTERNAL_Interface*iface, Node*node,
clocktypemobilityEventTime, doublec1, doublec2, doublec3, shortazimuth, shortelevation, doublec1Speed,
doublec2Speed, doublec3Speed)

Update the position, orientation, and velocity vector of a node at a user-specified time. The velocity vector is expected to be in the same
distance units used for the the position, per one second. Coordinate values, azimuth/elevation, and speed values are checked to be in the
proper range, and are converted if they are not. The range of coordinate values depends on the terrain data.
void

EXTERNAL_ChangeNodeVelocityAtTime(EXTERNAL_Interface*iface, Node*node, clocktypemobilityEventTime,


doublespeed, doublec1Speed, doublec2Speed, doublec3Speed)

Update the velocity vector of a node at a user-specified time. The velocity vector is expected to be in the same distance units used for
the terrain, per one second. The speed parameter must also be provided, accurate for the provided velocity vector, and always in meters
per second.
void

EXTERNAL_ChangeNodeVelocityAtTime(EXTERNAL_Interface*iface, Node*node, clocktypemobilityEventTime,


doublec1Speed, doublec2Speed, doublec3Speed)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

Update the velocity vector of a node at a user-specified time. The velocity vector is expected to be in the same distance units used for
the terrain, per one second.
BOOL

EXTERNAL_ConfigStringPresent(NodeInput*nodeInput, char*string)

This function will check the config file for a string. Typically this is used during interface registration to see if the interface is turned on
in the config file.
BOOL

EXTERNAL_ConfigStringIsYes(NodeInput*nodeInput, char*string)

This function will check the config file for a string. Typically this is used during interface registration to see if the interface is turned on
in the config file. Checks that the string is YES.
void

EXTERNAL_MESSAGE_RemoteSend(EXTERNAL_Interface*iface, intdestinationPartitionId, Message *msg,


clocktypedelay, ExternalScheduleTypescheduling)

Send a message to the external interface on a different partition. This function makes it possible for your external interface to send a
message to your external interface that is on on a different/remote partition. You will then need to add your message handler into the
function EXTERNAL_ProcessEvent (). Lastly, you can request a best-effort delivery of your message to the remote external interface
by passing in a delay value of 0 and a scheduling type of EXTERNAL_SCHEDULE_LOOSELY. Be aware that best-effort messages
may be scheduled at slightly different simulation times each time your run your simulation. Further notes about scheduling. If your
external event won't result in additional qualnet events, except those that will be scheduled after safe time, then you can use LOOSELY.
If, your event is going to schedule additional qualnet event though, then you must use EXTERNAL_SCHEDULE_SAFE (so that the
event is delayed to the next safe time). If you violate safe time you will get assertion failures for safe time of signal receive time.
void

EXTERNAL_SetSimulationEndTime(partitionData*partitionData, clocktypeendTime)

This function is a means to programatically set the end of the simulation. The endTime argument can be omitted, in which case the
endTime is the current simulation time. If the requested time has already passed, the simulation will end as soon as possible.
clocktype

EXTERNAL_QueryRealTime()

This function will return the wall clock time in the qualnet time format. NOTE: Interfaces that are running in real-time should not use
this function to check the simulation time. The simulation time will not be the same as real time if the simulation was paused. Use the
interface's time function instead.
clocktype

EXTERNAL_QueryRealTime()

This function will return the wall clock time in the qualnet time format. NOTE: Interfaces that are running in real-time should not use
this function to check the simulation time. The simulation time will not be the same as real time if the simulation was paused. Use the
interface's time function instead.
clocktype

EXTERNAL_QueryCPUTime(EXTERNAL_Interface*iface)

This function will return the amount of Cpu time used by QualNet. The first call to this function will by an interface will return 0, and
timing will begin from that point.
void

EXTERNAL_Sleep(clocktypeamount)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

This function will sleep for a minimum amount of time as indicated by the amount parameter. Depending on which platform it is called
on the amount of time spent sleeping could be greater.

Constant / Data Structure Detail

Enumeration

ExternalScheduleType

Structure

Enumeration of allowed scheduling operations - e.g. EXTERNAL_ActivateNode


EXTERNAL_TreeNode

Structure

Structure of each node of a Splaytree


EXTERNAL_Tree

Structure

Structure of a Splaytree
EXTERNAL_ForwardInstantiate

Structure

Info field used for instantiating a forward app


EXTERNAL_ForwardSendUdpData

Structure

Info field used for sending a UDP forward app


EXTERNAL_ForwardSendTcpData

Structure

Info field used for sending a UDP forward app


EXTERNAL_TableRecord

Structure

A record in the table. Contains a pointer value and a timestamp, as well as information for maintaining a linked list.
EXTERNAL_SimulationDurationInfo

Structure

A duration of simulation time


EXTERNAL_TableOverflow

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

Structure

A overflow record.
EXTERNAL_Table

Structure

A table. Generally used for storing external packet data, but can be used for anything.
EXTERNAL_NetworkLayerPacket

A packet that will be sent at the network layer. Created by EXTERNAL_SendDataNetworkLayer, sent by
EXTERNAL_SendNetworkLayerPacket

Function / Macro Detail


Function / Macro
EXTERNAL_TreeInitialize

Format
void EXTERNAL_TreeInitialize (EXTERNAL_Tree*tree, BOOLuseStore, intmaxStore)

Parameters:

To initialize the splaytree

tree

- Pointer to the splaytree

useStore

- Use Store

maxStore

- Max Store

Returns:
void

- None

SCHED_SplayTreeInsert

void SCHED_SplayTreeInsert (EXTERNAL_Tree*tree, EXTERNAL_TreeNode*treeNode)

Parameters:

To insert a node into the Splaytree

tree

- Pointer to the splaytree

treeNode

- Pointer to the splayNode

Returns:
void

- None

EXTERNAL_TreePeekMin

void EXTERNAL_TreePeekMin (EXTERNAL_Tree*tree)

Parameters:

To look up a node in the Splaytree

tree

- Pointer to the splaytree

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

- None

void

EXTERNAL_InitializeTable

void EXTERNAL_InitializeTable (EXTERNAL_Table*table, intsize)

Parameters:

This function will initialize the table. The size parameter represents
the number of records that will be allocated in one block.

table
size

- The table

- The size of the table

Returns:
- None

void

EXTERNAL_FinalizeTable

void EXTERNAL_FinalizeTable (EXTERNAL_Table*table)

Parameters:

This function will finalize the table

table

- The table

Returns:
- None

void

EXTERNAL_GetUnusedRecord

EXTERNAL_TableRecord* EXTERNAL_GetUnusedRecord (EXTERNAL_Table*table)

Parameters:

This function will retrieve an unused record from the table. If the
packet table is full it will allocate a new block of records. The user
may fill in the record's contents. It will never return NULL.

table

- The table

Returns:
EXTERNAL_TableRecord*

- The retrieved record

EXTERNAL_GetEarliestRecord

EXTERNAL_TableRecord* EXTERNAL_GetEarliestRecord (EXTERNAL_Table*table)

Parameters:

This function will retrieve the earliest record in the table or NULL if
the table is empty.

table

- The table

Returns:
EXTERNAL_TableRecord*

- The retrieved record

EXTERNAL_GetEarliestRecord

BOOL EXTERNAL_GetEarliestRecord (EXTERNAL_Table*table, char*data)

Parameters:

This function will check if a data pointer is still in the table.

table
data

- The table

- The data to check for

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

- TRUE if it is in the table, FALSE if not

BOOL

EXTERNAL_FreeRecord

EXTERNAL_TableRecord* EXTERNAL_FreeRecord (EXTERNAL_Table*table)

Parameters:

This function frees a record previously returned from


EXTERNAL_GetUnusedRecord(). The memory contained in the data
portion of the record is the user's responsiblity to free.

table

- The table

Returns:
EXTERNAL_TableRecord*

EXTERNAL_SendDataAppLayerUDP

Sends data originating from the app layer using UDP. When the
packet reaches its destination it will call the forward function of the
external interface, if it exists.

- The retrieved record

void EXTERNAL_SendDataAppLayerUDP (EXTERNAL_Interface*iface, NodeAddressfrom,


NodeAddressto, char*data, intdataSize, clocktypetimestamp, AppTypeapp, TraceProtocolTypetrace,
TosTypepriority)
Parameters:
iface
from
to

- The external interface

- The address of the sending node

- The address of the receiving node

data

- The data that is to be sent. This may be NULL if there

dataSize

- The size of the data

timestamp
app

- The time to send this message. Pass 0 to send

- The application to send to, defaults to APP_FORWARD

trace

- The trace protocol, defaults to TRACE_FORWARD

priority

- The priority to send this message at

Returns:
- None

void

EXTERNAL_SendDataAppLayerUDP

Sends virtual data originating from the app layer using UDP. When
the packet reaches its destination it will call the forward forward
function of the external interface, if it exists.

void EXTERNAL_SendDataAppLayerUDP (EXTERNAL_Interface*iface, NodeAddressfrom,


NodeAddressto, char*header, intheaderSize, intvirtualDataSize, clocktypetimestamp, AppTypeapp,
TraceProtocolTypetrace, TosTypepriority)
Parameters:
iface
from
to

- The external interface

- The address of the sending node

- The address of the receiving node

header

- The header that is to be sent.

headerSize

- The size of the header

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

virtualDataSize
timestamp
app

- The size of the virtual data

- The time to send this message. Pass 0 to send

- The application to send to, defaults to APP_FORWARD

trace

- The trace protocol, defaults to TRACE_FORWARD

priority

- The priority to send this message at. defaults to IPTOS_PREC_ROUTINE

Returns:
- None

void

EXTERNAL_SendDataAppLayerTCP

void EXTERNAL_SendDataAppLayerTCP (EXTERNAL_Interface*iface, NodeAddressfrom,


NodeAddressto, char*data, intdataSize, clocktypetimestamp)

Parameters:
Sends data originating from the app layer using TCP. When the last
byte of data reaches its destination it will call the forward function of
the external interface, if it exists.

iface
from
to

- The external interface

- The address of the sending node

- The address of the receiving node

data

- The data that is to be sent. This may be NULL if there

dataSize

- The size of the data

timestamp

- The time to send this message. Pass 0 to send

Returns:
- None

void

EXTERNAL_SendDataNetworkLayer

Sends data originating from network layer. No provisions are made


for handling this data once it enters the QualNet network. This is the
responsibility of the external interface or protocols the data is sent to.

void EXTERNAL_SendDataNetworkLayer (EXTERNAL_Interface*iface, NodeAddressfrom,


NodeAddresssrcAddr, NodeAddressdestAddr, TosTypetos, unsigned charprotocol, unsigned intttl,
char*payload, intpayloadSize, clocktypetimestamp)
Parameters:
iface
from

- The external interface

- The address of the node that will send the

srcAddr

- The IP address of the node originally

destAddr
tos

- The Type of Service field in the IP header

protocol
ttl

- The address of the receiving node

- The protocol field in the IP header

- The Time to Live field in the IP header

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

payload

- The data that is to be sent. This should include

payloadSize
timestamp

- The size of the data

- The time to send this packet. Pass 0 to send

Returns:
- None

void

EXTERNAL_SendDataNetworkLayerOnInterface

Sends data originating from network layer on a specific interface of


the node. No provisions are made for handling this data once it enters
the QualNet network. This is the responsibility of the external
interface or protocols the data is sent to.

void EXTERNAL_SendDataNetworkLayerOnInterface (EXTERNAL_Interface*iface,


NodeAddressfrom, NodeAddresssrcAddr, NodeAddressdestAddr, unsigned shortidentification,
BOOLdontFragment, BOOLmoreFragments, unsigned shortfragmentOffset, TosTypetos, unsigned
charprotocol, unsigned intttl, char*payload, intpayloadSize, intinterfaceIndex, clocktypetimestamp)
Parameters:
iface
from

- The external interface

- The address of the node that will send the

srcAddr

- The IP address of the node originally

destAddr

- The address of the receiving node

identification
dontFragment

- Whether to set the dont fragment bit in the IP

moreFragments

- Whether to set the more fragments bit in the IP

fragmentOffset
tos

- The fragment offset field in the IP

- The Type of Service field in the IP header

protocol
ttl

- The identification field in the IP

- The protocol field in the IP header

- The Time to Live field in the IP header

payload

- The data that is to be sent. This should include

payloadSize

- The size of the data

interfaceIndex
timestamp

- The interface index

- The time to send this packet. Pass 0 to send

Returns:
void

EXTERNAL_SendVirtualDataNetworkLayer

- None

void EXTERNAL_SendVirtualDataNetworkLayer (EXTERNAL_Interface*iface, NodeAddressfrom,


NodeAddresssrcAddr, NodeAddressdestAddr, TosTypetos, unsigned charprotocol, unsigned intttl,
char*payload, intdataSize, intvirtualSize, clocktypetimestamp)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

Sends data originating from network layer. No provisions are made


for handling this data once it enters the QualNet network. This is the
responsibility of the external interface or protocols the data is sent to.

Parameters:
iface
from

- The external interface

- The address of the node that will send the

srcAddr

- The IP address of the node originally

destAddr
tos

- The Type of Service field in the IP header

protocol
ttl

- The address of the receiving node

- The protocol field in the IP header

- The Time to Live field in the IP header

payload

- The data that is to be sent. This should include

dataSize

- The size of the data

virtualSize
timestamp

- The size of the virtual data

- The time to send this packet. Pass 0 to send

Returns:
- None

void

EXTERNAL_SendDataNetworkLayer

Sends data originating from network layer. No provisions are made


for handling this data once it enters the QualNet network. This is the
responsibility of the external interface or protocols the data is sent to.

void EXTERNAL_SendDataNetworkLayer (EXTERNAL_Interface*iface, NodeAddressfrom,


NodeAddresssrcAddr, NodeAddressdestAddr, unsigned shortidentification, BOOLdontFragment,
BOOLmoreFragments, unsigned shortfragmentOffset, TosTypetos, unsigned charprotocol, unsigned
intttl, char*payload, intpayloadSize, intipHeaderLength, char*ipOptions, clocktypetimestamp)
Parameters:
iface
from

- The external interface

- The address of the node that will send the

srcAddr

- The IP address of the node originally

destAddr

- The address of the receiving node

identification
dontFragment

- Whether to set the dont fragment bit in the IP

moreFragments

- Whether to set the more fragments bit in the IP

fragmentOffset
tos

- The identification field in the IP

- The fragment offset field in the IP

- The Type of Service field in the IP header

protocol

- The protocol field in the IP header

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

ttl

- The Time to Live field in the IP header

payload

- The data that is to be sent. This should include

payloadSize

- The size of the data

ipHeaderLength

- length of the IP Header including options if any

ipOptions

- pointer to the IP Option.

timestamp

- The time to send this packet. Pass 0 to send

Returns:
- None

void

EXTERNAL_SendNetworkLayerPacket

void EXTERNAL_SendNetworkLayerPacket (Node*node, Message*msg)

Parameters:

Sends the packet from EXTERNAL_SendDataNetworkLayer after


some delay. This function should never be called directly.

node
msg

- The node sending the packet

- The message

Returns:
void

EXTERNAL_CreateMapping

- None

void EXTERNAL_CreateMapping (EXTERNAL_Interface*iface, char*key, intkeySize, char*value,


intvalueSize)

Parameters:
Creates a mapping between a key and a value. The key may be any
value and any length, such as an IP address, a MAC address, or a
generic string. The value may be anything and is the responsibility of
the user. Memory will be allocated for the key and the value.

iface
key

- The external interface

- The address of the key

keySize
value

- The size of the key in bytes

- The address of what the value maps to

valueSize

- The size of the value in bytes

Returns:
void

EXTERNAL_ResolveMapping

- None

int EXTERNAL_ResolveMapping (EXTERNAL_Interface*iface, char*key, intkeySize, char**value,


int*valueSize)

Parameters:
Resolves a mapping created by EXTERNAL_CreateMapping. If it
exists it is placed in the value and valueSize parameters and returns 0.
The returned value will point to the memory block allocated by
EXTERNAL_CreateMapping. If it does not exist it returns non-zero

iface
key

- The external interface

- Pointer to the key

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

and the value and valueSize parameters are invalid.


keySize
value

- The size of the key in bytes

- Pointer to the value (output)

valueSize

- The size of the key in bytes (output)

Returns:
- 0 if the mapping resolved, non-zero if it did not

int

EXTERNAL_DeleteMapping

int EXTERNAL_DeleteMapping (EXTERNAL_Interface*iface, char*key, intkeySize)

Parameters:

Deletes a mapping created by EXTERNAL_CreateMapping.

iface
key

- The external interface

- Pointer to the key

keySize

- The size of the key in bytes

Returns:
int

- 0 if the mapping resolved, non-zero if it did not

EXTERNAL_ActivateNode

void EXTERNAL_ActivateNode (EXTERNAL_Interface*iface, Node*node)

Parameters:

Activate a node so that it can begin processing events.

iface
node

- The external interface

- The node

Returns:
- None

void

EXTERNAL_DectivateNode

void EXTERNAL_DectivateNode (EXTERNAL_Interface*iface, Node*node)

Parameters:

Dectivate a node so that it stops processing events.

iface
node

- The external interface

- The node

Returns:
void

- None

EXTERNAL_PHY_SetTxPower

void EXTERNAL_PHY_SetTxPower (Node*node, intphyIndex, doublenewTxPower)

Parameters:

Just like PHY_SetTxPower (), but able to handle setting transmission


power when node is owned by a remote partition. Change to TxPower

node

- The node (can be either a local node or remote)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

will be scheduled as "best-effort" for remote nodes. The range of


coordinate values depends on the terrain data.

phyIndex

- The physical index

newTxPower

- The new transmission power.

Returns:
- None

void

EXTERNAL_PHY_GetTxPower

void EXTERNAL_PHY_GetTxPower (Node*node, intphyIndex, double *txPowerPtr)

Parameters:

Just like PHY_GetTxPower (), but able to handle getting transmission


power when node is owned by a remote partition.

node

- The node (can be either a local node or remote)

phyIndex

- The physical index

txPowerPtr

- (OUT) value of transmission power will be

Returns:
- None

void

EXTERNAL_ChangeNodePosition

void EXTERNAL_ChangeNodePosition (EXTERNAL_Interface*iface, Node*node, doublec1,


doublec2, doublec3)

Parameters:
Change the position of a node. This function will work using both
coordinate systems. Orientation is not changed. Coordinate values are
checked to be in the proper range, and are converted if they are not.
The range of coordinate values depends on the terrain data.

iface
node

- The external interface

- The node

c1

- The first coordinate

c2

- The second coordinate

c3

- The third coordinate

Returns:
- None

void

EXTERNAL_ChangeNodeOrientation

void EXTERNAL_ChangeNodeOrientation (EXTERNAL_Interface*iface, Node*node, shortazimuth,


shortelevation)

Parameters:
Change the orientation of a node. Position is not changed.
Azimuth/elevation are checked to be in the proper range, and are
converted if they are not.

iface
node

- The external interface

- The node

azimuth

- The azimuth, 0 <= azimuth <= 359

elevation

- The elevation, -180 <= elevation <= 180

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

- None

void

EXTERNAL_ChangeNodePositionAndOrientation

void EXTERNAL_ChangeNodePositionAndOrientation (EXTERNAL_Interface*iface, Node*node,


doublec1, doublec2, doublec3, shortazimuth, shortelevation)

Parameters:
Change both the position and orientation of a node. This function will
work using both coordinate systems. Coordinate values and
Azimuth/elevation values are checked to be in the proper range, and
are converted if they are not. The range of coordinate values depends
on the terrain data.

iface
node

- The external interface

- The node

c1

- The first coordinate

c2

- The second coordinate

c3

- The third coordinate

azimuth

- The azimuth, 0 <= azimuth <= 359

elevation

- The elevation, -180 <= elevation <= 180

Returns:
- None

void

EXTERNAL_ChangeNodePositionOrientationAndSpeedAtTime

Change the position, orientation, and speed of a node at a userspecified time. This function will work using both coordinate systems.
Coordinate values, azimuth/elevation, and speed values are checked to
be in the proper range, and are converted if they are not. The range of
coordinate values depends on the terrain data.

void EXTERNAL_ChangeNodePositionOrientationAndSpeedAtTime (EXTERNAL_Interface*iface,


Node*node, clocktypemobilityEventTime, doublec1, doublec2, doublec3, shortazimuth,
shortelevation, doublespeed)
Parameters:
iface
node

- The external interface

- The node

mobilityEventTime

- The absolute simulation time (not delay)

c1

- The first coordinate

c2

- The second coordinate

c3

- The third coordinate

azimuth

- The azimuth, 0 <= azimuth <= 359

elevation
speed

- The elevation, -180 <= elevation <= 180

- The speed in m/s

Returns:
void

EXTERNAL_ChangeNodePositionOrientationAndVelocityAtTime

- None

void EXTERNAL_ChangeNodePositionOrientationAndVelocityAtTime (EXTERNAL_Interface*iface,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

Update the position, orientation, and velocity vector of a node at a


user-specified time. The velocity vector is expected to be in the same
distance units used for the the position, per one second. The speed
parameter must also be provided, accurate for the provided velocity
vector, and always in meters per second. Coordinate values,
azimuth/elevation, and speed values are checked to be in the proper
range, and are converted if they are not. The range of coordinate
values depends on the terrain data.

Node*node, clocktypemobilityEventTime, doublec1, doublec2, doublec3, shortazimuth,


shortelevation, doublespeed, doublec1Speed, doublec2Speed, doublec3Speed)
Parameters:
iface
node

- The external interface

- The node

mobilityEventTime

- The absolute simulation time (not delay)

c1

- The first coordinate

c2

- The second coordinate

c3

- The third coordinate

azimuth

- The azimuth, 0 <= azimuth <= 359

elevation
speed

- The elevation, -180 <= elevation <= 180

- The speed in m/s

c1Speed

- The rate of change of the first coordinate in the

c2Speed

- The rate of change of the second coordinate in the

c3Speed

- The rate of change of the third coordinate in the

Returns:
- None

void

EXTERNAL_ChangeNodePositionOrientationAndVelocityAtTime

Update the position, orientation, and velocity vector of a node at a


user-specified time. The velocity vector is expected to be in the same
distance units used for the the position, per one second. Coordinate
values, azimuth/elevation, and speed values are checked to be in the
proper range, and are converted if they are not. The range of
coordinate values depends on the terrain data.

void EXTERNAL_ChangeNodePositionOrientationAndVelocityAtTime (EXTERNAL_Interface*iface,


Node*node, clocktypemobilityEventTime, doublec1, doublec2, doublec3, shortazimuth,
shortelevation, doublec1Speed, doublec2Speed, doublec3Speed)
Parameters:
iface
node

- The external interface

- The node

mobilityEventTime

- The absolute simulation time (not delay)

c1

- The first coordinate

c2

- The second coordinate

c3

- The third coordinate

azimuth

- The azimuth, 0 <= azimuth <= 359

elevation

- The elevation, -180 <= elevation <= 180

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

c1Speed

- The rate of change of the first coordinate in the

c2Speed

- The rate of change of the second coordinate in the

c3Speed

- The rate of change of the third coordinate in the

Returns:
- None

void

EXTERNAL_ChangeNodeVelocityAtTime

void EXTERNAL_ChangeNodeVelocityAtTime (EXTERNAL_Interface*iface, Node*node,


clocktypemobilityEventTime, doublespeed, doublec1Speed, doublec2Speed, doublec3Speed)

Parameters:
Update the velocity vector of a node at a user-specified time. The
velocity vector is expected to be in the same distance units used for
the terrain, per one second. The speed parameter must also be
provided, accurate for the provided velocity vector, and always in
meters per second.

iface
node

- The external interface

- The node

mobilityEventTime
speed

- The absolute simulation time (not delay)

- The speed in m/s

c1Speed

- The rate of change of the first coordinate in the

c2Speed

- The rate of change of the second coordinate in the

c3Speed

- The rate of change of the third coordinate in the

Returns:
- None

void

EXTERNAL_ChangeNodeVelocityAtTime

void EXTERNAL_ChangeNodeVelocityAtTime (EXTERNAL_Interface*iface, Node*node,


clocktypemobilityEventTime, doublec1Speed, doublec2Speed, doublec3Speed)

Parameters:
Update the velocity vector of a node at a user-specified time. The
velocity vector is expected to be in the same distance units used for
the terrain, per one second.

iface
node

- The external interface

- The node

mobilityEventTime

- The absolute simulation time (not delay)

c1Speed

- The rate of change of the first coordinate in the

c2Speed

- The rate of change of the second coordinate in the

c3Speed

- The rate of change of the third coordinate in the

Returns:
void

EXTERNAL_ConfigStringPresent

- None

BOOL EXTERNAL_ConfigStringPresent (NodeInput*nodeInput, char*string)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

This function will check the config file for a string. Typically this is
used during interface registration to see if the interface is turned on in
the config file.

Parameters:
nodeInput
string

- The configuration file

- The string to check for

Returns:
BOOL

- TRUE if the string is present, FALSE otherwise

EXTERNAL_ConfigStringIsYes

BOOL EXTERNAL_ConfigStringIsYes (NodeInput*nodeInput, char*string)

Parameters:

This function will check the config file for a string. Typically this is
used during interface registration to see if the interface is turned on in
the config file. Checks that the string is YES.

nodeInput
string

- The configuration file

- The string to check for

Returns:
BOOL

EXTERNAL_MESSAGE_RemoteSend

- TRUE if the string is YES, FALSE otherwise

void EXTERNAL_MESSAGE_RemoteSend (EXTERNAL_Interface*iface, intdestinationPartitionId,


Message *msg, clocktypedelay, ExternalScheduleTypescheduling)

Parameters:
Send a message to the external interface on a different partition. This
function makes it possible for your external interface to send a
message to your external interface that is on on a different/remote
partition. You will then need to add your message handler into the
function EXTERNAL_ProcessEvent (). Lastly, you can request a besteffort delivery of your message to the remote external interface by
passing in a delay value of 0 and a scheduling type of
EXTERNAL_SCHEDULE_LOOSELY. Be aware that best-effort
messages may be scheduled at slightly different simulation times each
time your run your simulation. Further notes about scheduling. If your
external event won't result in additional qualnet events, except those
that will be scheduled after safe time, then you can use LOOSELY. If,
your event is going to schedule additional qualnet event though, then
you must use EXTERNAL_SCHEDULE_SAFE (so that the event is
delayed to the next safe time). If you violate safe time you will get
assertion failures for safe time of signal receive time.
EXTERNAL_SetSimulationEndTime

void EXTERNAL_SetSimulationEndTime (partitionData*partitionData, clocktypeendTime)

Parameters:

This function is a means to programatically set the end of the


simulation. The endTime argument can be omitted, in which case the
endTime is the current simulation time. If the requested time has
already passed, the simulation will end as soon as possible.

iface

- Your external interface

destinationPartitionId
msg

- The partitionId that you want to send to

- The external message to send

delay

- When the message should be scheduled on the remote partion.

scheduling

- Whether this event can be executed lossely

Returns:
void

- None

partitionData
endTime

- pointer to data for this partition

- The simulation time to end at.

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

EXTERNAL_QueryRealTime

clocktype EXTERNAL_QueryRealTime ()

Parameters:

This function will return the wall clock time in the qualnet time
format. NOTE: Interfaces that are running in real-time should not use
this function to check the simulation time. The simulation time will
not be the same as real time if the simulation was paused. Use the
interface's time function instead.
EXTERNAL_QueryRealTime

Returns:

clocktype EXTERNAL_QueryRealTime ()

Parameters:

This function will return the wall clock time in the qualnet time
format. NOTE: Interfaces that are running in real-time should not use
this function to check the simulation time. The simulation time will
not be the same as real time if the simulation was paused. Use the
interface's time function instead.
EXTERNAL_QueryCPUTime

Returns:

Parameters:

This function will return the amount of Cpu time used by QualNet.
The first call to this function will by an interface will return 0, and
timing will begin from that point.

clocktype

clocktype

- The real time, not adjusted for simulation pauses.

- The real time, adjusted for simulation pauses.

clocktype EXTERNAL_QueryCPUTime (EXTERNAL_Interface*iface)

iface

- The external interface

Returns:
clocktype

- The CPU time

EXTERNAL_Sleep

void EXTERNAL_Sleep (clocktypeamount)

Parameters:

This function will sleep for a minimum amount of time as indicated


by the amount parameter. Depending on which platform it is called on
the amount of time spent sleeping could be greater.

amount

- The amount of time to sleep

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

EXTERNAL_UTILITIES

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/EXTERNAL_UTILITIES.html[10/28/2011 1:27:15 PM]

FILEIO

QualNet 5.2 API Reference


FILEIO
This file describes data strucutres and functions used for reading from input files and printing to output files.
Constant / Data Structure Summary
Type

Name

CONSTANT

ANY_NODEID

Optional macro values to use when calling IO_Read...() APIs. Defines any node id.

CONSTANT

ANY_ADDRESS

Optional macro values to use when calling IO_Read...() APIs. Defines any node address.

CONSTANT

ANY_INSTANCE

Optional macro values to use when calling IO_Read...() APIs. Defines any instance.

CONSTANT

MAX_INPUT_FILE_LINE_LENGTH

Maximum input file line length. Evaluates (6 * MAX_STRING_LENGTH)

CONSTANT

MAX_ADDRESS_STRING_LENGTH

Maximum length of address string.

CONSTANT

MAX_NUM_CACHED_FILES

Max number of -FILE references in an input file. (Restriction is only for immediate children)

CONSTANT

MATCH_NODE_ID

Defines the matching by node id.

CONSTANT

MATCH_NETWORK

Defines the matching by network.

CONSTANT

MATCH_INTERFACE

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Defines the matching by interface.

CONSTANT

INPUT_ALLOCATION_UNIT

Defines input allocation unit.

STRUCT

NodeInput

Definition of node input structure. typedef to NodeInput in include/main.h.

Function / Macro Summary


Return Type

Summary

void

IO_ConvertIpAddressToString(NodeAddressipAddress, char*addressString)

Parses IPv4 address into a dotted-decimal string.


int

IO_FindStringPos(const chars[], const charsubString[])

Returns the index of the first subString found in s.


char*

IO_GetToken(char*dst, const char*src, char **next)

Searches source buffer for the first %s-style token encountered, and copies it to dst.
char*

IO_GetDelimitedToken(char*dst, const char*src, const char*delim, char**next)

Searches source buffer for the first delimited token encountered, and copies it to dst.
const char*

IO_Right(const char *s, unsignedcount)

Returns a pointer to the right side of the string of length "count" characters.
char*

IO_Chop(const char*s)

Removes the last character of string.


void

IO_TrimNsbpSpaces(char*s)

Changes nsbp charecters for UTF-8 encoding to spaces.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

void

IO_TrimLeft(char*s)

Strips leading white space from a string (by memmove()ing string contents left).
void

IO_TrimRight(char*s)

Strips trailing white space from a string (by inserting early NULL).
void

IO_CompressWhiteSpace(char*s)

Compresses white space between words in the string to one space in a string. White space at the very beginning and very end of the
string is also compressed to one space -- not stripped entirely.
BOOL

IO_IsStringNonNegativeInteger(const char*s)

Returns TRUE if every character in string is a digit. (Even white space will cause return of FALSE)
void

IO_ConvertStringToLowerCase(chars[])

Runs tolower() on each character in string and converts the same to lowercase.
void

IO_ConvertStringToUpperCase(chars[])

Runs toupper() on each character in string and converts the same to uppercase.
BOOL

IO_CaseInsensitiveStringsAreEqual(const char[]s1, const char[]s2, charlengthToCompare)

Checks two strings are equal or not ignoring case.


BOOL

IO_BlankLine(chars[])

Checks the blank line/string.


BOOL

IO_CommentLine(chars[])

Checks whether the line is a comment(i.e. starts with '#').


int

IO_FindCaseInsensitiveStringPos(const chars[], const charsubString[])

Finds the case insensitive sub string position in a string.


int

IO_FindCaseInsensitiveStringPos(const chars[], const charsubString[])

Finds the case insensitive sub string position in a string.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

IO_SkipToken.(char*token, char*tokenSep, char*skip)

skip the first n tokens.


NodeInput *

IO_CreateNodeInput(NodeInput*nodeInput, const char*filename)

Allocates a NodeInput datastructure that can then be passed to IO_ReadNodeInput Called for each file variable in the config file.
void

IO_InitializeNodeInput(NodeInput*nodeInput)

Initializes a NodeInput structure


void

IO_ReadNodeInput(NodeInput*nodeInput, const char*filename)

Reads an input file into a NodeInput struct. Calls IO_ReadFileParameters to first read in -FILE paramters. Then calls
IO_ReadFileParameters to read the rest of the parameters.
void

IO_ReadNodeInputEx(NodeInput*nodeInput, const char*filename, const char*includeComment)

Reads an input file into a NodeInput struct. The includeComment Flag facilitate whether to include the commented line lines in the
nodeInput structure or not. The commented lines should only be included in Backward Compatibity for Old scenario exe. This exe is
responsible for creating new config file and router model file. These new files contains changes according to current VERSION of
QualNet. Calls IO_ReadFileParameters to first read in -FILE paramters. Then calls IO_ReadFileParameters to read the rest of the
parameters.
BOOL

IO_ConvertFile(NodeInput*nodeInput, NodeInput*nodeOutput, char*version)

Converts the contents of an old configuration file to the latest version.


void

IO_ReadLine(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, char*readVal)

This API is used to retrieve a whole line from input files.


void

IO_ReadString(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, char*readVal)

This API is used to retrieve a string parameter value from input files.
void

IO_ReadBool(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, BOOL*readVal)

This API is used to retrieve a boolean parameter value from input files.
void

IO_ReadInt(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, int*readVal)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

This API is used to retrieve an integer parameter value from input files.
void

IO_ReadDouble(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, double*readVal)

This API is used to retrieve a double parameter value from input files.
void

IO_ReadFloat(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, float*readVal)

This API is used to retrieve a float parameter value from input files.
void

IO_ReadTime(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, clocktype*readVal)

This API is used to retrieve time parameter value from input files.
void

IO_ReadCachedFile(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*index, BOOL*wasFound, NodeInput*parameterValue)

This API is used to retrieve cached file parameter value from input files.
void

IO_ReadStringInstance(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch,
BOOL*wasFound, char*parameterValue)

This API is used to retrieve string parameter values from input files for a specific instance.
void

IO_ReadBoolInstance(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch,
BOOL*wasFound, BOOL*parameterValue)

This API is used to retrieve boolean parameter values from input files for a specific instance.
void

IO_ReadIntInstance(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch,
BOOL*wasFound, int*parameterValue)

This API is used to retrieve integer parameter values from input files for a specific instance.
void

IO_ReadDoubleInstance(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch,
BOOL*wasFound, double*parameterValue)

This API is used to retrieve double parameter values from input files for a specific instance.
void

IO_ReadFloatInstance(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch,
BOOL*wasFound, float*parameterValue)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

This API is used to retrieve float parameter values from input files for a specific instance.
void

IO_ReadTimeInstance(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch,
BOOL*wasFound, clocktype*parameterValue)

This API is used to retrieve time parameter values from input files for a specific instance.
void

IO_ReadCachedFileInstance(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const


NodeInput*nodeInput, const char*parameterName, const intparameterInstanceNumber, const
BOOLfallbackIfNoInstanceMatch, BOOL*wasFound, NodeInput*parameterValue)

This API is used to retrieve file parameter values from input files for a specific instance.
void

IO_ParseNodeIdHostOrNetworkAddress(const chars[], NodeAddress*outputNodeAddress, int*numHostBits,


BOOL*isNodeId)

Parses a string for a nodeId, host address, or network address.


void

IO_ParseNodeIdOrHostAddress(const chars[], NodeAddress*outputNodeAddress, BOOL*isNodeId)

Parses a string for a nodeId or host address.


void

IO_ParseNetworkAddress(const chars[], NodeAddress*outputNodeAddress, int*numHostBits)

Parses a string for a network address.


void

IO_FreeNodeInput(NodeInput*nodeInput)

Frees a NodeInput struct. (Currently unused.)


void

IO_PrintStat(Node*node, const char*layer, const char*protocol, NodeAddressinterfaceAddress, intinstanceId,


const char*buf)

Print out the relevant stat in "buf", along with the node id and the layer type generating this stat.
void

IO_AppParseSourceAndDestStrings(Node*node, const char*inputString, const char*sourceString,


NodeAddress*sourceNodeId, NodeAddress*sourceAddr, const char*destString, NodeAddress*destNodeId,
NodeAddress*destAddr)

Application input parsing API. Parses the source and destination strings.
void

IO_AppParseSourceString(Node*node, const char*inputString, const char*sourceString,


NodeAddress*sourceNodeId, NodeAddress*sourceAddr)

Application input parsing API. Parses the source string.


void

IO_AppParseDestString(Node*node, const char*inputString, const char*destString, NodeAddress*destNodeId,


NodeAddress*destAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Application input parsing API. Parses the destination string.


void

IO_AppParseHostString(Node*node, const char*inputString, const char*destString, NodeAddress*destNodeId,


NodeAddress*destAddr)

Application input parsing API. Parses the host string.


void

IO_AppForbidSameSourceAndDest(const char*inputString, NodeAddresssourceNodeId, NodeAddressdestNodeId)

Application input checking API. Checks for the same source and destination node id. Calls abort() for same source and destination.
BOOL

QualifierMatches(const NodeAddressnodeId, const NodeAddressinterfaceAddress, const char*qualifier,


int*matchType)

This is an auxiliary API used by the IO_Read...() set of APIs.


void

IO_ReadBool(const NodeAddressnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, BOOL*parameterValue)

This API is used to retrieve boolean parameter values from input files. Overloaded API for Ipv6 compatibility.
None

IO_ReadBool()

Reads boolean value for specified ATM address.


void

IO_ReadBool(const NodeAddressnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, BOOL*parameterValue)

This API is used to retrieve boolean parameter values from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadString(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, char*readVal)

This API is used to retrieve a string parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadString(const NodeIdnodeId, const AtmAddress*interfaceAddress, const NodeInput *nodeInput, const char


*parameterName, BOOL *wasFound, char *parameterValue)

Reads string value for specified ATM address.


void

IO_ReadString(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,


BOOL*wasFound, char*readVal)

This API is used to retrieve a string parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadInt(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const char*index,


BOOL*wasFound, int*readVal)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

This API is used to retrieve an integer parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadInt(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,


BOOL*wasFound, int*readVal)

This API is used to retrieve an integer parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadInt()

Reads int value for specified ATM address.


void

IO_ReadDouble(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, double*readVal)

This API is used to retrieve a double parameter value from input files. Overloaded API for Ipv6 compatibility.
None

IO_ReadDouble()

Reads double value for specified ATM address.


void

IO_ReadDouble(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,


BOOL*wasFound, double*readVal)

This API is used to retrieve a double parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadFloat(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, float*readVal)

This API is used to retrieve a float parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadFloat()

Reads float value for specified ATM address.


void

IO_ReadFloat(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,


BOOL*wasFound, float*readVal)

This API is used to retrieve a float parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadTime(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, clocktype*readVal)

This API is used to retrieve time parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadTime()

Reads time value for specified ATM address.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

void

IO_ReadTime(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,


BOOL*wasFound, clocktype*readVal)

This API is used to retrieve time parameter value from input files. Overloaded API for Ipv6 compatibility.
None

IO_ReadBoolInstance()

Reads BOOL value for specified ATM address.


void

IO_ReadStringInstance(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
char*parameterValue)

This API is used to retrieve string parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadStringInstance()

Reads string value for specified ATM address.


void

IO_ReadStringInstance(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
char*parameterValue)

This API is used to retrieve string parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadIntInstance(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
int*parameterValue)

This API is used to retrieve integer parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadIntInstance(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
int*parameterValue)

This API is used to retrieve integer parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadDoubleInstance(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
double*parameterValue)

This API is used to retrieve double parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadDoubleInstance()

Reads double value for specified ATM address.


void

IO_ReadDoubleInstance(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
double*parameterValue)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

This API is used to retrieve double parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadFloatInstance(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
float*parameterValue)

This API is used to retrieve float parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadFloatInstance(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
float*parameterValue)

This API is used to retrieve float parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadTimeInstance(const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
clocktype*parameterValue)

This API is used to retrieve time parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadTimeInstance()

Reads clocktype value for specified ATM address.


void

IO_ReadTimeInstance(const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
clocktype*parameterValue)

This API is used to retrieve time parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_ReadCachedFile(const NodeAddressnodeId, const Address*address, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, NodeInput*parameterValue)

This API is used to retrieve cached file parameter value from input files. Overloaded API for Ipv6 compatibility.
void

IO_ReadCachedFileInstance(const NodeAddressnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
NodeInput*parameterValue)

This API is used to retrieve file parameter values from input files for a specific instance. Overloaded API for Ipv6 compatibility.
void

IO_PrintStat(Node*node, const char*layer, const char*protocol, const char*interfaceAddress, intinstanceId,


const char*buf)

Print out the relevant stat in "buf", along with the node id and the layer type generating this stat. Overloaded API for Ipv6 compatibility.
void

IO_ParseNodeIdHostOrNetworkAddress(const chars[], in6_addr*ipAddress, BOOL*isIpAddr, NodeId*nodeId)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Parses a string for a nodeId, host address, or network address. Overloaded API for Ipv6 compatibility.
void

IO_ParseNodeIdHostOrNetworkAddress(const chars[], ATM addr*atmAddress, BOOL*isAtmAddr, NodeId*nodeId)

Parses a string for a nodeId, host address, or network address. Overloaded API for Ipv6 compatibility.
void

IO_ParseNodeIdOrHostAddress(const chars[], in6_addr*outputNodeAddress, BOOL*isNodeId)

Parses a string for a nodeId or host address.


void

IO_ParseNetworkAddress(const chars[], unsigned int*tla, unsigned int*nla, unsigned int*sla)

Parses a string for a network address. Overloaded API for Ipv6 compatibility.
void

IO_AppParseSourceAndDestStrings(Node*node, const char*inputString, const char*sourceString,


NodeId*sourceNodeId, Address*sourceAddr, const char*destString, NodeId*destNodeId, Address*destAddr)

Application input parsing API. Parses the source and destination strings. Overloaded for Ipv6 compatibility.
void

IO_AppParseSourceString(Node*node, const char*inputString, const char*sourceString,


NodeAddress*sourceNodeId, Address*sourceAddr, NetworkTypenetworkType)

Application input parsing API. Parses the source string. Overloaded for Ipv6 compatibility.
void

IO_AppParseDestString(Node*node, const char*inputString, const char*destString, NodeAddress*destNodeId,


Address*destAddr, NetworkTypenetworkType)

Application input parsing API. Parses the destination string. Overloaded for Ipv6 compatibility.
BOOL

QualifierMatches(const NodeIdnodeId, const in6_addrinterfaceAddress, const char*qualifier, int*matchType)

This is an auxiliary API used by the IO_Read...() set of APIs. Overloaded for Ipv6 compatibility
BOOL

QualifierMatches(const NodeIdnodeId, const AtmAddress*interfaceAddress, const char*qualifier, int*matchType)

This is an auxiliary API used by the IO_Read...() set of APIs. Overloaded for Ipv6 compatibility
void

IO_ConvertIpv6StringToAddress()(char*interfaceAddr, in6_addr*ipAddress)

Convert IPv6 address string to in6_addr structure. API for Ipv6 compatibility.
void

IO_ConvertIpAddressToString(in6_addr*ipAddress, char*interfaceAddr)

Parses IPv6 address into a formatted string. Overloaded API for Ipv6 compatibility.
void

IO_ConvertIpAddressToString(Address*ipAddress, char*interfaceAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Parses IPv6 address into a formatted string. Overloaded API for Ipv6 compatibility.
void

IO_ConvertStringToNodeAddress(char*addressString, NodeAddress*outputNodeAddress)

This API is used to covert a string parameter to NodeAdress.


BOOL

IO_CheckIsSameAddress(Addressaddr1, Addressaddr2)

Compares IPv4 | IPv6 address. API for Ipv6 compatibility.


void

IO_ReadString(Node* nodenode, const NodeInput*nodeInput, const char*index, BOOL*wasFound, char*readVal)

This API is used to retrieve a string parameter value from input files.
void

IO_CacheFile(const NodeInput*nodeInput, const char*filename)

This API is used to read an auxiliary input file into a NodeInput struct Called for each file variable in the config file.
int

IO_GetMaxLen(fileNamechar*)

This API is used to get the maximun length of a line in the file.
int

IO_GetMaxLen(fpFILE*)

This API is used to get the maximun length of a line in the file.
int

NI_GetMaxLen(nodeInputNodeInput*)

This API is used to get the maximun length of a line in nodeInput.


int

NI_GetMaxLen(nodeInputconst NodeInput*)

This API is used to get the maximun length of a line in nodeInput.


void

IO_ParseNetworkAddress(const chars[], unsigned int*u_atmVal)

Parses a string for a network address. Overloaded API for ATM compatibility.
void

IO_ConvertAddrToString(Address*address, char*addrStr)

Convert generic address to appropriate network type address string format.


void

IO_ConvertAtmAddressToString(AtmAddressaddr, char*addrStr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Convert Atm address to address string format.


void

IO_InsertIntValue(const chars[], const unsigned intval, unsigned intu_atmVal)

Insert integer value for specific string in case of ATM


int

IO_ReadCachedFileIndex(NodeAddressnodeId, NodeAddressinterfaceAddress, unsigned intnodeInput)

Return Cached file index for the given parameter name


void

IO_ReadString(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, char*parameterValue)

This API is used to retrieve a string parameter value from input files.
void

IO_ReadInt64(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, Int64*parameterValue)

This API is used to retrieve a Int64 parameter value from input files.
void

IO_ReadTime(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, clocktype*parameterValue)

This API is used to retrieve a clocktype parameter value from input files.
void

IO_ReadInt(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, int*parameterValue)

This API is used to retrieve a Int parameter value from input files.
void

IO_ReadDouble(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, double*parameterValue)

This API is used to retrieve a double parameter value from input files.
void

IO_ReadCachedFile(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, NodeInput*parameterValue)

This API is used to retrieve a cached file parameter value from input files.
void

IO_ReadLine(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, char*parameterValue)

This API is used to retrieve a whole line from input files.


void

IO_ReadStringInstance(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
char*parameterValue)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

This API is used to retrieve string parameter values from input files for a specific instance.
void

IO_ReadDoubleInstance(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
double*parameterValue)

This API is used to retrieve double parameter values from input files for a specific instance.
void

IO_ReadIntInstance(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
int*parameterValue)

This API is used to retrieve int parameter values from input files for a specific instance.
void

IO_ReadTimeInstance(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
clocktype*parameterValue)

This API is used to retrieve clocktype parameter values from input files for a specific instance.
void

IO_ReadCachedFileInstance(Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
NodeInput*parameterValue)

This API is used to retrieve cached file parameter values from input files for a specific instance.
void

IO_ReadStringUsingIpAddress(Node*node, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, char*parameterValue)

This API is used to retrieve a string parameter value from input files using the ip-address.
void

IO_ReadString(const NodeAddressnodeId, NodeAddressipv4Address, in6_addr*ipv6Address, const


NodeInput*nodeInput, const char*parameterName, BOOL*wasFound, char*parameterValue)

This API is used to retrieve a string parameter value from input files.
void

IO_ReadString(const NodeAddressnodeId, intinterfaceIndex, const NodeAddressipv4SubnetAddress, const


in6_addr*ipv6SubnetAddress, const NodeInput*nodeInput, const char*parameterName, char*parameterValue,
BOOL&wasFound, int&matchType)

This API is used to retrieve a string parameter value from input files.

Constant / Data Structure Detail

Constant

ANY_NODEID0xffffffff

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Constant

Optional macro values to use when calling IO_Read...() APIs. Defines any node id.
ANY_ADDRESS0xffffffff

Constant

Optional macro values to use when calling IO_Read...() APIs. Defines any node address.
ANY_INSTANCE0xffffffff

Constant

Optional macro values to use when calling IO_Read...() APIs. Defines any instance.
MAX_INPUT_FILE_LINE_LENGTH6 * MAX_STRING_LENGTH

Constant

Maximum input file line length. Evaluates (6 * MAX_STRING_LENGTH)


MAX_ADDRESS_STRING_LENGTH80

Constant

Maximum length of address string.


MAX_NUM_CACHED_FILES128

Constant

Max number of -FILE references in an input file. (Restriction is only for immediate children)
MATCH_NODE_ID4

Constant

Defines the matching by node id.


MATCH_NETWORK6

Constant

Defines the matching by network.


MATCH_INTERFACE8

Constant

Defines the matching by interface.


INPUT_ALLOCATION_UNIT500

Structure

Defines input allocation unit.


NodeInput

Definition of node input structure. typedef to NodeInput in include/main.h.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Function / Macro Detail


Function / Macro
IO_ConvertIpAddressToString

Format
void IO_ConvertIpAddressToString (NodeAddressipAddress, char*addressString)

Parameters:

Parses IPv4 address into a dotted-decimal


string.

ipAddress

- IPv4 address to be converted into

addressString

- Storage for string.

Returns:
- None

void

IO_FindStringPos

int IO_FindStringPos (const chars[], const charsubString[])

Parameters:

Returns the index of the first subString found


in s.

s[]

- Source string.

subString[]

- Substring to earch for.

Returns:
- Index of the first subString found in s. -1, if not found.

int

IO_GetToken

char* IO_GetToken (char*dst, const char*src, char **next)

Parameters:

Searches source buffer for the first %s-style


token encountered, and copies it to dst.

dst

- Buffer to copy token too. If passed in as

src

- Source string.

next

- Storage for pointer to remainder of string.

Returns:
- dst, if string was found and dst was passed in as non-NULL. Pointer to token in src, if string was found and dst was
passed in as NULL. NULL, otherwise.

char*

IO_GetDelimitedToken

char* IO_GetDelimitedToken (char*dst, const char*src, const char*delim, char**next)

Parameters:

Searches source buffer for the first delimited


token encountered, and copies it to dst.

dst

- Buffer to copy token too. If passed in as

src

- Source string.

delim

- Delimiter string.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

next

- Storage for pointer to remainder of string.

Returns:
- dst, if string was found and dst was passed in as non-NULL. Pointer to token in src, if string was found and dst was
passed in as NULL. NULL, otherwise.

char*

IO_Right

const char* IO_Right (const char *s, unsignedcount)

Parameters:

Returns a pointer to the right side of the


string of length "count" characters.

- String.

count

- Number of characters on the right side.

Returns:
- A pointer to the right side of the string of length "count" characters. If count is 0, then a pointer to the string's
terminating NULL is returned. If count is equal to or greater than the number of characters in the string, then the whole string
is returned. A "character" is just a byte of char type that's not NULL. So, '\n' counts as a character.

const char*

IO_Chop

char* IO_Chop (const char*s)

Parameters:

Removes the last character of string.

- String.

Returns:
- s. If the string has a strlen() of zero, then the string is returned unmodified. A "character" is just a byte of char type
that's not NULL. So, '\n' counts as a character.

char*

IO_TrimNsbpSpaces

void IO_TrimNsbpSpaces (char*s)

Parameters:

Changes nsbp charecters for UTF-8 encoding


to spaces.

- String.

Returns:
void

- None

IO_TrimLeft

void IO_TrimLeft (char*s)

Parameters:

Strips leading white space from a string (by


memmove()ing string contents left).

- String.

Returns:
void

IO_TrimRight

- None

void IO_TrimRight (char*s)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Strips trailing white space from a string (by


inserting early NULL).

Parameters:
s

- String.

Returns:
void

- None

IO_CompressWhiteSpace

void IO_CompressWhiteSpace (char*s)

Parameters:

Compresses white space between words in


the string to one space in a string. White
space at the very beginning and very end of
the string is also compressed to one space -not stripped entirely.

Returns:

IO_IsStringNonNegativeInteger

BOOL IO_IsStringNonNegativeInteger (const char*s)

Parameters:

Returns TRUE if every character in string is a


digit. (Even white space will cause return of
FALSE)

- String.

void

- None

- String.

Returns:
BOOL

- TRUE if every character is a digit. FALSE, otherwise.

IO_ConvertStringToLowerCase

void IO_ConvertStringToLowerCase (chars[])

Parameters:

Runs tolower() on each character in string


and converts the same to lowercase.

s[]

- String.

Returns:
void

- None

IO_ConvertStringToUpperCase

void IO_ConvertStringToUpperCase (chars[])

Parameters:

Runs toupper() on each character in string


and converts the same to uppercase.

s[]

- String.

Returns:
void

- None

IO_CaseInsensitiveStringsAreEqual

BOOL IO_CaseInsensitiveStringsAreEqual (const char[]s1, const char[]s2, charlengthToCompare)

Parameters:

Checks two strings are equal or not ignoring


case.

s1

- First string.

s2

- Second string.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

lengthToCompare

- Length to compare.

Returns:
- Returns TRUE if strings are equal, FALSE otherwise.

BOOL

IO_BlankLine

BOOL IO_BlankLine (chars[])

Parameters:

Checks the blank line/string.

s[]

- String.

Returns:
- Returns TRUE if the string is blank. FALSE, otherwise.

BOOL

IO_CommentLine

BOOL IO_CommentLine (chars[])

Parameters:

Checks whether the line is a comment(i.e.


starts with '#').

s[]

- String.

Returns:
- Returns TRUE if the line is a comment. FALSE, otherwise.

BOOL

IO_FindCaseInsensitiveStringPos

int IO_FindCaseInsensitiveStringPos (const chars[], const charsubString[])

Parameters:

Finds the case insensitive sub string position


in a string.

s[]

- String.

subString[]

- Sub string

Returns:
int

- Returns the position of case insensitive sub string if found. -1, otherwise.

IO_FindCaseInsensitiveStringPos

int IO_FindCaseInsensitiveStringPos (const chars[], const charsubString[])

Parameters:

Finds the case insensitive sub string position


in a string.

s[]

- String.

subString[]

- Sub string

Returns:
int

- Returns the position of case insensitive sub string if found. -1, otherwise.

IO_SkipToken.

IO_SkipToken. (char*token, char*tokenSep, char*skip)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

skip the first n tokens.

token

- pointer to the input string,

tokenSep
skip

- pointer to the token separators,

- number of skips.

Returns:
IO_CreateNodeInput

NodeInput * IO_CreateNodeInput (NodeInput*nodeInput, const char*filename)

Parameters:

Allocates a NodeInput datastructure that can


then be passed to IO_ReadNodeInput Called
for each file variable in the config file.

nodeInput
filename

- Pointer to node input.

- Path to input file.

Returns:
NodeInput *

- None

IO_InitializeNodeInput

void IO_InitializeNodeInput (NodeInput*nodeInput)

Parameters:

Initializes a NodeInput structure

nodeInput

- A pointer to NodeInput structure.

Returns:
void

- None

IO_ReadNodeInput

void IO_ReadNodeInput (NodeInput*nodeInput, const char*filename)

Parameters:

Reads an input file into a NodeInput struct.


Calls IO_ReadFileParameters to first read in FILE paramters. Then calls
IO_ReadFileParameters to read the rest of the
parameters.

nodeInput
filename

- Pointer to node input.

- Path to input file.

Returns:
void

- None

IO_ReadNodeInputEx

void IO_ReadNodeInputEx (NodeInput*nodeInput, const char*filename, const char*includeComment)

Parameters:

Reads an input file into a NodeInput struct.


The includeComment Flag facilitate whether
to include the commented line lines in the
nodeInput structure or not. The commented
lines should only be included in Backward
Compatibity for Old scenario exe. This exe is

nodeInput
filename

- Pointer to node input.

- Path to input file.

includeComment

- When this flag is true it

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

responsible for creating new config file and


router model file. These new files contains
changes according to current VERSION of
QualNet. Calls IO_ReadFileParameters to
first read in -FILE paramters. Then calls
IO_ReadFileParameters to read the rest of the
parameters.
IO_ConvertFile

BOOL IO_ConvertFile (NodeInput*nodeInput, NodeInput*nodeOutput, char*version)

Parameters:

Converts the contents of an old configuration


file to the latest version.

void

- None

nodeInput

- A pointer to node input.

nodeOutput
version

- A pointer to node input. Goes through

- Not used.

Returns:
- Returns TRUE if able to convert. FALSE, otherwise. Either couldn't load the database or something else bad
happened, so just copy the old into the new.

BOOL

IO_ReadLine

void IO_ReadLine (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, char*readVal)

Parameters:
This API is used to retrieve a whole line from
input files.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IP address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadString

- None

void IO_ReadString (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, char*readVal)

Parameters:
This API is used to retrieve a string parameter
value from input files.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IP address of interface.

- Pointer to node input.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

index

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadBool

- None

void IO_ReadBool (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, BOOL*readVal)

Parameters:
This API is used to retrieve a boolean
parameter value from input files.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IP address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadInt

- None

void IO_ReadInt (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, int*readVal)

Parameters:
This API is used to retrieve an integer
parameter value from input files.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IP address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadDouble

- None

void IO_ReadDouble (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, double*readVal)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Parameters:
This API is used to retrieve a double
parameter value from input files.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IP address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadFloat

- None

void IO_ReadFloat (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, float*readVal)

Parameters:
This API is used to retrieve a float parameter
value from input files.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IP address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadTime

- None

void IO_ReadTime (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, clocktype*readVal)

Parameters:
This API is used to retrieve time parameter
value from input files.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IP address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Returns:
void

IO_ReadCachedFile

- None

void IO_ReadCachedFile (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*index, BOOL*wasFound, NodeInput*parameterValue)

Parameters:
This API is used to retrieve cached file
parameter value from input files.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IP address of interface.

- Pointer to node input.

- Parameter name.

wasFound

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadStringInstance

This API is used to retrieve string parameter


values from input files for a specific instance.

- None

void IO_ReadStringInstance (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
char*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IP address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadBoolInstance

- None

void IO_ReadBoolInstance (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
BOOL*parameterValue)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

This API is used to retrieve boolean


parameter values from input files for a
specific instance.

Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IP address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadIntInstance

This API is used to retrieve integer parameter


values from input files for a specific instance.

- None

void IO_ReadIntInstance (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
int*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IP address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadDoubleInstance

This API is used to retrieve double parameter


values from input files for a specific instance.

- None

void IO_ReadDoubleInstance (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
double*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

interfaceAddress
nodeInput

- IP address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadFloatInstance

This API is used to retrieve float parameter


values from input files for a specific instance.

- None

void IO_ReadFloatInstance (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
float*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IP address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadTimeInstance

This API is used to retrieve time parameter


values from input files for a specific instance.

- None

void IO_ReadTimeInstance (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const NodeInput*nodeInput,


const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
clocktype*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress

- IP address of interface.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadCachedFileInstance

This API is used to retrieve file parameter


values from input files for a specific instance.

- None

void IO_ReadCachedFileInstance (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const


NodeInput*nodeInput, const char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch,
BOOL*wasFound, NodeInput*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IP address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ParseNodeIdHostOrNetworkAddress

- None

void IO_ParseNodeIdHostOrNetworkAddress (const chars[], NodeAddress*outputNodeAddress, int*numHostBits,


BOOL*isNodeId)

Parameters:
Parses a string for a nodeId, host address, or
network address.

s[]

- String to parse.

outputNodeAddress
numHostBits
isNodeId

- Storage for nodeId or IP address.

- Storage for number of host bits

- Storage for whether the string is

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Returns:
- None

void

IO_ParseNodeIdOrHostAddress

void IO_ParseNodeIdOrHostAddress (const chars[], NodeAddress*outputNodeAddress, BOOL*isNodeId)

Parameters:

Parses a string for a nodeId or host address.

s[]

- String to parse.

outputNodeAddress
isNodeId

- Storage for nodeId or IP address.

- Storage for whether the string is

Returns:
- None

void

IO_ParseNetworkAddress

void IO_ParseNetworkAddress (const chars[], NodeAddress*outputNodeAddress, int*numHostBits)

Parameters:

Parses a string for a network address.

s[]

- String to parse.

outputNodeAddress
numHostBits

- Storage for network address.

- Storage for number of host bits

Returns:
- None

void

IO_FreeNodeInput

void IO_FreeNodeInput (NodeInput*nodeInput)

Parameters:

Frees a NodeInput struct. (Currently unused.)

nodeInput

- Pointer to node input.

Returns:
- None

void

IO_PrintStat

void IO_PrintStat (Node*node, const char*layer, const char*protocol, NodeAddressinterfaceAddress, intinstanceId, const
char*buf)

Parameters:
Print out the relevant stat in "buf", along with
the node id and the layer type generating this
stat.

node

- The node generating the stat.

layer

- The layer generating the stat.

protocol

- The protocol generating the stat.

interfaceAddress

- Interface address.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

instanceId
buf

- Instance id.

- String which has the statistic to

Returns:
void

IO_AppParseSourceAndDestStrings

Application input parsing API. Parses the


source and destination strings.

- None

void IO_AppParseSourceAndDestStrings (Node*node, const char*inputString, const char*sourceString,


NodeAddress*sourceNodeId, NodeAddress*sourceAddr, const char*destString, NodeAddress*destNodeId,
NodeAddress*destAddr)
Parameters:
node

- A pointer to Node.

inputString

- The input string.

sourceString

- The source string.

sourceNodeId

- A pointer to NodeAddress.

sourceAddr

- A pointer to NodeAddress.

destString

- Const char pointer.

destNodeId

- A pointer to NodeAddress.

destAddr

- A pointer to NodeAddress.

Returns:
void

IO_AppParseSourceString

- None

void IO_AppParseSourceString (Node*node, const char*inputString, const char*sourceString, NodeAddress*sourceNodeId,


NodeAddress*sourceAddr)

Parameters:
Application input parsing API. Parses the
source string.

node

- A pointer to Node.

inputString

- The input string.

sourceString

- The source string.

sourceNodeId

- A pointer to NodeAddress.

sourceAddr

- A pointer to NodeAddress.

Returns:
void

IO_AppParseDestString

- None

void IO_AppParseDestString (Node*node, const char*inputString, const char*destString, NodeAddress*destNodeId,


NodeAddress*destAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Parameters:
Application input parsing API. Parses the
destination string.

node

- A pointer to Node.

inputString

- The input string.

destString

- Const char pointer.

destNodeId

- A pointer to NodeAddress.

destAddr

- A pointer to NodeAddress.

Returns:
void

IO_AppParseHostString

- None

void IO_AppParseHostString (Node*node, const char*inputString, const char*destString, NodeAddress*destNodeId,


NodeAddress*destAddr)

Parameters:
Application input parsing API. Parses the host
string.

node

- A pointer to Node.

inputString

- The input string.

destString

- Const char pointer.

destNodeId

- A pointer to NodeAddress.

destAddr

- A pointer to NodeAddress.

Returns:
void

- None

IO_AppForbidSameSourceAndDest

void IO_AppForbidSameSourceAndDest (const char*inputString, NodeAddresssourceNodeId, NodeAddressdestNodeId)

Parameters:

Application input checking API. Checks for


the same source and destination node id.
Calls abort() for same source and destination.

inputString

- The input string.

sourceNodeId
destNodeId

- Source node id, read from the

- Destination node id, read from the

Returns:
void

QualifierMatches

- None

BOOL QualifierMatches (const NodeAddressnodeId, const NodeAddressinterfaceAddress, const char*qualifier,


int*matchType)

Parameters:
This is an auxiliary API used by the
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

IO_Read...() set of APIs.

nodeId

- nodeId to select for.

interfaceAddress

- IP address to select for.

qualifier

- String containing the

matchType

- Stores the type of the match,

Returns:
BOOL

IO_ReadBool

- Returns TRUE if match found. FALSE, otherwise.

void IO_ReadBool (const NodeAddressnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, BOOL*parameterValue)

Parameters:
This API is used to retrieve boolean
parameter values from input files. Overloaded
API for Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- Pointer to node input.

parameterName
wasFound

- IPv6 address of interface.

- Parameter name.

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

- None

IO_ReadBool

None IO_ReadBool ()

Parameters:

Reads boolean value for specified ATM


address.

Returns:
None

IO_ReadBool

- None

void IO_ReadBool (const NodeAddressnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, BOOL*parameterValue)

Parameters:
This API is used to retrieve boolean
parameter values from input files. Overloaded
API for Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput

- Pointer to node input.

parameterName
wasFound

- Parameter name.

- Storage for success of seach.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadString

- None

void IO_ReadString (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, char*readVal)

Parameters:
This API is used to retrieve a string parameter
value from input files. Overloaded API for
Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IP address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadString

- None

void IO_ReadString (const NodeIdnodeId, const AtmAddress*interfaceAddress, const NodeInput *nodeInput, const char
*parameterName, BOOL *wasFound, char *parameterValue)

Parameters:
Reads string value for specified ATM
address.

nodeId

- NodeId for which parameter has

interfaceAddress
nodeInput

- pointer to configuration inputs

parameterName
wasFound

- ATM Interface address

- Parameter to be read

- Parameter found or not

parameterValue

- Parameter's value if found.

Returns:
void

IO_ReadString

- None

void IO_ReadString (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, char*readVal)

Parameters:
This API is used to retrieve a string parameter
value from input files. Overloaded API for

nodeId

- nodeId. Can be ANY_NODEID.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Ipv6 compatibility.
address

- IP address of interface.

nodeInput
index

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadInt

- None

void IO_ReadInt (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, int*readVal)

Parameters:
This API is used to retrieve an integer
parameter value from input files. Overloaded
API for Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IPv6 address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

IO_ReadInt

- None

void IO_ReadInt (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, int*readVal)

Parameters:
This API is used to retrieve an integer
parameter value from input files. Overloaded
API for Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput
index

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

void

- None

IO_ReadInt

void IO_ReadInt ()

Parameters:

Reads int value for specified ATM address.

Returns:
void

IO_ReadDouble

- None NOTE: Overloaded API IO_ReadInt()

void IO_ReadDouble (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, double*readVal)

Parameters:
This API is used to retrieve a double
parameter value from input files. Overloaded
API for Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IPv6 address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

- None

IO_ReadDouble

None IO_ReadDouble ()

Parameters:

Reads double value for specified ATM


address.

Returns:
None

IO_ReadDouble

- None

void IO_ReadDouble (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, double*readVal)

Parameters:
This API is used to retrieve a double
parameter value from input files. Overloaded
API for Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput
index

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Returns:
void

IO_ReadFloat

- None

void IO_ReadFloat (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, float*readVal)

Parameters:
This API is used to retrieve a float parameter
value from input files. Overloaded API for
Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IPv6 address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

- None

IO_ReadFloat

void IO_ReadFloat ()

Parameters:

Reads float value for specified ATM address.

Returns:
void

IO_ReadFloat

- None NOTE: Overloaded API IO_ReadFloat()

void IO_ReadFloat (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, float*readVal)

Parameters:
This API is used to retrieve a float parameter
value from input files. Overloaded API for
Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput
index

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

IO_ReadTime

void IO_ReadTime (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, clocktype*readVal)

Parameters:
This API is used to retrieve time parameter
value from input files. Overloaded API for
Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput
index

- IPv6 address of interface.

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

- None

IO_ReadTime

void IO_ReadTime ()

Parameters:

Reads time value for specified ATM address.

Returns:
void

IO_ReadTime

- None

void IO_ReadTime (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, clocktype*readVal)

Parameters:
This API is used to retrieve time parameter
value from input files. Overloaded API for
Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput
index

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of seach.

- Storage for parameter value.

Returns:
void

- None

IO_ReadBoolInstance

None IO_ReadBoolInstance ()

Parameters:

Reads BOOL value for specified ATM

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

address.
None

IO_ReadStringInstance

This API is used to retrieve string parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None

void IO_ReadStringInstance (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
char*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IPv6 address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

- None

IO_ReadStringInstance

void IO_ReadStringInstance ()

Parameters:

Reads string value for specified ATM


address.

Returns:
void

IO_ReadStringInstance

This API is used to retrieve string parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None NOTE: Overloaded API IO_ReadStringInstance()

void IO_ReadStringInstance (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
char*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch

- Selects parameter without

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

wasFound

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadIntInstance

This API is used to retrieve integer parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None

void IO_ReadIntInstance (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
int*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IPv6 address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadIntInstance

This API is used to retrieve integer parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None

void IO_ReadIntInstance (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
int*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Returns:
void

IO_ReadDoubleInstance

This API is used to retrieve double parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None

void IO_ReadDoubleInstance (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
double*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IPv6 address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

- None

IO_ReadDoubleInstance

void IO_ReadDoubleInstance ()

Parameters:

Reads double value for specified ATM


address.

Returns:
void

IO_ReadDoubleInstance

This API is used to retrieve double parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None NOTE: Overloaded API IO_ReadDoubleInstance()

void IO_ReadDoubleInstance (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
double*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

address

- IPv6 address of interface.

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadFloatInstance

This API is used to retrieve float parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None

void IO_ReadFloatInstance (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
float*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IPv6 address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadFloatInstance

This API is used to retrieve float parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None

void IO_ReadFloatInstance (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
float*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadTimeInstance

This API is used to retrieve time parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None

void IO_ReadTimeInstance (const NodeIdnodeId, const in6_addr*interfaceAddress, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
clocktype*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

interfaceAddress
nodeInput

- IPv6 address of interface.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

- None

IO_ReadTimeInstance

void IO_ReadTimeInstance ()

Parameters:

Reads clocktype value for specified ATM


address.

Returns:
void

IO_ReadTimeInstance

This API is used to retrieve time parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None NOTE: Overloaded API IO_ReadTimeInstance()

void IO_ReadTimeInstance (const NodeIdnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
clocktype*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadCachedFile

- None

void IO_ReadCachedFile (const NodeAddressnodeId, const Address*address, const NodeInput*nodeInput, const char*index,
BOOL*wasFound, NodeInput*parameterValue)

Parameters:
This API is used to retrieve cached file
parameter value from input files. Overloaded
API for Ipv6 compatibility.

nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput
index

- Pointer to node input.

- Parameter name.

wasFound

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadCachedFileInstance

This API is used to retrieve file parameter


values from input files for a specific instance.
Overloaded API for Ipv6 compatibility.

- None

void IO_ReadCachedFileInstance (const NodeAddressnodeId, const Address*address, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
NodeInput*parameterValue)
Parameters:
nodeId

- nodeId. Can be ANY_NODEID.

address

- Address of interface.

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Returns:
- None

void

IO_PrintStat

void IO_PrintStat (Node*node, const char*layer, const char*protocol, const char*interfaceAddress, intinstanceId, const
char*buf)

Parameters:
Print out the relevant stat in "buf", along with
the node id and the layer type generating this
stat. Overloaded API for Ipv6 compatibility.

node

- The node generating the stat.

layer

- The layer generating the stat.

protocol

- The protocol generating the stat.

interfaceAddress
instanceId
buf

- The Interface address the stat.

- Instance id.

- String which has the statistic to

Returns:
void

- None

IO_ParseNodeIdHostOrNetworkAddress

void IO_ParseNodeIdHostOrNetworkAddress (const chars[], in6_addr*ipAddress, BOOL*isIpAddr, NodeId*nodeId)

Parameters:

Parses a string for a nodeId, host address, or


network address. Overloaded API for Ipv6
compatibility.

s[]

- String to parse.

ipAddress
isIpAddr
nodeId

- Storage for ipv6address.

- Storage for whether the string is

- Storage for nodeId.

Returns:
void

- None

IO_ParseNodeIdHostOrNetworkAddress

void IO_ParseNodeIdHostOrNetworkAddress (const chars[], ATM addr*atmAddress, BOOL*isAtmAddr, NodeId*nodeId)

Parameters:

Parses a string for a nodeId, host address, or


network address. Overloaded API for Ipv6
compatibility.

s[]

- String to parse.

atmAddress
isAtmAddr
nodeId

- Storage for ATMaddress.

- Storage for whether the string is

- Storage for nodeId.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

void

- None

IO_ParseNodeIdOrHostAddress

void IO_ParseNodeIdOrHostAddress (const chars[], in6_addr*outputNodeAddress, BOOL*isNodeId)

Parameters:

Parses a string for a nodeId or host address.

s[]

- String to parse.

outputNodeAddress
isNodeId

- Storage for ipv6address.

- Storage for whether the string is

Returns:
void

- None

IO_ParseNetworkAddress

void IO_ParseNetworkAddress (const chars[], unsigned int*tla, unsigned int*nla, unsigned int*sla)

Parameters:

Parses a string for a network address.


Overloaded API for Ipv6 compatibility.

s[]

- String to parse.

tla

- Storage for tla

nla

- Storage for nla.

sla

- Storage for sla.

Returns:
void

IO_AppParseSourceAndDestStrings

- None

void IO_AppParseSourceAndDestStrings (Node*node, const char*inputString, const char*sourceString,


NodeId*sourceNodeId, Address*sourceAddr, const char*destString, NodeId*destNodeId, Address*destAddr)

Parameters:
Application input parsing API. Parses the
source and destination strings. Overloaded for
Ipv6 compatibility.

node

- A pointer to Node.

inputString

- The input string.

sourceString

- The source string.

sourceNodeId

- A pointer to NodeId.

sourceAddr

- A pointer to Address.

destString

- Const char pointer.

destNodeId

- A pointer to NodeId.

destAddr

- A pointer to Address.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

void

IO_AppParseSourceString

- None

void IO_AppParseSourceString (Node*node, const char*inputString, const char*sourceString, NodeAddress*sourceNodeId,


Address*sourceAddr, NetworkTypenetworkType)

Parameters:
Application input parsing API. Parses the
source string. Overloaded for Ipv6
compatibility.

node

- A pointer to Node.

inputString

- The input string.

sourceString

- The source string.

sourceNodeId

- A pointer to NodeAddress.

sourceAddr

- A pointer to Address.

networkType

- used when sourceString

Returns:
void

IO_AppParseDestString

- None

void IO_AppParseDestString (Node*node, const char*inputString, const char*destString, NodeAddress*destNodeId,


Address*destAddr, NetworkTypenetworkType)

Parameters:
Application input parsing API. Parses the
destination string. Overloaded for Ipv6
compatibility.

node

- A pointer to Node.

inputString

- The input string.

destString

- Const char pointer.

destNodeId

- A pointer to NodeAddress.

destAddr

- A pointer to Address.

networkType

- used when sourceString

Returns:
void

- None

QualifierMatches

BOOL QualifierMatches (const NodeIdnodeId, const in6_addrinterfaceAddress, const char*qualifier, int*matchType)

Parameters:

This is an auxiliary API used by the


IO_Read...() set of APIs. Overloaded for Ipv6
compatibility

nodeId

- nodeId to select for.

interfaceAddress

- IPv6 address to select for.

qualifier

- String containing the

matchType

- Stores the type of the match,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Returns:
BOOL

- Returns TRUE if match found. FALSE, otherwise.

QualifierMatches

BOOL QualifierMatches (const NodeIdnodeId, const AtmAddress*interfaceAddress, const char*qualifier, int*matchType)

Parameters:

This is an auxiliary API used by the


IO_Read...() set of APIs. Overloaded for Ipv6
compatibility

nodeId

- nodeId to select for.

interfaceAddress

- ATM address to select for.

qualifier

- String containing the

matchType

- Stores the type of the match,

Returns:
BOOL

- Returns TRUE if match found. FALSE, otherwise.

IO_ConvertIpv6StringToAddress()

void IO_ConvertIpv6StringToAddress() (char*interfaceAddr, in6_addr*ipAddress)

Parameters:

Convert IPv6 address string to in6_addr


structure. API for Ipv6 compatibility.

interfaceAddr
ipAddress

- Storage for ipv6address string

- Storage for ipv6address.

Returns:
void

- None

IO_ConvertIpAddressToString

void IO_ConvertIpAddressToString (in6_addr*ipAddress, char*interfaceAddr)

Parameters:

Parses IPv6 address into a formatted string.


Overloaded API for Ipv6 compatibility.

ipAddress

- Storage for ipv6address.

interfaceAddr

- Storage for ipv6address string

Returns:
void

- None

IO_ConvertIpAddressToString

void IO_ConvertIpAddressToString (Address*ipAddress, char*interfaceAddr)

Parameters:

Parses IPv6 address into a formatted string.


Overloaded API for Ipv6 compatibility.

ipAddress

- IP address info

interfaceAddr

- Storage for ipv6address string

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

- None

void

IO_ConvertStringToNodeAddress

void IO_ConvertStringToNodeAddress (char*addressString, NodeAddress*outputNodeAddress)

Parameters:

This API is used to covert a string parameter


to NodeAdress.

addressString

- IP address string info

outputNodeAddress

- Storage for IP address

Returns:
- None

void

IO_CheckIsSameAddress

BOOL IO_CheckIsSameAddress (Addressaddr1, Addressaddr2)

Parameters:

Compares IPv4 | IPv6 address. API for Ipv6


compatibility.

addr1

- Storage for IPv4 | IPv6 address

addr2

- Storage for IPv4 | IPv6 address

Returns:
- None

BOOL

IO_ReadString

void IO_ReadString (Node* nodenode, const NodeInput*nodeInput, const char*index, BOOL*wasFound, char*readVal)

Parameters:

This API is used to retrieve a string parameter


value from input files.

node

- Node pointer for which string is

nodeInput
index

- Pointer to node input.

- Parameter name.

wasFound
readVal

- Storage for success of search.

- Storage for parameter value.

Returns:
void

- None

IO_CacheFile

void IO_CacheFile (const NodeInput*nodeInput, const char*filename)

Parameters:

This API is used to read an auxiliary input


file into a NodeInput struct Called for each
file variable in the config file.

nodeInput
filename

- Pointer to node input.

- Path to input file.

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

IO_GetMaxLen

int IO_GetMaxLen (fileNamechar*)

Parameters:

This API is used to get the maximun length


of a line in the file.

char*

- Pointer to the name of the file.

Returns:
- Interger with the largest line length.

int

IO_GetMaxLen

int IO_GetMaxLen (fpFILE*)

Parameters:

This API is used to get the maximun length


of a line in the file.

FILE*

- Pointer to a file stream.

Returns:
- Interger with the largest line length.

int

NI_GetMaxLen

int NI_GetMaxLen (nodeInputNodeInput*)

Parameters:

This API is used to get the maximun length


of a line in nodeInput.

NodeInput*

- Pointer to a node input.

Returns:
- Interger with the largest line length.

int

NI_GetMaxLen

int NI_GetMaxLen (nodeInputconst NodeInput*)

Parameters:

This API is used to get the maximun length


of a line in nodeInput.

const NodeInput*

- Pointer to a node input.

Returns:
- Interger with the largest line length.

int

IO_ParseNetworkAddress

void IO_ParseNetworkAddress (const chars[], unsigned int*u_atmVal)

Parameters:

Parses a string for a network address.


Overloaded API for ATM compatibility.

s[]

- String to parse.

u_atmVal

- Storage for icd, aid, ptp

Returns:
void

IO_ConvertAddrToString

- None

void IO_ConvertAddrToString (Address*address, char*addrStr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

Convert generic address to appropriate


network type address string format.

Parameters:
address

- generic address

addrStr

- address string

Returns:
- NULL

void

IO_ConvertAtmAddressToString

void IO_ConvertAtmAddressToString (AtmAddressaddr, char*addrStr)

Parameters:

Convert Atm address to address string format.

- Atm address

addr

addrStr

- address string

Returns:
- NULL

void

IO_InsertIntValue

void IO_InsertIntValue (const chars[], const unsigned intval, unsigned intu_atmVal)

Parameters:

Insert integer value for specific string in case


of ATM

s[]

- character array

val

- value to be inserted

u_atmVal

- atm_value need to be checked

Returns:
- NULL

void

IO_ReadCachedFileIndex

int IO_ReadCachedFileIndex (NodeAddressnodeId, NodeAddressinterfaceAddress, unsigned intnodeInput)

Parameters:

Return Cached file index for the given


parameter name

nodeId

- node Id

interfaceAddress
nodeInput

- Interface Address for the given node

- atm_value need to be checked

Returns:
int

IO_ReadString

- None

void IO_ReadString (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, char*parameterValue)

Parameters:
This API is used to retrieve a string parameter
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

value from input files.

node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- Pointer to node input.

parameterName
wasFound

- interface Index.

- Parameter name.

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadInt64

- None

void IO_ReadInt64 (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, Int64*parameterValue)

Parameters:
This API is used to retrieve a Int64 parameter
value from input files.

node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- Pointer to node input.

parameterName
wasFound

- interface Index.

- Parameter name.

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadTime

- None

void IO_ReadTime (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, clocktype*parameterValue)

Parameters:
This API is used to retrieve a clocktype
parameter value from input files.

node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- interface Index.

- Pointer to node input.

parameterName

- Parameter name.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

wasFound

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadInt

- None

void IO_ReadInt (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, int*parameterValue)

Parameters:
This API is used to retrieve a Int parameter
value from input files.

node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- Pointer to node input.

parameterName
wasFound

- interface Index.

- Parameter name.

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadDouble

- None

void IO_ReadDouble (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, double*parameterValue)

Parameters:
This API is used to retrieve a double
parameter value from input files.

node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- Pointer to node input.

parameterName
wasFound

- interface Index.

- Parameter name.

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

IO_ReadCachedFile

void IO_ReadCachedFile (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, NodeInput*parameterValue)

Parameters:
This API is used to retrieve a cached file
parameter value from input files.

node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- Pointer to node input.

parameterName
wasFound

- interface Index.

- Parameter name.

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadLine

- None

void IO_ReadLine (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, BOOL*wasFound, char*parameterValue)

Parameters:
This API is used to retrieve a whole line from
input files.

node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- Pointer to node input.

parameterName
wasFound

- interface Index.

- Parameter name.

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadStringInstance

This API is used to retrieve string parameter


values from input files for a specific instance.

- None

void IO_ReadStringInstance (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
char*parameterValue)
Parameters:
node

- node structure pointer.

nodeId

- nodeId.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

interfaceIndex
nodeInput

- interface Index.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadDoubleInstance

This API is used to retrieve double parameter


values from input files for a specific instance.

- None

void IO_ReadDoubleInstance (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
double*parameterValue)
Parameters:
node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- interface Index.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadIntInstance

This API is used to retrieve int parameter


values from input files for a specific instance.

- None

void IO_ReadIntInstance (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
int*parameterValue)
Parameters:
node

- node structure pointer.

nodeId
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

- nodeId.
interfaceIndex
nodeInput

- interface Index.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadTimeInstance

This API is used to retrieve clocktype


parameter values from input files for a
specific instance.

- None

void IO_ReadTimeInstance (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
clocktype*parameterValue)
Parameters:
node

- node structure pointer.

nodeId

- nodeId.

interfaceIndex
nodeInput

- interface Index.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadCachedFileInstance

This API is used to retrieve cached file


parameter values from input files for a
specific instance.

- None

void IO_ReadCachedFileInstance (Node*node, const NodeIdnodeId, intinterfaceIndex, const NodeInput*nodeInput, const


char*parameterName, const intparameterInstanceNumber, const BOOLfallbackIfNoInstanceMatch, BOOL*wasFound,
NodeInput*parameterValue)
Parameters:
node

- node structure pointer.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

nodeId

- nodeId.

interfaceIndex
nodeInput

- interface Index.

- Pointer to node input.

parameterName

- Parameter name.

parameterInstanceNumber

- Instance number.

fallbackIfNoInstanceMatch
wasFound

- Selects parameter without

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadStringUsingIpAddress

- None

void IO_ReadStringUsingIpAddress (Node*node, intinterfaceIndex, const NodeInput*nodeInput, const char*parameterName,


BOOL*wasFound, char*parameterValue)

Parameters:
This API is used to retrieve a string parameter
value from input files using the ip-address.

node

- node structure pointer.

interfaceIndex
nodeInput

- Pointer to node input.

parameterName
wasFound

- interface Index.

- Parameter name.

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadString

- None

void IO_ReadString (const NodeAddressnodeId, NodeAddressipv4Address, in6_addr*ipv6Address, const


NodeInput*nodeInput, const char*parameterName, BOOL*wasFound, char*parameterValue)

Parameters:
This API is used to retrieve a string parameter
value from input files.

nodeId

- nodeId.

ipv4Address

- IP address of an interface

ipv6Address

- IPv6 address of an interface

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

FILEIO

wasFound

- Storage for success of seach.

parameterValue

- Storage for parameter value.

Returns:
void

IO_ReadString

This API is used to retrieve a string parameter


value from input files.

- None

void IO_ReadString (const NodeAddressnodeId, intinterfaceIndex, const NodeAddressipv4SubnetAddress, const


in6_addr*ipv6SubnetAddress, const NodeInput*nodeInput, const char*parameterName, char*parameterValue,
BOOL&wasFound, int&matchType)
Parameters:
nodeId

- nodeId.

interfaceIndex

- interface index

ipv4SubnetAddress

- IPv4 subnet address

ipv6SubnetAddress

- IPv6 subnet address

nodeInput

- Pointer to node input.

parameterName

- Parameter name.

parameterValue
wasFound

- Storage for parameter value.

- Storage for success of search.

matchType

- Storage for matchType.

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/FILEIO.html[10/28/2011 1:27:48 PM]

GUI

QualNet 5.2 API Reference


GUI
This file describes data structures and functions for interfacing with the QualNet GUI and the other graphical tools.
Constant / Data Structure Summary
Type

Name

CONSTANT

GUI_DEFAULT_STEP

The default interval before waiting for the Animator handshake/STEP.

CONSTANT

GUI_DEFAULT_ICON

Icon used in case none is specified for a node.

CONSTANT

MAX_LAYERS

By default, there are 8 layers, but users may add more

CONSTANT

GUI_DEFAULT_DATA_TYPE

Default value to use for data types.

CONSTANT

GUI_EMULATION_DATA_TYPE

Default value to use for data types.

CONSTANT

GUI_DEFAULT_LINK_TYPE

Default value to use for link types.

CONSTANT

GUI_DEFAULT_NODE_TYPE

Default value to use for node types.

CONSTANT

GUI_DEFAULT_INTERFACE

Default interface for GUI commands.

CONSTANT

GUI_WIRELESS_LINK_TYPE

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Used to distinguish wireless and wired links.

CONSTANT

GUI_ATM_LINK_TYPE

Used to distinguish ATM links from other types.

CONSTANT

GUI_COVERAGE_LINK_TYPE

Used by Stats Manager

CONSTANT

GUI_MAX_COMMAND_LENGTH

Maximum length for a single interchange with Animator.

ENUMERATION

GuiLayers

Layer in protocol stack. Allows animation filtering.

ENUMERATION

GuiEvents

Semantic events to be animated.

ENUMERATION

GuiStatisticsEvents

Statistics events recognized by Animator.

ENUMERATION

GuiMetrics

Types of statistical metrics.

ENUMERATION

GuiDataTypes

The numeric data types supported for dynamic statistics.

ENUMERATION

GuiEffects

Animation effects that can be assigned to an event.

ENUMERATION

GuiColors

Colors that can be assigned to Animator effects.

ENUMERATION

GuiSubnetTypes

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Types of subnets recognized by the Animator.

ENUMERATION

GuiCommands

Coded commands sent from Animator to Simulator.

ENUMERATION

GuiReplies

Coded commands sent from Simulator to Animator.

ENUMERATION

GuiReply

Structure containing message sent to Animator.

STRUCT

MetricData

Class to identify a specific dynamic statistic.

STRUCT

MetricLayerData

Contains a list of the metrics collected at a layer of the protocol stack.

STRUCT

GuiCommand

Structure containing command received from Animator.

Function / Macro Summary


Return Type

Summary

void

GUI_HandleHITLInput(const char *args, PartitionData *partition)

Called from GUI_EXTERNAL_ReceiveCommand() if command type is GUI_USER_DEFINED. Created so that GUI Human In the
loop commands can also be given through a file, instead of giving it through the GUI. Will serve for good unit testing of GUI HITL
commands
void

GUI_Initialize(NodeInput*nodeInput, intnumNodes, intcoordinateSystem, Coordinatesorigin,


Coordinatesdimensions, clocktypemaxClock)

Initializes the GUI in order to start the animation. The terrain map should give the path (either absolute, or relative to
QUALNET_HOME) of an file to represent the terrain.
void

GUI_SetEffect(GuiEventsevent, GuiLayerslayer, inttype, GuiEffectseffect, GuiColorscolor)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

This function will allow the protocol designer to specify the effect to use to display certain events.
void

GUI_InitNode(Node*node, NodeInput*nodeInput, clocktypetime)

Provides the initial location and orientation of the node, the transmission range (for wireless nodes), a node type, and optional icon and
label.
void

GUI_InitWirelessInterface(Node*node, intinterfaceIndex)

Provides the initial location and orientation of the node, the transmission range (for wireless nodes), a node type, and optional icon and
label.
void

GUI_InitializeInterfaces(NodeInput*nodeInput)

Sets the IP address associated with one of the node's interfaces.


void

GUI_SetInterfaceAddress(NodeIdnodeID, NodeAddressinterfaceAddress, intinterfaceIndex, clocktypetime)

Sets the IP address associated with one of the node's interfaces.


void

GUI_SetSubnetMask(NodeIdnodeID, NodeAddressinterfaceAddress, intinterfaceIndex, clocktypetime)

Sets the Subnet mask associated with one of the node's interfaces.
void

GUI_SetInterfaceName(NodeIdnodeID, char*interfaceAddress, intinterfaceIndex, clocktypetime)

Sets the Interface name associated with one of the node's interfaces.
void

GUI_MoveNode(NodeIdnodeID, Coordinatesposition, clocktypetime)

Moves the node to a new position.


void

GUI_SetNodeOrientation(NodeIdnodeID, Orientationorientation, clocktypetime)

Changes the orientation of a node.


void

GUI_SetNodeIcon(NodeIdnodeID, char*iconFile, clocktypetime)

Changes the icon associated with a node.


void

GUI_SetNodeLabel(NodeIdnodeID, char*label, clocktypetime)

Changes the label (the node name) of a node.


void

GUI_SetNodeRange(NodeIdnodeID, intinterfaceIndex, doublerange, clocktypetime)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Changes the transmission range of a node


void

GUI_SetNodeType(NodeIdnodeID, inttype, clocktypetime)

Changes the (symbolic) type of a node


void

GUI_SetPatternIndex(Node*node, intinterfaceIndex, intindex, clocktypetime)

Sets the antenna pattern to one of a previously specified antenna pattern file.
void

GUI_SetPatternAndAngle(nodenode*, intinterfaceIndex, intindex, intangleInDegrees, clocktypetime)

For steerable antennas, it sets the pattern to use, and also an angle relative to the node's current orientation.
void

GUI_AddLink(NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, NodeAddresssubnetAddress,


intnumHostBits, clocktypetime)

Adds a link (one hop on a route) between two nodes. In a wired topology, this could be a static route; in wireless, a dynamic one.
void

GUI_AddLink(NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, inttla, intnla, intsla,


clocktypetime)

Adds an IPv6 link (one hop on a route) between two nodes. In a wired topology, this could be a static route; in wireless, a dynamic one.
void

GUI_AddLink(NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, IPv6subnetAddressip6_addr,


IPv6subnetPrefixLenunsigned int, clocktypetime)

Adds an IPv6 link (one hop on a route) between two nodes. In a wired topology, this could be a static route; in wireless, a dynamic one.
void

GUI_DeleteLink(NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, clocktypetime)

Removes link of a specific type.


void

GUI_DeleteLink(NodeIdsourceID, NodeIddestID, GuiLayerslayer, clocktypetime)

Removes the aforementioned link, no matter the "type."


void

GUI_Broadcast(NodeIdnodeID, GuiLayerslayer, inttype, intinterfaceIndex, clocktypetime)

Indicates a broadcast.
void

GUI_EndBroadcast(NodeIdnodeID, GuiLayerslayer, inttype, intinterfaceIndex, clocktypetime)

Indicates the end of a broadcast.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

void

GUI_Multicast(NodeIdnodeID, GuiLayerslayer, inttype, intinterfaceIndex, clocktypetime)

Indicates a multicast. (Probably need to add a destination address.)


void

GUI_Unicast(NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, intsendingInterfaceIndex,


intreceivingInterfaceIndex, clocktypetime)

Sends a unicast packet/frame/signal to a destination. Will probably be drawn as a temporary line between source and destination,
followed by a signal (at the receiver) indicating success or failure.
void

GUI_Receive(NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, intsendingInterfaceIndex,


intreceivingInterfaceIndex, clocktypetime)

Shows a successful receipt at a destination.


void

GUI_Drop(NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, intsendingInterfaceIndex,


intreceivingInterfaceIndex, clocktypetime)

Shows a packet/frame/signal being dropped by a node.


void

GUI_Collision(NodeIdnodeID, GuiLayerslayer, clocktypetime)

Shows a node detecting a collision.


void

GUI_CreateSubnet(GuiSubnetTypestype, NodeAddresssubnetAddress, intnumHostBits, const char*nodeList,


clocktypetime)

Creates a subnet. Normally done at startup.


void

GUI_CreateSubnet(GuiSubnetTypestype, in6_addrIPv6subnetAddress, unsigned intIPv6subnetPrefixLen, const


char*nodeList, clocktypetime)

Creates a IPv6 subnet. Normally done at startup.


void

GUI_CreateSubnet(GuiSubnetTypestype, IPv6subnetAddressip6_addr, IPv6subnetPrefixLenunsigned int, const


char*nodeList, clocktypetime)

Creates a IPv6 subnet. Normally done at startup.


void

GUI_CreateHierarchy(intcomponentID, char*nodeList)

Since the GUI supports hierarchical design, this function informs the GUI of the contents of a hierarchical component.
void

GUI_MoveHierarchy(inthierarchyId, CoordinatescenterCoordinates, Orientationorientation, clocktypetime)

Moves the center point of a hierarchy to a new position.


void

(intpatternID, char*inputLine)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

GUI_CreateWeatherPattern

Sends the input line describing a weather pattern to the GUI.


void

GUI_MoveWeatherPattern(intpatternID, Coordinatescoordinates, clocktypetime)

Moves the first point of a weather pattern to a new position.


void

GUI_AddApplication(NodeIdsourceID, NodeIddestID, char*appName, intuniqueId, clocktypetime)

Shows label beside the client and the server as app link is setup.
void

GUI_DeleteApplication(NodeIdsourceID, NodeIddestID, char*appName, intuniqueId, clocktypetime)

Deletes the labels shown by AddApplication.


void

GUI_AddInterfaceQueue(NodeIdnodeID, GuiLayerslayer, intinterfaceIndex, unsignedpriority, intqueueSize,


clocktypetime)

Creates a queue for a node, interface and priority.


void

GUI_QueueInsertPacket(NodeIdnodeID, GuiLayerslayer, intinterfaceIndex, unsignedpriority, intpacketSize,


clocktypetime)

Inserting one packet to a queue for a node, interface and priority


void

GUI_QueueDropPacket(NodeIdnodeID, GuiLayerslayer, intinterfaceIndex, unsignedpriority, clocktypetime)

Dropping one packet from a queue for a node, interface and priority.
void

GUI_QueueDequeuePacket(NodeIdnodeID, GuiLayerslayer, intinterfaceIndex, unsignedpriority, intpacketSize,


clocktypetime)

Dequeuing one packet from a queue for a node, interface and priority
int

GUI_DefineMetric(char*name, NodeIdnodeID, GuiLayerslayer, intlinkID, GuiDataTypesdatatype,


GuiMetricsmetrictype)

This function defines a metric by giving it a name and a description. The system will assign a number to this data item. Future
references to the data should use the number rather than the name. The link ID will be used to associate a metric with a particular
application link, or MAC interface, etc.
void

GUI_SendIntegerData(NodeIdnodeID, intmetricID, intvalue, clocktypetime)

Sends data for an integer metric.


void

GUI_SendUnsignedData(NodeIdnodeID, intmetricID, unsignedvalue, clocktypetime)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Sends data for an unsigned metric.


void

GUI_SendRealData(NodeIdnodeID, intmetricID, doublevalue, clocktypetime)

Sends data for a floating point metric.


bool

GUI_isAnimateOrInteractive()

Returns true if the GUI was activated on the command line.


void

GUI_EXTERNAL_Bootstrap(intargc, char**argv, NodeInput*nodeInput, intnumberOfProcessors, intthisPartitionId)

Creates a connection to the GUI


void

GUI_EXTERNAL_Registration(PartitionData*partitionData, EXTERNAL_InterfaceList*list)

Registers the GUI as an external interface


void

GUI_CreateReply(GuiRepliesreplyType, stdmsg)

Function used to replace newline characters in a string being sent to the GUI.

Constant / Data Structure Detail

Constant

GUI_DEFAULT_STEP1 econds

Constant

The default interval before waiting for the Animator handshake/STEP.


GUI_DEFAULT_ICON""

Constant

Icon used in case none is specified for a node.


MAX_LAYERS12

Constant

By default, there are 8 layers, but users may add more


GUI_DEFAULT_DATA_TYPE0

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Constant

Default value to use for data types.


GUI_EMULATION_DATA_TYPE1

Constant

Default value to use for data types.


GUI_DEFAULT_LINK_TYPE0

Constant

Default value to use for link types.


GUI_DEFAULT_NODE_TYPE0

Constant

Default value to use for node types.


GUI_DEFAULT_INTERFACE0

Constant

Default interface for GUI commands.


GUI_WIRELESS_LINK_TYPE1

Constant

Used to distinguish wireless and wired links.


GUI_ATM_LINK_TYPE2

Constant

Used to distinguish ATM links from other types.


GUI_COVERAGE_LINK_TYPE3

Constant

Used by Stats Manager


GUI_MAX_COMMAND_LENGTH1024

Enumeration

Maximum length for a single interchange with Animator.


GuiLayers

Enumeration

Layer in protocol stack. Allows animation filtering.


GuiEvents

Enumeration

Semantic events to be animated.


GuiStatisticsEvents

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Enumeration

Statistics events recognized by Animator.


GuiMetrics

Enumeration

Types of statistical metrics.


GuiDataTypes

Enumeration

The numeric data types supported for dynamic statistics.


GuiEffects

Enumeration

Animation effects that can be assigned to an event.


GuiColors

Enumeration

Colors that can be assigned to Animator effects.


GuiSubnetTypes

Enumeration

Types of subnets recognized by the Animator.


GuiCommands

Enumeration

Coded commands sent from Animator to Simulator.


GuiReplies

Enumeration

Coded commands sent from Simulator to Animator.


GuiReply

Structure

Structure containing message sent to Animator.


MetricData

Structure

Class to identify a specific dynamic statistic.


MetricLayerData

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Structure

Contains a list of the metrics collected at a layer of the protocol stack.


GuiCommand

Structure containing command received from Animator.

Function / Macro Detail


Function / Macro
GUI_HandleHITLInput

Format
void GUI_HandleHITLInput (const char *args, PartitionData *partition)

Parameters:

Called from
GUI_EXTERNAL_ReceiveCommand() if
command type is GUI_USER_DEFINED.
Created so that GUI Human In the loop
commands can also be given through a file,
instead of giving it through the GUI. Will
serve for good unit testing of GUI HITL
commands
GUI_Initialize

args

- the command itself

partition

- the partition pointer

Returns:
void

- NULL

void GUI_Initialize (NodeInput*nodeInput, intnumNodes, intcoordinateSystem, Coordinatesorigin, Coordinatesdimensions,


clocktypemaxClock)

Parameters:
Initializes the GUI in order to start the
animation. The terrain map should give the
path (either absolute, or relative to
QUALNET_HOME) of an file to represent
the terrain.

nodeInput
numNodes

- configuration file

- the number of nodes in the simulation

coordinateSystem
origin

- LATLONALT or CARTESIAN

- Southwest corner

dimensions
maxClock

- Northeast corner, or size

- length of the simulation

Returns:
void

- NULL

GUI_SetEffect

void GUI_SetEffect (GuiEventsevent, GuiLayerslayer, inttype, GuiEffectseffect, GuiColorscolor)

Parameters:

This function will allow the protocol designer


to specify the effect to use to display certain
events.

event

- the type of event for the new effect

layer

- the protocol layer

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

type

- special key to distinguish similar events

effect
color

- the effect to use

- optional color for the effect

Returns:
void

- NULL

GUI_InitNode

void GUI_InitNode (Node*node, NodeInput*nodeInput, clocktypetime)

Parameters:

Provides the initial location and orientation of


the node, the transmission range (for wireless
nodes), a node type, and optional icon and
label.

node

- the node

nodeInput
time

- configuration file

- the current simulation time

Returns:
void

- NULL

GUI_InitWirelessInterface

void GUI_InitWirelessInterface (Node*node, intinterfaceIndex)

Parameters:

Provides the initial location and orientation of


the node, the transmission range (for wireless
nodes), a node type, and optional icon and
label.

node

- the node

interfaceIndex

- the interface to initialize

Returns:
void

- NULL

GUI_InitializeInterfaces

void GUI_InitializeInterfaces (NodeInput*nodeInput)

Parameters:

Sets the IP address associated with one of the


node's interfaces.

nodeInput

- configuration file

Returns:
void

- NULL

GUI_SetInterfaceAddress

void GUI_SetInterfaceAddress (NodeIdnodeID, NodeAddressinterfaceAddress, intinterfaceIndex, clocktypetime)

Parameters:

Sets the IP address associated with one of the


node's interfaces.

nodeID

- the node's ID

interfaceAddress
interfaceIndex

- new IP address

- interface Address to change

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

time

- the current simulation time

Returns:
void

- NULL

GUI_SetSubnetMask

void GUI_SetSubnetMask (NodeIdnodeID, NodeAddressinterfaceAddress, intinterfaceIndex, clocktypetime)

Parameters:

Sets the Subnet mask associated with one of


the node's interfaces.

nodeID

- the node's ID

interfaceAddress
interfaceIndex
time

- new Subnet mask

- Subnet mask to change

- the current simulation time

Returns:
void

- NULL

GUI_SetInterfaceName

void GUI_SetInterfaceName (NodeIdnodeID, char*interfaceAddress, intinterfaceIndex, clocktypetime)

Parameters:

Sets the Interface name associated with one


of the node's interfaces.

nodeID

- the node's ID

interfaceAddress
interfaceIndex
time

- new Interface name

- interface Name to change

- the current simulation time

Returns:
void

- NULL

GUI_MoveNode

void GUI_MoveNode (NodeIdnodeID, Coordinatesposition, clocktypetime)

Parameters:

Moves the node to a new position.

nodeID

- the node's ID

position
time

- the new position

- the current simulation time

Returns:
void

GUI_SetNodeOrientation

- NULL

void GUI_SetNodeOrientation (NodeIdnodeID, Orientationorientation, clocktypetime)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Changes the orientation of a node.

Parameters:
nodeID

- the node's ID

orientation
time

- the new orientation

- the current simulation time

Returns:
- NULL

void

GUI_SetNodeIcon

void GUI_SetNodeIcon (NodeIdnodeID, char*iconFile, clocktypetime)

Parameters:

Changes the icon associated with a node.

nodeID

- the node's ID

iconFile
time

- the path to the image file, may be the

- the current simulation time

Returns:
- NULL

void

GUI_SetNodeLabel

void GUI_SetNodeLabel (NodeIdnodeID, char*label, clocktypetime)

Parameters:

Changes the label (the node name) of a node.

nodeID
label
time

- the node's ID

- a string to label the node

- the current simulation time

Returns:
- NULL

void

GUI_SetNodeRange

void GUI_SetNodeRange (NodeIdnodeID, intinterfaceIndex, doublerange, clocktypetime)

Parameters:

Changes the transmission range of a node

nodeID

- the node's ID

interfaceIndex
range
time

- which of the node's interfaces to use

- the new transmission range in meters

- the current simulation time

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

GUI_SetNodeType

void GUI_SetNodeType (NodeIdnodeID, inttype, clocktypetime)

Parameters:

Changes the (symbolic) type of a node

nodeID

- the node's ID

type

- user defined type, used with GUI_SetEffect

time

- the current simulation time

Returns:
- NULL

void

GUI_SetPatternIndex

void GUI_SetPatternIndex (Node*node, intinterfaceIndex, intindex, clocktypetime)

Parameters:

Sets the antenna pattern to one of a


previously specified antenna pattern file.

node

- the node pointer

interfaceIndex
index
time

- which of the node's interfaces to use

- index into the node's antenna pattern file

- the current simulation time

Returns:
- NULL

void

GUI_SetPatternAndAngle

void GUI_SetPatternAndAngle (nodenode*, intinterfaceIndex, intindex, intangleInDegrees, clocktypetime)

Parameters:

For steerable antennas, it sets the pattern to


use, and also an angle relative to the node's
current orientation.

node*

- the node pointer

interfaceIndex
index

- index into the node's antenna pattern file

angleInDegrees
time

- which of the node's interfaces to use

- angle to rotate the pattern

- the current simulation time

Returns:
void

GUI_AddLink

- NULL

void GUI_AddLink (NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, NodeAddresssubnetAddress,


intnumHostBits, clocktypetime)

Parameters:
Adds a link (one hop on a route) between two
nodes. In a wired topology, this could be a

sourceID

- the source node for the link

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

static route; in wireless, a dynamic one.


destID
layer
type

- the destination node

- the protocol layer associated w/ the link

- a user-defined type for the link

subnetAddress
numHostBits
time

- subnet address for network links

- subnet size for network links

- the current simulation time

Returns:
- NULL

void

GUI_AddLink

void GUI_AddLink (NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, inttla, intnla, intsla, clocktypetime)

Parameters:

Adds an IPv6 link (one hop on a route)


between two nodes. In a wired topology, this
could be a static route; in wireless, a dynamic
one.

sourceID
destID
layer
type

- the source node for the link

- the destination node

- the protocol layer associated w/ the link

- a user-defined type for the link

tla

- TLA field of IPv6 address

nla

- NLA field of IPv6 address

sla

- SLA field of IPv6 address

time

- the current simulation time

Returns:
- NULL

void

GUI_AddLink

void GUI_AddLink (NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, IPv6subnetAddressip6_addr,


IPv6subnetPrefixLenunsigned int, clocktypetime)

Parameters:
Adds an IPv6 link (one hop on a route)
between two nodes. In a wired topology, this
could be a static route; in wireless, a dynamic
one.

sourceID
destID
layer
type

- the source node for the link

- the destination node

- the protocol layer associated w/ the link

- a user-defined type for the link

ip6_addr

- IPv6 address

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

unsigned int
time

- IPv6 address prefix length

- the current simulation time

Returns:
- NULL

void

GUI_DeleteLink

void GUI_DeleteLink (NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, clocktypetime)

Parameters:

Removes link of a specific type.

sourceID
destID
layer

- the source node for the link

- the destination node

- the protocol layer associated w/ the link

type

- type of link being deleted

time

- the current simulation time

Returns:
- NULL

void

GUI_DeleteLink

void GUI_DeleteLink (NodeIdsourceID, NodeIddestID, GuiLayerslayer, clocktypetime)

Parameters:

Removes the aforementioned link, no matter


the "type."

sourceID
destID
layer
time

- the source node for the link

- the destination node

- the protocol layer associated w/ the link

- the current simulation time

Returns:
- NULL

void

GUI_Broadcast

void GUI_Broadcast (NodeIdnodeID, GuiLayerslayer, inttype, intinterfaceIndex, clocktypetime)

Parameters:

Indicates a broadcast.

nodeID
layer
type

- the node's ID

- the protocol layer associated w/ event

- a user-defined type for the link

interfaceIndex
time

- which of the node's interfaces to use

- the current simulation time

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Returns:
- NULL

void

GUI_EndBroadcast

void GUI_EndBroadcast (NodeIdnodeID, GuiLayerslayer, inttype, intinterfaceIndex, clocktypetime)

Parameters:

Indicates the end of a broadcast.

nodeID
layer
type

- the node's ID

- the protocol layer associated w/ event

- a user-defined type for the link

interfaceIndex
time

- which of the node's interfaces to use

- the current simulation time

Returns:
- NULL

void

GUI_Multicast

void GUI_Multicast (NodeIdnodeID, GuiLayerslayer, inttype, intinterfaceIndex, clocktypetime)

Parameters:

Indicates a multicast. (Probably need to add a


destination address.)

nodeID
layer
type

- the node's ID

- the protocol layer associated w/ event

- a user-defined type for the link

interfaceIndex
time

- which of the node's interfaces to use

- the current simulation time

Returns:
- NULL

void

GUI_Unicast

void GUI_Unicast (NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, intsendingInterfaceIndex,


intreceivingInterfaceIndex, clocktypetime)

Parameters:
Sends a unicast packet/frame/signal to a
destination. Will probably be drawn as a
temporary line between source and
destination, followed by a signal (at the
receiver) indicating success or failure.

sourceID
destID
layer
type

- the source node

- the destination node

- protocol layer associated w/ the event

- a user-defined type

sendingInterfaceIndex

- sender's interface to use

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

receivingInterfaceIndex
time

- receiver's interface to use

- the current simulation time

Returns:
- NULL

void

GUI_Receive

void GUI_Receive (NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, intsendingInterfaceIndex,


intreceivingInterfaceIndex, clocktypetime)

Parameters:
Shows a successful receipt at a destination.
sourceID
destID
layer
type

- the source node

- the destination node

- protocol layer associated w/ the event

- a user-defined type

sendingInterfaceIndex

- sender's interface to use

receivingInterfaceIndex
time

- receiver's interface to use

- the current simulation time

Returns:
- NULL

void

GUI_Drop

void GUI_Drop (NodeIdsourceID, NodeIddestID, GuiLayerslayer, inttype, intsendingInterfaceIndex,


intreceivingInterfaceIndex, clocktypetime)

Parameters:
Shows a packet/frame/signal being dropped
by a node.

sourceID
destID
layer
type

- the source node

- the destination node

- protocol layer associated w/ the event

- a user-defined type

sendingInterfaceIndex

- sender's interface to use

receivingInterfaceIndex
time

- receiver's interface to use

- the current simulation time

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

GUI_Collision

void GUI_Collision (NodeIdnodeID, GuiLayerslayer, clocktypetime)

Parameters:

Shows a node detecting a collision.

nodeID
layer
time

- the node's ID

- the protocol layer associated w/ event

- the current simulation time

Returns:
void

GUI_CreateSubnet

- NULL

void GUI_CreateSubnet (GuiSubnetTypestype, NodeAddresssubnetAddress, intnumHostBits, const char*nodeList,


clocktypetime)

Parameters:
Creates a subnet. Normally done at startup.
type

- GUI_WIRED/WIRELESS/SATELLITE_NETWORK

subnetAddress
numHostBits
nodeList
time

- base address for the subnet

- number of host bits for subnet mask

- the rest of the .config file SUBNET line

- the current simulation time

Returns:
void

GUI_CreateSubnet

- NULL

void GUI_CreateSubnet (GuiSubnetTypestype, in6_addrIPv6subnetAddress, unsigned intIPv6subnetPrefixLen, const


char*nodeList, clocktypetime)

Parameters:
Creates a IPv6 subnet. Normally done at
startup.

type

- GUI_WIRED/WIRELESS/SATELLITE_NETWORK

IPv6subnetAddress

- base address for the subnet

IPv6subnetPrefixLen
nodeList
time

- number of network bits present

- the rest of the .config file SUBNET line

- the current simulation time

Returns:
void

GUI_CreateSubnet

- NULL

void GUI_CreateSubnet (GuiSubnetTypestype, IPv6subnetAddressip6_addr, IPv6subnetPrefixLenunsigned int, const


char*nodeList, clocktypetime)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Parameters:
Creates a IPv6 subnet. Normally done at
startup.

type

- GUI_WIRED/WIRELESS/SATELLITE_NETWORK

ip6_addr

- IPv6 address

unsigned int
nodeList
time

- IPv6 address prefix length

- the rest of the .config file SUBNET line

- the current simulation time

Returns:
void

- NULL

GUI_CreateHierarchy

void GUI_CreateHierarchy (intcomponentID, char*nodeList)

Parameters:

Since the GUI supports hierarchical design,


this function informs the GUI of the contents
of a hierarchical component.

componentID
nodeList

- an identifier for the hierarchy

- the rest of the .config file COMPONENT line

Returns:
void

- NULL

GUI_MoveHierarchy

void GUI_MoveHierarchy (inthierarchyId, CoordinatescenterCoordinates, Orientationorientation, clocktypetime)

Parameters:

Moves the center point of a hierarchy to a


new position.

hierarchyId

- the hierarchy's ID

centerCoordinates
orientation
time

- the new position

- the new orientation

- the current simulation time

Returns:
void

- NULL

GUI_CreateWeatherPattern

void GUI_CreateWeatherPattern (intpatternID, char*inputLine)

Parameters:

Sends the input line describing a weather


pattern to the GUI.

patternID

- the weather pattern ID

inputLine

- the .weather file line

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

GUI_MoveWeatherPattern

void GUI_MoveWeatherPattern (intpatternID, Coordinatescoordinates, clocktypetime)

Parameters:

Moves the first point of a weather pattern to a


new position.

patternID

- the weather pattern ID

coordinates
time

- the new position

- the current simulation time

Returns:
void

- NULL

GUI_AddApplication

void GUI_AddApplication (NodeIdsourceID, NodeIddestID, char*appName, intuniqueId, clocktypetime)

Parameters:

Shows label beside the client and the server


as app link is setup.

sourceID
destID

- the destination node

appName

- the application name, e.g. "CBR"

uniqueId
time

- the source node

- unique label for this application session

- the current simulation time

Returns:
void

- NULL

GUI_DeleteApplication

void GUI_DeleteApplication (NodeIdsourceID, NodeIddestID, char*appName, intuniqueId, clocktypetime)

Parameters:

Deletes the labels shown by AddApplication.

sourceID
destID

- the destination node

appName

- the application name, e.g. "CBR"

uniqueId
time

- the source node

- unique label for this application session

- the current simulation time

Returns:
void

GUI_AddInterfaceQueue

- NULL

void GUI_AddInterfaceQueue (NodeIdnodeID, GuiLayerslayer, intinterfaceIndex, unsignedpriority, intqueueSize,


clocktypetime)

Parameters:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Creates a queue for a node, interface and


priority.

nodeID
layer

- the node's ID

- protocol layer associated w/ the event

interfaceIndex
priority

- priority of queue

queueSize
time

- associated interface of node

- maximum size in bytes

- the current simulation time

Returns:
- NULL

void

GUI_QueueInsertPacket

void GUI_QueueInsertPacket (NodeIdnodeID, GuiLayerslayer, intinterfaceIndex, unsignedpriority, intpacketSize,


clocktypetime)

Parameters:
Inserting one packet to a queue for a node,
interface and priority

nodeID
layer

- the node's ID

- protocol layer associated w/ the event

interfaceIndex
priority

- priority of queue

packetSize
time

- associated interface of node

- size of packet

- the current simulation time

Returns:
- NULL

void

GUI_QueueDropPacket

void GUI_QueueDropPacket (NodeIdnodeID, GuiLayerslayer, intinterfaceIndex, unsignedpriority, clocktypetime)

Parameters:

Dropping one packet from a queue for a


node, interface and priority.

nodeID
layer

- the node's ID

- protocol layer associated w/ the event

interfaceIndex
priority
time

- associated interface of node

- priority of queue

- the current simulation time

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

GUI_QueueDequeuePacket

void GUI_QueueDequeuePacket (NodeIdnodeID, GuiLayerslayer, intinterfaceIndex, unsignedpriority, intpacketSize,


clocktypetime)

Parameters:
Dequeuing one packet from a queue for a
node, interface and priority

nodeID
layer

- the node's ID

- protocol layer associated w/ the event

interfaceIndex
priority

- associated interface of node

- priority of queue

packetSize

- size of packet

- the current simulation time

time

Returns:
- NULL

void

GUI_DefineMetric

int GUI_DefineMetric (char*name, NodeIdnodeID, GuiLayerslayer, intlinkID, GuiDataTypesdatatype,


GuiMetricsmetrictype)

Parameters:
This function defines a metric by giving it a
name and a description. The system will
assign a number to this data item. Future
references to the data should use the number
rather than the name. The link ID will be used
to associate a metric with a particular
application link, or MAC interface, etc.

- the name of the metric

name

nodeID
layer

- the node's ID

- protocol layer associated w/ the event

linkID

- e.g., an application session ID

datatype

- real/unsigned/integer

metrictype

- cumulative/average, etc.

Returns:
int

- an identifier associated the the metric name and layer

GUI_SendIntegerData

void GUI_SendIntegerData (NodeIdnodeID, intmetricID, intvalue, clocktypetime)

Parameters:

Sends data for an integer metric.

nodeID

- the node's ID

metricID
value
time

- the value returned by DefineMetric

- the current value of the metric

- the current simulation time

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

Returns:
- NULL

void

GUI_SendUnsignedData

void GUI_SendUnsignedData (NodeIdnodeID, intmetricID, unsignedvalue, clocktypetime)

Parameters:

Sends data for an unsigned metric.

nodeID

- the node's ID

metricID
value
time

- the value returned by DefineMetric

- the current value of the metric

- the current simulation time

Returns:
- NULL

void

GUI_SendRealData

void GUI_SendRealData (NodeIdnodeID, intmetricID, doublevalue, clocktypetime)

Parameters:

Sends data for a floating point metric.

nodeID

- the node's ID

metricID
value
time

- the value returned by DefineMetric

- the current value of the metric

- the current simulation time

Returns:
void

- NULL

GUI_isAnimateOrInteractive

bool GUI_isAnimateOrInteractive ()

Parameters:

Returns true if the GUI was activated on the


command line.

Returns:
bool

- True if the GUI is enabled.

GUI_EXTERNAL_Bootstrap

void GUI_EXTERNAL_Bootstrap (intargc, char**argv, NodeInput*nodeInput, intnumberOfProcessors, intthisPartitionId)

Parameters:

Creates a connection to the GUI

argc

- number of command line parameters

argv

- command line parameters

nodeInput

- the contents of the .config file

numberOfProcessors

- the number of processors in use

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

GUI

thisPartitionId

- the ID of this partition

Returns:
void

- NULL

GUI_EXTERNAL_Registration

void GUI_EXTERNAL_Registration (PartitionData*partitionData, EXTERNAL_InterfaceList*list)

Parameters:

Registers the GUI as an external interface

partitionData
list

- the partition to register with

- the list to add oneself to

Returns:
void

- NULL

GUI_CreateReply

void GUI_CreateReply (GuiRepliesreplyType, stdmsg)

Parameters:

Function used to replace newline characters


in a string being sent to the GUI.

replyType
msg

- the type of reply

- string*

Returns:
void

- NULL

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/GUI.html[10/28/2011 1:27:57 PM]

IP

QualNet 5.2 API Reference


IP
This file contains data structures and prototypes of functions used by IP.
Constant / Data Structure Summary
Type

Name

CONSTANT

IPVERSION4

Version of IP

CONSTANT

IPTOS_LOWDELAY

Type of service ( low delay)

CONSTANT

IPTOS_THROUGHPUT

Type of service ( throughput)

CONSTANT

IPTOS_RELIABILITY

Type of service (reliability)

CONSTANT

IPTOS_MINCOST

Type of service ( minimum cost)

CONSTANT

IPTOS_ECT

Bits 6 and 7 in the IPv4 TOS octet are designated as the ECN field. Bit 6 is designated as the ECT bit.

CONSTANT

IPTOS_CE

Bits 6 and 7 in the IPv4 TOS octet are designated as the ECN field. Bit 7 is designated as the CE bit.

CONSTANT

IPTOS_DSCP_MAX

Bits 0 to 5 in the IPv4 TOS octet are designated as DSCP field.The range for this 6-bit field is < 0 - 63 >.

CONSTANT

IPTOS_DSCP_MIN

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Bits 0 to 5 in the IPv4 TOS octet are designated as DSCP field.The range for this 6-bit field is < 0 - 63 >.

CONSTANT

IPTOS_PREC_EFINTERNETCONTROL

IP precedence 'EF clasee internet control'

CONSTANT

IPTOS_PREC_NETCONTROL

IP precedence 'net control'

CONSTANT

IPTOS_PREC_INTERNETCONTROL

IP precedence 'internet control'

CONSTANT

IPTOS_PREC_CRITIC_ECP

IP precedence 'critic ecp'

CONSTANT

IPTOS_PREC_FLASHOVERRIDE

IP precedence 'flash override'

CONSTANT

IPTOS_PREC_FLASH

IP precedence 'flash'

CONSTANT

IPTOS_PREC_IMMEDIATE

IP precedence 'immediate'

CONSTANT

IPTOS_PREC_PRIORITY

IP precedence 'priority'

CONSTANT

IPTOS_PREC_ROUTINE

IP precedence 'routing'

CONSTANT

IPTOS_PREC_INTERNETCONTROL_MIN_DELAY_SET

IP precedence 'internet control'with the 'minimize delay' bit set

CONSTANT

IPTOS_PREC_CRITIC_ECP_MIN_DELAY_SET

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

IP precedence 'critic ecp'with the 'minimize delay' bit set

CONSTANT

IPOPT_CONTROL

IP option 'control'

CONSTANT

IPOPT_RESERVED1

IP option 'reserved1'.

CONSTANT

IPOPT_DEBMEAS

IP option 'debmeas'

CONSTANT

IPOPT_RESERVED2

IP option 'reserved2'

CONSTANT

IPOPT_EOL

IP option 'end of option list'.

CONSTANT

IPOPT_NOP

IP option 'no operation'.

CONSTANT

IPOPT_RR

IP option 'record packet route'.

CONSTANT

IPOPT_TS

IP option 'timestamp'.

CONSTANT

IPOPT_SECURITY

IP option ' provide s,c,h,tcc'.

CONSTANT

IPOPT_LSRR

IP option 'loose source route'.

CONSTANT

IPOPT_SATID

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

IP option 'satnet id'.


CONSTANT

IPOPT_SSRR

IP option 'strict source route '.

CONSTANT

IPOPT_TRCRT

IP option 'Traceroute'.

CONSTANT

IPOPT_OPTVAL

Offset to IP option 'option ID'

CONSTANT

IPOPT_OLEN

Offset to IP option 'option length'

CONSTANT

IPOPT_OFFSET

Offset to IP option 'offset within option'

CONSTANT

IPOPT_MINOFF

Offset to IP option 'min value of above'

CONSTANT

IPOPT_TS_TSONLY

Flag bits for ipt_flg (timestamps only );

CONSTANT

IPOPT_TS_TSANDADDR

Flag bits for ipt_flg (timestamps and addresses );

CONSTANT

IPOPT_TS_PRESPEC

Flag bits for ipt_flg (specified modules only );

CONSTANT

IPOPT_SECUR_UNCLASS

'unclass' bits for security in IP option field

CONSTANT

IPOPT_SECUR_CONFID

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

'confid' bits for security in IP option field


CONSTANT

IPOPT_SECUR_EFTO

'efto' bits for security in IP option field

CONSTANT

IPOPT_SECUR_MMMM

'mmmm' bits for security in IP option field

CONSTANT

IPOPT_SECUR_RESTR

'restr' bits for security in IP option field

CONSTANT

IPOPT_SECUR_SECRET

'secreat' bits for security in IP option field

CONSTANT

IPOPT_SECUR_TOPSECRET

'top secret' bits for security in IP option field

CONSTANT

MAXTTL

Internet implementation parameters (maximum time to live (seconds) )

CONSTANT

IPDEFTTL

Internet implementation parameters (default ttl, from RFC 1340 )

CONSTANT

IPFRAGTTL

Internet implementation parameters (time to live for frags, slowhz )

CONSTANT

IPTTLDEC

Internet implementation parameters (subtracted when forwarding)

CONSTANT

IPDEFTOS

Internet implementation parameters (default TOS )

CONSTANT

IP_MSS

Internet implementation parameters ( default maximum segment size )

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

CONSTANT

IPPROTO_IP

IP protocol numbers.

CONSTANT

IPPROTO_ICMP

IP protocol numbers for ICMP.

CONSTANT

IPPROTO_IGMP

IP protocol numbers for IGMP.

CONSTANT

IPPROTO_IPIP

IP protocol numbers for IP tunneling.

CONSTANT

IPPROTO_TCP

IP protocol numbers for TCP .

CONSTANT

IPPROTO_UDP

IP protocol numbers for UDP

CONSTANT

IPPROTO_IPV6

IP protocol number for DUAL-IP.

CONSTANT

IPPROTO_RSVP

IP protocol numbers for RSVP.

CONSTANT

IPPROTO_MOBILE_IP

IP protocol numbers for MOBILE_IP.

CONSTANT

IPPROTO_CES_HAIPE

IP protocol numbers.

CONSTANT

IPPROTO_ESP

IP protocol numbers for IPSEC.

CONSTANT

IPPROTO_AH

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

IP protocol numbers for IPSEC.

CONSTANT

IPPROTO_ISAKMP

IP protocol numbers for IPSEC.

CONSTANT

IPPROTO_CES_ISAKMP

IP protocol numbers for IPSEC.

CONSTANT

IPPROTO_IAHEP

IP protocol numbers.

CONSTANT

IPPROTO_OSPF

IP protocol numbers for OSPF .

CONSTANT

IPPROTO_PIM

IP protocol numbers for PIM .

CONSTANT

IPPROTO_RPIM

IP protocol numbers for PIM .

CONSTANT

IPPROTO_IGRP

IP protocol numbers for IGRP .

CONSTANT

IPPROTO_EIGRP

IP protocol numbers for EIGRP .

CONSTANT

IPPROTO_BELLMANFORD

IP protocol numbers for BELLMANFORD.

CONSTANT

IPPROTO_IPIP_RED

IP protocol numbers for IP_RED.

CONSTANT

IPPROTO_FISHEYE

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

IP protocol numbers for FISHEYE .

CONSTANT

IPPROTO_FSRL

IP protocol numbers for LANMAR .

CONSTANT

IPPROTO_ANODR

IP protocol numbers for ANODR .

CONSTANT

IPPROTO_SECURE_NEIGHBOR

IP protocol numbers for secure neighbor discovery .

CONSTANT

IPPROTO_SECURE_COMMUNITY

IP protocol numbers for secure routing community

CONSTANT

IPPROTO_NETWORK_CES_CLUSTER

IP protocol numbers for clustering protocol.

CONSTANT

IPPROTO_ROUTING_CES_ROSPF

IP protocol numbers for ROSPF protocol.

CONSTANT

IPPROTO_IPIP_ROUTING_CES_MALSR

IP protocol numbers for MALSR IP encapsulation.

CONSTANT

IPPROTO_IPIP_ROUTING_CES_ROSPF

IP protocol numbers for ROSPF IP encapsulation.

CONSTANT

IPPROTO_NETWORK_CES_REGION

IP protocol numbers for RAP election protocol.

CONSTANT

IPPROTO_MPR

IP protocol numbers for MPR

CONSTANT

IPPROTO_IPIP_ROUTING_CES_SRW

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

IP protocol numbers for ROUTING_CES_SRW IP encapsulation.


CONSTANT

IPPROTO_IPIP_SDR

IP protocol numbers for SDR IP encapsulation.

CONSTANT

IPPROTO_IPIP_SDR

IP protocol numbers for SDR IP encapsulation.

CONSTANT

IPPROTO_MULTICAST_CES_SRW_MOSPF

IP protocol numbers for MULTICAST_CES_SRW_MOSPF IP encapsulation.

CONSTANT

IPPROTO_CES_HSLS

IP protocol numbers for HSLS protocol.

CONSTANT

IPPROTO_AODV

IP protocol numbers for AODV .

CONSTANT

IPPROTO_DYMO

IP protocol numbers for DYMO .

CONSTANT

IPPROTO_MAODV

IP protocol numbers for MAODV.

CONSTANT

IPPROTO_DSR

IP protocol numbers for DSR .

CONSTANT

IPPROTO_ODMRP

IP protocol numbers for ODMRP .

CONSTANT

IPPROTO_LAR1

IP protocol numbers for LAR1.

CONSTANT

IPPROTO_STAR

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

IP protocol numbers for STAR.


CONSTANT

IPPROTO_DAWN

IP protocol numbers for DAWN.

CONSTANT

IPPROTO_EPLRS

IP protocol numbers for EPLRS protocol.

CONSTANT

IPPROTO_EPLRS

IP protocol numbers for EPLRS protocol.

CONSTANT

IPPROTO_CES_EPLRS_MPR

IP protocol numbers for EPLRS MPR protocol.

CONSTANT

IPPROTO_DVMRP

IP protocol numbers for DVMRP.

CONSTANT

IPPROTO_GSM

IP protocol numbers for GSM.

CONSTANT

IPPROTO_EXTERNAL

IP protocol for external interface.

CONSTANT

IPPROTO_INTERNET_GATEWAY

IP protocol numbers for Internet gateway for emulated nodes

CONSTANT

IPPROTO_EXATA_VIRTUAL_LAN

IP protocol numbers for Internet gateway for emulated nodes

CONSTANT

IPPROTO_NDP

IP protocol numbers for NDP.

CONSTANT

IPPROTO_BRP

IP protocol numbers for BRP .

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

CONSTANT

IP_MIN_HEADER_SIZE

Minimum IP header size in bytes

CONSTANT

IP_MAX_HEADER_SIZE

Maximum IP header size in bytes

CONSTANT

IP_FRAGMENT_HOLD_TIME

Fragmented packets hold time.

CONSTANT

IP_MIN_MULTICAST_ADDRESS

Used to determine whether an IP address is multicast.

CONSTANT

IP_MAX_MULTICAST_ADDRESS

Used to determine whether an IP address is multicast.

CONSTANT

MULTICAST_DEFAULT_INTERFACE_ADDRESS

Default multicast interface address (224.0.0.0).

CONSTANT

IP_MIN_RESERVED_MULTICAST_ADDRESS

Minimum reserve multicast address (224.0.0.0).

CONSTANT

IP_MAX_RESERVED_MULTICAST_ADDRESS

Maximum reserve multicast address (224.0.0.255).

CONSTANT

MULTICAST_DEFAULT_NUM_HOST_BITS

Multicast default num host bit

CONSTANT

NETWORK_UNREACHABLE

Network unreachable.

CONSTANT

DEFAULT_INTERFACE

Default interface index

CONSTANT

NETWORK_IP_REASS_BUFF_TIMER

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Max time data can stored in assembly buffer

CONSTANT

MAX_IP_FRAGMENTS_SIMPLE_CASE

Max size of fragment allowed.

CONSTANT

SMALL_REASSEMBLY_BUFFER_SIZE

Size of reassemble buffer

CONSTANT

REASSEMBLY_BUFFER_EXPANSION_MULTIPLIER

Multiplier used for reassemble buffer expansion

ENUMERATION

BackplaneType

NetworkIp backplane type(either CENTRAL or DISTRIBUTED)

STRUCT

IpHeaderType

IpHeaderType is 20 bytes,just like in the BSD code.

STRUCT

ip_timestamp

Time stamp option structure.

STRUCT

ip_traceroute

TraceRoute option structure.

STRUCT

NetworkIpBackplaneInfo

Structure maintaining IP Back plane Information

STRUCT

ipHeaderSizeInfo

Structure maintaining IP header size Information

STRUCT

NetworkMulticastForwardingTableRow

Structure of an entity of multicast forwarding table.

STRUCT

NetworkMulticastForwardingTable

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Structure of multicast forwarding table

STRUCT

NetworkIpMulticastGroupEntry

Structure for Multicast Group Entry

STRUCT

IpPerHopBehaviorInfoType

Structure to maintain DS priority queue mapping

STRUCT

IpMftcParameter

Variables of the structure define a unique condition class

STRUCT

IpMultiFieldTrafficConditionerInfo

Structure used to store traffic condition.

STRUCT

IpOptionsHeaderType

Structure of optional header for IP source route

STRUCT

NetworkIpStatsType

Structure used to keep track of all stats of network layer.

STRUCT

NetworkForwardingTableRow

Structure of an entity of forwarding table.

STRUCT

NetworkForwardingTable

Structure of forwarding table.

STRUCT

IpInterfaceInfoType

Structure for maintaining IP interface informations. This struct must be allocated by new, not MEM_malloc. All member variables
MUST be initialized in the constructor.

STRUCT

ip_frag_data

QualNet typedefs struct ip_frag_data to IpFragData. is a simple queue to hold fragmented packets.

STRUCT

Ipv6FragQueue

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Ipv6 fragment queue structure.

STRUCT

FragmetedMsg

QualNet typedefs struct fragmeted_msg_struct to ip6q. struct fragmeted_msg_struct is a simple fragmented packets msg hold structure.

STRUCT

NetworkDataIp;

Main structure of network layer.

STRUCT

IpReassemblyBufferType

Structure of reassembly buffer

STRUCT

IpReassemblyBufferListCellType

Structure of reassembly buffer cell listing

STRUCT

IpReassemblyBufferListType

Structure of reassembly buffer list

Function / Macro Summary


Return Type

Summary

MACRO

IPOPT_COPIED(o)

IP option 'copied'.
MACRO

IPOPT_CLASS(o)

IP option 'class'
MACRO

IPOPT_NUMBER(o)

IP option 'number'
MACRO

IpHeaderSize(ipHeader)

Returns IP header ip_hl field * 4, which is the size of the IP header in bytes.
MACRO

SetIpHeaderSize(IpHeader, Size)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Sets IP header ip_hl field (header length) to Size divided by 4


MACRO

FragmentOffset(ipHeader)

Starting position of this fragment in actual packet.


MACRO

SetFragmentOffset(ipHeader, offset)

To set offset of fragment.


void

IpHeaderSetVersion()(UInt32*ip_v_hl_tos_len, unsigned intversion)

Set the value of version number for IpHeaderType


void

IpHeaderSetHLen()(UInt32*ip_v_hl_tos_len, unsigned inthlen)

Set the value of header length for IpHeaderType


void

IpHeaderSetTOS()(UInt32*ip_v_hl_tos_len, unsigned intipTos)

Set the value of Type of Service for IpHeaderType


void

IpHeaderSetIpLength()(UInt32*ip_v_hl_tos_len, unsigned intipLen)

Set the value of ip length for IpHeaderType


void

IpHeaderSetIpFragOffset()(UInt16*ipFragment, UInt16offset)

Set the value of ip_fragment_offset for IpHeaderType


void

IpHeaderSetIpReserved()(UInt16*ipFragment, UInt16ipReserved)

Set the value of ipReserved for IpHeaderType


void

IpHeaderSetIpDontFrag()(UInt16*ipFragment, UInt16dontFrag)

Set the value of ip_dont_fragment for IpHeaderType


void

IpHeaderSetIpMoreFrag()(UInt16*ipFragment, UInt16moreFrag)

Set the value of ip_more_fragment for IpHeaderType


unsigned int

IpHeaderGetVersion()(UInt32ip_v_hl_tos_len)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Returns the value of version number for IpHeaderType


unsigned int

IpHeaderGetHLen()(UInt32ip_v_hl_tos_len)

Returns the value of header length for IpHeaderType


unsigned int

IpHeaderGetTOS()(UInt32ip_v_hl_tos_len)

Returns the value of Type of Service for IpHeaderType


unsigned int

IpHeaderGetIpLength()(UInt32ip_v_hl_tos_len)

Returns the value of ip length for IpHeaderType


UInt16

IpHeaderGetIpFragOffset()(UInt16ipFragment)

Returns the value of ip_fragment_offset for IpHeaderType


BOOL

IpHeaderGetIpDontFrag()(UInt16ipFragment)

Returns the value of ip_dont_fragment for IpHeaderType


BOOL

IpHeaderGetIpMoreFrag()(UInt16ipFragment)

Returns the value of ip_more_fragment for IpHeaderType


BOOL

IpHeaderGetIpReserved()(UInt16ipFragment)

Returns the value of ipReserved for IpHeaderType


void

Ip_timestampSetFlag()(unsigned charflgOflw, unsigned charflag)

Set the value of flag for ip_timestamp_str


void

Ip_timestampSetOvflw()(unsigned charflgOflw, unsigned charovflw)

Set the value of ovflw for ip_timestamp_str


unsigned char

Ip_timestampGetFlag()(unsigned charflgOflw)

Returns the value of flag for ip_timestamp_str


unsigned char

Ip_timestampGetOvflw()(unsigned charflgOflw)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Returns the value of overflow counter for ip_timestamp_str


NodeAddress

ConvertNumHostBitsToSubnetMask(intnumHostBits)

To generate subnetmask using number of host bit


int

ConvertSubnetMaskToNumHostBits(NodeAddresssubnetMask)

To generate number of host bit using subnetmask.


NodeAddress

MaskIpAddress(NodeAddressaddress, NodeAddressmask)

To mask a ip address.
NodeAddress

MaskIpAddressWithNumHostBits(NodeAddressaddress, intnumHostBits)

To mask a ip address.
NodeAddress

CalcBroadcastIpAddress(NodeAddressaddress, intnumHostBits)

To generate broadcast address.


BOOL

IsIpAddressInSubnet(NodeAddressaddress, NodeAddresssubnetAddress, intnumHostbits)

To check if a ip address belongs to a subnet.


void

NetworkIpAddHeader(Node*node, Message*msg, NodeAddresssourceAddress, NodeAddressdestinationAddress,


TosTypepriority, unsigned charprotocol, unsignedttl)

Add an IP packet header to a message. Just calls AddIpHeader.


IpOptionsHeaderType*

FindAnIpOptionField(const IpHeaderType*ipHeader, const intoptionKey)

Searches the IP header for the option field with option code that matches optionKey, and returns a pointer to the option field
header.
void

NetworkIpPreInit(Node*node)

IP initialization required before any of the other layers are initialized. This is mainly for MAC initialization, which requires certain
IP structures be pre-initialized.
void

NetworkIpInit(Node*node, const NodeInput*nodeInput)

Initialize IP variables, and all network-layer IP protocols..


void

NetworkIpLayer(Node*node, Message*msg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Handle IP layer events, incoming messages and messages sent to itself (timers, etc.).
void

NetworkIpFinalize(Node*node)

Finalize function for the IP model. Finalize functions for all network-layer IP protocols are called here.
void

NetworkIpReceivePacketFromTransportLayer(Node*node, Message*msg, NodeAddresssourceAddress,


NodeAddressdestinationAddress, intoutgoingInterface, TosTypepriority, unsigned charprotocol,
BOOLisEcnCapable)

Called by transport layer protocols (UDP, TCP) to send UDP datagrams and TCP segments using IP. Simply calls
NetworkIpSendRawMessage().
void

NetworkIpSendRawMessage(Node*node, Message*msg, NodeAddresssourceAddress, NodeAddressdestinationAddress,


intoutgoingInterface, TosTypepriority, unsigned charprotocol, unsignedttl)

Called by NetworkIpReceivePacketFromTransportLayer() to send to send UDP datagrams, TCP segments using IP. Also called by
network-layer routing protocols (AODV, OSPF, etc.) to send IP packets. This function adds an IP header and calls
RoutePacketAndSendToMac().
void

NetworkIpSendRawMessageWithDelay(Node*node, Message*msg, NodeAddresssourceAddress,


NodeAddressdestinationAddress, intoutgoingInterface, TosTypepriority, unsigned charprotocol,
unsignedttl, clocktypedelay)

Same as NetworkIpSendRawMessage(), but schedules event after a simulation delay.


void

NetworkIpSendRawMessageToMacLayer(Node*node, Message*msg, NodeAddresssourceAddress,


NodeAddressdestinationAddress, TosTypepriority, unsigned charprotocol, unsignedttl, intinterfaceIndex,
NodeAddressnextHop)

Called by network-layer routing protocols (AODV, OSPF, etc.) to add an IP header to payload data, and with the resulting IP
packet, calls NetworkIpSendPacketOnInterface().
void

NetworkIpSendRawMessageToMacLayerWithDelay(Node*node, Message*msg, NodeAddresssourceAddress,


NodeAddressdestinationAddress, TosTypepriority, unsigned charprotocol, unsignedttl, intinterfaceIndex,
NodeAddressnextHop, clocktypedelay)

Same as NetworkIpSendRawMessageToMacLayer(), but schedules the event after a simulation delay by calling
NetworkIpSendPacketOnInterfaceWithDelay().
void

NetworkIpSendPacketToMacLayer(Node*node, Message*msg, intinterfaceIndex, NodeAddressnextHop)

This function is called once the outgoing interface index and next hop address to which to route an IP packet are known.
void

NetworkIpSendPacketOnInterface(Node*node, Message*msg, intincomingInterface, intoutgoingInterface,


NodeAddressnextHop)

This function is called once the outgoing interface index and next hop address to which to route an IP packet are known. This
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

queues an IP packet for delivery to the MAC layer. This functions calls QueueUpIpFragmentForMacLayer(). This function is used
to initiate fragmentation if required, but since fragmentation has been disabled, all it does is assert false if the IP packet is too big
before calling the next function.
void

NetworkIpSendPacketToMacLayerWithDelay(Node*node, Message*msg, intinterfaceIndex, NodeAddressnextHop,


clocktypedelay)

Same as NetworkIpSendPacketOnInterface(), but schedules event after a simulation delay.


void

NetworkIpSendPacketOnInterfaceWithDelay(Node*node, Message*msg, intincommingInterface,


intoutgoingInterface, NodeAddressnextHop, clocktypedelay)

Same as NetworkIpSendPacketOnInterface(), but schedules event after a simulation delay.


void

NetworkIpSendRawPacketOnInterfaceWithDelay(Node*node, Message*msg, intincommingInterface,


intoutgoingInterface, NodeAddressnextHop, clocktypedelay)

Same as NetworkIpSendPacketOnInterface(), but schedules event after a simulation delay and denotes raw packet.
void

NetworkIpSendPacketToMacLayerWithNewStrictSourceRoute(Node*node, Message*msg,
NodeAddress[]newRouteAddresses, intnumNewRouteAddresses, BOOLremoveExistingRecordedRoute)

Tacks on a new source route to an existing IP packet and then sends the packet to the MAC layer.
void

NetworkIpReceivePacketFromMacLayer(Node*node, Message*msg, NodeAddresspreviousHopNodeId,


intinterfaceIndex)

IP received IP packet from MAC layer. Updates the Stats database and then calls NetworkIpReceivePacket.
void

NetworkIpReceivePacket(Node*node, Message*msg, NodeAddresspreviousHopNodeId, intinterfaceIndex)

IP received IP packet. Determine whether the packet is to be delivered to this node, or needs to be forwarded. ipHeader->ip_ttl is
decremented here, instead of the way BSD TCP/IP does it, which is to decrement TTL right before forwarding the packet.
QualNet's alternative method suits its network-layer ad hoc routing protocols, which may do their own forwarding.
void

NetworkIpNotificationOfPacketDrop(Node*node, Message*msg, NodeAddressnextHopNodeAddres,


intinterfaceIndex)

Invoke callback functions when a packet is dropped.


MacLayerStatusEventHandlerFunctionType

NetworkIpGetMacLayerStatusEventHandlerFunction(Node*node, intinterfaceIndex)

Get the status event handler function pointer.


void

NetworkIpSetMacLayerStatusEventHandlerFunction(Node*node,
MacLayerStatusEventHandlerFunctionTypeStatusEventHandlerPtr, intinterfaceIndex)

Allows the MAC layer to send status messages (e.g., packet drop, link failure) to a network-layer routing protocol for routing
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

optimization.
void

NetworkIpSneakPeekAtMacPacket(Node*node, const Message*msg, intinterfaceIndex, NodeAddressprevHop)

Called Directly by the MAC layer, this allows a routing protocol to "sneak a peek" or "tap" messages it would not normally see
from the MAC layer. This function will possibly unfragment such packets and call the function registered by the routing protocol
to do the "Peek".
PromiscuousMessagePeekFunctionType

NetworkIpGetPromiscuousMessagePeekFunction(Node*node, intinterfaceIndex)

Returns the network-layer function which will promiscuously inspect packets. See NetworkIpSneakPeekAtMacPacket().
void

NetworkIpSetPromiscuousMessagePeekFunction(Node*node, PromiscuousMessagePeekFunctionTypePeekFunctionPtr,
intinterfaceIndex)

Sets the network-layer function which will promiscuously inspect packets. See NetworkIpSneakPeekAtMacPacket().
void

NetworkIpReceiveMacAck(Node*node, intinterfaceIndex, const Message*msg, NodeAddressnextHop)

MAC received an ACK, so call ACK handler function.


MacLayerAckHandlerType

NetworkIpGetMacLayerAckHandler(Node*node, intinterfaceIndex)

Get MAC layer ACK handler


void

NetworkIpSetMacLayerAckHandler(Node*node, MacLayerAckHandlerTypemacAckHandlerPtr, intinterfaceIndex)

Set MAC layer ACK handler


void

SendToUdp(Node*node, Message*msg, TosTypepriority, NodeAddresssourceAddress,


NodeAddressdestinationAddress, intincomingInterfaceIndex)

Sends a UDP packet to UDP in the transport layer. The source IP address, destination IP address, and priority of the packet are also
sent.
void

SendToTcp(Node*node, Message*msg, TosTypepriority, NodeAddresssourceAddress,


NodeAddressdestinationAddress, BOOLaCongestionExperienced)

Sends a TCP packet to TCP in the transport layer. The source IP address, destination IP address, and priority of the packet are also
sent..
void

SendToRsvp(Node*node, Message*msg, TosTypepriority, NodeAddresssourceAddress,


NodeAddressdestinationAddress, intinterfaceIndex, unsignedttl)

Sends a RSVP packet to RSVP in the transport layer. The source IP address, destination IP address, and priority of the packet are
also sent.
void

NetworkIpRemoveIpHeader(Node*node, Message*msg, NodeAddress*sourceAddress,


NodeAddress*destinationAddress, TosType*priority, unsigned char*protocol, unsigned*ttl)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Removes the IP header from a message while also returning all the fields of the header.
void

AddIpOptionField(Node*node, Message*msg, intoptionCode, intoptionSize)

Inserts an option field in the header of an IP packet.


void

ExtractIpSourceAndRecordedRoute(Message*msg, NodeAddress[]RouteAddresses, int*NumAddresses,


int*RouteAddressIndex)

Retrieves a copy of the source and recorded route from the options field in the header.
RouterFunctionType

NetworkIpGetRouterFunction(Node*node, intinterfaceIndex)

Get the router function pointer.


void

NetworkIpSetRouterFunction(Node*node, RouterFunctionTypeRouterFunctionPtr, intinterfaceIndex)

Allows a routing protocol to set the "routing function" (one of its functions) which is called when a packet needs to be routed.
NetworkIpSetRouterFunction() allows a routing protocol to define the routing function. The routing function is called by the
network layer to ask the routing protocol to route the packet. The routing function is given the packet and its destination. The
routing protocol can route the packet and set "PacketWasRouted" to TRUE; or not route the packet and set to FALSE. If the
packet, was not routed, then the network layer will try to use the forwarding table or the source route the source route in the IP
header. This function will also be given packets for the local node the routing protocols can look at packets for protocol reasons. In
this case, the message should not be modified and PacketWasRouted must be set to FALSE.
void

NetworkIpAddUnicastRoutingProtocolType(Node*node, NetworkRoutingProtocolTyperoutingProtocolType,
intinterfaceIndex)

Add unicast routing protocol type to interface.


void

NetworkIpAddUnicastIntraRegionRoutingProtocolType(Node*node,
NetworkRoutingProtocolTyperoutingProtocolType, intinterfaceIndex)

Add unicast intra region routing protocol type to interface.


void*

NetworkIpGetRoutingProtocol(Node*node, NetworkRoutingProtocolTyperoutingProtocolType)

Get routing protocol structure associated with routing protocol running on this interface.
NetworkRoutingProtocolType

NetworkIpGetUnicastRoutingProtocolType(Node*node, intinterfaceIndex)

Get unicast routing protocol type on this interface.


void

NetworkIpSetHsrpOnInterface(Node*node, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

To enable hsrp on a interface


BOOL

NetworkIpIsHsrpEnabled(Node*node, intinterfaceIndex)

To test if any interface is hsrp enabled.


void

NetworkIpAddNewInterface(Node*node, NodeAddressinterfaceIpAddress, intnumHostBits,


int*newInterfaceIndex, const NodeInput*nodeInput)

Add new interface to node.


void

NetworkIpInitCpuQueueConfiguration(Node*node, const NodeInput*nodeInput)

Initializes cpu queue parameters during startup.


void

NetworkIpInitInputQueueConfiguration(Node*node, const NodeInput*nodeInput, intinterfaceIndex)

Initializes input queue parameters during startup.


void

NetworkIpInitOutputQueueConfiguration(Node*node, const NodeInput*nodeInput, intinterfaceIndex)

Initializes queue parameters during startup.


void

NetworkIpCreateQueues(Node*node, const NodeInput*nodeInput, intinterfaceIndex)

Initializes input and output queue parameters during startup


void

NetworkIpSchedulerParameterInit(Scheduler*schedulerPtr, const intnumPriorities, Queue*queue)

Initialize the scheduler parameters and also allocate memory for queues if require.
void

NetworkIpSchedulerInit(Node*node, const NodeInput*nodeInput, intinterfaceIndex, Scheduler*schedulerPtr,


const char*schedulerTypeString)

Call initialization function for appropriate scheduler.


void

NetworkIpCpuQueueInsert(Node*node, Message*msg, NodeAddressnextHopAddress,


NodeAddressdestinationAddress, intoutgoingInterface, intnetworkType, BOOL*queueIsFull,
intincomingInterface)

Calls the cpu packet scheduler for an interface to retrieve an IP packet from a queue associated with the interface. The dequeued
packet, since it's already been routed, has an associated next-hop IP address. The packet's priority value is also returned.
void

NetworkIpInputQueueInsert(Node*node, intincomingInterface, Message*msg, NodeAddressnextHopAddress,


NodeAddressdestinationAddress, intoutgoingInterface, intnetworkType, BOOL*queueIsFull)

Calls input packet scheduler for an interface to retrieve an IP packet from a queue associated with the interface. The dequeued
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

packet, since it's already been routed, has an associated next-hop IP address. The packet's priority value is also returned.
void

NetworkIpOutputQueueInsert(Node*node, intinterfaceIndex, Message*msg, NodeAddressnextHopAddress,


NodeAddressdestinationAddress, intnetworkType, BOOL*queueIsFull)

Calls output packet scheduler for an interface to retrieve an IP packet from a queue associated with the interface. The dequeued
packet, since it's already been routed, has an associated next-hop IP address. The packet's priority value is also returned. Called by
QueueUpIpFragmentForMacLayer().
BOOL

NetworkIpInputQueueDequeuePacket(Node*node, intincomingInterface, Message**msg,


NodeAddress*nextHopAddress, int*outgoingInterface, int*networkType, QueuePriorityType*priority)

Calls the packet scheduler for an interface to retrieve an IP packet from the input queue associated with the interface.
BOOL

NetworkIpOutputQueueDequeuePacket(Node*node, intinterfaceIndex, Message**msg,


NodeAddress*nextHopAddress, int*networkType, QueuePriorityType*priority)

Calls the packet scheduler for an interface to retrieve an IP packet from a queue associated with the interface. The dequeued
packet, since it's already been routed, has an associated next-hop IP address. The packet's priority value is also returned. This
function is called by MAC_OutputQueueDequeuePacket() (mac/mac.pc), which itself is called from mac/mac_802_11.pc and other
MAC protocol source files. This function will assert false if the scheduler cannot return an IP packet for whatever reason.
BOOL

NetworkIpOutputQueueDequeuePacketForAPriority(Node*node, intinterfaceIndex, QueuePriorityTypepriority,


Message**msg, NodeAddress*nextHopAddress, int*networkType, intposInQueue)

Same as NetworkIpOutputQueueDequeuePacket(), except the packet dequeued is requested by a specific priority, instead of
leaving the priority decision up to the packet scheduler. This function is called by
MAC_OutputQueueDequeuePacketForAPriority() (mac/mac.pc), which itself is called from mac/mac_802_11.pc and other MAC
protocol source files. This function will assert false if the scheduler cannot return an IP packet for whatever reason.
BOOL

NetworkIpOutputQueueDequeuePacketWithIndex(Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


NodeAddress*nextHopAddress, int*networkType)

Same as NetworkIpOutputQueueDequeuePacket(), except the packet dequeued is requested by a specific index This function is
called by MAC_OutputQueueDequeuePacketForAPriority() (mac/mac.pc), which itself is called from mac/mac_802_11.pc and
other MAC protocol source files. This function will assert false if the scheduler cannot return an IP packet for whatever reason.
BOOL

NetworkIpInputQueueTopPacket(Node*node, intincomingInterface, Message**msg, NodeAddress*nextHopAddress,


int*outgoingInterface, int*networkType, QueuePriorityType*priority)

Same as NetworkIpInputQueueDequeuePacket(), except the packet is not actually dequeued. Note that the message containing the
packet is not copied; the contents may (inadvertently or not) be directly modified.
BOOL

NetworkIpOutputQueueTopPacket(Node*node, intinterfaceIndex, Message**msg, NodeAddress*nextHopAddress,


int*networkType, QueuePriorityType*priority)

Same as NetworkIpOutputQueueDequeuePacket(), except the packet is not actually dequeued. Note that the message containing the
packet is not copied; the contents may (inadvertently or not) be directly modified. This function is called by
MAC_OutputQueueTopPacket() (mac/mac.pc), which itself is called from mac/mac_802_11.pc and other MAC protocol source
files. This function will assert false if the scheduler cannot return an IP packet for whatever reason.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

BOOL

NetworkIpOutputQueuePeekWithIndex(Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


NodeAddress*nextHopAddress, QueuePriorityType*priority)

Same as NetworkIpOutputQueueDequeuePacket(), except the packet is not actually dequeued. Note that the message containing the
packet is not copied; the contents may (inadvertently or not) be directly modified. This function is called by
MAC_OutputQueueTopPacket() (mac/mac.pc), which itself is called from mac/mac_802_11.pc and other MAC protocol source
files. This function will assert false if the scheduler cannot return an IP packet for whatever reason.
BOOL

NetworkIpOutputQueueTopPacketForAPriority(Node*node, intinterfaceIndex, QueuePriorityTypepriority,


Message**msg, NodeAddress*nextHopAddress, intposInQueue)

Same as NetworkIpOutputQueueDequeuePacketForAPriority(), except the packet is not actually dequeued. Note that the message
containing the packet is not copied; the contents may (inadvertently or not) be directly modified. This function is called by
MAC_OutputQueueTopPacketForAPriority() (mac/mac.pc), which itself is called from mac/mac_802_11.pc and other MAC
protocol source files. This function will assert false if the scheduler cannot return an IP packet for whatever reason.
BOOL

NetworkIpInputQueueIsEmpty(Node*node, intincomingInterface)

Calls the packet scheduler for an interface to determine whether the interface's input queue is empty
BOOL

NetworkIpOutputQueueIsEmpty(Node*node, intinterfaceIndex)

Calls the packet scheduler for an interface to determine whether the interface's output queue is empty.
int

NetworkIpOutputQueueNumberInQueue(Node*node, intinterfaceIndex, BOOLspecificPriorityOnly,


QueuePriorityTypepriority)

Calls the packet scheduler for an interface to determine how many packets are in a queue. There may be multiple queues on an
interface, so the priority of the desired queue is also provided.
NodeAddress

NetworkIpOutputQueueDropPacket(Node*node, intinterfaceIndex, Message**msg)

Drop a packet from the queue.


void

NetworkIpDeleteOutboundPacketsToANode(Node*node, const NodeAddressnextHopAddress, const


NodeAddressdestinationAddress, const BOOLreturnPacketsToRoutingProtocol)

Deletes all packets in the queue going (probably broken), to the specified next hop address. There is option to return all such
packets back to the routing protocols. via the usual mechanism (callback).
unsigned

GetQueueNumberFromPriority(TosTypeuserTos, intnumQueues)

Get queue number through which a given user priority will be forwarded.
QueuePriorityType

ReturnPriorityForPHB(Node*node, TosTypetos)

Returns the priority queue corresponding to the DS/TOS field.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

void

NetworkGetInterfaceAndNextHopFromForwardingTable(Node*node, NodeAddressdestinationAddress,
int*interfaceIndex, NodeAddress*nextHopAddress)

Do a lookup on the routing table with a destination IP address to obtain a route (index of an outgoing interface and a next hop Ip
address).
void

NetworkGetInterfaceAndNextHopFromForwardingTable(Node*node, intcurrentInterface,
NodeAddressdestinationAddress, int*interfaceIndex, NodeAddress*nextHopAddress)

Do a lookup on the routing table with a destination IP address to obtain a route (index of an outgoing interface and a next hop Ip
address).
void

NetworkGetInterfaceAndNextHopFromForwardingTable(Node*node, NodeAddressdestinationAddress,
int*interfaceIndex, NodeAddress*nextHopAddress, BOOLtestType, NetworkRoutingProtocolTypetype)

Do a lookup on the routing table with a destination IP address to obtain a route (index of an outgoing interface and a next hop Ip
address).
void

NetworkGetInterfaceAndNextHopFromForwardingTable(Node*node, intoperatingInterface,
NodeAddressdestinationAddress, int*interfaceIndex, NodeAddress*nextHopAddress, BOOLtestType,
NetworkRoutingProtocolTypetype)

Do a lookup on the routing table with a destination IP address to obtain a route (index of an outgoing interface and a next hop Ip
address).
int

NetworkIpGetInterfaceIndexForNextHop(Node*node, NodeAddressnextHopAddress)

This function looks at the network address of each of a node's network interfaces. When nextHopAddress is matched to a network,
the interface index corresponding to the network is returned. (used by NetworkUpdateForwardingTable() and ospfv2.pc)
int

NetworkGetInterfaceIndexForDestAddress(Node*node, NodeAddressdestAddress)

Get interface for the destination address.


NetworkRoutingAdminDistanceType

NetworkRoutingGetAdminDistance(Node*node, NetworkRoutingProtocolTypetype)

Get the administrative distance of a routing protocol. These values don't quite match those recommended by Cisco.
void

NetworkInitForwardingTable(Node*node)

Initialize the IP fowarding table, allocate enough memory for number of rows.
void

NetworkUpdateForwardingTable(Node*node, NodeAddressdestAddress, NodeAddressdestAddressMask,


NodeAddressnextHopAddress, intoutgoingInterfaceIndex, intcost, NetworkRoutingProtocolTypetype)

Update or add entry to IP routing table. Search the routing table for an entry with an exact match for destAddress,
destAddressMask, and routing protocol. Update this entry with the specified nextHopAddress (the outgoing interface is
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

automatically determined from the nextHopAddress -- see code). If no matching entry found, then add a new route.
void

NetworkRemoveForwardingTableEntry(Node*node, NodeAddressdestAddress, NodeAddressdestAddressMask,


NodeAddressnextHopAddress, intoutgoingInterfaceIndex)

Remove single entries in the routing table


void

NetworkEmptyForwardingTable(Node*node, NetworkRoutingProtocolTypetype)

Remove entries in the routing table corresponding to a given routing protocol.


void

NetworkPrintForwardingTable(Node*node)

Display all entries in node's routing table.


int

NetworkGetMetricForDestAddress(Node*node, NodeAddressdestAddress)

Get the cost metric for a destination from the forwarding table.
void

NetworkIpSetRouteUpdateEventFunction(Node*node, NetworkRouteUpdateEventTyperouteUpdateFunctionPtr)

Set a callback fuction when a route changes from forwarding table.


NetworkRouteUpdateEventType

NetworkIpGetRouteUpdateEventFunction(Node*node)

Print packet headers when packet tracing is enabled.


NodeAddress

NetworkIpGetInterfaceAddress(Node*node, intinterfaceIndex)

Get the interface address on this interface


char*

NetworkIpGetInterfaceName(Node*node, intinterfaceIndex)

To get the interface name associated with the interface


NodeAddress

NetworkIpGetInterfaceNetworkAddress(Node*node, intinterfaceIndex)

To get network address associated with interface


NodeAddress

NetworkIpGetInterfaceSubnetMask(Node*node, intinterfaceIndex)

To retrieve subnet mask of the node interface


int

NetworkIpGetInterfaceNumHostBits(Node*node, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Get the number of host bits on this interface


NodeAddress

NetworkIpGetInterfaceBroadcastAddress(Node*node, intinterfaceIndex)

Get broadcast address on this interface


BOOL

IsOutgoingBroadcast(Node*node, NodeAddressdestAddress, int*outgoingInterface,


NodeAddress*outgoingBroadcastAddress)

Checks whether IP packet's destination address is broadcast


BOOL

NetworkIpIsMyIP(Node*node, NodeAddressipAddress)

In turn calls IsMyPacket()


void

NetworkIpConfigurationError(Node*node, char []parameterName, intinterfaceIndex)

Prints out the IP configuration error


void

NetworkPrintIpHeader(Message*msg)

To print the IP header


void

NetworkIpAddToMulticastGroupList(Node*node, NodeAddressgroupAddress)

Add a specified node to a multicast group


void

NetworkIpRemoveFromMulticastGroupList(Node*node, NodeAddressgroupAddress)

To remove specified node from a multicast group


void

NetworkIpPrintMulticastGroupList(Node*node)

To print the multicast grouplist


BOOL

NetworkIpIsPartOfMulticastGroup(Node*node, NodeAddressgroupAddress)

check if a node is part of specified multicast group


void

NetworkIpJoinMulticastGroup(Node*node, NodeAddressmcastAddr, clocktypedelay)

To join a multicast group


void

NetworkIpJoinMulticastGroup(Node*node, NodeAddressmcastAddr, clocktypedelay)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

To join a multicast group


void

NetworkIpLeaveMulticastGroup(Node*node, NodeAddressmcastAddr, clocktypedelay)

To leave a multicast group


void

NetworkIpLeaveMulticastGroup(Node*node, NodeAddressmcastAddr, clocktypedelay)

To leave a multicast group


void

NetworkIpSetMulticastTimer(Node*node, longeventType, NodeAddressmcastAddr, clocktypedelay)

To set a multicast timer to join or leave multicast groups


void

NetworkIpSetMulticastRoutingProtocol(Node*node, void*multicastRoutingProtocol, intinterfaceIndex)

Assign a multicast routing protocol to an interface


void *

NetworkIpGetMulticastRoutingProtocol(Node*node, NetworkRoutingProtocolTyperoutingProtocolType)

To get the Multicast Routing Protocol structure


void

NetworkIpAddMulticastRoutingProtocolType(Node*node, NetworkRoutingProtocolTypemulticastProtocolType,
intinterfaceIndex)

Assign a multicast protocol type to an interface


void

NetworkIpSetMulticastRouterFunction(Node*node, MulticastRouterFunctionTyperouterFunctionPtr,
intinterfaceIndex)

Set a multicast router function to an interface


MulticastRouterFunctionType

NetworkIpGetMulticastRouterFunction(Node*node, intinterfaceIndex)

Get the multicast router function for an interface


void

NetworkIpUpdateMulticastRoutingProtocolAndRouterFunction(Node*node,
NetworkRoutingProtocolTyperoutingProtocolType, intinterfaceIndex)

Assign multicast routing protocol structure and router function to an interface. We are only allocating the multicast routing
protocol structure and router function once by using pointers to the original structures.
void

NetworkIpUpdateUnicastRoutingProtocolAndRouterFunction(Node*node,
NetworkRoutingProtocolTyperoutingProtocolType, intinterfaceIndex)

Assign unicast routing protocol structure and router function to an interface. We are only allocating the unicast routing protocol
structure and router function once by using pointers to the original structures.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

int

NetworkIpGetInterfaceIndexFromAddress(Node*node, NodeAddressaddress)

Get the interface index from an IP address.


int

NetworkIpGetInterfaceIndexFromSubnetAddress(Node*node, NodeAddressaddress)

Get the interface index from an IP subnet address.


BOOL

NetworkIpIsMulticastAddress(Node*node, NodeAddressaddress)

Check if an address is a multicast address.


void

NetworkInitMulticastForwardingTable(Node*node)

initialize the multicast fowarding table, allocate enough memory for number of rows, used by ip
void

NetworkEmptyMulticastForwardingTable(Node*node)

empty out all the entries in the multicast forwarding table. basically set the size of table back to 0.
LinkedList*

NetworkGetOutgoingInterfaceFromMulticastForwardingTable(Node*node, NodeAddresssourceAddress,
NodeAddressgroupAddress)

get the interface Id node that lead to the (source, multicast group) pair.
void

NetworkUpdateMulticastForwardingTable(Node*node, NodeAddresssourceAddress,
NodeAddressmulticastGroupAddress, intinterfaceIndex)

update entry with(sourceAddress,multicastGroupAddress) pair. search for the row with(sourceAddress,multicastGroupAddress) and
update its interface.
void

NetworkPrintMulticastForwardingTable(Node*node)

display all entries in multicast forwarding table of the node.


void

NetworkPrintMulticastOutgoingInterface(Node*node, list*list)

Print mulitcast outgoing interfaces.


BOOL

NetworkInMulticastOutgoingInterface(Node*node, List*list, intinterfaceIndex)

Determine if interface is in multicast outgoing interface list.


void

NetworkIpPrintTraceXML(Node*node, Message*msg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Print packet trace information in XML format.


void

RouteThePacketUsingLookupTable(Node*node, Message*msg, intincomingInterface)

Tries to route and send the packet using the node's forwarding table.
int

GetNetworkIPFragUnit(Node*node, intinterfaceIndex)

Returns the network ip fragmentation unit.


void

NetworkIpUserProtocolInit(Node*node, const NodeInput*nodeInput, const char*routingProtocolString,


NetworkRoutingProtocolType*routingProtocolType, void**routingProtocolData)

Initialization of user protocol(disabled)


void

NetworkIpUserHandleProtocolEvent(Node*node, Message*msg)

Event handler function of user protocol(disabled)


void

NetworkIpUserHandleProtocolPacket(Node*node, Message*msg, unsigned charipProtocol,


NodeAddresssourceAddress, NodeAddressdestinationAddress, intttl)

Process a user protocol generated control packet(disabled)


void

NetworkIpUserProtocolFinalize(Node*node, intuserProtocolNumber)

Finalization of user protocol(disabled)


void

Atm_RouteThePacketUsingLookupTable(Node*node, NodeAddress*destAddr, int*outIntf, NodeAddress*nextHop)

Routing packet received at ATM node


void

RouteThePacketUsingMulticastForwardingTable(Node*node, Message*msg, intincomingInterface)

Tries to route the multicast packet using the multicast forwarding table.
int

NETWORKIpRoutingInit(Node *node, const NodeInput *nodeInputnodeInput)

Initialization function for network layer. Initializes IP.


Int64

NetworkIpGetBandwidth(Node*node, intinterfaceIndex)

getting the bandwidth information


clocktype

NetworkIpGetPropDelay(Node*node, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

getting the propagation delay information


BOOL

NetworkIpInterfaceIsEnabled(Node*node, intinterfaceIndex)

To check the interface is enabled or not?


BOOL

NetworkIpIsWiredNetwork(Node*node, intinterfaceIndex)

Determines if an interface is a wired interface.


BOOL

NetworkIpIsPointToPointNetwork(Node*node, intinterfaceIndex)

Determines if an interface is a point-to-point.


BOOL

IsIPV4MulticastEnabledOnInterface(Node*node, intinterfaceIndex)

To check if IPV4 Multicast is enabled on interface?


BOOL

IsIPV4RoutingEnabledOnInterface(Node*node, intinterfaceIndex)

To check if IPV4 Routing is enabled on interface?


NetworkProtocolType

NetworkIpGetNetworkProtocolType(Node*node, NodeAddressnodeId)

Get Network Protocol Type for the node


NetworkType

ResolveNetworkTypeFromSrcAndDestNodeId(Node*node, NodeIdsourceNodeId, NodeIddestNodeId)

Resolve the NetworkType from source and destination node id's.


BOOL

NetworkIpIsWiredBroadcastNetwork(Node*node, intinterfaceIndex)

Determines if an interface is a wired interface.


ip_traceroute*

FindTraceRouteOption(const IpHeaderType*ipHeader)

Searches the IP header for the Traceroute option field , and returns a pointer to traceroute header.

Constant / Data Structure Detail

Constant

IPVERSION44

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

Version of IP
IPTOS_LOWDELAY0x10

Constant

Type of service ( low delay)


IPTOS_THROUGHPUT0x08

Constant

Type of service ( throughput)


IPTOS_RELIABILITY0x04

Constant

Type of service (reliability)


IPTOS_MINCOST0x02

Constant

Type of service ( minimum cost)


IPTOS_ECT0x02

Constant

Bits 6 and 7 in the IPv4 TOS octet are designated as the ECN field. Bit 6 is designated as the ECT bit.
IPTOS_CE0x01

Constant

Bits 6 and 7 in the IPv4 TOS octet are designated as the ECN field. Bit 7 is designated as the CE bit.
IPTOS_DSCP_MAX0x3f

Constant

Bits 0 to 5 in the IPv4 TOS octet are designated as DSCP field.The range for this 6-bit field is < 0 - 63 >.
IPTOS_DSCP_MIN0x00

Constant

Bits 0 to 5 in the IPv4 TOS octet are designated as DSCP field.The range for this 6-bit field is < 0 - 63 >.
IPTOS_PREC_EFINTERNETCONTROL0xb8

Constant

IP precedence 'EF clasee internet control'


IPTOS_PREC_NETCONTROL0xe0

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

IP precedence 'net control'


IPTOS_PREC_INTERNETCONTROL0xc0

Constant

IP precedence 'internet control'


IPTOS_PREC_CRITIC_ECP0xa0

Constant

IP precedence 'critic ecp'


IPTOS_PREC_FLASHOVERRIDE0x80

Constant

IP precedence 'flash override'


IPTOS_PREC_FLASH0x60

Constant

IP precedence 'flash'
IPTOS_PREC_IMMEDIATE0x40

Constant

IP precedence 'immediate'
IPTOS_PREC_PRIORITY0x20

Constant

IP precedence 'priority'
IPTOS_PREC_ROUTINE0x00

Constant

IP precedence 'routing'
IPTOS_PREC_INTERNETCONTROL_MIN_DELAY_SET0xd0

Constant

IP precedence 'internet control'with the 'minimize delay' bit set


IPTOS_PREC_CRITIC_ECP_MIN_DELAY_SET0xb0

Constant

IP precedence 'critic ecp'with the 'minimize delay' bit set


IPOPT_CONTROL0x00

Constant

IP option 'control'
IPOPT_RESERVED10x20

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

IP option 'reserved1'.
IPOPT_DEBMEAS0x40

Constant

IP option 'debmeas'
IPOPT_RESERVED20x60

Constant

IP option 'reserved2'
IPOPT_EOL0

Constant

IP option 'end of option list'.


IPOPT_NOP1

Constant

IP option 'no operation'.


IPOPT_RR7

Constant

IP option 'record packet route'.


IPOPT_TS68

Constant

IP option 'timestamp'.
IPOPT_SECURITY130

Constant

IP option ' provide s,c,h,tcc'.


IPOPT_LSRR131

Constant

IP option 'loose source route'.


IPOPT_SATID136

Constant

IP option 'satnet id'.


IPOPT_SSRR137

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

IP option 'strict source route '.


IPOPT_TRCRT82

Constant

IP option 'Traceroute'.
IPOPT_OPTVAL0

Constant

Offset to IP option 'option ID'


IPOPT_OLEN1

Constant

Offset to IP option 'option length'


IPOPT_OFFSET2

Constant

Offset to IP option 'offset within option'


IPOPT_MINOFF4

Constant

Offset to IP option 'min value of above'


IPOPT_TS_TSONLY0

Constant

Flag bits for ipt_flg (timestamps only );


IPOPT_TS_TSANDADDR1

Constant

Flag bits for ipt_flg (timestamps and addresses );


IPOPT_TS_PRESPEC3

Constant

Flag bits for ipt_flg (specified modules only );


IPOPT_SECUR_UNCLASS0x0000

Constant

'unclass' bits for security in IP option field


IPOPT_SECUR_CONFID0xf135

Constant

'confid' bits for security in IP option field


IPOPT_SECUR_EFTO0x789a

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

'efto' bits for security in IP option field


IPOPT_SECUR_MMMM0xbc4d

Constant

'mmmm' bits for security in IP option field


IPOPT_SECUR_RESTR0xaf13

Constant

'restr' bits for security in IP option field


IPOPT_SECUR_SECRET0xd788

Constant

'secreat' bits for security in IP option field


IPOPT_SECUR_TOPSECRET0x6bc5

Constant

'top secret' bits for security in IP option field


MAXTTL255

Constant

Internet implementation parameters (maximum time to live (seconds) )


IPDEFTTL64

Constant

Internet implementation parameters (default ttl, from RFC 1340 )


IPFRAGTTL60

Constant

Internet implementation parameters (time to live for frags, slowhz )


IPTTLDEC1

Constant

Internet implementation parameters (subtracted when forwarding)


IPDEFTOS0x10

Constant

Internet implementation parameters (default TOS )


IP_MSS576

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

Internet implementation parameters ( default maximum segment size )


IPPROTO_IP0

Constant

IP protocol numbers.
IPPROTO_ICMP1

Constant

IP protocol numbers for ICMP.


IPPROTO_IGMP2

Constant

IP protocol numbers for IGMP.


IPPROTO_IPIP4

Constant

IP protocol numbers for IP tunneling.


IPPROTO_TCP6

Constant

IP protocol numbers for TCP .


IPPROTO_UDP17

Constant

IP protocol numbers for UDP


IPPROTO_IPV641

Constant

IP protocol number for DUAL-IP.


IPPROTO_RSVP46

Constant

IP protocol numbers for RSVP.


IPPROTO_MOBILE_IP48

Constant

IP protocol numbers for MOBILE_IP.


IPPROTO_CES_HAIPE49

Constant

IP protocol numbers.
IPPROTO_ESP50

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

IP protocol numbers for IPSEC.


IPPROTO_AH51

Constant

IP protocol numbers for IPSEC.


IPPROTO_ISAKMP52

Constant

IP protocol numbers for IPSEC.


IPPROTO_CES_ISAKMP53

Constant

IP protocol numbers for IPSEC.


IPPROTO_IAHEP54

Constant

IP protocol numbers.
IPPROTO_OSPF89

Constant

IP protocol numbers for OSPF .


IPPROTO_PIM103

Constant

IP protocol numbers for PIM .


IPPROTO_RPIM104

Constant

IP protocol numbers for PIM .


IPPROTO_IGRP100

Constant

IP protocol numbers for IGRP .


IPPROTO_EIGRP88

Constant

IP protocol numbers for EIGRP .


IPPROTO_BELLMANFORD150

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

IP protocol numbers for BELLMANFORD.


IPPROTO_IPIP_RED150

Constant

IP protocol numbers for IP_RED.


IPPROTO_FISHEYE160

Constant

IP protocol numbers for FISHEYE .


IPPROTO_FSRL161

Constant

IP protocol numbers for LANMAR .


IPPROTO_ANODR162

Constant

IP protocol numbers for ANODR .


IPPROTO_SECURE_NEIGHBOR163

Constant

IP protocol numbers for secure neighbor discovery .


IPPROTO_SECURE_COMMUNITY164

Constant

IP protocol numbers for secure routing community


IPPROTO_NETWORK_CES_CLUSTER165

Constant

IP protocol numbers for clustering protocol.


IPPROTO_ROUTING_CES_ROSPF167

Constant

IP protocol numbers for ROSPF protocol.


IPPROTO_IPIP_ROUTING_CES_MALSR168

Constant

IP protocol numbers for MALSR IP encapsulation.


IPPROTO_IPIP_ROUTING_CES_ROSPF169

Constant

IP protocol numbers for ROSPF IP encapsulation.


IPPROTO_NETWORK_CES_REGION170

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

IP protocol numbers for RAP election protocol.


IPPROTO_MPR171

Constant

IP protocol numbers for MPR


IPPROTO_IPIP_ROUTING_CES_SRW173

Constant

IP protocol numbers for ROUTING_CES_SRW IP encapsulation.


IPPROTO_IPIP_SDR174

Constant

IP protocol numbers for SDR IP encapsulation.


IPPROTO_IPIP_SDR175

Constant

IP protocol numbers for SDR IP encapsulation.


IPPROTO_MULTICAST_CES_SRW_MOSPF177

Constant

IP protocol numbers for MULTICAST_CES_SRW_MOSPF IP encapsulation.


IPPROTO_CES_HSLS178

Constant

IP protocol numbers for HSLS protocol.


IPPROTO_AODV123

Constant

IP protocol numbers for AODV .


IPPROTO_DYMO132

Constant

IP protocol numbers for DYMO .


IPPROTO_MAODV124

Constant

IP protocol numbers for MAODV.


IPPROTO_DSR135

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

IP protocol numbers for DSR .


IPPROTO_ODMRP145

Constant

IP protocol numbers for ODMRP .


IPPROTO_LAR1110

Constant

IP protocol numbers for LAR1.


IPPROTO_STAR136

Constant

IP protocol numbers for STAR.


IPPROTO_DAWN120

Constant

IP protocol numbers for DAWN.


IPPROTO_EPLRS174

Constant

IP protocol numbers for EPLRS protocol.


IPPROTO_EPLRS174

Constant

IP protocol numbers for EPLRS protocol.


IPPROTO_CES_EPLRS_MPR179

Constant

IP protocol numbers for EPLRS MPR protocol.


IPPROTO_DVMRP200

Constant

IP protocol numbers for DVMRP.


IPPROTO_GSM202

Constant

IP protocol numbers for GSM.


IPPROTO_EXTERNAL233

Constant

IP protocol for external interface.


IPPROTO_INTERNET_GATEWAY240

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

IP protocol numbers for Internet gateway for emulated nodes


IPPROTO_EXATA_VIRTUAL_LAN241

Constant

IP protocol numbers for Internet gateway for emulated nodes


IPPROTO_NDP255

Constant

IP protocol numbers for NDP.


IPPROTO_BRP251

Constant

IP protocol numbers for BRP .


IP_MIN_HEADER_SIZE20

Constant

Minimum IP header size in bytes


IP_MAX_HEADER_SIZE60

Constant

Maximum IP header size in bytes


IP_FRAGMENT_HOLD_TIME60 * SECOND

Constant

Fragmented packets hold time.


IP_MIN_MULTICAST_ADDRESS0xE0000000

Constant

Used to determine whether an IP address is multicast.


IP_MAX_MULTICAST_ADDRESS0xEFFFFFFF

Constant

Used to determine whether an IP address is multicast.


MULTICAST_DEFAULT_INTERFACE_ADDRESS3758096384u

Constant

Default multicast interface address (224.0.0.0).


IP_MIN_RESERVED_MULTICAST_ADDRESS0xE0000000

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Constant

Minimum reserve multicast address (224.0.0.0).


IP_MAX_RESERVED_MULTICAST_ADDRESS0xE00000FF

Constant

Maximum reserve multicast address (224.0.0.255).


MULTICAST_DEFAULT_NUM_HOST_BITS27

Constant

Multicast default num host bit


NETWORK_UNREACHABLE-2

Constant

Network unreachable.
DEFAULT_INTERFACE0

Constant

Default interface index


NETWORK_IP_REASS_BUFF_TIMER(15 * SECOND)

Constant

Max time data can stored in assembly buffer


MAX_IP_FRAGMENTS_SIMPLE_CASE64

Constant

Max size of fragment allowed.


SMALL_REASSEMBLY_BUFFER_SIZE2048

Constant

Size of reassemble buffer


REASSEMBLY_BUFFER_EXPANSION_MULTIPLIER8

Enumeration

Multiplier used for reassemble buffer expansion


BackplaneType

Structure

NetworkIp backplane type(either CENTRAL or DISTRIBUTED)


IpHeaderType

Structure

IpHeaderType is 20 bytes,just like in the BSD code.


ip_timestamp

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Structure

Time stamp option structure.


ip_traceroute

Structure

TraceRoute option structure.


NetworkIpBackplaneInfo

Structure

Structure maintaining IP Back plane Information


ipHeaderSizeInfo

Structure

Structure maintaining IP header size Information


NetworkMulticastForwardingTableRow

Structure

Structure of an entity of multicast forwarding table.


NetworkMulticastForwardingTable

Structure

Structure of multicast forwarding table


NetworkIpMulticastGroupEntry

Structure

Structure for Multicast Group Entry


IpPerHopBehaviorInfoType

Structure

Structure to maintain DS priority queue mapping


IpMftcParameter

Structure

Variables of the structure define a unique condition class


IpMultiFieldTrafficConditionerInfo

Structure

Structure used to store traffic condition.


IpOptionsHeaderType

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Structure

Structure of optional header for IP source route


NetworkIpStatsType

Structure

Structure used to keep track of all stats of network layer.


NetworkForwardingTableRow

Structure

Structure of an entity of forwarding table.


NetworkForwardingTable

Structure

Structure of forwarding table.


IpInterfaceInfoType

Structure

Structure for maintaining IP interface informations. This struct must be allocated by new, not MEM_malloc. All member variables MUST
be initialized in the constructor.
ip_frag_data

Structure

QualNet typedefs struct ip_frag_data to IpFragData. is a simple queue to hold fragmented packets.
Ipv6FragQueue

Structure

Ipv6 fragment queue structure.


FragmetedMsg

Structure

QualNet typedefs struct fragmeted_msg_struct to ip6q. struct fragmeted_msg_struct is a simple fragmented packets msg hold structure.
NetworkDataIp;

Structure

Main structure of network layer.


IpReassemblyBufferType

Structure

Structure of reassembly buffer


IpReassemblyBufferListCellType

Structure of reassembly buffer cell listing

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Structure

IpReassemblyBufferListType

Structure of reassembly buffer list

Function / Macro Detail


Function / Macro
IPOPT_COPIED(o)

Format
IP option 'copied'.

IPOPT_CLASS(o)

IP option 'class'

IPOPT_NUMBER(o)

IP option 'number'

IpHeaderSize(ipHeader)

Returns IP header ip_hl field * 4, which is the size of the IP header in bytes.

SetIpHeaderSize(IpHeader, Size)

Sets IP header ip_hl field (header length) to Size divided by 4

FragmentOffset(ipHeader)

Starting position of this fragment in actual packet.

SetFragmentOffset(ipHeader, offset)

To set offset of fragment.

IpHeaderSetVersion()

void IpHeaderSetVersion() (UInt32*ip_v_hl_tos_len, unsigned intversion)

Parameters:

Set the value of version number for IpHeaderType

ip_v_hl_tos_len
version

- The variable containing the value of ip_v

- Input value for set operation

Returns:
void

- None

IpHeaderSetHLen()

void IpHeaderSetHLen() (UInt32*ip_v_hl_tos_len, unsigned inthlen)

Parameters:

Set the value of header length for IpHeaderType

ip_v_hl_tos_len
hlen

- The variable containing the value of ip_v

- Input value for set operation

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Returns:
void

- None

IpHeaderSetTOS()

void IpHeaderSetTOS() (UInt32*ip_v_hl_tos_len, unsigned intipTos)

Parameters:

Set the value of Type of Service for IpHeaderType

ip_v_hl_tos_len
ipTos

- The variable containing the value of ip_v

- Input value for set operation

Returns:
void

- None

IpHeaderSetIpLength()

void IpHeaderSetIpLength() (UInt32*ip_v_hl_tos_len, unsigned intipLen)

Parameters:

Set the value of ip length for IpHeaderType

ip_v_hl_tos_len
ipLen

- The variable containing the value of ip_v

- Input value for set operation

Returns:
void

- None

IpHeaderSetIpFragOffset()

void IpHeaderSetIpFragOffset() (UInt16*ipFragment, UInt16offset)

Parameters:

Set the value of ip_fragment_offset for IpHeaderType

ipFragment
offset

- The variable containing the value of

- Input value for set operation

Returns:
void

- None

IpHeaderSetIpReserved()

void IpHeaderSetIpReserved() (UInt16*ipFragment, UInt16ipReserved)

Parameters:

Set the value of ipReserved for IpHeaderType

ipFragment

- The variable containing the value of

ipReserved

- Input value for set operation

Returns:
void

- None

IpHeaderSetIpDontFrag()

void IpHeaderSetIpDontFrag() (UInt16*ipFragment, UInt16dontFrag)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Set the value of ip_dont_fragment for IpHeaderType

ipFragment
dontFrag

- The variable containing the value of

- Input value for set operation

Returns:
void

- None

IpHeaderSetIpMoreFrag()

void IpHeaderSetIpMoreFrag() (UInt16*ipFragment, UInt16moreFrag)

Parameters:

Set the value of ip_more_fragment for IpHeaderType

ipFragment
moreFrag

- The variable containing the value of

- Input value for set operation

Returns:
void

- None

IpHeaderGetVersion()

unsigned int IpHeaderGetVersion() (UInt32ip_v_hl_tos_len)

Parameters:

Returns the value of version number for IpHeaderType

ip_v_hl_tos_len

- The variable containing the value of ip_v

Returns:
unsigned int

- None

IpHeaderGetHLen()

unsigned int IpHeaderGetHLen() (UInt32ip_v_hl_tos_len)

Parameters:

Returns the value of header length for IpHeaderType

ip_v_hl_tos_len

- The variable containing the value of ip_v

Returns:
unsigned int

- None

IpHeaderGetTOS()

unsigned int IpHeaderGetTOS() (UInt32ip_v_hl_tos_len)

Parameters:

Returns the value of Type of Service for IpHeaderType

ip_v_hl_tos_len

- The variable containing the value of ip_v

Returns:
unsigned int

- None

IpHeaderGetIpLength()

unsigned int IpHeaderGetIpLength() (UInt32ip_v_hl_tos_len)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Returns the value of ip length for IpHeaderType

ip_v_hl_tos_len

- The variable containing the value of ip_v

Returns:
unsigned int

- None

IpHeaderGetIpFragOffset()

UInt16 IpHeaderGetIpFragOffset() (UInt16ipFragment)

Parameters:

Returns the value of ip_fragment_offset for IpHeaderType

ipFragment

- The variable containing the value of

Returns:
UInt16

- None

IpHeaderGetIpDontFrag()

BOOL IpHeaderGetIpDontFrag() (UInt16ipFragment)

Parameters:

Returns the value of ip_dont_fragment for IpHeaderType

ipFragment

- The variable containing the value of

Returns:
BOOL

- None

IpHeaderGetIpMoreFrag()

BOOL IpHeaderGetIpMoreFrag() (UInt16ipFragment)

Parameters:

Returns the value of ip_more_fragment for IpHeaderType

ipFragment

- The variable containing the value of

Returns:
BOOL

- None

IpHeaderGetIpReserved()

BOOL IpHeaderGetIpReserved() (UInt16ipFragment)

Parameters:

Returns the value of ipReserved for IpHeaderType

ipFragment

- The variable containing the value of

Returns:
BOOL

- None

Ip_timestampSetFlag()

void Ip_timestampSetFlag() (unsigned charflgOflw, unsigned charflag)

Parameters:

Set the value of flag for ip_timestamp_str

flgOflw
flag

- The variable containing the value of flag and

- Input value for set operation

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

- None

void

Ip_timestampSetOvflw()

void Ip_timestampSetOvflw() (unsigned charflgOflw, unsigned charovflw)

Parameters:

Set the value of ovflw for ip_timestamp_str

flgOflw
ovflw

- The variable containing the value of flag and

- Input value for set operation

Returns:
- None

void

Ip_timestampGetFlag()

unsigned char Ip_timestampGetFlag() (unsigned charflgOflw)

Parameters:

Returns the value of flag for ip_timestamp_str

flgOflw

- The variable containing the value of flag and

Returns:
unsigned char

- None

Ip_timestampGetOvflw()

unsigned char Ip_timestampGetOvflw() (unsigned charflgOflw)

Parameters:

Returns the value of overflow counter for ip_timestamp_str

flgOflw

- The variable containing the value of flag and

Returns:
unsigned char

- None

ConvertNumHostBitsToSubnetMask

NodeAddress ConvertNumHostBitsToSubnetMask (intnumHostBits)

Parameters:

To generate subnetmask using number of host bit

numHostBits

- number of host bit.

Returns:
NodeAddress

- subnetmask

ConvertSubnetMaskToNumHostBits

int ConvertSubnetMaskToNumHostBits (NodeAddresssubnetMask)

Parameters:

To generate number of host bit using subnetmask.

subnetMask

- subnetmask.

Returns:
int

- number of host bit.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

MaskIpAddress

NodeAddress MaskIpAddress (NodeAddressaddress, NodeAddressmask)

Parameters:

To mask a ip address.

address
mask

- address of a node

- mask of subnet.

Returns:
NodeAddress

- masked node address.

MaskIpAddressWithNumHostBits

NodeAddress MaskIpAddressWithNumHostBits (NodeAddressaddress, intnumHostBits)

Parameters:

To mask a ip address.

address

- address of a node.

numHostBits

- number of host bit.

Returns:
NodeAddress

- masked node address.

CalcBroadcastIpAddress

NodeAddress CalcBroadcastIpAddress (NodeAddressaddress, intnumHostBits)

Parameters:

To generate broadcast address.

address

- address of a node.

numHostBits

- number of host bit.

Returns:
NodeAddress

- Broadcast address.

IsIpAddressInSubnet

BOOL IsIpAddressInSubnet (NodeAddressaddress, NodeAddresssubnetAddress, intnumHostbits)

Parameters:

To check if a ip address belongs to a subnet.

address

- address of a node.

subnetAddress
numHostbits

- address of a subnet.

- number of host bit.

Returns:
BOOL

NetworkIpAddHeader

- TRUE if ip address belongs to a subnet else FALSE.

void NetworkIpAddHeader (Node*node, Message*msg, NodeAddresssourceAddress,


NodeAddressdestinationAddress, TosTypepriority, unsigned charprotocol, unsignedttl)

Parameters:
Add an IP packet header to a message. Just calls AddIpHeader.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

node
msg

- Pointer to node.

- Pointer to message.

sourceAddress

- Source IP address.

destinationAddress

- Destination IP address.

priority

- Currently a TosType.

protocol

- IP protocol number.

ttl

- Time to live.If 0, uses default

Returns:
void

- None

FindAnIpOptionField

IpOptionsHeaderType* FindAnIpOptionField (const IpHeaderType*ipHeader, const intoptionKey)

Parameters:

Searches the IP header for the option field with option code that
matches optionKey, and returns a pointer to the option field header.

ipHeader

- Pointer to an IP header.

optionKey

- Option code for desired option field.

Returns:
IpOptionsHeaderType* - to the header of the desired option field. NULL if no option fields, or the
desired option field cannot be found.

NetworkIpPreInit

void NetworkIpPreInit (Node*node)

Parameters:

IP initialization required before any of the other layers are


initialized. This is mainly for MAC initialization, which requires
certain IP structures be pre-initialized.

node

- pointer to node.

Returns:
void

- None

NetworkIpInit

void NetworkIpInit (Node*node, const NodeInput*nodeInput)

Parameters:

Initialize IP variables, and all network-layer IP protocols..

node

- pointer to node.

nodeInput

- Pointer to node input.

Returns:
void

NetworkIpLayer

- None

void NetworkIpLayer (Node*node, Message*msg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Handle IP layer events, incoming messages and messages sent to


itself (timers, etc.).

Parameters:
node
msg

- Pointer to node.

- Pointer to message.

Returns:
void

- None

NetworkIpFinalize

void NetworkIpFinalize (Node*node)

Parameters:

Finalize function for the IP model. Finalize functions for all


network-layer IP protocols are called here.

node

- Pointer to node.

Returns:
void

NetworkIpReceivePacketFromTransportLayer

Called by transport layer protocols (UDP, TCP) to send UDP


datagrams and TCP segments using IP. Simply calls
NetworkIpSendRawMessage().

- None

void NetworkIpReceivePacketFromTransportLayer (Node*node, Message*msg,


NodeAddresssourceAddress, NodeAddressdestinationAddress, intoutgoingInterface, TosTypepriority,
unsigned charprotocol, BOOLisEcnCapable)
Parameters:
node
msg

- Pointer to node.

- Pointer to message from transport

sourceAddress

- Source IP address.

destinationAddress
outgoingInterface

- Destination IP address.

- outgoing interface to use to

priority

- Priority of packet.

protocol

- IP protocol number.

isEcnCapable

- Is this node ECN capable?

Returns:
void

NetworkIpSendRawMessage

Called by NetworkIpReceivePacketFromTransportLayer() to send


to send UDP datagrams, TCP segments using IP. Also called by
network-layer routing protocols (AODV, OSPF, etc.) to send IP
packets. This function adds an IP header and calls
RoutePacketAndSendToMac().

- None

void NetworkIpSendRawMessage (Node*node, Message*msg, NodeAddresssourceAddress,


NodeAddressdestinationAddress, intoutgoingInterface, TosTypepriority, unsigned charprotocol,
unsignedttl)
Parameters:
node
msg

- Pointer to node.

- Pointer to message with payload data

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

sourceAddress

- Source IP address.

destinationAddress
outgoingInterface

- Destination IP address.

- outgoing interface to use to

priority

- Priority of packet.

protocol

- IP protocol number.

ttl

- Time to live.

Returns:
- None

void

NetworkIpSendRawMessageWithDelay

Same as NetworkIpSendRawMessage(), but schedules event after a


simulation delay.

void NetworkIpSendRawMessageWithDelay (Node*node, Message*msg, NodeAddresssourceAddress,


NodeAddressdestinationAddress, intoutgoingInterface, TosTypepriority, unsigned charprotocol,
unsignedttl, clocktypedelay)
Parameters:
node
msg

- Pointer to node.

- Pointer to message with payload data

sourceAddress

- Source IP address.

destinationAddress
outgoingInterface

- Destination IP address.

- outgoing interface to use to

priority

- TOS of packet.

protocol

- IP protocol number.

ttl

- Time to live.

delay

- Delay

Returns:
void

NetworkIpSendRawMessageToMacLayer

Called by network-layer routing protocols (AODV, OSPF, etc.) to


add an IP header to payload data, and with the resulting IP packet,
calls NetworkIpSendPacketOnInterface().

- None

void NetworkIpSendRawMessageToMacLayer (Node*node, Message*msg,


NodeAddresssourceAddress, NodeAddressdestinationAddress, TosTypepriority, unsigned charprotocol,
unsignedttl, intinterfaceIndex, NodeAddressnextHop)
Parameters:
node
msg

- Pointer to node.

- Pointer to message with payload data

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

sourceAddress

- Source IP address.

destinationAddress

- Destination IP address.

priority

- TOS of packet.

protocol

- IP protocol number.

ttl

- Time to live.

interfaceIndex
nextHop

- Index of outgoing interface.

- Next hop IP address.

Returns:
- None

void

NetworkIpSendRawMessageToMacLayerWithDelay

Same as NetworkIpSendRawMessageToMacLayer(), but schedules


the event after a simulation delay by calling
NetworkIpSendPacketOnInterfaceWithDelay().

void NetworkIpSendRawMessageToMacLayerWithDelay (Node*node, Message*msg,


NodeAddresssourceAddress, NodeAddressdestinationAddress, TosTypepriority, unsigned charprotocol,
unsignedttl, intinterfaceIndex, NodeAddressnextHop, clocktypedelay)
Parameters:
node
msg

- Pointer to node.

- Pointer to message with payload data

sourceAddress

- Source IP address.

destinationAddress

- Destination IP address.

priority

- TOS of packet.

protocol

- IP protocol number.

ttl

- Time to live.

interfaceIndex
nextHop
delay

- Index of outgoing interface.

- Next hop IP address.

- delay.

Returns:
void

NetworkIpSendPacketToMacLayer

- None

void NetworkIpSendPacketToMacLayer (Node*node, Message*msg, intinterfaceIndex,


NodeAddressnextHop)

Parameters:
This function is called once the outgoing interface index and next
hop address to which to route an IP packet are known.

node

- Pointer to node.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

msg

- Pointer to message with ip packet.

interfaceIndex
nextHop

- Index of outgoing interface.

- Next hop IP address.

Returns:
- None

void

NetworkIpSendPacketOnInterface

void NetworkIpSendPacketOnInterface (Node*node, Message*msg, intincomingInterface,


intoutgoingInterface, NodeAddressnextHop)

Parameters:
This function is called once the outgoing interface index and next
hop address to which to route an IP packet are known. This queues
an IP packet for delivery to the MAC layer. This functions calls
QueueUpIpFragmentForMacLayer(). This function is used to
initiate fragmentation if required, but since fragmentation has been
disabled, all it does is assert false if the IP packet is too big before
calling the next function.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

incomingInterface

- Index of incoming interface.

outgoingInterface

- Index of outgoing interface.

nextHop

- Next hop IP address.

Returns:
- None

void

NetworkIpSendPacketToMacLayerWithDelay

void NetworkIpSendPacketToMacLayerWithDelay (Node*node, Message*msg, intinterfaceIndex,


NodeAddressnextHop, clocktypedelay)

Parameters:
Same as NetworkIpSendPacketOnInterface(), but schedules event
after a simulation delay.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

interfaceIndex
nextHop
delay

- Index of outgoing interface.

- Next hop IP address.

- delay

Returns:
void

NetworkIpSendPacketOnInterfaceWithDelay

- None

void NetworkIpSendPacketOnInterfaceWithDelay (Node*node, Message*msg, intincommingInterface,


intoutgoingInterface, NodeAddressnextHop, clocktypedelay)

Parameters:
Same as NetworkIpSendPacketOnInterface(), but schedules event
after a simulation delay.

node

- Pointer to node.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

msg

- Pointer to message with ip packet.

incommingInterface
outgoingInterface
nextHop
delay

- Index of incomming interface.

- Index of outgoing interface.

- Next hop IP address.

- delay

Returns:
- None

void

NetworkIpSendRawPacketOnInterfaceWithDelay

void NetworkIpSendRawPacketOnInterfaceWithDelay (Node*node, Message*msg,


intincommingInterface, intoutgoingInterface, NodeAddressnextHop, clocktypedelay)

Parameters:
Same as NetworkIpSendPacketOnInterface(), but schedules event
after a simulation delay and denotes raw packet.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

incommingInterface
outgoingInterface
nextHop
delay

- Index of incomming interface.

- Index of outgoing interface.

- Next hop IP address.

- delay

Returns:
void

NetworkIpSendPacketToMacLayerWithNewStrictSourceRoute

- None

void NetworkIpSendPacketToMacLayerWithNewStrictSourceRoute (Node*node, Message*msg,


NodeAddress[]newRouteAddresses, intnumNewRouteAddresses, BOOLremoveExistingRecordedRoute)

Parameters:
Tacks on a new source route to an existing IP packet and then
sends the packet to the MAC layer.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

newRouteAddresses

- Source route (address array).

numNewRouteAddresses

- Number of array elements.

removeExistingRecordedRoute

- Flag to indicate previous record

Returns:
void

NetworkIpReceivePacketFromMacLayer

- None

void NetworkIpReceivePacketFromMacLayer (Node*node, Message*msg,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

NodeAddresspreviousHopNodeId, intinterfaceIndex)

Parameters:
IP received IP packet from MAC layer. Updates the Stats database
and then calls NetworkIpReceivePacket.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

previousHopNodeId
interfaceIndex

- nodeId of the previous hop.

- Index of interface on which packet arrived.

Returns:
void

NetworkIpReceivePacket

- None

void NetworkIpReceivePacket (Node*node, Message*msg, NodeAddresspreviousHopNodeId,


intinterfaceIndex)

Parameters:
IP received IP packet. Determine whether the packet is to be
delivered to this node, or needs to be forwarded. ipHeader->ip_ttl
is decremented here, instead of the way BSD TCP/IP does it, which
is to decrement TTL right before forwarding the packet. QualNet's
alternative method suits its network-layer ad hoc routing protocols,
which may do their own forwarding.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

previousHopNodeId
interfaceIndex

- nodeId of the previous hop.

- Index of interface on which packet arrived.

Returns:
void

NetworkIpNotificationOfPacketDrop

- None

void NetworkIpNotificationOfPacketDrop (Node*node, Message*msg,


NodeAddressnextHopNodeAddres, intinterfaceIndex)

Parameters:
Invoke callback functions when a packet is dropped.
node
msg

- Pointer to node.

- Pointer to message with ip packet.

nextHopNodeAddres
interfaceIndex

- next hop address of dropped packet.

- interface that experienced the packet drop.

Returns:
void

NetworkIpGetMacLayerStatusEventHandlerFunction

- None

MacLayerStatusEventHandlerFunctionType NetworkIpGetMacLayerStatusEventHandlerFunction
(Node*node, intinterfaceIndex)

Parameters:
Get the status event handler function pointer.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

node

- Pointer to node.

interfaceIndex

- interface associated with the status

Returns:
MacLayerStatusEventHandlerFunctionType

NetworkIpSetMacLayerStatusEventHandlerFunction

- Status event handler function.

void NetworkIpSetMacLayerStatusEventHandlerFunction (Node*node,


MacLayerStatusEventHandlerFunctionTypeStatusEventHandlerPtr, intinterfaceIndex)

Parameters:
Allows the MAC layer to send status messages (e.g., packet drop,
link failure) to a network-layer routing protocol for routing
optimization.

node

- Pointer to node.

StatusEventHandlerPtr
interfaceIndex

- interface

- interface associated with the status

Returns:
void

NetworkIpSneakPeekAtMacPacket

- None

void NetworkIpSneakPeekAtMacPacket (Node*node, const Message*msg, intinterfaceIndex,


NodeAddressprevHop)

Parameters:
Called Directly by the MAC layer, this allows a routing protocol to
"sneak a peek" or "tap" messages it would not normally see from
the MAC layer. This function will possibly unfragment such
packets and call the function registered by the routing protocol to
do the "Peek".

node
msg

- Pointer to node.

- The message being peeked at from the

interfaceIndex
prevHop

- The interface of which the "peeked" message belongs to.

- next hop address of dropped packet.

Returns:
void

NetworkIpGetPromiscuousMessagePeekFunction

- None

PromiscuousMessagePeekFunctionType NetworkIpGetPromiscuousMessagePeekFunction (Node*node,


intinterfaceIndex)

Parameters:
Returns the network-layer function which will promiscuously
inspect packets. See NetworkIpSneakPeekAtMacPacket().

node

- Pointer to node.

interfaceIndex

- Interface associated with the peek function.

Returns:
PromiscuousMessagePeekFunctionType

NetworkIpSetPromiscuousMessagePeekFunction

- Function pointer

void NetworkIpSetPromiscuousMessagePeekFunction (Node*node,


PromiscuousMessagePeekFunctionTypePeekFunctionPtr, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Parameters:
Sets the network-layer function which will promiscuously inspect
packets. See NetworkIpSneakPeekAtMacPacket().

node

- Pointer to node.

PeekFunctionPtr
interfaceIndex

- Peek function.

- Interface associated with the peek function.

Returns:
void

NetworkIpReceiveMacAck

- None

void NetworkIpReceiveMacAck (Node*node, intinterfaceIndex, const Message*msg,


NodeAddressnextHop)

Parameters:
MAC received an ACK, so call ACK handler function.
node

- Pointer to node.

interfaceIndex
msg

- Interface associated with the ACK handler function.

- Message that was ACKed.

nextHop

- Next hop that sent the MAC layer ACK

Returns:
void

- None

NetworkIpGetMacLayerAckHandler

MacLayerAckHandlerType NetworkIpGetMacLayerAckHandler (Node*node, intinterfaceIndex)

Parameters:

Get MAC layer ACK handler

node

- Pointer to node.

interfaceIndex

- Interface associated with ACK handler function

Returns:
MacLayerAckHandlerType

NetworkIpSetMacLayerAckHandler

- MAC acknowledgement function pointer

void NetworkIpSetMacLayerAckHandler (Node*node, MacLayerAckHandlerTypemacAckHandlerPtr,


intinterfaceIndex)

Parameters:
Set MAC layer ACK handler
node

- Pointer to node.

macAckHandlerPtr
interfaceIndex

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- Callback function handling

- Interface associated with the ACK handler

IP

void

SendToUdp

- None

void SendToUdp (Node*node, Message*msg, TosTypepriority, NodeAddresssourceAddress,


NodeAddressdestinationAddress, intincomingInterfaceIndex)

Parameters:
Sends a UDP packet to UDP in the transport layer. The source IP
address, destination IP address, and priority of the packet are also
sent.

node
msg

- Pointer to node.

- Pointer to message with UDP packet.

priority

- TOS of UDP packet.

sourceAddress

- Source IP address.

destinationAddress

- Destination IP address.

incomingInterfaceIndex

- interface that received the packet

Returns:
void

SendToTcp

- None

void SendToTcp (Node*node, Message*msg, TosTypepriority, NodeAddresssourceAddress,


NodeAddressdestinationAddress, BOOLaCongestionExperienced)

Parameters:
Sends a TCP packet to TCP in the transport layer. The source IP
address, destination IP address, and priority of the packet are also
sent..

node
msg

- Pointer to node.

- Pointer to message with TCP packet.

priority

- TOS of TCP packet.

sourceAddress

- Source IP address.

destinationAddress

- Destination IP address.

aCongestionExperienced

- Determine if congestion is

Returns:
void

SendToRsvp

- None

void SendToRsvp (Node*node, Message*msg, TosTypepriority, NodeAddresssourceAddress,


NodeAddressdestinationAddress, intinterfaceIndex, unsignedttl)

Parameters:
Sends a RSVP packet to RSVP in the transport layer. The source IP
address, destination IP address, and priority of the packet are also
sent.

node
msg

- Pointer to node.

- Pointer to message with RSVP packet.

priority

- TOS of UDP packet.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

sourceAddress

- Source IP address.

destinationAddress
interfaceIndex
ttl

- Destination IP address.

- incoming interface index.

- Receiving TTL

Returns:
void

NetworkIpRemoveIpHeader

- None

void NetworkIpRemoveIpHeader (Node*node, Message*msg, NodeAddress*sourceAddress,


NodeAddress*destinationAddress, TosType*priority, unsigned char*protocol, unsigned*ttl)

Parameters:
Removes the IP header from a message while also returning all the
fields of the header.

node
msg

- Pointer to node.

- Pointer to message

sourceAddress

- Storage for source IP address.

destinationAddress

- Storage for destination IP

priority

- Storage for TosType.(values are

protocol

- Storage for IP protocol number

ttl

- Storage for time to live.

Returns:
void

- None

AddIpOptionField

void AddIpOptionField (Node*node, Message*msg, intoptionCode, intoptionSize)

Parameters:

Inserts an option field in the header of an IP packet.

node
msg

- Pointer to node.

- Pointer to message

optionCode

- The option code

optionSize

- Size of the option

Returns:
void

ExtractIpSourceAndRecordedRoute

- None

void ExtractIpSourceAndRecordedRoute (Message*msg, NodeAddress[]RouteAddresses,


int*NumAddresses, int*RouteAddressIndex)

Parameters:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Retrieves a copy of the source and recorded route from the options
field in the header.

msg

- Pointer to message with IP packet.

RouteAddresses
NumAddresses

- Storage for source/recorded route.

- Storage for size of RouteAddresses[] array.

RouteAddressIndex

- The index of the first address of the

Returns:
void

- None

NetworkIpGetRouterFunction

RouterFunctionType NetworkIpGetRouterFunction (Node*node, intinterfaceIndex)

Parameters:

Get the router function pointer.

node

- Pointer to node.

interfaceIndex

- interface associated with router function

Returns:
RouterFunctionType

NetworkIpSetRouterFunction

- router function pointer.

void NetworkIpSetRouterFunction (Node*node, RouterFunctionTypeRouterFunctionPtr,


intinterfaceIndex)

Parameters:
Allows a routing protocol to set the "routing function" (one of its
functions) which is called when a packet needs to be routed.
NetworkIpSetRouterFunction() allows a routing protocol to define
the routing function. The routing function is called by the network
layer to ask the routing protocol to route the packet. The routing
function is given the packet and its destination. The routing
protocol can route the packet and set "PacketWasRouted" to TRUE;
or not route the packet and set to FALSE. If the packet, was not
routed, then the network layer will try to use the forwarding table
or the source route the source route in the IP header. This function
will also be given packets for the local node the routing protocols
can look at packets for protocol reasons. In this case, the message
should not be modified and PacketWasRouted must be set to
FALSE.
NetworkIpAddUnicastRoutingProtocolType

node

- Pointer to node.

RouterFunctionPtr
interfaceIndex

- Router function to set.

- interface associated with router function.

Returns:
void

- None

void NetworkIpAddUnicastRoutingProtocolType (Node*node,


NetworkRoutingProtocolTyperoutingProtocolType, intinterfaceIndex)

Parameters:
Add unicast routing protocol type to interface.
node

- Pointer to node.

routingProtocolType
interfaceIndex

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- Router function to add.

- Interface associated with the router function.

IP

Returns:
- None

void

NetworkIpAddUnicastIntraRegionRoutingProtocolType

void NetworkIpAddUnicastIntraRegionRoutingProtocolType (Node*node,


NetworkRoutingProtocolTyperoutingProtocolType, intinterfaceIndex)

Parameters:
Add unicast intra region routing protocol type to interface.
node

- Pointer to node.

routingProtocolType
interfaceIndex

- Router function to add.

- Interface associated with the router function.

Returns:
- None

void

NetworkIpGetRoutingProtocol

void* NetworkIpGetRoutingProtocol (Node*node, NetworkRoutingProtocolTyperoutingProtocolType)

Parameters:

Get routing protocol structure associated with routing protocol


running on this interface.

node

- Pointer to node.

routingProtocolType

- Router function to

Returns:
void*

NetworkIpGetUnicastRoutingProtocolType

- Routing protocol structure requested.

NetworkRoutingProtocolType NetworkIpGetUnicastRoutingProtocolType (Node*node,


intinterfaceIndex)

Parameters:
Get unicast routing protocol type on this interface.
node

- Pointer to node.

interfaceIndex

- network interface for request.

Returns:
NetworkRoutingProtocolType

- The unicast routing protocol type.

NetworkIpSetHsrpOnInterface

void NetworkIpSetHsrpOnInterface (Node*node, intinterfaceIndex)

Parameters:

To enable hsrp on a interface

node

- Pointer to node.

interfaceIndex

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- network interface.

IP

NetworkIpIsHsrpEnabled

BOOL NetworkIpIsHsrpEnabled (Node*node, intinterfaceIndex)

Parameters:

To test if any interface is hsrp enabled.

node

- Pointer to node.

interfaceIndex

- network interface.

Returns:
BOOL

NetworkIpAddNewInterface

- return TRUE if any one interface is hsrp enabled else return FALSE.

void NetworkIpAddNewInterface (Node*node, NodeAddressinterfaceIpAddress, intnumHostBits,


int*newInterfaceIndex, const NodeInput*nodeInput)

Parameters:
Add new interface to node.
node

- Pointer to node.

interfaceIpAddress
numHostBits

- Number of host bits for the interface.

newInterfaceIndex
nodeInput

- Interface to add.

- The interface number of the new interface.

- Provides access to

Returns:
void

- None

NetworkIpInitCpuQueueConfiguration

void NetworkIpInitCpuQueueConfiguration (Node*node, const NodeInput*nodeInput)

Parameters:

Initializes cpu queue parameters during startup.

node

- Pointer to node.

nodeInput

- Pointer to node input.

Returns:
void

NetworkIpInitInputQueueConfiguration

- None

void NetworkIpInitInputQueueConfiguration (Node*node, const NodeInput*nodeInput,


intinterfaceIndex)

Parameters:
Initializes input queue parameters during startup.
node

- Pointer to node.

nodeInput

- Pointer to node input.

interfaceIndex

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- interface associated with queue.

IP

Returns:
- None

void

NetworkIpInitOutputQueueConfiguration

void NetworkIpInitOutputQueueConfiguration (Node*node, const NodeInput*nodeInput,


intinterfaceIndex)

Parameters:
Initializes queue parameters during startup.
node

- Pointer to node.

nodeInput

- Pointer to node input.

interfaceIndex

- interface associated with queue.

Returns:
- None

void

NetworkIpCreateQueues

void NetworkIpCreateQueues (Node*node, const NodeInput*nodeInput, intinterfaceIndex)

Parameters:

Initializes input and output queue parameters during startup

node

- Pointer to node.

nodeInput

- Pointer to node input.

interfaceIndex

- interface associated with queue.

Returns:
- None

void

NetworkIpSchedulerParameterInit

void NetworkIpSchedulerParameterInit (Scheduler*schedulerPtr, const intnumPriorities, Queue*queue)

Parameters:

Initialize the scheduler parameters and also allocate memory for


queues if require.

schedulerPtr

- pointer to schedular

numPriorities
queue

- Number of priorities available

- pointer to ip queue.

Returns:
void

NetworkIpSchedulerInit

- None

void NetworkIpSchedulerInit (Node*node, const NodeInput*nodeInput, intinterfaceIndex,


Scheduler*schedulerPtr, const char*schedulerTypeString)

Parameters:
Call initialization function for appropriate scheduler.
node

- pointer to node

nodeInput

- pointer to nodeinput

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

interfaceIndex
schedulerPtr

- interface index

- type of Scheduler

schedulerTypeString

- Scheduler name

Returns:
void

NetworkIpCpuQueueInsert

Calls the cpu packet scheduler for an interface to retrieve an IP


packet from a queue associated with the interface. The dequeued
packet, since it's already been routed, has an associated next-hop IP
address. The packet's priority value is also returned.

- None

void NetworkIpCpuQueueInsert (Node*node, Message*msg, NodeAddressnextHopAddress,


NodeAddressdestinationAddress, intoutgoingInterface, intnetworkType, BOOL*queueIsFull,
intincomingInterface)
Parameters:
node
msg

- Pointer to node.

- Pointer to message with IP packet.

nextHopAddress

- Packet's next hop address.

destinationAddress
outgoingInterface

- Packet's destination address.

- Used to determine where packet

networkType

- Type of network packet is using (IP,

queueIsFull

- Storage for boolean indicator.

incomingInterface

- Incoming interface of packet.

Returns:
void

NetworkIpInputQueueInsert

Calls input packet scheduler for an interface to retrieve an IP packet


from a queue associated with the interface. The dequeued packet,
since it's already been routed, has an associated next-hop IP
address. The packet's priority value is also returned.

- None

void NetworkIpInputQueueInsert (Node*node, intincomingInterface, Message*msg,


NodeAddressnextHopAddress, NodeAddressdestinationAddress, intoutgoingInterface, intnetworkType,
BOOL*queueIsFull)
Parameters:
node

- Pointer to node.

incomingInterface
msg

- interface of input queue.

- Pointer to message with IP packet.

nextHopAddress

- Packet's next hop address.

destinationAddress
outgoingInterface

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- Packet's destination address.

- Used to determine where packet

IP

networkType

- Type of network packet is using (IP,

queueIsFull

- Storage for boolean indicator.

Returns:
void

NetworkIpOutputQueueInsert

- None

void NetworkIpOutputQueueInsert (Node*node, intinterfaceIndex, Message*msg,


NodeAddressnextHopAddress, NodeAddressdestinationAddress, intnetworkType, BOOL*queueIsFull)

Parameters:
Calls output packet scheduler for an interface to retrieve an IP
packet from a queue associated with the interface. The dequeued
packet, since it's already been routed, has an associated next-hop IP
address. The packet's priority value is also returned. Called by
QueueUpIpFragmentForMacLayer().

node

- Pointer to node.

interfaceIndex
msg

- interface of input queue.

- Pointer to message with IP packet.

nextHopAddress

- Packet's next hop address.

destinationAddress

- Packet's destination address.

networkType

- Type of network packet is using (IP,

queueIsFull

- Storage for boolean indicator.

Returns:
void

NetworkIpInputQueueDequeuePacket

- None

BOOL NetworkIpInputQueueDequeuePacket (Node*node, intincomingInterface, Message**msg,


NodeAddress*nextHopAddress, int*outgoingInterface, int*networkType, QueuePriorityType*priority)

Parameters:
Calls the packet scheduler for an interface to retrieve an IP packet
from the input queue associated with the interface.

node

- Pointer to node.

incomingInterface
msg

- interface to dequeue from.

- Storage for pointer to message

nextHopAddress

- Storage for Packet's

outgoingInterface
networkType
priority

- Used to determine where packet

- Type of network packet is using (IP,

- Storage for

Returns:
BOOL

NetworkIpOutputQueueDequeuePacket

- TRUE if dequeued successfully, FALSE otherwise.

BOOL NetworkIpOutputQueueDequeuePacket (Node*node, intinterfaceIndex, Message**msg,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

NodeAddress*nextHopAddress, int*networkType, QueuePriorityType*priority)

Parameters:
Calls the packet scheduler for an interface to retrieve an IP packet
from a queue associated with the interface. The dequeued packet,
since it's already been routed, has an associated next-hop IP
address. The packet's priority value is also returned. This function is
called by MAC_OutputQueueDequeuePacket() (mac/mac.pc),
which itself is called from mac/mac_802_11.pc and other MAC
protocol source files. This function will assert false if the scheduler
cannot return an IP packet for whatever reason.

node

- Pointer to node.

interfaceIndex
msg

- index to interface .

- Storage for pointer to message

nextHopAddress
networkType
priority

- Storage for Packet's next hop address.

- Type of network packet is using (IP,

- Storage for priority

Returns:
BOOL

NetworkIpOutputQueueDequeuePacketForAPriority

Same as NetworkIpOutputQueueDequeuePacket(), except the


packet dequeued is requested by a specific priority, instead of
leaving the priority decision up to the packet scheduler. This
function is called by
MAC_OutputQueueDequeuePacketForAPriority() (mac/mac.pc),
which itself is called from mac/mac_802_11.pc and other MAC
protocol source files. This function will assert false if the scheduler
cannot return an IP packet for whatever reason.

- TRUE if dequeued successfully, FALSE otherwise.

BOOL NetworkIpOutputQueueDequeuePacketForAPriority (Node*node, intinterfaceIndex,


QueuePriorityTypepriority, Message**msg, NodeAddress*nextHopAddress, int*networkType,
intposInQueue)
Parameters:
node

- Pointer to node.

interfaceIndex
priority
msg

- index to interface .

- priority of packet.

- Storage for pointer to message

nextHopAddress
networkType
posInQueue

- Storage for Packet's next hop address.

- Type of network packet is using (IP,

- Position of packet in Queue.

Returns:
BOOL

NetworkIpOutputQueueDequeuePacketWithIndex

- TRUE if dequeued successfully, FALSE otherwise.

BOOL NetworkIpOutputQueueDequeuePacketWithIndex (Node*node, intinterfaceIndex, intmsgIndex,


Message**msg, NodeAddress*nextHopAddress, int*networkType)

Parameters:
Same as NetworkIpOutputQueueDequeuePacket(), except the
packet dequeued is requested by a specific index This function is
called by MAC_OutputQueueDequeuePacketForAPriority()
(mac/mac.pc), which itself is called from mac/mac_802_11.pc and
other MAC protocol source files. This function will assert false if
the scheduler cannot return an IP packet for whatever reason.

node

- Pointer to node.

interfaceIndex
msgIndex

- index to interface .

- index of packet.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

msg

- Storage for pointer to message

nextHopAddress
networkType

- Storage for Packet's next hop address.

- Type of network packet is using (IP,

Returns:
BOOL

NetworkIpInputQueueTopPacket

- TRUE if dequeued successfully, FALSE otherwise.

BOOL NetworkIpInputQueueTopPacket (Node*node, intincomingInterface, Message**msg,


NodeAddress*nextHopAddress, int*outgoingInterface, int*networkType, QueuePriorityType*priority)

Parameters:
Same as NetworkIpInputQueueDequeuePacket(), except the packet
is not actually dequeued. Note that the message containing the
packet is not copied; the contents may (inadvertently or not) be
directly modified.

node

- Pointer to node.

incomingInterface
msg

- interface to get top packet from.

- Storage for pointer to message

nextHopAddress

- Storage for Packet's next hop addr.

outgoingInterface
networkType
priority

- Used to determine where packet should go

- Type of network packet is using (IP,

- Storage for priority

Returns:
BOOL

NetworkIpOutputQueueTopPacket

- TRUE if there is a packet, FALSE otherwise.

BOOL NetworkIpOutputQueueTopPacket (Node*node, intinterfaceIndex, Message**msg,


NodeAddress*nextHopAddress, int*networkType, QueuePriorityType*priority)

Parameters:
Same as NetworkIpOutputQueueDequeuePacket(), except the
packet is not actually dequeued. Note that the message containing
the packet is not copied; the contents may (inadvertently or not) be
directly modified. This function is called by
MAC_OutputQueueTopPacket() (mac/mac.pc), which itself is
called from mac/mac_802_11.pc and other MAC protocol source
files. This function will assert false if the scheduler cannot return
an IP packet for whatever reason.

node

- Pointer to node.

interfaceIndex
msg

- index to interface .

- Storage for pointer to message

nextHopAddress
networkType
priority

- Storage for Packet's next hop addr.

- Type of network of the packet

- Storage for priority

Returns:
BOOL

NetworkIpOutputQueuePeekWithIndex

- TRUE if there is a packet, FALSE otherwise.

BOOL NetworkIpOutputQueuePeekWithIndex (Node*node, intinterfaceIndex, intmsgIndex,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Message**msg, NodeAddress*nextHopAddress, QueuePriorityType*priority)

Parameters:
Same as NetworkIpOutputQueueDequeuePacket(), except the
packet is not actually dequeued. Note that the message containing
the packet is not copied; the contents may (inadvertently or not) be
directly modified. This function is called by
MAC_OutputQueueTopPacket() (mac/mac.pc), which itself is
called from mac/mac_802_11.pc and other MAC protocol source
files. This function will assert false if the scheduler cannot return
an IP packet for whatever reason.

node

- Pointer to node.

interfaceIndex
msgIndex
msg

- index to interface .

- index to message .

- Storage for pointer to message

nextHopAddress
priority

- Storage for Packet's next hop addr.

- Storage for priority

Returns:
BOOL

NetworkIpOutputQueueTopPacketForAPriority

- TRUE if there is a packet, FALSE otherwise.

BOOL NetworkIpOutputQueueTopPacketForAPriority (Node*node, intinterfaceIndex,


QueuePriorityTypepriority, Message**msg, NodeAddress*nextHopAddress, intposInQueue)

Parameters:
Same as NetworkIpOutputQueueDequeuePacketForAPriority(),
except the packet is not actually dequeued. Note that the message
containing the packet is not copied; the contents may (inadvertently
or not) be directly modified. This function is called by
MAC_OutputQueueTopPacketForAPriority() (mac/mac.pc), which
itself is called from mac/mac_802_11.pc and other MAC protocol
source files. This function will assert false if the scheduler cannot
return an IP packet for whatever reason.

node

- Pointer to node.

interfaceIndex
priority
msg

- index to interface .

- priority of packet

- Storage for pointer to message

nextHopAddress
posInQueue

- Storage for packet's next hop address.

- Position of packet in Queue.

Returns:
BOOL

- TRUE if there is a packet, FALSE otherwise.

NetworkIpInputQueueIsEmpty

BOOL NetworkIpInputQueueIsEmpty (Node*node, intincomingInterface)

Parameters:

Calls the packet scheduler for an interface to determine whether the


interface's input queue is empty

node

- Pointer to node.

incomingInterface

- Index of interface.

Returns:
- TRUE if the scheduler says the interface's input queue is empty. FALSE if the scheduler says
the interface's input queue is not empty.

BOOL

NetworkIpOutputQueueIsEmpty

BOOL NetworkIpOutputQueueIsEmpty (Node*node, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Calls the packet scheduler for an interface to determine whether the


interface's output queue is empty.

Parameters:
- Pointer to node.

node

interfaceIndex

- Index of interface.

Returns:
- TRUE if the scheduler says the interface's output queue is empty. FALSE if the scheduler says
the interface's output queue is not empty.

BOOL

NetworkIpOutputQueueNumberInQueue

int NetworkIpOutputQueueNumberInQueue (Node*node, intinterfaceIndex, BOOLspecificPriorityOnly,


QueuePriorityTypepriority)

Parameters:
Calls the packet scheduler for an interface to determine how many
packets are in a queue. There may be multiple queues on an
interface, so the priority of the desired queue is also provided.

- Pointer to node.

node

interfaceIndex

- Index of interface.

specificPriorityOnly
priority

- Should we only get the number of packets

- Priority of queue.

Returns:
- Number of packets in queue.

int

NetworkIpOutputQueueDropPacket

NodeAddress NetworkIpOutputQueueDropPacket (Node*node, intinterfaceIndex, Message**msg)

Parameters:

Drop a packet from the queue.

node

- Pointer to node.

interfaceIndex
msg

- index to interface .

- Storage for pointer to message

Returns:
NodeAddress

NetworkIpDeleteOutboundPacketsToANode

- Next hop of dropped packet.

void NetworkIpDeleteOutboundPacketsToANode (Node*node, const NodeAddressnextHopAddress,


const NodeAddressdestinationAddress, const BOOLreturnPacketsToRoutingProtocol)

Parameters:
Deletes all packets in the queue going (probably broken), to the
specified next hop address. There is option to return all such
packets back to the routing protocols. via the usual mechanism
(callback).

node

- Pointer to node.

nextHopAddress

- Next hop associated with

destinationAddress

- destination associated with

returnPacketsToRoutingProtocol
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- Determine whether or not

IP

Returns:
void

- None

GetQueueNumberFromPriority

unsigned GetQueueNumberFromPriority (TosTypeuserTos, intnumQueues)

Parameters:

Get queue number through which a given user priority will be


forwarded.

userTos

- user TOS.

numQueues

- Number of queues.

Returns:
unsigned

- Index of the queue.

ReturnPriorityForPHB

QueuePriorityType ReturnPriorityForPHB (Node*node, TosTypetos)

Parameters:

Returns the priority queue corresponding to the DS/TOS field.

node
tos

- Pointer to node.

- TOS field

Returns:
QueuePriorityType

NetworkGetInterfaceAndNextHopFromForwardingTable

- priority queue

void NetworkGetInterfaceAndNextHopFromForwardingTable (Node*node,


NodeAddressdestinationAddress, int*interfaceIndex, NodeAddress*nextHopAddress)

Parameters:
Do a lookup on the routing table with a destination IP address to
obtain a route (index of an outgoing interface and a next hop Ip
address).

node

- Pointer to node.

destinationAddress

- Destination IP address.

interfaceIndex

- Storage for index of outgoing

nextHopAddress

- Storage for next hop IP address.

Returns:
void

NetworkGetInterfaceAndNextHopFromForwardingTable

- None

void NetworkGetInterfaceAndNextHopFromForwardingTable (Node*node, intcurrentInterface,


NodeAddressdestinationAddress, int*interfaceIndex, NodeAddress*nextHopAddress)

Parameters:
Do a lookup on the routing table with a destination IP address to
obtain a route (index of an outgoing interface and a next hop Ip
address).

node

- Pointer to node.

currentInterface

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- Current interface in use.

IP

destinationAddress

- Destination IP address.

interfaceIndex

- Storage for index of outgoing

nextHopAddress

- Storage for next hop IP address.

Returns:
void

NetworkGetInterfaceAndNextHopFromForwardingTable

Do a lookup on the routing table with a destination IP address to


obtain a route (index of an outgoing interface and a next hop Ip
address).

- None

void NetworkGetInterfaceAndNextHopFromForwardingTable (Node*node,


NodeAddressdestinationAddress, int*interfaceIndex, NodeAddress*nextHopAddress, BOOLtestType,
NetworkRoutingProtocolTypetype)
Parameters:
node

- Pointer to node.

destinationAddress

- Destination IP address.

interfaceIndex

- Storage for index of outgoing

nextHopAddress

- Storage for next hop IP address.

testType
type

- Same protocol's routes if true

- routing protocol type.

Returns:
void

NetworkGetInterfaceAndNextHopFromForwardingTable

Do a lookup on the routing table with a destination IP address to


obtain a route (index of an outgoing interface and a next hop Ip
address).

- None

void NetworkGetInterfaceAndNextHopFromForwardingTable (Node*node, intoperatingInterface,


NodeAddressdestinationAddress, int*interfaceIndex, NodeAddress*nextHopAddress, BOOLtestType,
NetworkRoutingProtocolTypetype)
Parameters:
node

- Pointer to node.

operatingInterface

- interface currently being

destinationAddress

- Destination IP address.

interfaceIndex

- Storage for index of outgoing

nextHopAddress

- Storage for next hop IP address.

testType
type

- Same protocol's routes if true

- routing protocol type.

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

NetworkIpGetInterfaceIndexForNextHop

int NetworkIpGetInterfaceIndexForNextHop (Node*node, NodeAddressnextHopAddress)

Parameters:

This function looks at the network address of each of a node's


network interfaces. When nextHopAddress is matched to a
network, the interface index corresponding to the network is
returned. (used by NetworkUpdateForwardingTable() and
ospfv2.pc)

- Pointer to node.

node

nextHopAddress

- Destination IP address.

Returns:
int

- Index of outgoing interface, if nextHopAddress is on a directly connected network. -1, otherwise

NetworkGetInterfaceIndexForDestAddress

int NetworkGetInterfaceIndexForDestAddress (Node*node, NodeAddressdestAddress)

Parameters:

Get interface for the destination address.

- Pointer to node.

node

destAddress

- Destination IP address.

Returns:
int

NetworkRoutingGetAdminDistance

- interface index associated with destination.

NetworkRoutingAdminDistanceType NetworkRoutingGetAdminDistance (Node*node,


NetworkRoutingProtocolTypetype)

Parameters:
Get the administrative distance of a routing protocol. These values
don't quite match those recommended by Cisco.

node

- Pointer to node.

type

- Type value of routing protocol.

Returns:
NetworkRoutingAdminDistanceType

- The administrative distance of the routing protocol.

NetworkInitForwardingTable

void NetworkInitForwardingTable (Node*node)

Parameters:

Initialize the IP fowarding table, allocate enough memory for


number of rows.

node

- Pointer to node.

Returns:
void

NetworkUpdateForwardingTable

Update or add entry to IP routing table. Search the routing table for
an entry with an exact match for destAddress, destAddressMask,
and routing protocol. Update this entry with the specified

- None

void NetworkUpdateForwardingTable (Node*node, NodeAddressdestAddress,


NodeAddressdestAddressMask, NodeAddressnextHopAddress, intoutgoingInterfaceIndex, intcost,
NetworkRoutingProtocolTypetype)
Parameters:
node

- Pointer to node.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

nextHopAddress (the outgoing interface is automatically determined


from the nextHopAddress -- see code). If no matching entry found,
then add a new route.

destAddress

- IP address of destination

destAddressMask
nextHopAddress

- Netmask.

- Next hop IP address.

outgoingInterfaceIndex

- outgoing interface.

cost

- Cost metric associated with

type

- type value of

Returns:
void

NetworkRemoveForwardingTableEntry

- None

void NetworkRemoveForwardingTableEntry (Node*node, NodeAddressdestAddress,


NodeAddressdestAddressMask, NodeAddressnextHopAddress, intoutgoingInterfaceIndex)

Parameters:
Remove single entries in the routing table
node

- Pointer to node.

destAddress

- IP address of destination

destAddressMask
nextHopAddress

- Netmask.

- Next hop IP address.

outgoingInterfaceIndex

- outgoing interface.

Returns:
void

- None

NetworkEmptyForwardingTable

void NetworkEmptyForwardingTable (Node*node, NetworkRoutingProtocolTypetype)

Parameters:

Remove entries in the routing table corresponding to a given


routing protocol.

node

- Pointer to node.

type

- Type of routing protocol whose

Returns:
void

- None

NetworkPrintForwardingTable

void NetworkPrintForwardingTable (Node*node)

Parameters:

Display all entries in node's routing table.

node

- Pointer to node.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

- None

void

NetworkGetMetricForDestAddress

int NetworkGetMetricForDestAddress (Node*node, NodeAddressdestAddress)

Parameters:

Get the cost metric for a destination from the forwarding table.

- Pointer to node.

node

destAddress

- destination to get cost metric from.

Returns:
int

NetworkIpSetRouteUpdateEventFunction

- Cost metric associated with destination.

void NetworkIpSetRouteUpdateEventFunction (Node*node,


NetworkRouteUpdateEventTyperouteUpdateFunctionPtr)

Parameters:
Set a callback fuction when a route changes from forwarding table.
node

- Pointer to node.

routeUpdateFunctionPtr

- Route update

Returns:
void

- None

NetworkIpGetRouteUpdateEventFunction

NetworkRouteUpdateEventType NetworkIpGetRouteUpdateEventFunction (Node*node)

Parameters:

Print packet headers when packet tracing is enabled.

node

- Pointer to node.

Returns:
NetworkRouteUpdateEventType

- Route update callback function to set.

NetworkIpGetInterfaceAddress

NodeAddress NetworkIpGetInterfaceAddress (Node*node, intinterfaceIndex)

Parameters:

Get the interface address on this interface

node

- Pointer to the node

interfaceIndex

- Number of interface

Returns:
NodeAddress

- IP address associated with the interface

NetworkIpGetInterfaceName

char* NetworkIpGetInterfaceName (Node*node, intinterfaceIndex)

Parameters:

To get the interface name associated with the interface

node

- Pointer to the node

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

interfaceIndex

- Number of interface

Returns:
char*

- interface name

NetworkIpGetInterfaceNetworkAddress

NodeAddress NetworkIpGetInterfaceNetworkAddress (Node*node, intinterfaceIndex)

Parameters:

To get network address associated with interface

- Pointer to the node

node

interfaceIndex

- Number of interface

Returns:
NodeAddress

- network address associated with interface

NetworkIpGetInterfaceSubnetMask

NodeAddress NetworkIpGetInterfaceSubnetMask (Node*node, intinterfaceIndex)

Parameters:

To retrieve subnet mask of the node interface

- Pointer to the node

node

interfaceIndex

- Number of interface

Returns:
NodeAddress

- subnet mask of the specified interface

NetworkIpGetInterfaceNumHostBits

int NetworkIpGetInterfaceNumHostBits (Node*node, intinterfaceIndex)

Parameters:

Get the number of host bits on this interface

- Pointer to the node

node

interfaceIndex

- Number of interface

Returns:
int

- Number of host bits on the specified interface

NetworkIpGetInterfaceBroadcastAddress

NodeAddress NetworkIpGetInterfaceBroadcastAddress (Node*node, intinterfaceIndex)

Parameters:

Get broadcast address on this interface

node

- Pointer to the node

interfaceIndex

- Number of interface

Returns:
NodeAddress

- Broadcast address of specified interface

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

IsOutgoingBroadcast

BOOL IsOutgoingBroadcast (Node*node, NodeAddressdestAddress, int*outgoingInterface,


NodeAddress*outgoingBroadcastAddress)

Parameters:
Checks whether IP packet's destination address is broadcast
node

- Pointer to the node

destAddress

- IP packet's destination IP address.

outgoingInterface

- Outgoing interface index.

outgoingBroadcastAddress

- Broadcast address

Returns:
BOOL

- Returns true if destination is broadcast address

NetworkIpIsMyIP

BOOL NetworkIpIsMyIP (Node*node, NodeAddressipAddress)

Parameters:

In turn calls IsMyPacket()

node

- Pointer to the node

ipAddress

- An IP packet's destination IP address.

Returns:
BOOL

- Returns if it belongs to it.

NetworkIpConfigurationError

void NetworkIpConfigurationError (Node*node, char []parameterName, intinterfaceIndex)

Parameters:

Prints out the IP configuration error

node

- Pointer to the node

parameterName

- Error message to print

interfaceIndex

- interface number

Returns:
void

- None

NetworkPrintIpHeader

void NetworkPrintIpHeader (Message*msg)

Parameters:

To print the IP header

msg

- Pointer to Message

Returns:
void

NetworkIpAddToMulticastGroupList

- None

void NetworkIpAddToMulticastGroupList (Node*node, NodeAddressgroupAddress)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Add a specified node to a multicast group

Parameters:
node

- Pointer to the node

groupAddress

- address of multicast group

Returns:
- None

void

NetworkIpRemoveFromMulticastGroupList

void NetworkIpRemoveFromMulticastGroupList (Node*node, NodeAddressgroupAddress)

Parameters:

To remove specified node from a multicast group

node

- Pointer to the node

groupAddress

- address of multicast group

Returns:
- None

void

NetworkIpPrintMulticastGroupList

void NetworkIpPrintMulticastGroupList (Node*node)

Parameters:

To print the multicast grouplist

node

- Pointer to the node

Returns:
- None

void

NetworkIpIsPartOfMulticastGroup

BOOL NetworkIpIsPartOfMulticastGroup (Node*node, NodeAddressgroupAddress)

Parameters:

check if a node is part of specified multicast group

node

- Pointer to the node

groupAddress

- group to check if node is part of

Returns:
- None

BOOL

NetworkIpJoinMulticastGroup

void NetworkIpJoinMulticastGroup (Node*node, NodeAddressmcastAddr, clocktypedelay)

Parameters:

To join a multicast group

node

- Pointer to the node

mcastAddr
delay

- multicast group address

- delay after which to join

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

- None

void

NetworkIpJoinMulticastGroup

void NetworkIpJoinMulticastGroup (Node*node, NodeAddressmcastAddr, clocktypedelay)

Parameters:

To join a multicast group

node

- Pointer to the node

mcastAddr
delay

- multicast group address

- delay after which to join

Returns:
- None

void

NetworkIpLeaveMulticastGroup

void NetworkIpLeaveMulticastGroup (Node*node, NodeAddressmcastAddr, clocktypedelay)

Parameters:

To leave a multicast group

node

- Pointer to the node

mcastAddr
delay

- multicast group address

- delay after which to leave

Returns:
- None

void

NetworkIpLeaveMulticastGroup

void NetworkIpLeaveMulticastGroup (Node*node, NodeAddressmcastAddr, clocktypedelay)

Parameters:

To leave a multicast group

node

- Pointer to the node

mcastAddr
delay

- multicast group address

- delay after which to leave

Returns:
void

NetworkIpSetMulticastTimer

- None

void NetworkIpSetMulticastTimer (Node*node, longeventType, NodeAddressmcastAddr,


clocktypedelay)

Parameters:
To set a multicast timer to join or leave multicast groups
node

- Pointer to the node

eventType

- the event type

mcastAddr

- multicast group address

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

delay

- delay after which to leave

Returns:
void

NetworkIpSetMulticastRoutingProtocol

- None

void NetworkIpSetMulticastRoutingProtocol (Node*node, void*multicastRoutingProtocol,


intinterfaceIndex)

Parameters:
Assign a multicast routing protocol to an interface
node

- Pointer to the node

multicastRoutingProtocol
interfaceIndex

- multicast routing protocol

- interface number

Returns:
void

NetworkIpGetMulticastRoutingProtocol

- None

void * NetworkIpGetMulticastRoutingProtocol (Node*node,


NetworkRoutingProtocolTyperoutingProtocolType)

Parameters:
To get the Multicast Routing Protocol structure
node

- Pointer to the node

routingProtocolType

- routing protocol name

Returns:
void *

NetworkIpAddMulticastRoutingProtocolType

- None

void NetworkIpAddMulticastRoutingProtocolType (Node*node,


NetworkRoutingProtocolTypemulticastProtocolType, intinterfaceIndex)

Parameters:
Assign a multicast protocol type to an interface
node

- Pointer to this node

multicastProtocolType
interfaceIndex

- routing protocol

- interface number of the node

Returns:
void

NetworkIpSetMulticastRouterFunction

- None

void NetworkIpSetMulticastRouterFunction (Node*node,


MulticastRouterFunctionTyperouterFunctionPtr, intinterfaceIndex)

Parameters:
Set a multicast router function to an interface
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

node

- Pointer to this node

routerFunctionPtr
interfaceIndex

- router Func pointer

- interface number of the node

Returns:
void

- None

NetworkIpGetMulticastRouterFunction

MulticastRouterFunctionType NetworkIpGetMulticastRouterFunction (Node*node, intinterfaceIndex)

Parameters:

Get the multicast router function for an interface

node

- Pointer to this node

interfaceIndex

- interface number of the node

Returns:
MulticastRouterFunctionType

NetworkIpUpdateMulticastRoutingProtocolAndRouterFunction

- Multicast router function on this interface.

void NetworkIpUpdateMulticastRoutingProtocolAndRouterFunction (Node*node,


NetworkRoutingProtocolTyperoutingProtocolType, intinterfaceIndex)

Parameters:
Assign multicast routing protocol structure and router function to
an interface. We are only allocating the multicast routing protocol
structure and router function once by using pointers to the original
structures.

node

- this node

routingProtocolType
interfaceIndex

- multicast routing

- interface index.

Returns:
void

NetworkIpUpdateUnicastRoutingProtocolAndRouterFunction

- None

void NetworkIpUpdateUnicastRoutingProtocolAndRouterFunction (Node*node,


NetworkRoutingProtocolTyperoutingProtocolType, intinterfaceIndex)

Parameters:
Assign unicast routing protocol structure and router function to an
interface. We are only allocating the unicast routing protocol
structure and router function once by using pointers to the original
structures.

node

- this node

routingProtocolType
interfaceIndex

- unicast routing

- interface associated with unicast protocol.

Returns:
void

- None

NetworkIpGetInterfaceIndexFromAddress

int NetworkIpGetInterfaceIndexFromAddress (Node*node, NodeAddressaddress)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Get the interface index from an IP address.

- this node

node

address

- address to determine interface index for

Returns:
int

- interface index associated with specified address.

NetworkIpGetInterfaceIndexFromSubnetAddress

int NetworkIpGetInterfaceIndexFromSubnetAddress (Node*node, NodeAddressaddress)

Parameters:

Get the interface index from an IP subnet address.

- this node

node

address

- subnet address to determine interface

Returns:
int

- interface index associated with specified subnet address.

NetworkIpIsMulticastAddress

BOOL NetworkIpIsMulticastAddress (Node*node, NodeAddressaddress)

Parameters:

Check if an address is a multicast address.

node

- this node

address

- address to determine if multicast address.

Returns:
BOOL

- TRUE if address is multicast address, FALSE, otherwise.

NetworkInitMulticastForwardingTable

void NetworkInitMulticastForwardingTable (Node*node)

Parameters:

initialize the multicast fowarding table, allocate enough memory for


number of rows, used by ip

node

- this node

Returns:
void

- None

NetworkEmptyMulticastForwardingTable

void NetworkEmptyMulticastForwardingTable (Node*node)

Parameters:

empty out all the entries in the multicast forwarding table. basically
set the size of table back to 0.

node

- this node

Returns:
void

NetworkGetOutgoingInterfaceFromMulticastForwardingTable

- None

LinkedList* NetworkGetOutgoingInterfaceFromMulticastForwardingTable (Node*node,


NodeAddresssourceAddress, NodeAddressgroupAddress)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Parameters:
get the interface Id node that lead to the (source, multicast group)
pair.

node

- its own node

sourceAddress
groupAddress

- multicast source address

- multicast group

Returns:
- interface Id from node to (source, multicast group), or NETWORK_UNREACHABLE
(no such entry is found)

LinkedList*

NetworkUpdateMulticastForwardingTable

void NetworkUpdateMulticastForwardingTable (Node*node, NodeAddresssourceAddress,


NodeAddressmulticastGroupAddress, intinterfaceIndex)

Parameters:
update entry with(sourceAddress,multicastGroupAddress) pair.
search for the row with(sourceAddress,multicastGroupAddress) and
update its interface.

node

- its own node

sourceAddress

- multicast source

multicastGroupAddress
interfaceIndex

- multicast group

- interface to use for

Returns:
void

- None

NetworkPrintMulticastForwardingTable

void NetworkPrintMulticastForwardingTable (Node*node)

Parameters:

display all entries in multicast forwarding table of the node.

node

- this node

Returns:
void

- None

NetworkPrintMulticastOutgoingInterface

void NetworkPrintMulticastOutgoingInterface (Node*node, list*list)

Parameters:

Print mulitcast outgoing interfaces.

node

- this node

list

- list of outgoing interfaces.

Returns:
void

NetworkInMulticastOutgoingInterface

- None

BOOL NetworkInMulticastOutgoingInterface (Node*node, List*list, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Determine if interface is in multicast outgoing interface list.

Parameters:
node

- this node

list

- list of outgoing interfaces.

interfaceIndex

- interface to determine if in outgoing

Returns:
- TRUE if interface is in multicast outgoing interface list, FALSE otherwise.

BOOL

NetworkIpPrintTraceXML

void NetworkIpPrintTraceXML (Node*node, Message*msg)

Parameters:

Print packet trace information in XML format.

- this node

node
msg

- Packet to print headers from.

Returns:
- None

void

RouteThePacketUsingLookupTable

void RouteThePacketUsingLookupTable (Node*node, Message*msg, intincomingInterface)

Parameters:

Tries to route and send the packet using the node's forwarding
table.

- this node

node
msg

- Pointer to message with IP packet.

incomingInterface

- incoming interface of packet

Returns:
- NULL

void

GetNetworkIPFragUnit

int GetNetworkIPFragUnit (Node*node, intinterfaceIndex)

Parameters:

Returns the network ip fragmentation unit.

- this node

node

interfaceIndex

- interface of node

Returns:
int

NetworkIpUserProtocolInit

- None

void NetworkIpUserProtocolInit (Node*node, const NodeInput*nodeInput, const


char*routingProtocolString, NetworkRoutingProtocolType*routingProtocolType,
void**routingProtocolData)

Initialization of user protocol(disabled)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

node

- this node

nodeInput

- Provides access to

routingProtocolString

- routing protocol

routingProtocolType

- routing protocol

routingProtocolData

- Access to routing protocol data

Returns:
void

- None

NetworkIpUserHandleProtocolEvent

void NetworkIpUserHandleProtocolEvent (Node*node, Message*msg)

Parameters:

Event handler function of user protocol(disabled)

node
msg

- The node that is handling the event.

- the event that is being handled

Returns:
void

NetworkIpUserHandleProtocolPacket

- None

void NetworkIpUserHandleProtocolPacket (Node*node, Message*msg, unsigned charipProtocol,


NodeAddresssourceAddress, NodeAddressdestinationAddress, intttl)

Parameters:
Process a user protocol generated control packet(disabled)
node
msg

- this node

- message that is being received.

ipProtocol

- ip protocol

sourceAddress

- source address

destinationAddress
ttl

- destination address

- time to live

Returns:
void

- None

NetworkIpUserProtocolFinalize

void NetworkIpUserProtocolFinalize (Node*node, intuserProtocolNumber)

Parameters:

Finalization of user protocol(disabled)

node

- this node

userProtocolNumber
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- protocol number

IP

Returns:
- None

void

Atm_RouteThePacketUsingLookupTable

void Atm_RouteThePacketUsingLookupTable (Node*node, NodeAddress*destAddr, int*outIntf,


NodeAddress*nextHop)

Parameters:
Routing packet received at ATM node
- this node

node

destAddr

- destination Address

outIntf

- this node

nextHop

- nextHop address

Returns:
- None

void

RouteThePacketUsingMulticastForwardingTable

void RouteThePacketUsingMulticastForwardingTable (Node*node, Message*msg,


intincomingInterface)

Parameters:
Tries to route the multicast packet using the multicast forwarding
table.

- this node

node
msg

- Pointer to Message

incomingInterface

- Incomming Interface

Returns:
- NULL.

void

NETWORKIpRoutingInit

int NETWORKIpRoutingInit (Node *node, const NodeInput *nodeInputnodeInput)

Parameters:

Initialization function for network layer. Initializes IP.

- Pointer to node.

node

nodeInput

- Pointer to node input.

Returns:
int

- None

NetworkIpGetBandwidth

Int64 NetworkIpGetBandwidth (Node*node, intinterfaceIndex)

Parameters:

getting the bandwidth information

node

- the node who's bandwidth is needed.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

interfaceIndex

- interface Index.

Returns:
- inverted bandwidth ASSUMPTION : Bandwidth read from interface is in from of bps unit. To
invert the bandwidth we use the equation 10000000 / bandwidth. Where bandwidth is in Kbps unit.

Int64

NetworkIpGetPropDelay

clocktype NetworkIpGetPropDelay (Node*node, intinterfaceIndex)

Parameters:

getting the propagation delay information

node

- the node who's bandwidth is needed.

interfaceIndex

- interface Index.

Returns:
clocktype

- propagation delay ASSUMPTION : Array is exactly 3-byte long.

NetworkIpInterfaceIsEnabled

BOOL NetworkIpInterfaceIsEnabled (Node*node, intinterfaceIndex)

Parameters:

To check the interface is enabled or not?

node

- node structure pointer.

interfaceIndex

- interface Index.

Returns:
BOOL

- None

NetworkIpIsWiredNetwork

BOOL NetworkIpIsWiredNetwork (Node*node, intinterfaceIndex)

Parameters:

Determines if an interface is a wired interface.

node

- node structure pointer.

interfaceIndex

- interface Index.

Returns:
BOOL

- None

NetworkIpIsPointToPointNetwork

BOOL NetworkIpIsPointToPointNetwork (Node*node, intinterfaceIndex)

Parameters:

Determines if an interface is a point-to-point.

node

- node structure pointer.

interfaceIndex

Returns:
BOOL

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

- interface Index.

IP

IsIPV4MulticastEnabledOnInterface

BOOL IsIPV4MulticastEnabledOnInterface (Node*node, intinterfaceIndex)

Parameters:

To check if IPV4 Multicast is enabled on interface?

node

- node structure pointer.

interfaceIndex

- interface Index.

Returns:
BOOL

- None

IsIPV4RoutingEnabledOnInterface

BOOL IsIPV4RoutingEnabledOnInterface (Node*node, intinterfaceIndex)

Parameters:

To check if IPV4 Routing is enabled on interface?

node

- node structure pointer.

interfaceIndex

- interface Index.

Returns:
BOOL

- None

NetworkIpGetNetworkProtocolType

NetworkProtocolType NetworkIpGetNetworkProtocolType (Node*node, NodeAddressnodeId)

Parameters:

Get Network Protocol Type for the node

node

- node structure pointer.

nodeId

- node id.

Returns:
NetworkProtocolType

ResolveNetworkTypeFromSrcAndDestNodeId

- None

NetworkType ResolveNetworkTypeFromSrcAndDestNodeId (Node*node, NodeIdsourceNodeId,


NodeIddestNodeId)

Parameters:
Resolve the NetworkType from source and destination node id's.
node

- Pointer to the node.

sourceNodeId
destNodeId

- Source node id.

- Destination node id.

Returns:
NetworkType

- None

NetworkIpIsWiredBroadcastNetwork

BOOL NetworkIpIsWiredBroadcastNetwork (Node*node, intinterfaceIndex)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IP

Determines if an interface is a wired interface.

node

- node structure pointer.

interfaceIndex

- interface Index.

Returns:
BOOL

- None

FindTraceRouteOption

ip_traceroute* FindTraceRouteOption (const IpHeaderType*ipHeader)

Parameters:

Searches the IP header for the Traceroute option field , and returns
a pointer to traceroute header.

ipHeader

- Pointer to an IP header.

Returns:
- pointer to the header of the traceroute option field. NULL if no option fields, or the
desired option field cannot be found.

ip_traceroute*

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IP.html[10/28/2011 1:28:05 PM]

IPv6

QualNet 5.2 API Reference


IPv6
Data structures and parameters used in network layer are defined here.
Constant / Data Structure Summary
Type

Name

CONSTANT

MAX_KEY_LEN

Maximum Key length of ipv6 address.

CONSTANT

MAX_PREFIX_LEN

Maximum Prefix length of ipv6 address.

CONSTANT

CURR_HOP_LIMIT

Current Hop limit a packet will traverse.

CONSTANT

IPV6_ADDR_LEN

Ipv6 Address Lenght.

CONSTANT

IP6_NHDR_HOP

Hop-by_hop IPv6 Next header field value.

CONSTANT

IP6_NHDR_RT

Routing IPv6 Next header field value.

CONSTANT

IP6_NHDR_FRAG

Fragment IPv6 Next header field value.

CONSTANT

IP6_NHDR_AUTH

Authentication IPv6 Next header field value.

CONSTANT

IP6_NHDR_ESP

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Encryption IPv6 Next header field value.

CONSTANT

IP6_NHDR_IPCP

Compression IPv6 Next header field value.

CONSTANT

IP6_NHDR_OSPF

Compression IPv6 Next header field value.

CONSTANT

IP6_NHDR_DOPT

Destination IPv6 Next header field value.

CONSTANT

IP6_NHDR_NONH

No next header IPv6 Next header field value.

CONSTANT

IPV6_FLOWINFO_VERSION

Flow infromation version.

CONSTANT

IPV6_VERSION

IPv6 version no.

CONSTANT

IP6_MMTU

Minimal MTU and reassembly.

CONSTANT

IPPROTO_ICMPV6

ICMPv6 protocol no.

CONSTANT

IP6ANY_ANYCAST

IPv6 anycast.

CONSTANT

ND_DEFAULT_HOPLIM

Node Discovery hop count.

CONSTANT

IP6_INSOPT_NOALLOC

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

IPv6 insert option with no allocation.

CONSTANT

IP6_INSOPT_RAW

IPv6 insert raw option.

CONSTANT

IP_FORWARDING

IPv6 forwarding flag.

CONSTANT

IP6F_RESERVED_MASK

Reserved fragment flag.

CONSTANT

IP_DF

Don't fragment flag.

CONSTANT

IP6F_MORE_FRAG

More fragments flag.

CONSTANT

IP6F_OFF_MASK

Mask for fragmenting bits.

CONSTANT

IP6_FRAGTTL

Time to live for frags.

CONSTANT

IP6_T_FLAG

T Flag if set indicates transient multicast address.

CONSTANT

Multicast Address Scope Related constants.

CONSTANT

IP_FRAGMENT_HOLD_TIME

IP Fragment hold time.

CONSTANT

IP_ROUTETOIF

IPv6 route to interface.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

CONSTANT

IP_DEFAULT_MULTICAST_TTL

IPv6 route to interface.

CONSTANT

IPTTLDEC

TTL decrement.

CONSTANT

ENETUNREACH

Network unreachable.

CONSTANT

EHOSTUNREACH

Host unreachable.

CONSTANT

MAX_INITIAL_RTR_ADVERT_INTERVAL

Router Advertisement timer.

CONSTANT

RTR_SOLICITATION_INTERVAL

Router Solicitation timer.

CONSTANT

REACHABLE_TIME

reachable time

CONSTANT

UNREACHABLE_TIME

unreachable time

CONSTANT

RETRANS_TIMER

retransmission timer

CONSTANT

MAX_NEIGHBOR_ADVERTISEMENT

maximum neighbor advertisement

CONSTANT

MAX_RTR_SOLICITATIONS

maximum Router Solicitations NOTE : Sending only one Solicitation; modify it once autoconfiguration supported.

CONSTANT

MAX_MULTICAST_SOLICIT

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

maximum multicast solicitation

CONSTANT

MAX_UNICAST_SOLICIT

maximum unicast solicitation

CONSTANT

PKT_EXPIRE_DURATION

Packet expiration interval

CONSTANT

INVALID_LINK_ADDR

Invalid Link Layer Address

CONSTANT

MAX_HASHTABLE_SIZE

Maximum size of Hash-Table

CONSTANT

MAX_REVLOOKUP_SIZE

Maximum Rev Look up hash table size

CONSTANT

IP6_LSRRT

type 0

CONSTANT

IP6_NIMRT

type 1

CONSTANT

IP6_RT_MAX

Maximum number of addresses.

CONSTANT

IP6ANY_HOST_PROXY

proxy (host)

CONSTANT

IP6ANY_ROUTER_PROXY

proxy (router)

STRUCT

ip6_hdr_struct

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

QualNet typedefs struct ip6_hdr_struct to ip6_hdr. struct ip6_hdr_struct is 40 bytes, just like in the BSD code.

STRUCT

in6_multi_struct

QualNet typedefs struct in6_multi_struct to in6_multi. struct in6_multi_struct is just like in the BSD code.

STRUCT

ipv6_h2hhdr_struct

QualNet typedefs struct ipv6_h2hhdr_struct to ipv6_h2hhdr. struct ipv6_h2hhdr_struct is hop-by-Hop Options Header of 14 bytes, just
like in the BSD code.

STRUCT

ipv6_rthdr_struct

QualNet typedefs struct ipv6_rthdr_struct to ipv6_rthdr. struct ipv6_h2hhdr_struct is routing options header of 8 bytes, just like in the
BSD code.

STRUCT

ipv6_rthdr_struct

QualNet typedefs struct ipv6_rthdr_struct to ipv6_rthdr. struct ipv6_h2hhdr_struct is destination options header of 8 bytes, just like in
the BSD code.

STRUCT

ip_moptions_struct

QualNet typedefs struct ip_moptions_struct to ip_moptions. struct ip_moptions_struct is multicast option structure, just like in the BSD
code.

STRUCT

ip6_frag_struct

QualNet typedefs struct ip6_frag_struct to ipv6_fraghdr. struct ip6_frag_struct is fragmentation header structure.

STRUCT

ip6Stat_struct

QualNet typedefs struct ip6stat_struct to ip6Stat. struct ip6stat_struct is statistic information structure.

STRUCT

Ipv6MulticastForwardingTableRow

Structure of an entity of multicast forwarding table.

STRUCT

Ipv6MulticastForwardingTable

Structure of multicast forwarding table

STRUCT

Ipv6MulticastGroupEntry

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Structure for Multicast Group Entry


STRUCT

IPv6InterfaceInfo

QualNet typedefs struct ipv6_interface_struct to IPv6InterfaceInfo. struct ipv6_interface_struct is interface information structure.

STRUCT

messageBuffer

QualNet typedefs struct messageBufferStruct to messageBuffer. struct messageBufferStruct is the buffer to hold messages when
neighbour discovery is not done.

STRUCT

ip6q

QualNet typedefs struct ip6q_struct to ip6q. struct ip6q is a simple queue to hold fragmented packets.

STRUCT

Ipv6FragQueue

Ipv6 fragment queue structure.

STRUCT

FragmetedMsg

QualNet typedefs struct fragmeted_msg_struct to ip6q. struct fragmeted_msg_struct is a simple fragmented packets msg hold structure.

STRUCT

defaultRouterList

default router list structure.

STRUCT

destination_route_struct

QualNet typedefs struct destination_route_struct to destinationRoute. struct destination_route_struct is destination information structure
of a node.

STRUCT

DestinationCache

Destination cache entry structure

STRUCT

Ipv6HashData

Ipv6 hash data structure.

STRUCT

Ipv6HashBlockData

Ipv6 hash block-data structure.

STRUCT

Ipv6HashBlock

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Ipv6 hash block structure.


STRUCT

Ipv6HashTable

Ipv6 hash table structure

STRUCT

IPv6Data

QualNet typedefs struct ipv6_data_struct to IPv6Data. struct ipv6_data_struct is ipv6 information structure of a node.

STRUCT

ndpNadvEvent

QualNet typedefs struct ndp_event_struct to IPv6Data. struct ndp_event_struct is neighbor advertisement information structure.

Function / Macro Summary


Return Type

Summary

MACRO

ND_DEFAULT_CLASS(0xe0)

Node Discovery sets class.


MACRO

NDP_DELAY

NDP neighbor advertisement delay.


MACRO

IPV6JITTER_RANGE

IPv6 jitter timer.


MACRO

IPV6_SET_CLASS(hdr, priority)

Sets the flow class.


MACRO

IPV6_GET_CLASS(hdr)

Gets the flow class.


void

ip6_hdrSetVersion()(UInt32ipv6HdrVcf, UInt32version)

Set the value of version for ip6_hdr


void

ip6_hdrSetClass()(UInt32ipv6HdrVcf, unsigned charipv6Class)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Set the value of class for ip6_hdr


void

ip6_hdrSetFlow()(UInt32ipv6HdrVcf, UInt32flow)

Set the value of flow for ip6_hdr


UInt32

ip6_hdrGetVersion()(unsigned intipv6HdrVcf)

Returns the value of version for ip6_hdr


UInt32

ip6_hdrGetClass()(unsigned intipv6HdrVcf)

Returns the value of ip6_class for ip6_hdr


UInt32

ip6_hdrGetFlow()(unsigned intipv6HdrVcf)

Returns the value of ip6_flow for ip6_hdr


int

in6_isanycast(Node*node, in6_addraddr)

Checks whether the address is anycast address of the node.


None

Ipv6AddIpv6Header(Node*node, Message*msg, in6_addrsrcaddr, in6_addrdst_addr, TosTypepriority, unsigned


charprotocol, unsignedhlim)

Add an IPv6 packet header to a message. Just calls AddIpHeader.


None

Ipv6AddFragmentHeader(Node *nodenode, Message *msgmsg, unsigned charnextHeader, unsigned shortoffset,


unsigned intid)

Adds fragment header


None

Ipv6RemoveIpv6Header(Node *nodenode, Message *msgmsg, Address*sourceAddress, Address*


destinationAddressdestinationAddress, TosType *prioritypriority, unsigned char *protocolprotocol, unsigned
*hLimhLim)

Removes Ipv6 header


None

Ipv6PreInit(Node*node)

IPv6 Pre Initialization.


None

IPv6Init(Node*node, const NodeInput*nodeInput)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

IPv6 Initialization.
BOOL

Ipv6IsMyPacket(Node*node, in6_addr*dst_addr)

Checks whether the packet is the nodes packet. if the packet is of the node then returns TRUE, otherwise FALSE.
BOOL

Ipv6IsAddressInNetwork(const in6_addr*globalAddr, unsigned inttla, unsigned intvla, unsigned intsla)

Checks whether the address is in the same network. : if in the same network then returns TRUE, otherwise FALSE.
NodeAddress

Ipv6GetLinkLayerAddress(Node*node, intinterfaceId, char*ll_addr_str)

Returns 32 bit link layer address of the interface.


None

Ipv6AddNewInterface(Node*node, in6_addr*globalAddr, unsigned inttla, unsigned intnla, unsigned intsla,


int*newinterfaceIndex, const NodeInput*nodeInput)

Adds an ipv6 interface to the node.


BOOL

Ipv6IsForwardingEnabled(IPv6Data*ipv6)

Checks whether the node is forwarding enabled.


None

Ipv6Layer(Node*node, Message*msg)

Handle IPv6 layer events, incoming messages and messages sent to itself (timers, etc.).
None

Ipv6Finalize(Node*node)

Finalize function for the IPv6 model. Finalize functions for all network-layer IPv6 protocols are called here.
int

Ipv6GetMTU(Node*node, intinterfaceId)

Returns the maximum transmission unit of the interface.


int

Ipv6GetInterfaceIndexFromAddress(Node*node, in6_addr*dst)

Returns interface index of the specified address.


None

Ipv6CpuQueueInsert(Node*node, Message*msg, NodeAddressnextHopAddress, in6_addrdestinationAddress,


intoutgoingInterface, intnetworkType, BOOL*queueIsFull)

Calls the cpu packet scheduler for an interface to retrieve an IPv6 packet from a queue associated with the interface. The dequeued
packet, since it's already been routed, has an associated next-hop IPv6 address. The packet's priority value is also returned.
None

Ipv6InputQueueInsert(Node*node, intincomingInterface, Message*msg, NodeAddressnextHopAddress,


in6_addrdestinationAddress, intoutgoingInterface, intnetworkType, BOOL*queueIsFull)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Calls input packet scheduler for an interface to retrieve an IP packet from a queue associated with the interface. The dequeued packet,
since it's already been routed, has an associated next-hop IPv6 address. The packet's priority value is also returned.
None

Ipv6OutputQueueInsert(Node*node, intinterfaceIndex, Message*msg, NodeAddressnextHopAddress,


NodeAddressdestinationAddress, intnetworkType, BOOL*queueIsFull)

Calls output packet scheduler for an interface to retrieve an IP packet from a queue associated with the interface. The dequeued packet,
since it's already been routed, has an associated next-hop IPv6 address. The packet's priority value is also returned. Called by
QueueUpIpFragmentForMacLayer().
None

QueueUpIpv6FragmentForMacLayer(Node*node, intinterfaceIndex, Message*msg, NodeAddressnextHopAddress,


NodeAddressdestinationAddress, intnetworkType, BOOL*queueIsFull)

Calls output packet scheduler for an interface to retrieve an IP packet from a queue associated with the interface. The dequeued packet,
since it's already been routed, has an associated next-hop IPv6 address. The packet's priority value is also returned. Called by
QueueUpIpFragmentForMacLayer().
None

Ipv6SendPacketOnInterface(Node*node, Message*msg, intincommingInterface, intoutgoingInterface,


NodeAddressnextHop)

This function is called once the outgoing interface index and next hop address to which to route an IPv6 packet are known. This queues
an IPv6 packet for delivery to the MAC layer. This functions calls QueueUpIpFragmentForMacLayer(). This function is used to initiate
fragmentation if required,before calling the next function.
None

Ipv6SendOnBackplane(Node*node, Message*msg, intincommingInterface, intoutgoingInterface,


NodeAddresshopAddr)

This function is called when the packet delivered through backplane delay. required,before calling the next function.
None

Ipv6SendRawMessage(Node*node, Message*msg, in6_addrsourceAddress, in6_addrdestinationAddress,


intoutgoingInterface, TosTypepriority, unsigned charprotocol, unsignedttl)

Called by NetworkIpReceivePacketFromTransportLayer() to send to send UDP datagrams using IPv6. This function adds an IPv6
header and calls RoutePacketAndSendToMac().
None

Ipv6SendToUdp(Node*node, Message*msg, TosTypepriority, AddresssourceAddress, AddressdestinationAddress,


intincomingInterfaceIndex)

Sends a UDP packet to UDP in the transport layer. The source IPv6 address, destination IPv6 address, and priority of the packet are also
sent.
None

Ipv6SendToTCP(Node*node, Message*msg, TosTypepriority, AddresssourceAddress, AddressdestinationAddress,


intincomingInterfaceIndex)

Sends a TCP packet to UDP in the transport layer. The source IPv6 address, destination IPv6 address, and priority of the packet are also
sent.
None

Ipv6ReceivePacketFromMacLayer(Node*node, Message*msg, NodeAddresspreviousHopNodeId, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

IPv6 received IPv6 packet from MAC layer. Determine whether the packet is to be delivered to this node, or needs to be forwarded.
BOOL

Ipv6AddMessageInBuffer(Node*node, Message*msg, in6_addr*nextHopAddr, intinCommingInterface)

Adds an ipv6 packet in message in the hold buffer


BOOL

Ipv6DeleteMessageInBuffer(Node*node, messageBuffer*mBuf)

Delets an ipv6 packet in the hold buffer


void

Ipv6DropMessageFromBuffer(Node*node, messageBuffer*mBuf)

Drops an ipv6 packet from the hold buffer


NetworkType

Ipv6GetAddressTypeFromString(char*interfaceAddr)

Returns network type from string ip address.


IPv6 multicast address

Ipv6GetInterfaceMulticastAddress(Node*node, intinterfaceIndex)

Get multicast address of this interface


None

Ipv6SolicitationMulticastAddress(in6_addr*dst_addr, in6_addr*target)

Copies multicast solicitation address.


None

Ipv6AllRoutersMulticastAddress(in6_addr* dstdst)

Function to assign all routers multicast address.


None

IPv6GetLinkLocalAddress(node, intinterface, in6_addr*addr)

Gets ipv6 link local address of the interface in output parameter addr.
None

IPv6GetSiteLocalAddress(node, intinterface, in6_addr*addr)

Gets ipv6 site local address of the interface in output parameter addr.
None

IPv6GetSiteLocalAddress(node, intinterface, in6_addr*addr)

Gets ipv6 global agreeable address of the interface in output parameter addr.
None

Ipv6GetPrefix(in6_addr*addr, in6_addr*prefix)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Gets ipv6 prefix from address.


Prefix for this interface

Ipv6GetPrefixFromInterfaceIndex(Node*node, intinterfaceIndex)

Gets ipv6 prefix from address.


BOOL

Ipv6OutputQueueIsEmpty(Node *nodenode, intinterfaceIndex)

Check weather output queue is empty


None

Ipv6RoutingStaticInit(Node *nodenode, const NodeInputnodeInput, NetworkRoutingProtocolTypetype)

Ipv6 Static routing initialization function.


None

Ipv6RoutingStaticEntry(Node *nodenode, char currentLine[]currentLine)

Static routing route entry function


None

Ipv6AddDestination(Node* nodenode, route* roro)

Adds destination in the destination cache.


None

Ipv6DeleteDestination(Node* nodenode)

Deletes destination from the destination cache.


int

Ipv6CheckForValidPacket(Node* nodenode, SchedulerType* schedulerscheduler, unsigned int* pIndexpIndex)

Checks the packet's validity


None

Ipv6NdpProcessing(Node* nodenode)

Ipv6 Destination cache and neighbor cache : processing function


None

Ipv6UpdateForwardingTable(Node* nodenode, in6_addr destPrefixdestPrefix, in6_addr nextHopPrefixnextHopPrefix,


intinterfaceIndex, int metricmetric)

Updates Ipv6 Forwarding Table


None

Ipv6EmptyForwardingTable(Node* nodenode, NetworkRoutingProtocolType typetype)

Empties Ipv6 Forwarding Table for a particular routing protocol entry


None

Ipv6PrintForwardingTable(Node* nodenode)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Prints the forwarding table.


Interface index associated with
specified subnet address.

Ipv6InterfaceIndexFromSubnetAddress(Node* nodenode, in6_addr*address)

Get the interface index from an IPv6 subnet address.


void

Ipv6GetInterfaceAndNextHopFromForwardingTable(Node* nodenode, in6_addrdestAddr, int*interfaceIndex,


in6_addr*nextHopAddr)

Do a lookup on the routing table with a destination IPv6 address to obtain an outgoing interface and a next hop Ipv6 address.
interface index associated with
destination.

Ipv6GetInterfaceIndexForDestAddress(Node* nodenode, in6_addrdestAddr)

Get interface for the destination address.


interface index associated with
destination.

Ipv6GetMetricForDestAddress(Node* nodenode, in6_addrdestAddr)

Get the cost metric for a destination from the forwarding table.
Interface index associated with
destination if found,

Ipv6IpGetInterfaceIndexForNextHop(Node* nodenode, in6_addrdestAddr)

This function looks at the network address of each of a node's network interfaces. When nextHopAddress is matched to a network, the
interface index corresponding to the network is returned.
Ipv6RouterFunctionType

Ipv6GetRouterFunction(Node*node, intinterfaceIndex)

Get the router function pointer.


void

Ipv6SendPacketToMacLayer(Node* nodenode, Message*msg, in6_addrdestAddr, in6_addr*nextHopAddr,


int*interfaceIndex)

Used if IPv6 next hop address and outgoing interface is known.


void

Ipv6JoinMulticastGroup(Node*node, in6_addrmcastAddr, clocktypedelay)

Join a multicast group.


void

Ipv6AddToMulticastGroupList(Node*node, in6_addrgroupAddress)

Add group to multicast group list.


void

Ipv6LeaveMulticastGroup(Node*node, in6_addrmcastAddr)

Leave a multicast group.


void

Ipv6RemoveFromMulticastGroupList(Node*node, in6_addrgroupAddress)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Remove group from multicast group list.


void

Ipv6NotificationOfPacketDrop(Node*node, Message*msg, const NodeAddressnextHopAddress, intinterfaceIndex)

Invoke callback functions when a packet is dropped.


TRUE if node is part of
multicast group,

Ipv6IsPartOfMulticastGroup(Node*node, Message*msg, in6_addrgroupAddress)

Check if destination is part of the multicast group.


TRUE if reserved multicast
address, FALSE otherwise.

Ipv6IsReservedMulticastAddress(Node*node, in6_addrmcastAddr)

Check if address is reserved multicast address.


TRUE if interface is in multicast
outgoing interface

Ipv6InMulticastOutgoingInterface(Node*node, LinkedList*list, intinterfaceIndex)

Determine if interface is in multicast outgoing interface list.


void

Ipv6UpdateMulticastForwardingTable(Node*node, in6_addrsourceAddress, in6_addrmulticastGroupAddress)

update entry with (sourceAddress, multicastGroupAddress) pair. search for the row with (sourceAddress, multicastGroupAddress) and
update its interface.
Interface List if match found,
NULL otherwise.

Ipv6GetOutgoingInterfaceFromMulticastTable(Node*node, in6_addrsourceAddress, in6_addrgroupAddress)

get the interface List that lead to the (source, multicast group) pair.
void

Ipv6CreateBroadcastAddress()

Create IPv6 Broadcast Address (ff02 followed by all one).


Prefix Length.

Ipv6GetPrefixLength()

Get prefix length of an interface.


void

Ipv6SetMacLayerStatusEventHandlerFunction(Node*node,
Ipv6MacLayerStatusEventHandlerFunctionTypeStatusEventHandlerPtr, intinterfaceIndex)

Allows the MAC layer to send status messages (e.g., packet drop, link failure) to a network-layer routing protocol for routing
optimization.
void

Ipv6DeleteOutboundPacketsToANode(Node*node, const in6_addrnextHopAddress, const in6_addrdestinationAddress,


const BOOLreturnPacketsToRoutingProtocol)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Deletes all packets in the queue going to the specified next hop address. There is option to return all such packets back to the routing
protocols.
void

Ipv6IsLoopbackAddress(Node*node, in6_addraddress)

Check if address is self loopback address.


TRUE if my Ip, FALSE otherwise.

Ipv6IsMyIp(Node*node, in6_addr*dst_addr)

Check if address is self loopback address.


Scope value if valid multicast
address, 0 otherwise.

Ipv6IsValidGetMulticastScope(Node*node, in6_addrmultiAddr)

Check if multicast address has valid scope.


BOOL

IsIPV6RoutingEnabledOnInterface(Node*node, intinterfaceIndex)

To check if IPV6 Routing is enabled on interface?

Constant / Data Structure Detail

Constant

MAX_KEY_LEN128

Constant

Maximum Key length of ipv6 address.


MAX_PREFIX_LEN64

Constant

Maximum Prefix length of ipv6 address.


CURR_HOP_LIMIT255

Constant

Current Hop limit a packet will traverse.


IPV6_ADDR_LEN16

Constant

Ipv6 Address Lenght.


IP6_NHDR_HOP0

Hop-by_hop IPv6 Next header field value.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Constant

IP6_NHDR_RT43

Constant

Routing IPv6 Next header field value.


IP6_NHDR_FRAG44

Constant

Fragment IPv6 Next header field value.


IP6_NHDR_AUTH51

Constant

Authentication IPv6 Next header field value.


IP6_NHDR_ESP50

Constant

Encryption IPv6 Next header field value.


IP6_NHDR_IPCP108

Constant

Compression IPv6 Next header field value.


IP6_NHDR_OSPF89

Constant

Compression IPv6 Next header field value.


IP6_NHDR_DOPT60

Constant

Destination IPv6 Next header field value.


IP6_NHDR_NONH59

Constant

No next header IPv6 Next header field value.


IPV6_FLOWINFO_VERSION0x000000f0

Constant

Flow infromation version.


IPV6_VERSION6

Constant

IPv6 version no.


IP6_MMTU1280

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Constant

Minimal MTU and reassembly.


IPPROTO_ICMPV658

Constant

ICMPv6 protocol no.


IP6ANY_ANYCAST3

Constant

IPv6 anycast.
ND_DEFAULT_HOPLIM255

Constant

Node Discovery hop count.


IP6_INSOPT_NOALLOC1

Constant

IPv6 insert option with no allocation.


IP6_INSOPT_RAW2

Constant

IPv6 insert raw option.


IP_FORWARDING1

Constant

IPv6 forwarding flag.


IP6F_RESERVED_MASK0x0600

Constant

Reserved fragment flag.


IP_DF0x4000

Constant

Don't fragment flag.


IP6F_MORE_FRAG0x01

Constant

More fragments flag.


IP6F_OFF_MASK0xf8ff

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Constant

Mask for fragmenting bits.


IP6_FRAGTTL120

Constant

Time to live for frags.


IP6_T_FLAG0x10

Constant

T Flag if set indicates transient multicast address.


Multicast Address Scope Related constants.

Constant

IP_FRAGMENT_HOLD_TIME60 * SECOND

Constant

IP Fragment hold time.


IP_ROUTETOIF4

Constant

IPv6 route to interface.


IP_DEFAULT_MULTICAST_TTL255

Constant

IPv6 route to interface.


IPTTLDEC1

Constant

TTL decrement.
ENETUNREACH1

Constant

Network unreachable.
EHOSTUNREACH2

Constant

Host unreachable.
MAX_INITIAL_RTR_ADVERT_INTERVAL16 * SECOND

Constant

Router Advertisement timer.


RTR_SOLICITATION_INTERVAL4 * SECOND

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Constant

Router Solicitation timer.


REACHABLE_TIME(30 * SECOND)

Constant

reachable time
UNREACHABLE_TIME(30 * SECOND)

Constant

unreachable time
RETRANS_TIMER(2 * SECOND)

Constant

retransmission timer
MAX_NEIGHBOR_ADVERTISEMENT3

Constant

maximum neighbor advertisement


MAX_RTR_SOLICITATIONS1

Constant

maximum Router Solicitations NOTE : Sending only one Solicitation; modify it once autoconfiguration supported.
MAX_MULTICAST_SOLICIT3

Constant

maximum multicast solicitation


MAX_UNICAST_SOLICIT3

Constant

maximum unicast solicitation


PKT_EXPIRE_DURATION(3 * SECOND)

Constant

Packet expiration interval


INVALID_LINK_ADDR-3

Constant

Invalid Link Layer Address


MAX_HASHTABLE_SIZE4

Maximum size of Hash-Table

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Constant

MAX_REVLOOKUP_SIZE100

Constant

Maximum Rev Look up hash table size


IP6_LSRRT0

Constant

type 0
IP6_NIMRT1

Constant

type 1
IP6_RT_MAX3

Constant

Maximum number of addresses.


IP6ANY_HOST_PROXY1

Constant

proxy (host)
IP6ANY_ROUTER_PROXY2

Structure

proxy (router)
ip6_hdr_struct

Structure

QualNet typedefs struct ip6_hdr_struct to ip6_hdr. struct ip6_hdr_struct is 40 bytes, just like in the BSD code.
in6_multi_struct

Structure

QualNet typedefs struct in6_multi_struct to in6_multi. struct in6_multi_struct is just like in the BSD code.
ipv6_h2hhdr_struct

Structure

QualNet typedefs struct ipv6_h2hhdr_struct to ipv6_h2hhdr. struct ipv6_h2hhdr_struct is hop-by-Hop Options Header of 14 bytes, just
like in the BSD code.
ipv6_rthdr_struct

QualNet typedefs struct ipv6_rthdr_struct to ipv6_rthdr. struct ipv6_h2hhdr_struct is routing options header of 8 bytes, just like in the BSD
code.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Structure

ipv6_rthdr_struct

Structure

QualNet typedefs struct ipv6_rthdr_struct to ipv6_rthdr. struct ipv6_h2hhdr_struct is destination options header of 8 bytes, just like in the
BSD code.
ip_moptions_struct

Structure

QualNet typedefs struct ip_moptions_struct to ip_moptions. struct ip_moptions_struct is multicast option structure, just like in the BSD
code.
ip6_frag_struct

Structure

QualNet typedefs struct ip6_frag_struct to ipv6_fraghdr. struct ip6_frag_struct is fragmentation header structure.
ip6Stat_struct

Structure

QualNet typedefs struct ip6stat_struct to ip6Stat. struct ip6stat_struct is statistic information structure.
Ipv6MulticastForwardingTableRow

Structure

Structure of an entity of multicast forwarding table.


Ipv6MulticastForwardingTable

Structure

Structure of multicast forwarding table


Ipv6MulticastGroupEntry

Structure

Structure for Multicast Group Entry


IPv6InterfaceInfo

Structure

QualNet typedefs struct ipv6_interface_struct to IPv6InterfaceInfo. struct ipv6_interface_struct is interface information structure.
messageBuffer

Structure

QualNet typedefs struct messageBufferStruct to messageBuffer. struct messageBufferStruct is the buffer to hold messages when
neighbour discovery is not done.
ip6q

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Structure

QualNet typedefs struct ip6q_struct to ip6q. struct ip6q is a simple queue to hold fragmented packets.
Ipv6FragQueue

Structure

Ipv6 fragment queue structure.


FragmetedMsg

Structure

QualNet typedefs struct fragmeted_msg_struct to ip6q. struct fragmeted_msg_struct is a simple fragmented packets msg hold structure.
defaultRouterList

Structure

default router list structure.


destination_route_struct

Structure

QualNet typedefs struct destination_route_struct to destinationRoute. struct destination_route_struct is destination information structure of
a node.
DestinationCache

Structure

Destination cache entry structure


Ipv6HashData

Structure

Ipv6 hash data structure.


Ipv6HashBlockData

Structure

Ipv6 hash block-data structure.


Ipv6HashBlock

Structure

Ipv6 hash block structure.


Ipv6HashTable

Structure

Ipv6 hash table structure


IPv6Data

QualNet typedefs struct ipv6_data_struct to IPv6Data. struct ipv6_data_struct is ipv6 information structure of a node.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Structure

ndpNadvEvent

QualNet typedefs struct ndp_event_struct to IPv6Data. struct ndp_event_struct is neighbor advertisement information structure.

Function / Macro Detail


Function / Macro
ND_DEFAULT_CLASS(0xe0)

Format
Node Discovery sets class.

NDP_DELAY

NDP neighbor advertisement delay.

IPV6JITTER_RANGE

IPv6 jitter timer.

IPV6_SET_CLASS(hdr, priority)

Sets the flow class.

IPV6_GET_CLASS(hdr)

Gets the flow class.

ip6_hdrSetVersion()

void ip6_hdrSetVersion() (UInt32ipv6HdrVcf, UInt32version)

Parameters:

Set the value of version for ip6_hdr

ipv6HdrVcf
version

- The variable containing the value of ip6_v,ip6_class

- Input value for set operation

Returns:
void

- NULL.

ip6_hdrSetClass()

void ip6_hdrSetClass() (UInt32ipv6HdrVcf, unsigned charipv6Class)

Parameters:

Set the value of class for ip6_hdr

ipv6HdrVcf
ipv6Class

- The variable containing the value of ip6_v,ip6_class

- Input value for set operation

Returns:
void

ip6_hdrSetFlow()

- NULL.

void ip6_hdrSetFlow() (UInt32ipv6HdrVcf, UInt32flow)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Set the value of flow for ip6_hdr

Parameters:
ipv6HdrVcf

- The variable containing the value of ip6_v,ip6_class

- Input value for set operation

flow

Returns:
- NULL.

void

ip6_hdrGetVersion()

UInt32 ip6_hdrGetVersion() (unsigned intipv6HdrVcf)

Parameters:

Returns the value of version for ip6_hdr

ipv6HdrVcf

- The variable containing the value of ip6_v,ip6_class

Returns:
UInt32

- None

ip6_hdrGetClass()

UInt32 ip6_hdrGetClass() (unsigned intipv6HdrVcf)

Parameters:

Returns the value of ip6_class for ip6_hdr

ipv6HdrVcf

- The variable containing the value of ip6_v,ip6_class

Returns:
UInt32

- None

ip6_hdrGetFlow()

UInt32 ip6_hdrGetFlow() (unsigned intipv6HdrVcf)

Parameters:

Returns the value of ip6_flow for ip6_hdr

ipv6HdrVcf

- The variable containing the value of ip6_v,ip6_class

Returns:
UInt32

- None

in6_isanycast

int in6_isanycast (Node*node, in6_addraddr)

Parameters:

Checks whether the address is anycast address of the


node.

node

- Pointer to node structure.

addr

- ipv6 address.

Returns:
int

Ipv6AddIpv6Header

- None

None Ipv6AddIpv6Header (Node*node, Message*msg, in6_addrsrcaddr, in6_addrdst_addr, TosTypepriority,


unsigned charprotocol, unsignedhlim)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Parameters:
Add an IPv6 packet header to a message. Just calls
AddIpHeader.

node
msg

- Pointer to node.

- Pointer to message.

srcaddr

- Source IPv6 address.

dst_addr

- Destination IPv6 address.

priority

- Current type of service

protocol

- IPv6 protocol number.

hlim

- Hop limit.

Returns:
None

Ipv6AddFragmentHeader

- None

None Ipv6AddFragmentHeader (Node *nodenode, Message *msgmsg, unsigned charnextHeader, unsigned


shortoffset, unsigned intid)

Parameters:
Adds fragment header
node
msg

- Pointer to node

- Pointer to Message

nextHeader
offset
id

- nextHeader

- offset

- id

Returns:
None

Ipv6RemoveIpv6Header

- None

None Ipv6RemoveIpv6Header (Node *nodenode, Message *msgmsg, Address*sourceAddress, Address*


destinationAddressdestinationAddress, TosType *prioritypriority, unsigned char *protocolprotocol, unsigned
*hLimhLim)

Removes Ipv6 header

Parameters:
node
msg

- Pointer to node

- Pointer to message

sourceAddress

- Poineter Source address

destinationAddress
priority

- Destination address

- Priority

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

protocol
hLim

- protocol

- hLim

Returns:
None

- None

Ipv6PreInit

None Ipv6PreInit (Node*node)

Parameters:

IPv6 Pre Initialization.

node

- Pointer to node structure.

Returns:
None

- None

IPv6Init

None IPv6Init (Node*node, const NodeInput*nodeInput)

Parameters:

IPv6 Initialization.

node

- Pointer to node structure.

nodeInput

- Node input.

Returns:
None

- None

Ipv6IsMyPacket

BOOL Ipv6IsMyPacket (Node*node, in6_addr*dst_addr)

Parameters:

Checks whether the packet is the nodes packet. if the


packet is of the node then returns TRUE, otherwise
FALSE.

node

- Pointer to node structure.

dst_addr

- ipv6 packet destination address.

Returns:
BOOL

- None

Ipv6IsAddressInNetwork

BOOL Ipv6IsAddressInNetwork (const in6_addr*globalAddr, unsigned inttla, unsigned intvla, unsigned intsla)

Parameters:

Checks whether the address is in the same network. : if


in the same network then returns TRUE, otherwise
FALSE.

globalAddr

- Pointer to ipv6 address.

tla

- Top level ipv6 address.

vla

- Next level ipv6 address.

sla

- Site local ipv6 address.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

BOOL

- None

Ipv6GetLinkLayerAddress

NodeAddress Ipv6GetLinkLayerAddress (Node*node, intinterfaceId, char*ll_addr_str)

Parameters:

Returns 32 bit link layer address of the interface.

node

- Pointer to node structure.

interfaceId

- Interface Id.

ll_addr_str

- Pointer to character link layer

Returns:
NodeAddress

Ipv6AddNewInterface

- None

None Ipv6AddNewInterface (Node*node, in6_addr*globalAddr, unsigned inttla, unsigned intnla, unsigned intsla,
int*newinterfaceIndex, const NodeInput*nodeInput)

Parameters:
Adds an ipv6 interface to the node.
node

- Pointer to node structure.

globalAddr

- Global ipv6 address pointer.

tla

- Top level id.

nla

- Next level id.

sla

- Site level id.

newinterfaceIndex
nodeInput

- Pointer to new interface index.

- Node Input.

Returns:
None

- None

Ipv6IsForwardingEnabled

BOOL Ipv6IsForwardingEnabled (IPv6Data*ipv6)

Parameters:

Checks whether the node is forwarding enabled.

ipv6

- Pointer to ipv6 data structure.

Returns:
BOOL

- None

Ipv6Layer

None Ipv6Layer (Node*node, Message*msg)

Parameters:

Handle IPv6 layer events, incoming messages and

node

- Pointer to node.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

messages sent to itself (timers, etc.).


msg

- Pointer to message.

Returns:
None

- None

Ipv6Finalize

None Ipv6Finalize (Node*node)

Parameters:

Finalize function for the IPv6 model. Finalize functions


for all network-layer IPv6 protocols are called here.

node

- Pointer to node.

Returns:
None

- None

Ipv6GetMTU

int Ipv6GetMTU (Node*node, intinterfaceId)

Parameters:

Returns the maximum transmission unit of the interface.

node

- Pointer to node.

interfaceId

- Interface Id.

Returns:
int

- None

Ipv6GetInterfaceIndexFromAddress

int Ipv6GetInterfaceIndexFromAddress (Node*node, in6_addr*dst)

Parameters:

Returns interface index of the specified address.

node
dst

- Pointer to node.

- IPv6 address.

Returns:
int

Ipv6CpuQueueInsert

- None

None Ipv6CpuQueueInsert (Node*node, Message*msg, NodeAddressnextHopAddress,


in6_addrdestinationAddress, intoutgoingInterface, intnetworkType, BOOL*queueIsFull)

Parameters:
Calls the cpu packet scheduler for an interface to
retrieve an IPv6 packet from a queue associated with the
interface. The dequeued packet, since it's already been
routed, has an associated next-hop IPv6 address. The
packet's priority value is also returned.

node
msg

- Pointer to node.

- Pointer to message with IPv6 packet.

nextHopAddress

- Packet's next hop link layer address.

destinationAddress
outgoingInterface

- Packet's destination address.

- Used to determine where packet

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

networkType

- Type of network packet is using (IPv6,

queueIsFull

- Storage for boolean indicator.

Returns:
None

Ipv6InputQueueInsert

- None

None Ipv6InputQueueInsert (Node*node, intincomingInterface, Message*msg, NodeAddressnextHopAddress,


in6_addrdestinationAddress, intoutgoingInterface, intnetworkType, BOOL*queueIsFull)

Parameters:
Calls input packet scheduler for an interface to retrieve
an IP packet from a queue associated with the interface.
The dequeued packet, since it's already been routed, has
an associated next-hop IPv6 address. The packet's
priority value is also returned.

node

- Pointer to node.

incomingInterface
msg

- interface of input queue.

- Pointer to message with IPv6 packet.

nextHopAddress

- Packet's next hop link layer address.

destinationAddress
outgoingInterface

- Packet's destination address.

- Used to determine where packet

networkType

- Type of network packet is using (IPv6,

queueIsFull

- Storage for boolean indicator.

Returns:
None

Ipv6OutputQueueInsert

- None

None Ipv6OutputQueueInsert (Node*node, intinterfaceIndex, Message*msg, NodeAddressnextHopAddress,


NodeAddressdestinationAddress, intnetworkType, BOOL*queueIsFull)

Parameters:
Calls output packet scheduler for an interface to retrieve
an IP packet from a queue associated with the interface.
The dequeued packet, since it's already been routed, has
an associated next-hop IPv6 address. The packet's
priority value is also returned. Called by
QueueUpIpFragmentForMacLayer().

node

- Pointer to node.

interfaceIndex
msg

- interface of input queue.

- Pointer to message with IPv6 packet.

nextHopAddress

- Packet's next link layer hop address.

destinationAddress

- Packet's destination address.

networkType

- Type of network packet is using (IPv6,

queueIsFull

- Storage for boolean indicator.

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

None

QueueUpIpv6FragmentForMacLayer

- None

None QueueUpIpv6FragmentForMacLayer (Node*node, intinterfaceIndex, Message*msg,


NodeAddressnextHopAddress, NodeAddressdestinationAddress, intnetworkType, BOOL*queueIsFull)

Parameters:
Calls output packet scheduler for an interface to retrieve
an IP packet from a queue associated with the interface.
The dequeued packet, since it's already been routed, has
an associated next-hop IPv6 address. The packet's
priority value is also returned. Called by
QueueUpIpFragmentForMacLayer().

node

- Pointer to node.

interfaceIndex
msg

- interface of input queue.

- Pointer to message with IPv6 packet.

nextHopAddress

- Packet's next hop address.

destinationAddress

- Packet's destination address.

networkType

- Type of network packet is using (IPv6,

queueIsFull

- Storage for boolean indicator.

Returns:
None

Ipv6SendPacketOnInterface

- None

None Ipv6SendPacketOnInterface (Node*node, Message*msg, intincommingInterface, intoutgoingInterface,


NodeAddressnextHop)

Parameters:
This function is called once the outgoing interface index
and next hop address to which to route an IPv6 packet
are known. This queues an IPv6 packet for delivery to
the MAC layer. This functions calls
QueueUpIpFragmentForMacLayer(). This function is
used to initiate fragmentation if required,before calling
the next function.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

incommingInterface
outgoingInterface
nextHop

- Index of incoming interface.

- Index of outgoing interface.

- Next hop link layer address.

Returns:
None

Ipv6SendOnBackplane

- None

None Ipv6SendOnBackplane (Node*node, Message*msg, intincommingInterface, intoutgoingInterface,


NodeAddresshopAddr)

Parameters:
This function is called when the packet delivered
through backplane delay. required,before calling the
next function.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

incommingInterface

- Index of incomming interface.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

outgoingInterface
hopAddr

- Index of outgoing interface.

- Next hop link layer address.

Returns:
None

Ipv6SendRawMessage

- None

None Ipv6SendRawMessage (Node*node, Message*msg, in6_addrsourceAddress, in6_addrdestinationAddress,


intoutgoingInterface, TosTypepriority, unsigned charprotocol, unsignedttl)

Parameters:
Called by
NetworkIpReceivePacketFromTransportLayer() to send
to send UDP datagrams using IPv6. This function adds
an IPv6 header and calls RoutePacketAndSendToMac().

node
msg

- Pointer to node.

- Pointer to message with payload data

sourceAddress

- Source IPv6 address.

destinationAddress
outgoingInterface

- Destination IPv6 address.

- outgoing interface to use to

priority

- Priority of packet.

protocol

- IPv6 protocol number.

ttl

- Time to live.

Returns:
None

Ipv6SendToUdp

- None

None Ipv6SendToUdp (Node*node, Message*msg, TosTypepriority, AddresssourceAddress,


AddressdestinationAddress, intincomingInterfaceIndex)

Parameters:
Sends a UDP packet to UDP in the transport layer. The
source IPv6 address, destination IPv6 address, and
priority of the packet are also sent.

node
msg

- Pointer to node.

- Pointer to message with UDP packet.

priority

- Priority of UDP

sourceAddress

- Source IP address info.

destinationAddress

- Destination IP address info.

incomingInterfaceIndex

- interface that received the packet

Returns:
None

Ipv6SendToTCP

- None

None Ipv6SendToTCP (Node*node, Message*msg, TosTypepriority, AddresssourceAddress,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

AddressdestinationAddress, intincomingInterfaceIndex)

Parameters:
Sends a TCP packet to UDP in the transport layer. The
source IPv6 address, destination IPv6 address, and
priority of the packet are also sent.

node
msg

- Pointer to node.

- Pointer to message with UDP packet.

priority

- Priority of TCP

sourceAddress

- Source IP address info.

destinationAddress

- Destination IP address info.

incomingInterfaceIndex

- interface that received the packet

Returns:
None

Ipv6ReceivePacketFromMacLayer

- None

None Ipv6ReceivePacketFromMacLayer (Node*node, Message*msg, NodeAddresspreviousHopNodeId,


intinterfaceIndex)

Parameters:
IPv6 received IPv6 packet from MAC layer. Determine
whether the packet is to be delivered to this node, or
needs to be forwarded.

node
msg

- Pointer to node.

- Pointer to message with ip packet.

previousHopNodeId
interfaceIndex

- nodeId of the previous hop.

- Index of interface on which packet arrived.

Returns:
None

- None

Ipv6AddMessageInBuffer

BOOL Ipv6AddMessageInBuffer (Node*node, Message*msg, in6_addr*nextHopAddr, intinCommingInterface)

Parameters:

Adds an ipv6 packet in message in the hold buffer

node
msg

- Pointer to node structure.

- Pointer to message with ip packet.

nextHopAddr

- Source IPv6 address.

inCommingInterface

- Incoming interface

Returns:
BOOL

Ipv6DeleteMessageInBuffer

- None

BOOL Ipv6DeleteMessageInBuffer (Node*node, messageBuffer*mBuf)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Delets an ipv6 packet in the hold buffer

Parameters:
node

- Pointer to node structure.

mBuf

- Pointer to messageBuffer tail.

Returns:
BOOL

- None

Ipv6DropMessageFromBuffer

void Ipv6DropMessageFromBuffer (Node*node, messageBuffer*mBuf)

Parameters:

Drops an ipv6 packet from the hold buffer

node

- Pointer to node structure.

mBuf

- Pointer to messageBuffer tail.

Returns:
void

- None

Ipv6GetAddressTypeFromString

NetworkType Ipv6GetAddressTypeFromString (char*interfaceAddr)

Parameters:

Returns network type from string ip address.

interfaceAddr

- Character Pointer to ip address.

Returns:
NetworkType

- None

Ipv6GetInterfaceMulticastAddress

IPv6 multicast address Ipv6GetInterfaceMulticastAddress (Node*node, intinterfaceIndex)

Parameters:

Get multicast address of this interface

node

- Node pointer

interfaceIndex

- interface for which multicast is required

Returns:
IPv6 multicast address

- None

Ipv6SolicitationMulticastAddress

None Ipv6SolicitationMulticastAddress (in6_addr*dst_addr, in6_addr*target)

Parameters:

Copies multicast solicitation address.

dst_addr
target

- ipv6 address pointer.

- ipv6 multicast address pointer.

Returns:
None

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Ipv6AllRoutersMulticastAddress

None Ipv6AllRoutersMulticastAddress (in6_addr* dstdst)

Parameters:

Function to assign all routers multicast address.

dst

- IPv6 address pointer,

Returns:
None

- None

IPv6GetLinkLocalAddress

None IPv6GetLinkLocalAddress (node, intinterface, in6_addr*addr)

Parameters:

Gets ipv6 link local address of the interface in output


parameter addr.

node

- Pointer to the node structure.

interface
addr

- interface Index.

- ipv6 address pointer.

Returns:
None

- None

IPv6GetSiteLocalAddress

None IPv6GetSiteLocalAddress (node, intinterface, in6_addr*addr)

Parameters:

Gets ipv6 site local address of the interface in output


parameter addr.

node

- Pointer to the node structure.

interface
addr

- interface Index.

- ipv6 address pointer.

Returns:
None

- None

IPv6GetSiteLocalAddress

None IPv6GetSiteLocalAddress (node, intinterface, in6_addr*addr)

Parameters:

Gets ipv6 global agreeable address of the interface in


output parameter addr.

node

- Pointer to the node structure.

interface
addr

- interface Index.

- ipv6 address pointer.

Returns:
None

Ipv6GetPrefix

- None

None Ipv6GetPrefix (in6_addr*addr, in6_addr*prefix)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Gets ipv6 prefix from address.

Parameters:
addr

- ipv6 address pointer.

prefix

- ipv6 prefix pointer.

Returns:
None

- None

Ipv6GetPrefixFromInterfaceIndex

Prefix for this interface Ipv6GetPrefixFromInterfaceIndex (Node*node, intinterfaceIndex)

Parameters:

Gets ipv6 prefix from address.

node

- Node pointer

interfaceIndex

- interface for which multicast is required

Returns:
Prefix for this interface

- None

Ipv6OutputQueueIsEmpty

BOOL Ipv6OutputQueueIsEmpty (Node *nodenode, intinterfaceIndex)

Parameters:

Check weather output queue is empty

node

- Pointer to Node

interfaceIndex

- interfaceIndex

Returns:
BOOL

- None

Ipv6RoutingStaticInit

None Ipv6RoutingStaticInit (Node *nodenode, const NodeInputnodeInput, NetworkRoutingProtocolTypetype)

Parameters:

Ipv6 Static routing initialization function.

node

- Pointer to node

nodeInput
type

- *nodeInput

- type

Returns:
None

- None

Ipv6RoutingStaticEntry

None Ipv6RoutingStaticEntry (Node *nodenode, char currentLine[]currentLine)

Parameters:

Static routing route entry function

node

- Pointer to node

currentLine

- Static entry's current line.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Returns:
None

- None

Ipv6AddDestination

None Ipv6AddDestination (Node* nodenode, route* roro)

Parameters:

Adds destination in the destination cache.

node
ro

- Pointer to node

- Pointer to destination route.

Returns:
None

- None

Ipv6DeleteDestination

None Ipv6DeleteDestination (Node* nodenode)

Parameters:

Deletes destination from the destination cache.

node

- Pointer to node

Returns:
None

- None

Ipv6CheckForValidPacket

int Ipv6CheckForValidPacket (Node* nodenode, SchedulerType* schedulerscheduler, unsigned int* pIndexpIndex)

Parameters:

Checks the packet's validity

node

- Pointer to node

scheduler
pIndex

- pointer to scheduler

- packet index

Returns:
int

- None

Ipv6NdpProcessing

None Ipv6NdpProcessing (Node* nodenode)

Parameters:

Ipv6 Destination cache and neighbor cache : processing


function

node

- Pointer to node

Returns:
None

Ipv6UpdateForwardingTable

- None

None Ipv6UpdateForwardingTable (Node* nodenode, in6_addr destPrefixdestPrefix, in6_addr


nextHopPrefixnextHopPrefix, intinterfaceIndex, int metricmetric)

Parameters:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Updates Ipv6 Forwarding Table


node

- Pointer to node

destPrefix

- IPv6 destination address

nextHopPrefix

- IPv6 next hop address for this destination

interfaceIndex
metric

- interfaceIndex

- hop count between source and destination

Returns:
None

- None

Ipv6EmptyForwardingTable

None Ipv6EmptyForwardingTable (Node* nodenode, NetworkRoutingProtocolType typetype)

Parameters:

Empties Ipv6 Forwarding Table for a particular routing


protocol entry

node

- Pointer to node

type

- Routing protocol type

Returns:
None

- None

Ipv6PrintForwardingTable

None Ipv6PrintForwardingTable (Node* nodenode)

Parameters:

Prints the forwarding table.

node

- Pointer to node

Returns:
None

Ipv6InterfaceIndexFromSubnetAddress

- None

Interface index associated with specified subnet address. Ipv6InterfaceIndexFromSubnetAddress (Node* nodenode,
in6_addr*address)

Parameters:
Get the interface index from an IPv6 subnet address.
node

- Pointer to node

address

- Subnet Address

Returns:
Interface index associated with specified subnet address.

Ipv6GetInterfaceAndNextHopFromForwardingTable

- None

void Ipv6GetInterfaceAndNextHopFromForwardingTable (Node* nodenode, in6_addrdestAddr,


int*interfaceIndex, in6_addr*nextHopAddr)

Parameters:
Do a lookup on the routing table with a destination IPv6
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

address to obtain an outgoing interface and a next hop


Ipv6 address.

node

- Pointer to node

destAddr

- Destination Address

interfaceIndex
nextHopAddr

- Pointer to interface index

- Next Hop Addr for destination.

Returns:
void

Ipv6GetInterfaceIndexForDestAddress

- NULL.

interface index associated with destination. Ipv6GetInterfaceIndexForDestAddress (Node* nodenode,


in6_addrdestAddr)

Parameters:
Get interface for the destination address.
node

- Pointer to node

destAddr

- Destination Address

Returns:
interface index associated with destination.

- None

Ipv6GetMetricForDestAddress

interface index associated with destination. Ipv6GetMetricForDestAddress (Node* nodenode, in6_addrdestAddr)

Parameters:

Get the cost metric for a destination from the


forwarding table.

node

- Pointer to node

destAddr

- Destination Address

Returns:
interface index associated with destination.

Ipv6IpGetInterfaceIndexForNextHop

- None

Interface index associated with destination if found, Ipv6IpGetInterfaceIndexForNextHop (Node* nodenode,


in6_addrdestAddr)

Parameters:
This function looks at the network address of each of a
node's network interfaces. When nextHopAddress is
matched to a network, the interface index corresponding
to the network is returned.

node

- Pointer to node

destAddr

- Destination Address

Returns:
Interface index associated with destination if found,

- None

Ipv6GetRouterFunction

Ipv6RouterFunctionType Ipv6GetRouterFunction (Node*node, intinterfaceIndex)

Parameters:

Get the router function pointer.

node

- Pointer to node.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

interfaceIndex

- interface associated with router function

Returns:
Ipv6RouterFunctionType

Ipv6SendPacketToMacLayer

- router function pointer.

void Ipv6SendPacketToMacLayer (Node* nodenode, Message*msg, in6_addrdestAddr, in6_addr*nextHopAddr,


int*interfaceIndex)

Parameters:
Used if IPv6 next hop address and outgoing interface is
known.

node
msg

- Pointer to node

- Pointer to message

destAddr

- Destination Address

nextHopAddr

- Next Hop Addr for destination.

interfaceIndex

- Pointer to interface index

Returns:
- NULL.

void

Ipv6JoinMulticastGroup

void Ipv6JoinMulticastGroup (Node*node, in6_addrmcastAddr, clocktypedelay)

Parameters:

Join a multicast group.

node

- Pointer to node.

mcastAddr
delay

- multicast group to join.

- delay.

Returns:
void

- NULL.

Ipv6AddToMulticastGroupList

void Ipv6AddToMulticastGroupList (Node*node, in6_addrgroupAddress)

Parameters:

Add group to multicast group list.

node

- Pointer to node.

groupAddress

- Group to add to multicast group list.

Returns:
void

- NULL.

Ipv6LeaveMulticastGroup

void Ipv6LeaveMulticastGroup (Node*node, in6_addrmcastAddr)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Leave a multicast group.

node

- Pointer to node.

mcastAddr

- multicast group to leave.

Returns:
void

- NULL.

Ipv6RemoveFromMulticastGroupList

void Ipv6RemoveFromMulticastGroupList (Node*node, in6_addrgroupAddress)

Parameters:

Remove group from multicast group list.

node

- Pointer to node.

groupAddress

- Group to be removed from multicast

Returns:
void

Ipv6NotificationOfPacketDrop

- NULL.

void Ipv6NotificationOfPacketDrop (Node*node, Message*msg, const NodeAddressnextHopAddress,


intinterfaceIndex)

Parameters:
Invoke callback functions when a packet is dropped.
node
msg

- Pointer to node.

- Pointer to message.

nextHopAddress

- Next Hop Address

interfaceIndex

- Interface Index

Returns:
void

Ipv6IsPartOfMulticastGroup

- NULL.

TRUE if node is part of multicast group, Ipv6IsPartOfMulticastGroup (Node*node, Message*msg,


in6_addrgroupAddress)

Parameters:
Check if destination is part of the multicast group.
node
msg

- Pointer to node.

- Pointer to message.

groupAddress

- Multicast Address

Returns:
TRUE if node is part of multicast group,

Ipv6IsReservedMulticastAddress

- None

TRUE if reserved multicast address, FALSE otherwise. Ipv6IsReservedMulticastAddress (Node*node,


in6_addrmcastAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Parameters:
Check if address is reserved multicast address.
node

- Pointer to node.

mcastAddr

- multicast group to join.

Returns:
TRUE if reserved multicast address, FALSE otherwise.

Ipv6InMulticastOutgoingInterface

- None

TRUE if interface is in multicast outgoing interface Ipv6InMulticastOutgoingInterface (Node*node, LinkedList*list,


intinterfaceIndex)

Parameters:
Determine if interface is in multicast outgoing interface
list.

node

- Pointer to node.

list

- Pointer to Linked List.

interfaceIndex

- Interface Index.

Returns:
TRUE if interface is in multicast outgoing interface

- None

Ipv6UpdateMulticastForwardingTable

void Ipv6UpdateMulticastForwardingTable (Node*node, in6_addrsourceAddress, in6_addrmulticastGroupAddress)

Parameters:

update entry with (sourceAddress,


multicastGroupAddress) pair. search for the row with
(sourceAddress, multicastGroupAddress) and update its
interface.

node

- Pointer to node.

sourceAddress

- Source Address.

multicastGroupAddress

- multicast group.

Returns:
void

Ipv6GetOutgoingInterfaceFromMulticastTable

- NULL.

Interface List if match found, NULL otherwise. Ipv6GetOutgoingInterfaceFromMulticastTable (Node*node,


in6_addrsourceAddress, in6_addrgroupAddress)

Parameters:
get the interface List that lead to the (source, multicast
group) pair.

node

- Pointer to node.

sourceAddress
groupAddress

- Source Address

- multicast group address

Returns:
Interface List if match found, NULL otherwise.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

- None

IPv6

Ipv6CreateBroadcastAddress

void Ipv6CreateBroadcastAddress ()

Parameters:

Create IPv6 Broadcast Address (ff02 followed by all


one).

Returns:
void

- NULL.

Ipv6GetPrefixLength

Prefix Length. Ipv6GetPrefixLength ()

Parameters:

Get prefix length of an interface.

Returns:
Prefix Length.

Ipv6SetMacLayerStatusEventHandlerFunction

- None

void Ipv6SetMacLayerStatusEventHandlerFunction (Node*node,


Ipv6MacLayerStatusEventHandlerFunctionTypeStatusEventHandlerPtr, intinterfaceIndex)

Parameters:
Allows the MAC layer to send status messages (e.g.,
packet drop, link failure) to a network-layer routing
protocol for routing optimization.

node

- Pointer to node.

StatusEventHandlerPtr
interfaceIndex

- Function Pointer

- Interface Index

Returns:
void

Ipv6DeleteOutboundPacketsToANode

- NULL.

void Ipv6DeleteOutboundPacketsToANode (Node*node, const in6_addrnextHopAddress, const


in6_addrdestinationAddress, const BOOLreturnPacketsToRoutingProtocol)

Parameters:
Deletes all packets in the queue going to the specified
next hop address. There is option to return all such
packets back to the routing protocols.

node

- Pointer to node.

nextHopAddress

- Next Hop Address.

destinationAddress

- Destination Address

returnPacketsToRoutingProtocol

- bool

Returns:
void

- NULL.

Ipv6IsLoopbackAddress

void Ipv6IsLoopbackAddress (Node*node, in6_addraddress)

Parameters:

Check if address is self loopback address.

node

- Pointer to node.

address

- ipv6 address

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Returns:
void

- NULL.

Ipv6IsMyIp

TRUE if my Ip, FALSE otherwise. Ipv6IsMyIp (Node*node, in6_addr*dst_addr)

Parameters:

Check if address is self loopback address.

node

- Pointer to node.

dst_addr

- Pointer to ipv6 address

Returns:
TRUE if my Ip, FALSE otherwise.

- None

Ipv6IsValidGetMulticastScope

Scope value if valid multicast address, 0 otherwise. Ipv6IsValidGetMulticastScope (Node*node, in6_addrmultiAddr)

Parameters:

Check if multicast address has valid scope.

node

- Pointer to node.

multiAddr

- multicast address.

Returns:
Scope value if valid multicast address, 0 otherwise.

- None

IsIPV6RoutingEnabledOnInterface

BOOL IsIPV6RoutingEnabledOnInterface (Node*node, intinterfaceIndex)

Parameters:

To check if IPV6 Routing is enabled on interface?

node

- node structure pointer.

interfaceIndex

- interface Index.

Returns:
BOOL

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

IPv6

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/IPv6.html[10/28/2011 1:28:20 PM]

LIST

QualNet 5.2 API Reference


LIST
This file describes the data structures and functions used in the implementation of lists.
Constant / Data Structure Summary
Type

Name

STRUCT

ListItem template

Structure for each item of a generic container list

STRUCT

List

A list that stores different types of structures.

STRUCT

IntList

A list that stores integers.

Function / Macro Summary


Return Type

Summary

void

ListInit(Node*node, LinkedList**list)

Initialize the list


BOOL

ListIsEmpty(Node*node, LinkedList*list)

Check if list is empty


int

ListGetSize(Node*node, LinkedList*list)

Get the size of the list


void

ListInsert(Node*node, LinkedList*list, clocktypetimeStamp, void*data)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/LIST.html[10/28/2011 1:29:07 PM]

LIST

Insert an item at the end of the list


void*

FindItem(Node*node, List*list, intbyteSkip, char*key, intsize)

Find an item from the list


void*

FindItem(Node*node, List*list, intbyteSkip, char*key, intsize)

Find an item from the list


void

ListGet(Node*node, List*list, ListItem*listItem, BOOLfreeItem, BOOLisMsg)

Remove an item from the list


void

ListFree(Node*node, List*list, BOOLisMsg)

Free the entire list


void

IntListInit(Node*node, IntList**list)

Initialize the list


BOOL

IntListIsEmpty(Node*node, IntList*list)

Check if list is empty


int

IntListGetSize(Node*node, IntList*list)

Get the size of the list


void

ListInsert(Node*node, List*list, clocktypetimeStamp, void*data)

Insert an item at the end of the list


void

IntListGet(Node*node, IntList*list, IntListItem*listItem, BOOLfreeItem, BOOLisMsg)

Remove an item from the list


void

IntListFree(Node*node, IntList*list, BOOLisMsg)

Free the entire list

Constant / Data Structure Detail


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/LIST.html[10/28/2011 1:29:07 PM]

LIST

Structure

ListItem template

Structure

Structure for each item of a generic container list


List

Structure

A list that stores different types of structures.


IntList

A list that stores integers.

Function / Macro Detail


Function / Macro
ListInit

Format
void ListInit (Node*node, LinkedList**list)

Parameters:

Initialize the list

node

- Node that contains the list

list

- Pointer to list pointer

Returns:
void

- NULL

ListIsEmpty

BOOL ListIsEmpty (Node*node, LinkedList*list)

Parameters:

Check if list is empty

node

- Node that contains the list

list

- Pointer to the list

Returns:
BOOL

- If empty, TRUE, non-empty, FALSE

ListGetSize

int ListGetSize (Node*node, LinkedList*list)

Parameters:

Get the size of the list

node

- Pointer to the node containing the list

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/LIST.html[10/28/2011 1:29:07 PM]

LIST

- Pointer to the list

list

Returns:
- Size of the list

int

ListInsert

void ListInsert (Node*node, LinkedList*list, clocktypetimeStamp, void*data)

Parameters:

Insert an item at the end of the list

node

- Pointer to the node containing the list

list

- Pointer to the list

timeStamp
data

- Time the item was last inserted.

- item to be inserted

Returns:
- NULL

void

FindItem

void* FindItem (Node*node, List*list, intbyteSkip, char*key, intsize)

Parameters:

Find an item from the list

node

- Pointer to the node containing the list

list

- Pointer to the list

byteSkip
key

- How many bytes skip to get the key item

- The key that an item is idendified.

size

- Size of the key element in byte

Returns:
void*

- Item found, NULL if not found

FindItem

void* FindItem (Node*node, List*list, intbyteSkip, char*key, intsize)

Parameters:

Find an item from the list

node

- Pointer to the node containing the list

list

- Pointer to the list

byteSkip
key

- How many bytes skip to get the key item

- The key that an item is idendified.

size

- Size of the key element in byte

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/LIST.html[10/28/2011 1:29:07 PM]

LIST

void*

- Item found, NULL if not found

ListGet

void ListGet (Node*node, List*list, ListItem*listItem, BOOLfreeItem, BOOLisMsg)

Parameters:

Remove an item from the list

node

- Pointer to the node containing the list

list

- Pointer to the list to remove item from

listItem

- item to be removed

freeItem

- Whether to free the item

isMsg

- Whether is this item a message? If it is

Returns:
- NULL

void

ListFree

void ListFree (Node*node, List*list, BOOLisMsg)

Parameters:

Free the entire list

node

- Pointer to the node containing the list

list

- Pointer to the list to be freed

isMsg

- Does the list contain Messages? If so, we

Returns:
void

- NULL

IntListInit

void IntListInit (Node*node, IntList**list)

Parameters:

Initialize the list

node

- Node that contains the list

list

- Pointer to list pointer

Returns:
void

- NULL

IntListIsEmpty

BOOL IntListIsEmpty (Node*node, IntList*list)

Parameters:

Check if list is empty

node

- Node that contains the list

list

- Pointer to the list

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/LIST.html[10/28/2011 1:29:07 PM]

LIST

Returns:
- If empty, TRUE, non-empty, FALSE

BOOL

IntListGetSize

int IntListGetSize (Node*node, IntList*list)

Parameters:

Get the size of the list

node

- Pointer to the node containing the list

list

- Pointer to the list

Returns:
int

- Size of the list

ListInsert

void ListInsert (Node*node, List*list, clocktypetimeStamp, void*data)

Parameters:

Insert an item at the end of the list

node

- Pointer to the node containing the list

list

- Pointer to the list

timeStamp
data

- Time the item was last inserted.

- item to be inserted

Returns:
- NULL

void

IntListGet

void IntListGet (Node*node, IntList*list, IntListItem*listItem, BOOLfreeItem, BOOLisMsg)

Parameters:

Remove an item from the list

node

- Pointer to the node containing the list

list

- Pointer to the list to remove item from

listItem

- item to be removed

freeItem

- Whether to free the item

isMsg

- Whether is this item a message? If it is

Returns:
void

- NULL

IntListFree

void IntListFree (Node*node, IntList*list, BOOLisMsg)

Parameters:

Free the entire list

node

- Pointer to the node containing the list

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/LIST.html[10/28/2011 1:29:07 PM]

LIST

list

- Pointer to the list to be freed

isMsg

- Does the list contain Messages? If so, we

Returns:
void

- NULL

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/LIST.html[10/28/2011 1:29:07 PM]

MAC LAYER

QualNet 5.2 API Reference


MAC LAYER
This file describes data structures and functions used by the MAC Layer.
Constant / Data Structure Summary
Type

Name

CONSTANT

MAC_PROPAGATION_DELAY

Peer to Peer Propogation delay in the MAC

CONSTANT

MAC_ADDRESS_LENGTH_IN_BYTE

MAC address length

CONSTANT

Max_MacAdress_Length

Maximum MAC address length

CONSTANT

MAC_ADDRESS_DEFAULT_LENGTH

MAC address length in byte or octets

CONSTANT

MAC_CONFIGURATION_ATTRIBUTE

Number of attribute of mac address file

CONSTANT

HW_TYPE_NETROM

From KA9Q NET/ROM pseudo Hardware type.

CONSTANT

HW_TYPE_ETHER

Ethernet 10/100Mbps Hardware type Ethernet.

CONSTANT

HW_TYPE_EETHER

Hardware type Experimental Ethernet

CONSTANT

HW_TYPE_AX25

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Hardware type AX.25 Level 2

CONSTANT

HW_TYPE_PRONET

Hardware type PROnet token ring

CONSTANT

HW_TYPE_CHAOS

Hardware type Chaosnet

CONSTANT

HW_TYPE_IEEE802

IEEE 802.2 Ethernet/TR/TB

CONSTANT

HW_TYPE_ARCNET

Hardware type ARCnet

CONSTANT

HW_TYPE_APPLETLK

Hardware type APPLEtalk

CONSTANT

HW_TYPE_DLCI

Frame Relay DLCI

CONSTANT

HW_TYPE_ATM

ATM 10/100Mbps

CONSTANT

HW_TYPE_METRICOM

Hardware type HW_TYPE_METRICOM

CONSTANT

HW_TYPE_IEEE_1394

Hardware type IEEE_1394

CONSTANT

HW_TYPE_EUI_64

Hardware identifier

CONSTANT

HW_TYPE_UNKNOWN

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Unknown Hardware type MAC protocol HARDWARE identifiers.

CONSTANT

MAC_IPV4_LINKADDRESS_LENGTH

Length of 4 byte MacAddress

CONSTANT

MAC_NODEID_LINKADDRESS_LENGTH

Length of 2 byte MacAddress

CONSTANT

IPV4_LINKADDRESS

Hardware identifier

CONSTANT

HW_NODE_ID

Hardware identifier

CONSTANT

INVALID_MAC_ADDRESS

INVALID MAC ADDRESS

CONSTANT

STATION_VLAN_TAGGING_DEFAULT

Default VLAN TAGGING Value for a STATION node

ENUMERATION

MacInterfaceState

Describes one out of two possible states of MAC interface - enable or disable

ENUMERATION

MacLinkType

Describes different link type

ENUMERATION

MAC_PROTOCOL

Specifies different MAC_PROTOCOLs used

ENUMERATION

MAC_SECURITY

Specifies different MAC_SECURITY_PROTOCOLs used

ENUMERATION

ManagementRequestType

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Type of management request message


ENUMERATION

ManagementResponseType

Type of management response message

ENUMERATION

MacLinkType

Describes different fault type

STRUCT

MacHWAddress

MAC hardware address of variable length

STRUCT

Mac802Address

MAC address of size MAC_ADDRESS_LENGTH_IN_BYTE. It is default Mac address of type 802

STRUCT

MacVlan

Structure of VLAN in MAC sublayer

STRUCT

MacHeaderVlanTag

Structure of MAC sublayer VLAN header

STRUCT

MacData

A composite structure representing MAC sublayer which is typedefed to MacData in main.h

STRUCT

ManagementRequest

data structure of management request

STRUCT

ManagementResponse

data structure of management response

STRUCT

MacToPhyPacketDelayInfoType

Specifies the MAC to Physical layer delay information structure

STRUCT

MacFaultInfo

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Fields for keeping track of interface faults


STRUCT

RandFault

Structure containing random fault information.

Function / Macro Summary


Return Type

Summary

MACRO

MAC_EnableInterface(node, interfaceIndex)

Enable the MAC_interface


MACRO

MAC_DisableInterface(node, interfaceIndex)

Disable the MAC_interface


MACRO

MAC_ToggleInterfaceStatus(node, interfaceIndex)

Toggle the MAC_interface status


MACRO

MAC_InterfaceIsEnabled(node, interfaceIndex)

To query MAC_interface status is enabled or not


void

MacReportInterfaceStatus(Node*node, intinterfaceIndex, MacInterfaceStatestate)

Callback funtion to report interface status


void

MAC_SetInterfaceStatusHandlerFunction(Node*node, intinterfaceIndex, MacReportInterfaceStatusstatusHandler)

Set the MAC interface handler function to be called when interface faults occurs
MacReportInterfaceStatus

MAC_GetInterfaceStatusHandlerFunction(Node*node, intinterfaceIndex)

To get the MACInterface status handling function for the system


void

MacHasFrameToSendFn(Node*node, intinterfaceIndex)

Callback funtion for sending packet. It calls when network layer has packet to send.
void

MacReceiveFrameFn(Node*node, intinterfaceIndex, Message*msg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Callback funtion to receive packet.


void

MAC_NetworkLayerHasPacketToSend(Node*node, intinterfaceIndex)

Handles packets from the network layer when the network queue is empty
void

MAC_SwitchHasPacketToSend(Node*node, intinterfaceIndex)

To inform MAC that the Switch has packets to to send


void

MAC_ReceivePacketFromPhy(Node*node, intinterfaceIndex, Message*packet)

Handles packets received from physical layer


void

MAC_ManagementRequest(Node*node, intinterfaceIndex, ManagementRequest*req, ManagementResponse*resp)

Deliver a network management request to the MAC


void

MAC_ReceivePhyStatusChangeNotification(Node*node, intinterfaceIndex, PhyStatusTypeoldPhyStatus,


PhyStatusTypenewPhyStatus, clocktypereceiveDuration, Message*potentialIncomingPacket)

Handles status changes received from the physical layer


void

MAC_InitUserMacProtocol(Node*node, NodeInputnodeInput, const char*macProtocolName, intinterfaceIndex)

Initialisation function for the User MAC_protocol


void

MacFinalizeUserMacProtocol(Node*node, intinterfaceIndex)

Finalization function for the User MAC_protocol


void

MAC_HandleUserMacProtocolEvent(Node*node, intinterfaceIndex, Message*packet)

Handles the MAC protocol event


BOOL

MAC_OutputQueueIsEmpty(Node*node, intinterfaceIndex)

To check if Output queue for an interface of a node if empty or not


void

MAC_NotificationOfPacketDrop(Node*node, NodeAddressnextHopAddress, intinterfaceIndex, Message*msg)

To notify MAC of packet drop


void

MAC_NotificationOfPacketDrop(Node*node, MacHWAddressnextHopAddress, intinterfaceIndex, Message*msg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

To notify MAC of packet drop


void

MAC_NotificationOfPacketDrop(Node*node, Mac802AddressnextHopAddress, intinterfaceIndex, Message*msg)

To notify MAC of packet drop


BOOL

MAC_OutputQueueTopPacketForAPriority(Node*node, intinterfaceIndex, TosTypepriority, Message**msg,


NodeAddressnextHopAddress)

To notify MAC of priority packet arrival


BOOL

MAC_OutputQueueTopPacketForAPriority(Node*node, intinterfaceIndex, TosTypepriority, Message**msg,


Mac802Address*nextHopAddress)

To notify MAC of priority packet arrival


BOOL

MAC_OutputQueueTopPacketForAPriority(Node*node, intinterfaceIndex, TosTypepriority, Message**msg,


MacHWAddress*nextHopAddress)

To notify MAC of priority packet arrival


BOOL

MAC_OutputQueueDequeuePacketForAPriority(Node*node, intinterfaceIndex, TosTypepriority, Message**msg,


NodeAddress*nextHopAddress, int*networkType)

To remove the packet at the front of the specified priority output queue
BOOL

MAC_OutputQueueDequeuePacketForAPriority(Node*node, intinterfaceIndex, TosTypepriority, Message**msg,


MacHWAddress*nextHopAddress, int*networkType)

To remove the packet at the front of the specified priority output queue
BOOL

MAC_OutputQueueDequeuePacketForAPriority(Node*node, intinterfaceIndex, TosTypepriority, Message**msg,


Mac802Address*nextHopAddress, int*networkType)

To remove the packet at the front of the specified priority output queue
BOOL

MAC_OutputQueueDequeuePacketForAPriority(Node*node, intinterfaceIndex, TosType*priority, Message**msg,


MacHWAddress*destMacAddr, int*networkType, int*packType)

To allow a peek by network layer at packet before processing It is overloading function used for ARP packet
BOOL

MAC_OutputQueueDequeuePacketForAPriority(Node*node, intinterfaceIndex, TosType*priority, Message**msg,


Mac802Address*destMacAddr, int*networkType, int*packType)

To allow a peek by network layer at packet before processing It is overloading function used for ARP packet
void

MAC_SneakPeekAtMacPacket(Node*node, intinterfaceIndex, const Message*msg, NodeAddressprevHop,


NodeAddressdestAddr, intmessageType)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

To allow a peek by network layer at packet before processing


void

MAC_SneakPeekAtMacPacket(Node*node, intinterfaceIndex, const Message*msg, MacHWAddressprevHop,


MacHWAddressdestAddr, intarpMessageType)

To allow a peek by network layer at packet before processing


void

MAC_SneakPeekAtMacPacket(Node*node, intinterfaceIndex, const Message*msg, Mac802AddressprevHop,


Mac802AddressdestAddr, intmessageType)

To allow a peek by network layer at packet before processing


void

MAC_MacLayerAcknowledgement(Node*node, intinterfaceIndex, Message*msg, NodeAddressnextHop)

To send acknowledgement from MAC


void

MAC_MacLayerAcknowledgement(Node*node, intinterfaceIndex, Message*msg, MacHWAddress&nextHop)

To send acknowledgement from MAC


void

MAC_MacLayerAcknowledgement(Node*node, intinterfaceIndex, Message*msg, Mac802Address&nextHop)

To send acknowledgement from MAC


void

MAC_HandOffSuccessfullyReceivedPacket(Node*node, intinterfaceIndex, Message*msg, NodeAddresslastHopAddress)

Pass packet successfully up to the network layer


void

MAC_HandOffSuccessfullyReceivedPacket(Node*node, intinterfaceIndex, Message*msg, MacHWAddress*lastHopAddr)

Pass packet successfully up to the network layer


void

MAC_HandOffSuccessfullyReceivedPacket(Node*node, intinterfaceIndex, Message*msg, Mac802ddress*lastHopAddr)

Pass packet successfully up to the network layer


void

MAC_HandOffSuccessfullyReceivedPacket(Node*node, intinterfaceIndex, Message*msg,


MacHWAddress*lastHopAddress, intarpMessageType)

Pass packet successfully up to the network layer It is overloading function used for ARP packet
void

MAC_HandOffSuccessfullyReceivedPacket(Node*node, intinterfaceIndex, Message*msg,


Mac802Address*lastHopAddress, intarpMessageType)

Pass packet successfully up to the network layer It is overloading function used for ARP packet
BOOL

MAC_OutputQueueTopPacket(Node*node, intinterfaceIndex, Message**msg, NodeAddress*nextHopAddress,


intnetworkType, TosType*priority)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

To check packet at the top of output queue


BOOL

MAC_OutputQueueTopPacket(Node*node, intinterfaceIndex, Message**msg, MacHWAddress*nextHopAddress,


intnetworkType, TosType*priority)

To check packet at the top of output queue


BOOL

MAC_OutputQueueTopPacket(Node*node, intinterfaceIndex, Message**msg, Mac802Address*nextHopAddress,


intnetworkType, TosType*priority)

To check packet at the top of output queue


BOOL

MAC_OutputQueueDequeuePacket(Node*node, intinterfaceIndex, Message**msg, NodeAddress*nextHopAddress,


intnetworkType, TosType *priority)

To remove packet from front of output queue


BOOL

MAC_OutputQueueDequeuePacket(Node*node, intinterfaceIndex, Message**msg, MacHWAddress*nextHopAddress,


intnetworkType, TosType *priority)

To remove packet from front of output queue


BOOL

MAC_OutputQueueDequeuePacket(Node*node, intinterfaceIndex, Message**msg, Mac802Address*nextHopAddress,


intnetworkType, TosType *priority)

To remove packet from front of output queue, Its a overloaded function


BOOL

MAC_OutputQueueDequeuePacket(Node*node, intinterfaceIndex, Message**msg, NodeAddress*nextHopAddress,


int*networkType, TosType *priority, MacOutputQueueDequeueOptiondequeueOption,
MacOutputQueueDequeueCriteriadequeueCriteria, int *numFreeByte, int*numPacketPacked,
TraceProtocolTypetracePrt, BOOLeachWithMacHeader, intmaxHeaderSize, BOOLreturnPackedMsg)

To remove packet(s) from front of output queue; process packets with options for example, pakcing multiple packets with same next hop
address together
BOOL

MAC_OutputQueueDequeuePacketForAPriority(Node*node, intinterfaceIndex, intpriority, Message**msg,


NodeAddress*nextHopAddress, int*networkType, MacOutputQueueDequeueOptiondequeueOption,
MacOutputQueueDequeueCriteriadequeueCriteria, int *numFreeByte, int*numPacketPacked,
TraceProtocolTypetracePrt, BOOLeachWithMacHeader, intmaxHeaderSize, BOOLreturnPackedMsg)

To remove packet(s) from front of output queue; process packets with options for example, pakcing multiple packets with same next hop
address together
BOOL

MAC_IsMyUnicastFrame(Node*node, NodeAddressdestAddr)

Check if a packet (or frame) belongs to this node Should be used only for four byte mac address
BOOL

MAC_IsWiredNetwork(Node*node, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

To check if an interface is a wired interface


BOOL

MAC_IsPointToPointNetwork(Node*node, intinterfaceIndex)

Checks if an interface belongs to Point to PointNetwork


BOOL

MAC_IsPointToMultiPointNetwork(Node*node, intinterfaceIndex)

Checks if an interface belongs to Point to Multi-Point network.


BOOL

MAC_IsWiredBroadcastNetwork(Node*node, intinterfaceIndex)

Determines if an interface is a wired broadcast interface


BOOL

MAC_IsWirelessNetwork(Node*node, intinterfaceIndex)

Determine if a node's interface is a wireless interface


BOOL

MAC_IsWirelessAdHocNetwork(Node*node, intinterfaceIndex)

Determine if a node's interface is a possible wireless ad hoc interface


BOOL

MAC_IsOneHopBroadcastNetwork(Node*node, intinterfaceIndex)

Determines if an interface is a single Hop Broadcast interface


BOOL

MAC_IsASwitch(Node*node)

To check if a node is a switch


void

MAC_SetVirtualMacAddress(Node*node, intinterfaceIndex, NodeAddressvirtualMacAddress)

To set MAC address


void

MacSetDefaultHWAddress(Node*node, MacHWAddress*macAddr, intinterfaceIndex)

Set Default interface Hardware Address of node


NodeAddress

MAC_IsMyMacAddress(Node*node, intinterfaceIndex, NodeAddressdestAddr)

To check if received mac address belongs to itself


BOOL

MAC_IsMyHWAddress(Node*node, intinterfaceIndex, MacAddress*macAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Checks for own MAC address.


void

MacValidateAndSetHWAddress(char*macAddrStr, MacHWAddress*macAddr)

Validate MAC Address String after fetching from user


NodeAddress

DefaultMacHWAddressToIpv4Address(Node*node, MacHWAddress*macAddr)

Retrieve the IP Address from Default HW Address . Default HW address is equal to 6 bytes
void

MacGetHardwareLength(Node*node, intinterface, unsigned shorthwLength)

Retrieve the Hardware Length.


void

MacGetHardwareType(Node*node, intinterface, unsigned short*type)

Retrieve the Hardware Type.


void

MacGetHardwareAddressString(Node*node, intinterface)

Retrieve the Hardware Address String.


void

MacAddNewInterface(Node*node, NodeAddressinterfaceAddress, intnumHostBits, int*interfaceIndex, const


NodeInputnodeInput, char*macProtocolName)

To add a new Interface at MAC


void

MacAddVlanInfoForThisInterface(Node*node, int*interfaceIndex, NodeAddressinterfaceAddress, const


NodeInputnodeInput)

Init and read VLAN configuration from user input for node and interface passed as arguments
NodeAddress

MacReleaseVlanInfoForThisInterface(Node*node, intinterfaceIndex)

To flush VLAN info for an interface


BOOL

MAC_IsBroadcastHWAddress(MacHWAddress*macAddr)

Checks Broadcast MAC address


BOOL

MAC_IsIdenticalHWAddress(MacHWAddress*macAddr1, MacHWAddress*macAddr2)

Compares two MAC addresses


void

MAC_PrintHWAddr(MacHWAddress*macAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Prints interface Mac Address


void

MAC_PrintMacAddr(Mac802Address*macAddr)

Prints interface Mac Address


void

MAC_RandFaultInit(Node*node, intinterfaceIndex, const char*currentLine)

Initialization the Random Fault structure from input file


void

MAC_RandFaultFinalize(Node*node, intinterfaceIndex)

IPrint the statistics of Random link fault.


TosType

MAC_GetPacketsPriority(Message*msg)

Returns the priority of the packet


void

MAC_TranslateMulticatIPv4AddressToMulticastMacAddress(NodeAddressmultcastAddress, MacHWAddress*macMulticast)

Convert the Multicast ip address to multicast MAC address


BOOL

MAC_OutputQueuePeekByIndex(Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


NodeAddressnextHopAddress, TosTypepriority)

Look at the packet at the index of the output queue.


BOOL

MAC_OutputQueuePeekByIndex(Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


Mac802Address*nextHopAddress, TosTypepriority)

Look at the packet at the index of the output queue.


BOOL

MAC_OutputQueuePeekByIndex(intinterfaceIndex, intmsgIndex, Message**msg, MacHWAddress*nextHopAddress,


TosTypepriority)

Look at the packet at the index of the output queue.


BOOL

MAC_OutputQueueDequeuePacketWithIndex(Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


NodeAddressnextHopAddress, intnetworkType)

To remove the packet at specified index output queue.


BOOL

MAC_OutputQueueDequeuePacketWithIndex(Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


Mac802Address*nextHopMacAddress, intnetworkType)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

To remove the packet at specified index output queue.


BOOL

MAC_OutputQueueDequeuePacketWithIndex(Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


MacHWAddressnextHopMacAddress, intnetworkType)

To remove the packet at specified index output queue.


BOOL

MAC_IPv4addressIsMulticastAddress(NodeAddressipV4)

Check the given address is Multicast address or not.


BOOL

MAC_IsBroadcastMacAddress(MacAddress*macAddr)

Checks Broadcast MAC address.


void

IPv4AddressToDefaultMac802Address(Node*node, intindex, NodeAddressipv4Address, Mac802Address*macAddr)

Retrieve the Mac802Address from IP address.


Bool

ConvertVariableHWAddressTo802Address(Node*node, MacHWAddress*macHWAddr, Mac802Address*mac802Addr)

Convert Variable Hardware address to Mac 802 addtess


void

MAC_CopyMacHWAddress(MacHWAddress*destAddr, MacHWAddress*srcAddr)

Copies Hardware address address


NodeAddress

DefaultMac802AddressToIpv4Address(Node*node, Mac802Address*macAddr)

Retrieve IP address from.Mac802Address


BOOL

IPv4AddressToHWAddress(Node*node, intinterfaceIndex, Message*msg, NodeAddressipv4Address)

Converts IP address.To MacHWAddress


NodeAddress

MacHWAddressToIpv4Address(Node *node, intinterfaceIndex, MacHWAddress*macAddr)

This functions converts variable length Mac address to IPv4 address It checks the type of hardware address and based on that conversion
is done.
char*

decToHex(intdec)

Convert one byte decimal number to hex number.


void

MAC_FourByteMacAddressToVariableHWAddress(Node *node, intinterfaceIndex, MacHWAddress *macAddr,


NodeAddressnodeAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

NodeAddress

MAC_VariableHWAddressToFourByteMacAddress(Node*node, MacHWAddress*macAddr)

Retrieve IP address from.MacHWAddress of type IPV4_LINKADDRESS


MacHWAddress

GetBroadCastAddress(Node*node, intinterfaceIndex)

Returns Broadcast Address of an interface


MacHWAddress

GetMacHWAddress(Node*node, intinterfaceIndex)

Returns MacHWAddress of an interface


int

MacGetInterfaceIndexFromMacAddress(Node*node, MacHWAddressmacAddr)

Returns interfaceIndex at which Macaddress is configured


int

MacGetInterfaceIndexFromMacAddress(Node*node, Mac802AddressmacAddr)

Returns interfaceIndex at which Macaddress is configured


int

MacGetInterfaceIndexFromMacAddress(Node*node, NodeAddressmacAddr)

Returns interfaceIndex at which Macaddress is configured


void

MAC_Reset(Node*node, intInterfaceIndex)

Reset the Mac protocols use by the node


void

MAC_AddResetFunctionList(Node*node, intInterfaceIndex, void*param)

Add which protocols in the Mac layer to be reset to a fuction list pointer.

Constant / Data Structure Detail

Constant

MAC_PROPAGATION_DELAY1 * MICRO_SECOND

Constant

Peer to Peer Propogation delay in the MAC


MAC_ADDRESS_LENGTH_IN_BYTE6

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Constant

MAC address length


Max_MacAdress_Length16

Constant

Maximum MAC address length


MAC_ADDRESS_DEFAULT_LENGTH6

Constant

MAC address length in byte or octets


MAC_CONFIGURATION_ATTRIBUTE5

Constant

Number of attribute of mac address file


HW_TYPE_NETROM0

Constant

From KA9Q NET/ROM pseudo Hardware type.


HW_TYPE_ETHER1

Constant

Ethernet 10/100Mbps Hardware type Ethernet.


HW_TYPE_EETHER2

Constant

Hardware type Experimental Ethernet


HW_TYPE_AX253

Constant

Hardware type AX.25 Level 2


HW_TYPE_PRONET4

Constant

Hardware type PROnet token ring


HW_TYPE_CHAOS5

Constant

Hardware type Chaosnet


HW_TYPE_IEEE8026

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Constant

IEEE 802.2 Ethernet/TR/TB


HW_TYPE_ARCNET7

Constant

Hardware type ARCnet


HW_TYPE_APPLETLK8

Constant

Hardware type APPLEtalk


HW_TYPE_DLCI15

Constant

Frame Relay DLCI


HW_TYPE_ATM19

Constant

ATM 10/100Mbps
HW_TYPE_METRICOM23

Constant

Hardware type HW_TYPE_METRICOM


HW_TYPE_IEEE_139424

Constant

Hardware type IEEE_1394


HW_TYPE_EUI_6427

Constant

Hardware identifier
HW_TYPE_UNKNOWN0xffff

Constant

Unknown Hardware type MAC protocol HARDWARE identifiers.


MAC_IPV4_LINKADDRESS_LENGTH4

Constant

Length of 4 byte MacAddress


MAC_NODEID_LINKADDRESS_LENGTH2

Constant

Length of 2 byte MacAddress


IPV4_LINKADDRESS28

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Constant

Hardware identifier
HW_NODE_ID29

Constant

Hardware identifier
INVALID_MAC_ADDRESSMacHWAddress()

Constant

INVALID MAC ADDRESS


STATION_VLAN_TAGGING_DEFAULTFALSE

Enumeration

Default VLAN TAGGING Value for a STATION node


MacInterfaceState

Enumeration

Describes one out of two possible states of MAC interface - enable or disable
MacLinkType

Enumeration

Describes different link type


MAC_PROTOCOL

Enumeration

Specifies different MAC_PROTOCOLs used


MAC_SECURITY

Enumeration

Specifies different MAC_SECURITY_PROTOCOLs used


ManagementRequestType

Enumeration

Type of management request message


ManagementResponseType

Enumeration

Type of management response message


MacLinkType

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Structure

Describes different fault type


MacHWAddress

Structure

MAC hardware address of variable length


Mac802Address

Structure

MAC address of size MAC_ADDRESS_LENGTH_IN_BYTE. It is default Mac address of type 802


MacVlan

Structure

Structure of VLAN in MAC sublayer


MacHeaderVlanTag

Structure

Structure of MAC sublayer VLAN header


MacData

Structure

A composite structure representing MAC sublayer which is typedefed to MacData in main.h


ManagementRequest

Structure

data structure of management request


ManagementResponse

Structure

data structure of management response


MacToPhyPacketDelayInfoType

Structure

Specifies the MAC to Physical layer delay information structure


MacFaultInfo

Structure

Fields for keeping track of interface faults


RandFault

Structure containing random fault information.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Function / Macro Detail


Function / Macro
MAC_EnableInterface(node, interfaceIndex)

Format
Enable the MAC_interface

MAC_DisableInterface(node, interfaceIndex)

Disable the MAC_interface

MAC_ToggleInterfaceStatus(node, interfaceIndex)

Toggle the MAC_interface status

MAC_InterfaceIsEnabled(node, interfaceIndex)

To query MAC_interface status is enabled or not

MacReportInterfaceStatus

void MacReportInterfaceStatus (Node*node, intinterfaceIndex, MacInterfaceStatestate)

Parameters:

Callback funtion to report interface status

node

- Pointer to a network node

interfaceIndex
state

- index of interface

- Wheather it enable or disable

Returns:
void

MAC_SetInterfaceStatusHandlerFunction

- None

void MAC_SetInterfaceStatusHandlerFunction (Node*node, intinterfaceIndex,


MacReportInterfaceStatusstatusHandler)

Parameters:
Set the MAC interface handler function to be called when
interface faults occurs

node

- Pointer to a network node

interfaceIndex
statusHandler

- index of interface

- Pointer to status Handler

Returns:
void

- None

MAC_GetInterfaceStatusHandlerFunction

MacReportInterfaceStatus MAC_GetInterfaceStatusHandlerFunction (Node*node, intinterfaceIndex)

Parameters:

To get the MACInterface status handling function for the system

node

- Pointer to a network node

interfaceIndex

- index of interface

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Returns:
MacReportInterfaceStatus

- Pointer to status handler

MacHasFrameToSendFn

void MacHasFrameToSendFn (Node*node, intinterfaceIndex)

Parameters:

Callback funtion for sending packet. It calls when network layer


has packet to send.

node

- Pointer to node

interfaceIndex

- index of interface

Returns:
void

- NULL

MacReceiveFrameFn

void MacReceiveFrameFn (Node*node, intinterfaceIndex, Message*msg)

Parameters:

Callback funtion to receive packet.

node

- Pointer to node

interfaceIndex
msg

- index of interface

- Pointer to the message

Returns:
void

- NULL

MAC_NetworkLayerHasPacketToSend

void MAC_NetworkLayerHasPacketToSend (Node*node, intinterfaceIndex)

Parameters:

Handles packets from the network layer when the network queue
is empty

node

- Pointer to a network node

interfaceIndex

- index of interface

Returns:
void

- None

MAC_SwitchHasPacketToSend

void MAC_SwitchHasPacketToSend (Node*node, intinterfaceIndex)

Parameters:

To inform MAC that the Switch has packets to to send

node

- Pointer to a network node

interfaceIndex

- index of interface

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

MAC_ReceivePacketFromPhy

void MAC_ReceivePacketFromPhy (Node*node, intinterfaceIndex, Message*packet)

Parameters:

Handles packets received from physical layer

node

- Pointer to a network node

interfaceIndex
packet

- index of interface

- Pointer to Message

Returns:
void

MAC_ManagementRequest

- None

void MAC_ManagementRequest (Node*node, intinterfaceIndex, ManagementRequest*req,


ManagementResponse*resp)

Parameters:
Deliver a network management request to the MAC
node

- Pointer to a network node

interfaceIndex
req

- index of interface

- Pointer to a management request

resp

- Pointer to a management response

Returns:
void

MAC_ReceivePhyStatusChangeNotification

- None

void MAC_ReceivePhyStatusChangeNotification (Node*node, intinterfaceIndex,


PhyStatusTypeoldPhyStatus, PhyStatusTypenewPhyStatus, clocktypereceiveDuration,
Message*potentialIncomingPacket)

Handles status changes received from the physical layer

Parameters:
node

- Pointer to a network node

interfaceIndex

- index of interface

oldPhyStatus

- Old status of physical layer

newPhyStatus

- New status of physical layer

receiveDuration

- Duration after which received

potentialIncomingPacket

- Pointer to incoming message

Returns:
void

MAC_InitUserMacProtocol

- None

void MAC_InitUserMacProtocol (Node*node, NodeInputnodeInput, const char*macProtocolName,


intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Parameters:
Initialisation function for the User MAC_protocol
node

- Pointer to a network node

nodeInput

- Configured Inputs for the node

macProtocolName
interfaceIndex

- MAC protocol name

- interface index

Returns:
void

- None

MacFinalizeUserMacProtocol

void MacFinalizeUserMacProtocol (Node*node, intinterfaceIndex)

Parameters:

Finalization function for the User MAC_protocol

node

- Pointer to a network node

interfaceIndex

- index of interface

Returns:
void

- None

MAC_HandleUserMacProtocolEvent

void MAC_HandleUserMacProtocolEvent (Node*node, intinterfaceIndex, Message*packet)

Parameters:

Handles the MAC protocol event

node

- Pointer to a network node

interfaceIndex
packet

- index of interface

- Pointer to Message

Returns:
void

- None

MAC_OutputQueueIsEmpty

BOOL MAC_OutputQueueIsEmpty (Node*node, intinterfaceIndex)

Parameters:

To check if Output queue for an interface of a node if empty or


not

node

- Pointer to a network node

interfaceIndex

- index of interface

Returns:
BOOL

MAC_NotificationOfPacketDrop

- empty or not

void MAC_NotificationOfPacketDrop (Node*node, NodeAddressnextHopAddress, intinterfaceIndex,


Message*msg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Parameters:
To notify MAC of packet drop
node

- Pointer to a network node

nextHopAddress

- Node address

interfaceIndex

- interfaceIndex

msg

- Pointer to Message

Returns:
void

MAC_NotificationOfPacketDrop

- None

void MAC_NotificationOfPacketDrop (Node*node, MacHWAddressnextHopAddress, intinterfaceIndex,


Message*msg)

Parameters:
To notify MAC of packet drop
node

- Pointer to a network node

nextHopAddress

- Node address

interfaceIndex

- interfaceIndex

msg

- Pointer to Message

Returns:
void

MAC_NotificationOfPacketDrop

- None

void MAC_NotificationOfPacketDrop (Node*node, Mac802AddressnextHopAddress, intinterfaceIndex,


Message*msg)

Parameters:
To notify MAC of packet drop
node

- Pointer to a network node

nextHopAddress

- mac address

interfaceIndex

- interfaceIndex

msg

- Pointer to Message

Returns:
void

MAC_OutputQueueTopPacketForAPriority

- None

BOOL MAC_OutputQueueTopPacketForAPriority (Node*node, intinterfaceIndex, TosTypepriority,


Message**msg, NodeAddressnextHopAddress)

Parameters:
To notify MAC of priority packet arrival
node

- Pointer to a network node

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

interfaceIndex
priority
msg

- interfaceIndex

- Message Priority

- Pointer to Message

nextHopAddress

- Next hop address

Returns:
BOOL

MAC_OutputQueueTopPacketForAPriority

- TRUE if there is a packet, FALSE otherwise.

BOOL MAC_OutputQueueTopPacketForAPriority (Node*node, intinterfaceIndex, TosTypepriority,


Message**msg, Mac802Address*nextHopAddress)

Parameters:
To notify MAC of priority packet arrival
node

- Pointer to a network node

interfaceIndex
priority
msg

- interfaceIndex

- Message Priority

- Pointer to Message

nextHopAddress

- Next hop mac address

Returns:
BOOL

MAC_OutputQueueTopPacketForAPriority

- TRUE if there is a packet, FALSE otherwise.

BOOL MAC_OutputQueueTopPacketForAPriority (Node*node, intinterfaceIndex, TosTypepriority,


Message**msg, MacHWAddress*nextHopAddress)

Parameters:
To notify MAC of priority packet arrival
node

- Pointer to a network node

interfaceIndex
priority
msg

- interfaceIndex

- Message Priority

- Pointer to Message

nextHopAddress

- Next hop mac address

Returns:
BOOL

MAC_OutputQueueDequeuePacketForAPriority

- TRUE if there is a packet, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacketForAPriority (Node*node, intinterfaceIndex, TosTypepriority,


Message**msg, NodeAddress*nextHopAddress, int*networkType)

Parameters:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

To remove the packet at the front of the specified priority output


queue

node

- Pointer to a network node

interfaceIndex
priority
msg

- interfaceIndex

- Message Priority

- Pointer to Message

nextHopAddress
networkType

- Next hop address

- network type

Returns:
BOOL

MAC_OutputQueueDequeuePacketForAPriority

- TRUE if dequeued successfully, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacketForAPriority (Node*node, intinterfaceIndex, TosTypepriority,


Message**msg, MacHWAddress*nextHopAddress, int*networkType)

Parameters:
To remove the packet at the front of the specified priority output
queue

node

- Pointer to a network node

interfaceIndex
priority
msg

- interfaceIndex

- Message Priority

- Pointer to Message

nextHopAddress
networkType

- Next hop mac address

- network type

Returns:
BOOL

MAC_OutputQueueDequeuePacketForAPriority

- TRUE if dequeued successfully, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacketForAPriority (Node*node, intinterfaceIndex, TosTypepriority,


Message**msg, Mac802Address*nextHopAddress, int*networkType)

Parameters:
To remove the packet at the front of the specified priority output
queue

node

- Pointer to a network node

interfaceIndex
priority
msg

- interfaceIndex

- Message Priority

- Pointer to Message

nextHopAddress
networkType

- Next hop mac address

- network type

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Returns:
BOOL

MAC_OutputQueueDequeuePacketForAPriority

- TRUE if dequeued successfully, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacketForAPriority (Node*node, intinterfaceIndex,


TosType*priority, Message**msg, MacHWAddress*destMacAddr, int*networkType, int*packType)

Parameters:
To allow a peek by network layer at packet before processing It is
overloading function used for ARP packet

node

- Pointer to a network node

interfaceIndex
priority
msg

- interfaceIndex

- tos value

- Pointer to Message

destMacAddr

- Dest addr Pointer

networkType

- Network Type pointer

packType

- packet Type pointer

Returns:
BOOL

MAC_OutputQueueDequeuePacketForAPriority

- If success TRUE NOTE : Overloaded MAC_OutputQueueDequeuePacketForAPriority()

BOOL MAC_OutputQueueDequeuePacketForAPriority (Node*node, intinterfaceIndex,


TosType*priority, Message**msg, Mac802Address*destMacAddr, int*networkType, int*packType)

Parameters:
To allow a peek by network layer at packet before processing It is
overloading function used for ARP packet

node

- Pointer to a network node

interfaceIndex
priority
msg

- interfaceIndex

- tos value

- Pointer to Message

destMacAddr

- Dest addr Pointer

networkType

- Network Type pointer

packType

- packet Type pointer

Returns:
BOOL

MAC_SneakPeekAtMacPacket

- If success TRUE NOTE : Overloaded MAC_OutputQueueDequeuePacketForAPriority()

void MAC_SneakPeekAtMacPacket (Node*node, intinterfaceIndex, const Message*msg,


NodeAddressprevHop, NodeAddressdestAddr, intmessageType)

Parameters:
To allow a peek by network layer at packet before processing
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

prevHop

- Previous Node address

destAddr

- Destination Node address

messageType

- Distinguish between the ARP and general message

Returns:
void

MAC_SneakPeekAtMacPacket

- NULL

void MAC_SneakPeekAtMacPacket (Node*node, intinterfaceIndex, const Message*msg,


MacHWAddressprevHop, MacHWAddressdestAddr, intarpMessageType)

Parameters:
To allow a peek by network layer at packet before processing
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

prevHop

- Previous Node mac address

destAddr

- Destination Node mac address

arpMessageType

- Distinguish between the ARP and general message

Returns:
void

MAC_SneakPeekAtMacPacket

- NULL

void MAC_SneakPeekAtMacPacket (Node*node, intinterfaceIndex, const Message*msg,


Mac802AddressprevHop, Mac802AddressdestAddr, intmessageType)

Parameters:
To allow a peek by network layer at packet before processing
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

prevHop

- Previous Node address

destAddr

- Destination Node address

messageType

- Distinguish between the ARP and general message

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

void

MAC_MacLayerAcknowledgement

- NULL

void MAC_MacLayerAcknowledgement (Node*node, intinterfaceIndex, Message*msg,


NodeAddressnextHop)

Parameters:
To send acknowledgement from MAC
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHop

- Pointer to Node address

Returns:
void

MAC_MacLayerAcknowledgement

- None

void MAC_MacLayerAcknowledgement (Node*node, intinterfaceIndex, Message*msg,


MacHWAddress&nextHop)

Parameters:
To send acknowledgement from MAC
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHop

- Pointer to Node address

Returns:
void

MAC_MacLayerAcknowledgement

- None

void MAC_MacLayerAcknowledgement (Node*node, intinterfaceIndex, Message*msg,


Mac802Address&nextHop)

Parameters:
To send acknowledgement from MAC
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHop

- Pointer to nexthop mac address

Returns:
void

MAC_HandOffSuccessfullyReceivedPacket

- None

void MAC_HandOffSuccessfullyReceivedPacket (Node*node, intinterfaceIndex, Message*msg,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

NodeAddresslastHopAddress)

Parameters:
Pass packet successfully up to the network layer
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

lastHopAddress

- Node address

Returns:
void

MAC_HandOffSuccessfullyReceivedPacket

- None

void MAC_HandOffSuccessfullyReceivedPacket (Node*node, intinterfaceIndex, Message*msg,


MacHWAddress*lastHopAddr)

Parameters:
Pass packet successfully up to the network layer
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

lastHopAddr

- mac address

Returns:
void

MAC_HandOffSuccessfullyReceivedPacket

- None

void MAC_HandOffSuccessfullyReceivedPacket (Node*node, intinterfaceIndex, Message*msg,


Mac802ddress*lastHopAddr)

Parameters:
Pass packet successfully up to the network layer
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

lastHopAddr

- mac address

Returns:
void

MAC_HandOffSuccessfullyReceivedPacket

- None

void MAC_HandOffSuccessfullyReceivedPacket (Node*node, intinterfaceIndex, Message*msg,


MacHWAddress*lastHopAddress, intarpMessageType)

Parameters:
Pass packet successfully up to the network layer It is overloading
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

function used for ARP packet

node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

lastHopAddress

- mac address

arpMessageType

- Distinguish between ARP and general message

Returns:
void

MAC_HandOffSuccessfullyReceivedPacket

- NULL

void MAC_HandOffSuccessfullyReceivedPacket (Node*node, intinterfaceIndex, Message*msg,


Mac802Address*lastHopAddress, intarpMessageType)

Parameters:
Pass packet successfully up to the network layer It is overloading
function used for ARP packet

node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

lastHopAddress

- mac address

arpMessageType

- Distinguish between ARP and general message

Returns:
void

MAC_OutputQueueTopPacket

- NULL

BOOL MAC_OutputQueueTopPacket (Node*node, intinterfaceIndex, Message**msg,


NodeAddress*nextHopAddress, intnetworkType, TosType*priority)

Parameters:
To check packet at the top of output queue
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHopAddress
networkType
priority

- Next hop address

- network type

- Message Priority

Returns:
BOOL

MAC_OutputQueueTopPacket

- TRUE if there is a packet, FALSE otherwise.

BOOL MAC_OutputQueueTopPacket (Node*node, intinterfaceIndex, Message**msg,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

MacHWAddress*nextHopAddress, intnetworkType, TosType*priority)

Parameters:
To check packet at the top of output queue
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHopAddress
networkType
priority

- Next hop address

- network type

- Message Priority

Returns:
BOOL

MAC_OutputQueueTopPacket

- TRUE if there is a packet, FALSE otherwise.

BOOL MAC_OutputQueueTopPacket (Node*node, intinterfaceIndex, Message**msg,


Mac802Address*nextHopAddress, intnetworkType, TosType*priority)

Parameters:
To check packet at the top of output queue
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHopAddress
networkType
priority

- Next hop address

- network type

- Message Priority

Returns:
BOOL

MAC_OutputQueueDequeuePacket

- TRUE if there is a packet, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacket (Node*node, intinterfaceIndex, Message**msg,


NodeAddress*nextHopAddress, intnetworkType, TosType *priority)

Parameters:
To remove packet from front of output queue
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHopAddress
networkType

- Pointer to Node address

- network type

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

priority

- Pointer to queuing priority type

Returns:
BOOL

MAC_OutputQueueDequeuePacket

- TRUE if dequeued successfully, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacket (Node*node, intinterfaceIndex, Message**msg,


MacHWAddress*nextHopAddress, intnetworkType, TosType *priority)

Parameters:
To remove packet from front of output queue
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHopAddress
networkType
priority

- Pointer to Mac address

- network type

- Pointer to queuing priority type

Returns:
BOOL

MAC_OutputQueueDequeuePacket

- TRUE if dequeued successfully, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacket (Node*node, intinterfaceIndex, Message**msg,


Mac802Address*nextHopAddress, intnetworkType, TosType *priority)

Parameters:
To remove packet from front of output queue, Its a overloaded
function

node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHopAddress
networkType
priority

- Pointer to MacAddress address

- network type

- Pointer to queuing priority type

Returns:
BOOL

MAC_OutputQueueDequeuePacket

To remove packet(s) from front of output queue; process packets


with options for example, pakcing multiple packets with same

- TRUE if dequeued successfully, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacket (Node*node, intinterfaceIndex, Message**msg,


NodeAddress*nextHopAddress, int*networkType, TosType *priority,
MacOutputQueueDequeueOptiondequeueOption, MacOutputQueueDequeueCriteriadequeueCriteria, int
*numFreeByte, int*numPacketPacked, TraceProtocolTypetracePrt, BOOLeachWithMacHeader,
intmaxHeaderSize, BOOLreturnPackedMsg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

next hop address together

Parameters:
node

- Pointer to a network node

interfaceIndex
msg

- interfaceIndex

- Pointer to Message

nextHopAddress
networkType
priority

- Pointer to Node address

- network type

- Pointer to queuing priority type

dequeueOption

- option

dequeueCriteria
numFreeByte

- number of bytes can be packed in 1 transmission

numPacketPacked
tracePrt

- criteria

- number of packets packed

- Trace Protocol Type

eachWithMacHeader
maxHeaderSize

- Each msg has its own MAC header?

- max mac header size

returnPackedMsg

- return Packed msg or a list of msgs

Returns:
BOOL

MAC_OutputQueueDequeuePacketForAPriority

To remove packet(s) from front of output queue; process packets


with options for example, pakcing multiple packets with same
next hop address together

- TRUE if dequeued successfully, FALSE otherwise.

BOOL MAC_OutputQueueDequeuePacketForAPriority (Node*node, intinterfaceIndex, intpriority,


Message**msg, NodeAddress*nextHopAddress, int*networkType,
MacOutputQueueDequeueOptiondequeueOption, MacOutputQueueDequeueCriteriadequeueCriteria, int
*numFreeByte, int*numPacketPacked, TraceProtocolTypetracePrt, BOOLeachWithMacHeader,
intmaxHeaderSize, BOOLreturnPackedMsg)
Parameters:
node

- Pointer to a network node

interfaceIndex
priority
msg

- interfaceIndex

- Pointer to queuing priority type

- Pointer to Message

nextHopAddress
networkType

- Pointer to Node address

- network type

dequeueOption

- option

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

dequeueCriteria
numFreeByte

- number of bytes can be packed in 1 transmission

numPacketPacked
tracePrt

- criteria

- number of packets packed

- Trace Protocol Type

eachWithMacHeader
maxHeaderSize

- Each msg has its own MAC header?

- max mac header size

returnPackedMsg

- return Packed msg or a list of msgs

Returns:
BOOL

- TRUE if dequeued successfully, FALSE otherwise.

MAC_IsMyUnicastFrame

BOOL MAC_IsMyUnicastFrame (Node*node, NodeAddressdestAddr)

Parameters:

Check if a packet (or frame) belongs to this node Should be used


only for four byte mac address

node

- Pointer to a network node

destAddr

- Destination Address

Returns:
BOOL

- boolean

MAC_IsWiredNetwork

BOOL MAC_IsWiredNetwork (Node*node, intinterfaceIndex)

Parameters:

To check if an interface is a wired interface

node

- Pointer to a network node

interfaceIndex

- interfaceIndex

Returns:
BOOL

- boolean

MAC_IsPointToPointNetwork

BOOL MAC_IsPointToPointNetwork (Node*node, intinterfaceIndex)

Parameters:

Checks if an interface belongs to Point to PointNetwork

node

- Pointer to a network node

interfaceIndex

- interfaceIndex

Returns:
BOOL

- boolean

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

MAC_IsPointToMultiPointNetwork

BOOL MAC_IsPointToMultiPointNetwork (Node*node, intinterfaceIndex)

Parameters:

Checks if an interface belongs to Point to Multi-Point network.

node

- Pointer to a network node

interfaceIndex

- interfaceIndex

Returns:
BOOL

- boolean

MAC_IsWiredBroadcastNetwork

BOOL MAC_IsWiredBroadcastNetwork (Node*node, intinterfaceIndex)

Parameters:

Determines if an interface is a wired broadcast interface

node

- Pointer to a network node

interfaceIndex

- interfaceIndex

Returns:
BOOL

- boolean

MAC_IsWirelessNetwork

BOOL MAC_IsWirelessNetwork (Node*node, intinterfaceIndex)

Parameters:

Determine if a node's interface is a wireless interface

node

- Pointer to a network node

interfaceIndex

- interfaceIndex

Returns:
BOOL

- boolean

MAC_IsWirelessAdHocNetwork

BOOL MAC_IsWirelessAdHocNetwork (Node*node, intinterfaceIndex)

Parameters:

Determine if a node's interface is a possible wireless ad hoc


interface

node

- Pointer to a network node

interfaceIndex

- interfaceIndex

Returns:
BOOL

- boolean

MAC_IsOneHopBroadcastNetwork

BOOL MAC_IsOneHopBroadcastNetwork (Node*node, intinterfaceIndex)

Parameters:

Determines if an interface is a single Hop Broadcast interface

node

- Pointer to a network node

interfaceIndex

- interfaceIndex

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Returns:
BOOL

- boolean

MAC_IsASwitch

BOOL MAC_IsASwitch (Node*node)

Parameters:

To check if a node is a switch

node

- Pointer to a network node

Returns:
BOOL

- boolean

MAC_SetVirtualMacAddress

void MAC_SetVirtualMacAddress (Node*node, intinterfaceIndex, NodeAddressvirtualMacAddress)

Parameters:

To set MAC address

node

- Pointer to a network node

interfaceIndex

- interface index

virtualMacAddress

- MAC address

Returns:
void

- None

MacSetDefaultHWAddress

void MacSetDefaultHWAddress (Node*node, MacHWAddress*macAddr, intinterfaceIndex)

Parameters:

Set Default interface Hardware Address of node

node

- Pointer to Node structure

macAddr

- Pointer to hardware structure

interfaceIndex

- Interface on which the hardware address set

Returns:
void

- NULL

MAC_IsMyMacAddress

NodeAddress MAC_IsMyMacAddress (Node*node, intinterfaceIndex, NodeAddressdestAddr)

Parameters:

To check if received mac address belongs to itself

node

- Pointer to a network node

interfaceIndex
destAddr

- interface index

- dest address

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

NodeAddress

- Node Address

MAC_IsMyHWAddress

BOOL MAC_IsMyHWAddress (Node*node, intinterfaceIndex, MacAddress*macAddr)

Parameters:

Checks for own MAC address.

node

- Node pointer

interfaceIndex
macAddr

- Interface index

- Mac Address

Returns:
BOOL

- None

MacValidateAndSetHWAddress

void MacValidateAndSetHWAddress (char*macAddrStr, MacHWAddress*macAddr)

Parameters:

Validate MAC Address String after fetching from user

macAddrStr
macAddr

- Pointer to address string

- Pointer to hardware address structure

Returns:
void

- NULL

DefaultMacHWAddressToIpv4Address

NodeAddress DefaultMacHWAddressToIpv4Address (Node*node, MacHWAddress*macAddr)

Parameters:

Retrieve the IP Address from Default HW Address . Default HW


address is equal to 6 bytes

node

- Pointer to Node structure

macAddr

- Pointer to hardware address structure

Returns:
NodeAddress

- Ip address

MacGetHardwareLength

void MacGetHardwareLength (Node*node, intinterface, unsigned shorthwLength)

Parameters:

Retrieve the Hardware Length.

node

- Pointer to Node structure

interface
hwLength

- interface whose hardware length required

- Pointer to hardware string

Returns:
void

MacGetHardwareType

- NULL

void MacGetHardwareType (Node*node, intinterface, unsigned short*type)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Retrieve the Hardware Type.

Parameters:
node

- Pointer to Node structure

interface
type

- interface whose mac type requires

- Pointer to hardware type

Returns:
void

- NULL

MacGetHardwareAddressString

void MacGetHardwareAddressString (Node*node, intinterface)

Parameters:

Retrieve the Hardware Address String.

node

- Pointer to Node structure

interface

- interface whose hardware address retrieved

Returns:
void

MacAddNewInterface

- NULL

void MacAddNewInterface (Node*node, NodeAddressinterfaceAddress, intnumHostBits,


int*interfaceIndex, const NodeInputnodeInput, char*macProtocolName)

Parameters:
To add a new Interface at MAC
node

- Pointer to a network node

interfaceAddress
numHostBits

- No of host bits

interfaceIndex
nodeInput

- interface IP add

- interface index

- node input

macProtocolName

- Mac protocol of interface

Returns:
void

MacAddVlanInfoForThisInterface

- None

void MacAddVlanInfoForThisInterface (Node*node, int*interfaceIndex, NodeAddressinterfaceAddress,


const NodeInputnodeInput)

Parameters:
Init and read VLAN configuration from user input for node and
interface passed as arguments

node

- Pointer to a network node

interfaceIndex

- interface index

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

interfaceAddress
nodeInput

- interface IP add

- node input

Returns:
void

- None

MacReleaseVlanInfoForThisInterface

NodeAddress MacReleaseVlanInfoForThisInterface (Node*node, intinterfaceIndex)

Parameters:

To flush VLAN info for an interface

node

- Pointer to a network node

interfaceIndex

- interface index

Returns:
NodeAddress

- Node Address

MAC_IsBroadcastHWAddress

BOOL MAC_IsBroadcastHWAddress (MacHWAddress*macAddr)

Parameters:

Checks Broadcast MAC address

macAddr

- structure to hardware address

Returns:
BOOL

- TRUE or FALSE

MAC_IsIdenticalHWAddress

BOOL MAC_IsIdenticalHWAddress (MacHWAddress*macAddr1, MacHWAddress*macAddr2)

Parameters:

Compares two MAC addresses

macAddr1

- Pointer to harware address structure

macAddr2

- Pointer to harware address structure

Returns:
BOOL

- TRUE or FALSE

MAC_PrintHWAddr

void MAC_PrintHWAddr (MacHWAddress*macAddr)

Parameters:

Prints interface Mac Address

macAddr

- Mac address

Returns:
void

- None

MAC_PrintMacAddr

void MAC_PrintMacAddr (Mac802Address*macAddr)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Prints interface Mac Address

macAddr

- Mac address

Returns:
void

- None

MAC_RandFaultInit

void MAC_RandFaultInit (Node*node, intinterfaceIndex, const char*currentLine)

Parameters:

Initialization the Random Fault structure from input file

node

- Node pointer

interfaceIndex
currentLine

- Interface index

- pointer to the input string

Returns:
void

- NULL

MAC_RandFaultFinalize

void MAC_RandFaultFinalize (Node*node, intinterfaceIndex)

Parameters:

IPrint the statistics of Random link fault.

node

- Node pointer

interfaceIndex

- Interface index

Returns:
void

- NULL

MAC_GetPacketsPriority

TosType MAC_GetPacketsPriority (Message*msg)

Parameters:

Returns the priority of the packet

msg

- Node Pointer

Returns:
TosType

MAC_TranslateMulticatIPv4AddressToMulticastMacAddress

- priority NOTE: DOT11e updates

void MAC_TranslateMulticatIPv4AddressToMulticastMacAddress (NodeAddressmultcastAddress,


MacHWAddress*macMulticast)

Parameters:
Convert the Multicast ip address to multicast MAC address
multcastAddress
macMulticast

- Multicast ip address

- Pointer to mac hardware address

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

MAC_OutputQueuePeekByIndex

BOOL MAC_OutputQueuePeekByIndex (Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


NodeAddressnextHopAddress, TosTypepriority)

Parameters:
Look at the packet at the index of the output queue.
node

- Node pointer

interfaceIndex
msgIndex
msg

- Interface index

- Message index

- Double pointer to message

nextHopAddress
priority

- Next hop mac address

- priority

Returns:
BOOL

MAC_OutputQueuePeekByIndex

- TRUE if the messeage found, FALSE otherwise

BOOL MAC_OutputQueuePeekByIndex (Node*node, intinterfaceIndex, intmsgIndex, Message**msg,


Mac802Address*nextHopAddress, TosTypepriority)

Parameters:
Look at the packet at the index of the output queue.
node

- Node pointer

interfaceIndex
msgIndex
msg

- Interface index

- Message index

- Double pointer to message

nextHopAddress
priority

- Next hop mac address

- priority

Returns:
BOOL

MAC_OutputQueuePeekByIndex

- TRUE if the messeage found, FALSE otherwise

BOOL MAC_OutputQueuePeekByIndex (intinterfaceIndex, intmsgIndex, Message**msg,


MacHWAddress*nextHopAddress, TosTypepriority)

Parameters:
Look at the packet at the index of the output queue.
interfaceIndex
msgIndex
msg

- Interface index

- Message index

- Double pointer to message

nextHopAddress

- Next hop mac address

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

priority

- priority

Returns:
BOOL

MAC_OutputQueueDequeuePacketWithIndex

- TRUE if the messeage found, FALSE otherwise

BOOL MAC_OutputQueueDequeuePacketWithIndex (Node*node, intinterfaceIndex, intmsgIndex,


Message**msg, NodeAddressnextHopAddress, intnetworkType)

Parameters:
To remove the packet at specified index output queue.
node

- Node pointer

interfaceIndex
msgIndex
msg

- Interface index

- Message index

- Double pointer to message

nextHopAddress
networkType

- Next hop IP address

- Type of network

Returns:
BOOL

MAC_OutputQueueDequeuePacketWithIndex

- TRUE if the messeage dequeued properly, FALSE otherwise

BOOL MAC_OutputQueueDequeuePacketWithIndex (Node*node, intinterfaceIndex, intmsgIndex,


Message**msg, Mac802Address*nextHopMacAddress, intnetworkType)

Parameters:
To remove the packet at specified index output queue.
node

- Node pointer

interfaceIndex
msgIndex
msg

- Interface index

- Message index

- Double pointer to message

nextHopMacAddress
networkType

- Next hop mac address

- Type of network

Returns:
BOOL

MAC_OutputQueueDequeuePacketWithIndex

- TRUE if the messeage dequeued properly, FALSE otherwise

BOOL MAC_OutputQueueDequeuePacketWithIndex (Node*node, intinterfaceIndex, intmsgIndex,


Message**msg, MacHWAddressnextHopMacAddress, intnetworkType)

Parameters:
To remove the packet at specified index output queue.
node

- Node pointer

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

interfaceIndex
msgIndex
msg

- Interface index

- Message index

- Double pointer to message

nextHopMacAddress
networkType

- Next hop mac address

- Type of network

Returns:
- TRUE if the messeage dequeued properly, FALSE otherwise

BOOL

MAC_IPv4addressIsMulticastAddress

BOOL MAC_IPv4addressIsMulticastAddress (NodeAddressipV4)

Parameters:

Check the given address is Multicast address or not.

ipV4

- ipV4 address

Returns:
- TRUE or FALSE

BOOL

MAC_IsBroadcastMacAddress

BOOL MAC_IsBroadcastMacAddress (MacAddress*macAddr)

Parameters:

Checks Broadcast MAC address.

macAddr

- Mac Address.

Returns:
- None

BOOL

IPv4AddressToDefaultMac802Address

void IPv4AddressToDefaultMac802Address (Node*node, intindex, NodeAddressipv4Address,


Mac802Address*macAddr)

Parameters:
Retrieve the Mac802Address from IP address.
node

- Pointer to Node structure

index

- Interface Index

ipv4Address
macAddr

- Ipv4 address from which the

- Pointer to Mac802address structure

Returns:
void

ConvertVariableHWAddressTo802Address

- NULL

Bool ConvertVariableHWAddressTo802Address (Node*node, MacHWAddress*macHWAddr,


Mac802Address*mac802Addr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Parameters:
Convert Variable Hardware address to Mac 802 addtess
node

- Pointer to Node structure

macHWAddr

- Pointer to hardware address structure

mac802Addr

- Pointer to mac 802 address structure

Returns:
Bool

- None

MAC_CopyMacHWAddress

void MAC_CopyMacHWAddress (MacHWAddress*destAddr, MacHWAddress*srcAddr)

Parameters:

Copies Hardware address address

destAddr
srcAddr

- structure to destination hardware address

- structure to source hardware address

Returns:
void

- NULL

DefaultMac802AddressToIpv4Address

NodeAddress DefaultMac802AddressToIpv4Address (Node*node, Mac802Address*macAddr)

Parameters:

Retrieve IP address from.Mac802Address

node

- Pointer to Node structure

macAddr

- Pointer to hardware address structure

Returns:
NodeAddress

IPv4AddressToHWAddress

- Ipv4 Address

BOOL IPv4AddressToHWAddress (Node*node, intinterfaceIndex, Message*msg,


NodeAddressipv4Address)

Parameters:
Converts IP address.To MacHWAddress
node

- Pointer to Node structure

interfaceIndex
msg

- interfcae index of a node

- Message pointer

ipv4Address

- Ipv4 address from which the

Returns:
BOOL

MacHWAddressToIpv4Address

- Returns False when conversion fails

NodeAddress MacHWAddressToIpv4Address (Node *node, intinterfaceIndex, MacHWAddress*macAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

This functions converts variable length Mac address to IPv4


address It checks the type of hardware address and based on that
conversion is done.

Parameters:
node

- Pointer to node which indicates the host

interfaceIndex
macAddr

- Interface index of a node

- Pointer to MacHWAddress Structure.

Returns:
NodeAddress

- IP address

decToHex

char* decToHex (intdec)

Parameters:

Convert one byte decimal number to hex number.

dec

- decimal number

Returns:
char*

MAC_FourByteMacAddressToVariableHWAddress

- return correspondig hex digit string for one byte decimal number

void MAC_FourByteMacAddressToVariableHWAddress (Node *node, intinterfaceIndex,


MacHWAddress *macAddr, NodeAddressnodeAddr)

Parameters:
node

- Pointer to node which indicates the host

interfaceIndex
macAddr

- Interface index of a node

- Pointer to source MacHWAddress Structure

nodeAddr

- Ip address

Returns:
void

MAC_VariableHWAddressToFourByteMacAddress

- None

NodeAddress MAC_VariableHWAddressToFourByteMacAddress (Node*node,


MacHWAddress*macAddr)

Parameters:
Retrieve IP address from.MacHWAddress of type
IPV4_LINKADDRESS

node

- Pointer to Node structure

macAddr

- Pointer to hardware address structure

Returns:
NodeAddress

- Ipv4 Address

GetBroadCastAddress

MacHWAddress GetBroadCastAddress (Node*node, intinterfaceIndex)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

Returns Broadcast Address of an interface

- Pointer to a node

node

interfaceIndex

- Interface of a node

Returns:
MacHWAddress

- Broadcast mac address of a interface

GetMacHWAddress

MacHWAddress GetMacHWAddress (Node*node, intinterfaceIndex)

Parameters:

Returns MacHWAddress of an interface

- Pointer to a node

node

interfaceIndex

- inetrface of a node

Returns:
MacHWAddress

- Mac address of a interface

MacGetInterfaceIndexFromMacAddress

int MacGetInterfaceIndexFromMacAddress (Node*node, MacHWAddressmacAddr)

Parameters:

Returns interfaceIndex at which Macaddress is configured

- Pointer to a node

node

macAddr

- Mac Address of a node

Returns:
int

- interfaceIndex of node

MacGetInterfaceIndexFromMacAddress

int MacGetInterfaceIndexFromMacAddress (Node*node, Mac802AddressmacAddr)

Parameters:

Returns interfaceIndex at which Macaddress is configured

- Pointer to a node

node

macAddr

- Mac Address of a node

Returns:
int

- interfaceIndex of node

MacGetInterfaceIndexFromMacAddress

int MacGetInterfaceIndexFromMacAddress (Node*node, NodeAddressmacAddr)

Parameters:

Returns interfaceIndex at which Macaddress is configured

node

- Pointer to a node

macAddr

- Mac Address of a node

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAC LAYER

int

- interfaceIndex of node

MAC_Reset

void MAC_Reset (Node*node, intInterfaceIndex)

Parameters:

Reset the Mac protocols use by the node

node

- Pointer to the node

InterfaceIndex

- interface index

Returns:
- None

void

MAC_AddResetFunctionList

void MAC_AddResetFunctionList (Node*node, intInterfaceIndex, void*param)

Parameters:

Add which protocols in the Mac layer to be reset to a fuction list


pointer.

node

- Pointer to the node

InterfaceIndex
param

- interface index

- pointer to the protocols reset function

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAC LAYER.html[10/28/2011 1:29:22 PM]

MAIN

QualNet 5.2 API Reference


MAIN
This file contains some common definitions.
Constant / Data Structure Summary
Type

Name

CONSTANT

MAX_NUM_PHYS

Maximum number of Physical channel

CONSTANT

MAX_NUM_INTERFACES

Maximum number of Interfaces.

CONSTANT

PROTOCOL_TYPE_IP

Length Field value for protocol IP TYPE

CONSTANT

PROTOCOL_TYPE_ARP

ARP type

CONSTANT

ANY_DEST

This is a special addresses used in the MAC and network layers. It defines any destination.

CONSTANT

ANY_MAC802

This is a special addresses used in the MAC and network layers. It defines any destination of six byte.

CONSTANT

INVALID_802ADDRESS

This is a special addresses used in the MAC and network layers. It is used for invalid address

CONSTANT

ANY_SOURCE_ADDR

This is a special addresses used in the MAC and network layers. It defines any source.

CONSTANT

ANY_IP

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

This is a special addresses used in the MAC and network layers. It defines any IP.

CONSTANT

ANY_INTERFACE

This is a special addresses used in the MAC and network layers. It defines any Interface.

CONSTANT

CPU_INTERFACE

This is a special addresses used in the MAC and network layers. It defines CPU Interface.

CONSTANT

INVALID_ADDRESS

It defines Invalid Address. Used only by mac/mac_802_11.c.

CONSTANT

MAX_STRING_LENGTH

Generic maximum length of a string. The maximum length of any line in the input file is 3x this value.

CONSTANT

BIG_STRING_LENGTH

maximum length of a string.

CONSTANT

MAX_CLOCK_STRING_LENGTH

Generic maximum length of a clock string.

CONSTANT

MAX_NW_PKT_SIZE

Defines the Maximum Network Packet Size which can handled by the physical network. In QualNet, its value is 2048. Packet larger
than this will be fragmented by IP.

CONSTANT

MIN_NW_PKT_SIZE

Defines the Minimum Network Packet Size which can be handled by the physical network. In QualNet, its value is 40. Packets smaller
than this will not have room for transport headers and most firewall-type devices will drop an initial fragment that does not contain
enough data to hold the transport headers.

CONSTANT

MIN_IPv6_PKT_SIZE

Defines the Minimum Network Packet Size which can be handled by the IPv6 physical network. In QualNet, its value is 60. Packets
smaller than this will not have room for transport headers and most firewall-type devices will drop an initial fragment that does not
contain enough data to hold the transport headers. The additional space is to allow for IPv6's larger headers.

ENUMERATION

NetworkType

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

ENUMERATION

Enlisted different network type

enum for the various layers in QualNet. New layers added to the simulation should be added here as well. Used by models at all layers
in the protocol stack to mark newly created messages to be destined to the right layer/module.

STRUCT

in6_addr

Describes the IPv6 address

STRUCT

AtmAddress

Describes the ATM address

STRUCT

Address

Describes the address structure which contains the interface address and network type

Function / Macro Summary


Return Type

Summary

MACRO

MAX(X, Y)

Utility function MAX. Calculates the Maximum one from two given numbers.
MACRO

MIN(X, Y)

Utility function MIN. Calculates the Minimum one from two given numbers.
MACRO

ABS(X)

Utility function ABS. Return the absolute value of a given number.


MACRO

IN_DB(x)

Utility function, decibel converter. Performs the 10 base log operation on the given number and then multiply with 10.
MACRO

NON_DB(x)

Utility function, decibel converter. Performs power operation on the given number.
MACRO

MEM_malloc

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

Adds filename and line number parameters to the MEM_malloc function


NodeAddress

GetIPv4Address(Addressaddr)

Get IPv4 address from generic address


in6_addr

GetIPv6Address(Addressaddr)

Get IPv6 address from generic address


void

SetIPv4AddressInfo(Addressaddress, NodeAddressaddr)

Set IPv4 address and network type to generic address


void

SetIPv6AddressInfo(Addressaddress, in6_addraddr)

Set IPv6 address and network type to generic address


int

RoundToInt(doublex)

Round a float point number to an integer. This function tries to get consistent value on different platforms
void*

MEM_malloc(size_tsize, char*filename, intlineno)

Allocates memory block of a given size.


void

MEM_free(void*ptr)

Deallocates the memory in turn it calls free().


UInt8

maskChar(UInt8sposition, UInt8eposition)

Return 1's in all bit positions between sposition and eposition


UInt16

maskShort(UInt16sposition, UInt16eposition)

Return 1's in all bit positions between sposition and eposition


UInt32

maskInt(intsposition, inteposition)

Return 1's in all bit positions between sposition and eposition


UInt8

LshiftChar(UInt8x, UInt8eposition)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

Left shifts data where eposition determines the position of thelast bit after the shift and (size-eposition) determines the number of bits to
be shifted
UInt16

LshiftShort(UInt16x, UInt16eposition)

Left shifts data where eposition determines the position of thelast bit after the shift and (size-eposition) determines the number of bits to
be shifted
UInt32

LshiftInt(UInt32x, inteposition)

Left shifts data where eposition determines the position of thelast bit after the shift and (size-eposition) determines the number of bits to
be shifted
UInt8

RshiftChar(UInt8x, UInt8eposition)

Right shifts data where eposition determines the position of thelast bit after the shift and (size-eposition) determines the number of bits
to be shifted
UInt16

RshiftShort(UInt16x, UInt16eposition)

Right shifts data where eposition determines the position of thelast bit after the shift and (size-eposition) determines the number of bits
to be shifted
UInt32

RshiftInt(UInt32x, inteposition)

Right shifts data where eposition determines the position of thelast bit after the shift and (size-eposition) determines the number of bits
to be shifted

Constant / Data Structure Detail

Constant

MAX_NUM_PHYS28

Constant

Maximum number of Physical channel


MAX_NUM_INTERFACES96

Constant

Maximum number of Interfaces.


PROTOCOL_TYPE_IP0x0800

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

Constant

Length Field value for protocol IP TYPE


PROTOCOL_TYPE_ARP0x0806

Constant

ARP type
ANY_DEST0xffffffff

Constant

This is a special addresses used in the MAC and network layers. It defines any destination.
ANY_MAC8020xffffffffffff

Constant

This is a special addresses used in the MAC and network layers. It defines any destination of six byte.
INVALID_802ADDRESS0xfffffffffffe

Constant

This is a special addresses used in the MAC and network layers. It is used for invalid address
ANY_SOURCE_ADDR0xffffffff

Constant

This is a special addresses used in the MAC and network layers. It defines any source.
ANY_IP0xffffffff

Constant

This is a special addresses used in the MAC and network layers. It defines any IP.
ANY_INTERFACE-1

Constant

This is a special addresses used in the MAC and network layers. It defines any Interface.
CPU_INTERFACE-2

Constant

This is a special addresses used in the MAC and network layers. It defines CPU Interface.
INVALID_ADDRESS987654321

Constant

It defines Invalid Address. Used only by mac/mac_802_11.c.


MAX_STRING_LENGTH200

Constant

Generic maximum length of a string. The maximum length of any line in the input file is 3x this value.
BIG_STRING_LENGTH512

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

Constant

maximum length of a string.


MAX_CLOCK_STRING_LENGTH24

Constant

Generic maximum length of a clock string.


MAX_NW_PKT_SIZE2048

Constant

Defines the Maximum Network Packet Size which can handled by the physical network. In QualNet, its value is 2048. Packet larger than
this will be fragmented by IP.
MIN_NW_PKT_SIZE40

Constant

Defines the Minimum Network Packet Size which can be handled by the physical network. In QualNet, its value is 40. Packets smaller
than this will not have room for transport headers and most firewall-type devices will drop an initial fragment that does not contain enough
data to hold the transport headers.
MIN_IPv6_PKT_SIZE60

Enumeration

Defines the Minimum Network Packet Size which can be handled by the IPv6 physical network. In QualNet, its value is 60. Packets
smaller than this will not have room for transport headers and most firewall-type devices will drop an initial fragment that does not contain
enough data to hold the transport headers. The additional space is to allow for IPv6's larger headers.
NetworkType

Enumeration

Enlisted different network type

Structure

enum for the various layers in QualNet. New layers added to the simulation should be added here as well. Used by models at all layers in
the protocol stack to mark newly created messages to be destined to the right layer/module.
in6_addr

Structure

Describes the IPv6 address


AtmAddress

Structure

Describes the ATM address


Address

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

Describes the address structure which contains the interface address and network type

Function / Macro Detail


Function / Macro
MAX(X, Y)

Format
Utility function MAX. Calculates the Maximum one from two given numbers.

MIN(X, Y)

Utility function MIN. Calculates the Minimum one from two given numbers.

ABS(X)

Utility function ABS. Return the absolute value of a given number.

IN_DB(x)

Utility function, decibel converter. Performs the 10 base log operation on the given number and then multiply with 10.

NON_DB(x)

Utility function, decibel converter. Performs power operation on the given number.

MEM_malloc

Adds filename and line number parameters to the MEM_malloc function

GetIPv4Address

NodeAddress GetIPv4Address (Addressaddr)

Parameters:

Get IPv4 address from generic address

addr

- generic address.

Returns:
NodeAddress

- IPv4 address

GetIPv6Address

in6_addr GetIPv6Address (Addressaddr)

Parameters:

Get IPv6 address from generic address

addr

- generic address.

Returns:
in6_addr

- IPv6 address

SetIPv4AddressInfo

void SetIPv4AddressInfo (Addressaddress, NodeAddressaddr)

Parameters:

Set IPv4 address and network type to generic


address

address
addr

- generic address.

- IPv4 interface address.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

Returns:
- NULL

void

SetIPv6AddressInfo

void SetIPv6AddressInfo (Addressaddress, in6_addraddr)

Parameters:

Set IPv6 address and network type to generic


address

address

- generic address.

- IPv6 interface address.

addr

Returns:
- NULL

void

RoundToInt

int RoundToInt (doublex)

Parameters:

Round a float point number to an integer.


This function tries to get consistent value on
different platforms

- The float point number to be rounded

Returns:
- Returns the rounded integer

int

MEM_malloc

void* MEM_malloc (size_tsize, char*filename, intlineno)

Parameters:

Allocates memory block of a given size.

size

- Size of the memory block to be allocated.

filename
lineno

- Name of file allocating the memory

- Line in the file where the API is called

Returns:
void*

- Returns the pointer of allocated memory otherwise NULL if allocation fails.

MEM_free

void MEM_free (void*ptr)

Parameters:

Deallocates the memory in turn it calls free().

ptr

- Pointer of memory to be freed.

Returns:
void

- None

maskChar

UInt8 maskChar (UInt8sposition, UInt8eposition)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

Return 1's in all bit positions between


sposition and eposition

sposition

- starting bit position

eposition

- last bit position set to 1

Returns:
UInt8

- None

maskShort

UInt16 maskShort (UInt16sposition, UInt16eposition)

Parameters:

Return 1's in all bit positions between


sposition and eposition

sposition

- starting bit position

eposition

- last bit position set to 1

Returns:
UInt16

- None

maskInt

UInt32 maskInt (intsposition, inteposition)

Parameters:

Return 1's in all bit positions between


sposition and eposition

sposition

- starting bit position

eposition

- last bit position set to 1

Returns:
UInt32

- None

LshiftChar

UInt8 LshiftChar (UInt8x, UInt8eposition)

Parameters:

Left shifts data where eposition determines


the position of thelast bit after the shift and
(size-eposition) determines the number of bits
to be shifted

- the data to be shifted

eposition

- last bit position set to 1

Returns:
UInt8

- None

LshiftShort

UInt16 LshiftShort (UInt16x, UInt16eposition)

Parameters:

Left shifts data where eposition determines


the position of thelast bit after the shift and
(size-eposition) determines the number of bits
to be shifted

- the data to be shifted

eposition

- last bit position set to 1

Returns:
UInt16

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

LshiftInt

UInt32 LshiftInt (UInt32x, inteposition)

Parameters:

Left shifts data where eposition determines


the position of thelast bit after the shift and
(size-eposition) determines the number of bits
to be shifted

- the data to be shifted

eposition

- last bit position set to 1

Returns:
UInt32

- None

RshiftChar

UInt8 RshiftChar (UInt8x, UInt8eposition)

Parameters:

Right shifts data where eposition determines


the position of thelast bit after the shift and
(size-eposition) determines the number of bits
to be shifted

- the data to be shifted

eposition

- last bit position set to 1

Returns:
UInt8

- None

RshiftShort

UInt16 RshiftShort (UInt16x, UInt16eposition)

Parameters:

Right shifts data where eposition determines


the position of thelast bit after the shift and
(size-eposition) determines the number of bits
to be shifted

- the data to be shifted

eposition

- last bit position set to 1

Returns:
UInt16

- None

RshiftInt

UInt32 RshiftInt (UInt32x, inteposition)

Parameters:

Right shifts data where eposition determines


the position of thelast bit after the shift and
(size-eposition) determines the number of bits
to be shifted

- the data to be shifted

eposition

- last bit position set to 1

Returns:
UInt32

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAIN

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAIN.html[10/28/2011 1:29:31 PM]

MAPPING

QualNet 5.2 API Reference


MAPPING
This file describes data structures and functions for mapping between node pointers, node identifiers, and node addresses.
Constant / Data Structure Summary
Type

Name

CONSTANT

INVALID_MAPPING

Indicates Invalid Mapping

CONSTANT

MAX_INTERFACE_ADDRESSES

max no of addressees assigned to an interface

CONSTANT

NODE_HASH_SIZE

Defines node hash size. Hashes the nodeIds using a mod NODE_HASH_SIZE hash.

STRUCT

NetworkProperty

Describes the property of a network.

STRUCT

AddressMappingType

Describes the type of address mapping.

STRUCT

AddressReverseMappingType

Describes the type of reverse address mapping.

STRUCT

SubnetListType

Used to determine what the next address counter should be for each subnet address. This is needed to allow different SUBNET/LINK
statements to declare the same subnet address.

STRUCT

AddressMapType

Describes the detailed information of Node ID <--> IP address mappings.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

STRUCT

nodeIdToNodePtr

Describes the nodeId and corresponding nodePtr.

Function / Macro Summary


Return Type

Summary

MACRO

MADDR6_SCOPE(a)

Multicast Address Scope.


MACRO

IS_MULTIADDR6(a)

Checks whether an address is multicast address.


MACRO

CLR_ADDR6(a)

Set an address with 0 values.


MACRO

IS_CLR_ADDR6(a)

Does an address have the value of 0 (Cleared).


MACRO

COPY_ADDR6(from, to)

Copies from-ipv6 address to to-ipv6 address.


MACRO

SAME_ADDR6(a, b)

Checks if a and b address is same address.


MACRO

IS_ANYADDR6(a)

Checks whether the address is any address or not.


MACRO

IS_LOOPADDR6(a)

Checks whether it is loopback address.


MACRO

CMP_ADDR6(a, b)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Compaires two addresses.


MACRO

IS_IPV4ADDR6(a)

Checks whether it is ipv4 address.


MACRO

IS_LOCALADDR6(a)

Checks whether it is local address.


MACRO

IS_LINKLADDR6(a)

Checks whether it is link local address.


MACRO

IS_SITELADDR6(a)

Checks whether it is site local address.


MACRO

SAME_ADDR4(a, b)

Checks whether IPv4 addresses match.


MACRO

IS_ANYADDR4(a)

Checks whether IPv4 address is ANY_DEST.


BOOL

Address_IsSameAddress(Address* addr1addr1, Address* addr2addr2)

Check whether both addresses(i.e. addr1 and addr2) are same.


BOOL

Address_IsAnyAddress(Address* addraddr)

Check whether addr is any address of the same type


BOOL

Address_IsMulticastAddress(Address* addraddr)

Check whether addr is a multicast address


BOOL

Address_IsSubnetBroadcastAddress(Node* nodenode, Address* addraddr)

Check whether addr is a subnet broadcast address


void

Address_SetToAnyAddress(Address* addraddr, Address* refAddrrefAddr)

Set addr to any address of the same type as refAddr.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

void

Address_AddressCoopy(Address*dstAddress, Address*srcAddress)

Copy srcAddress to dstAddress


int

Ipv6CompareAddr6(in6_addra, in6_addrb)

Compairs to ipv6 address. if a is greater than b then returns positive, if equals then 0, a is smaller then b then negative.
BOOL

Ipv6IsAddressInNetwork(const in6_addr*globalAddr, unsigned inttla, unsigned intvla, unsigned intsla)

Checks whether the address is in the same network. : if in the same network then returns TRUE, otherwise FALSE.
BOOL

Ipv6IsAddressInNetwork(const in6_addr*globalAddr, const in6_addr*ipv6SubnetAddr, unsigned intprefixLenth)

Checks whether the address is in the same network. : if in the same network then returns TRUE, otherwise FALSE.
BOOL

Ipv6CheckNetworkParams(unsigned int tlatla, unsigned int nlanla, unsigned int slasla)

Checks network parameters (tla, nla, sla)


void

MAPPING_HashNodeId(IdToNodePtrMap*hash, NodeAddressnodeId, Node*nodePtr)

Hashes the nodeIds using a mod NODE_HASH_SIZE hash. This is not thread safe.
Node*

MAPPING_GetNodePtrFromHash(IdToNodePtrMap*hash, NodeAddressnodeId)

Retrieves the node pointer for nodeId from hash.


AddressMapType*

MAPPING_MallocAddressMap()

Allocates memory block of size AddressMapType.


void

MAPPING_InitAddressMap(AddressMapType*map)

Initializes the AddressMapType structure.


void

MAPPING_BuildAddressMap(const NodeInput*nodeInput, NodeAddress**nodeIdArrayPtr, AddressMapType*map)

Builds the address map


NodeAddress

MAPPING_GetInterfaceAddressForSubnet(Node*node, NodeAddressnodeId, NodeAddresssubnetAddress, intnumHostBits)

Gives Interface address for a Subnet.


NodeAddress

MAPPING_GetInterfaceAddressForSubnet(const AddressMapType*map, NodeAddressnodeId, NodeAddresssubnetAddress,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

intnumHostBits)

Gives Interface address for a Subnet.


NodeAddress

MAPPING_GetSubnetAddressForInterface(Node*node, NodeAddressnodeId, intinterfaceIndex)

Gives the Subnet address for an interface.


NodeAddress

MAPPING_GetSubnetMaskForInterface(Node*node, NodeAddressnodeId, intinterfaceIndex)

Gives the Subnet mask for an interface.


int

MAPPING_GetNumHostBitsForInterface(Node*node, NodeAddressnodeId, intinterfaceIndex)

Gives the number of host bits for an interface.


void

MAPPING_GetInterfaceInfoForInterface(Node*node, NodeAddressnodeId, intinterfaceIndex,


NodeAddress*interfaceAddress, NodeAddress*subnetAddress, NodeAddress*subnetMask, int*numHostBits)

Gives the Interface information for an interface.


NodeAddress

MAPPING_GetInterfaceAddressForInterface(Node*node, NodeAddressnodeId, intinterfaceIndex)

Gives the Interface address for an interface.


Address

MAPPING_GetInterfaceAddressForInterface(NetworkTypenetType, intrelativeInfInx)

Get node interface Address according to the network specific interface index. Overloaded function for ATM compatibility.
NodeAddress

MAPPING_GetNodeIdFromInterfaceAddress(Node*node, NodeAddressinterfaceAddress)

Gives Node id from an interface address.


NodeAddress

MAPPING_GetNodeIdFromInterfaceAddress(Node*node, AddressinterfaceAddress)

Gives Node id from an interface address. Overloaded for IPv6


NodeAddress

MAPPING_GetDefaultInterfaceAddressFromNodeId(Node*node, NodeAddressnodeId)

Gives default interface address from a node id.


unsigned int

MAPPING_GetNumNodesInSubnet(Node*node, NodeAddresssubnetAddress)

Gives the number of nodes in a subnet.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

unsigned int

MAPPING_GetSubnetAddressCounter(AddressMapType*map, NodeAddresssubnetAddress)

Gives the subnet address counter.


void

MAPPING_UpdateSubnetAddressCounter(AddressMapType*map, NodeAddresssubnetAddress, intaddressCounter)

Updates the subnet address counter.


int

MAPPING_GetInterfaceIndexFromInterfaceAddress(Node*node, NodeAddressinterfaceAddress)

Gets the node's interface index for the given address.


Address

MAPPING_GetNodeInfoFromAtmNetInfo(unsigned int*index, unsigned int*genIndex)

Get node interface Address, generic interfaceIndex and Atm related interfaceIndex from ATM Network information.
unsigned int

MAPPING_GetInterfaceIdForDestAddress(Node*node, NodeIdnodeId, NodeAddressdestAddr)

For a given destination address find its interface index


NodeAddress

MAPPING_GetSubnetMaskForDestAddress(Node*node, NodeIdnodeId, NodeAddressdestAddr)

For a given nodeId & destination address find the subnet mask for the associated network
NodeAddress

MAPPING_GetInterfaceAddrForNodeIdAndIntfId(Node*node, NodeIdnodeId, intintfId)

For a given nodeId & InterfaceId find the associated IP-Address


unsigned int

MAPPING_GetIPv6NetworkAddressCounter(AddressMapType*map, in6_addrsubnetAddr, unsigned intsubnetPrefixLen)

Get IPV6 network address counter.


void

MAPPING_UpdateIPv6NetworkAddressCounter(AddressMapType*map, in6_addrsubnetAddr, unsigned intsubnetPrefixLen,


intaddressCounter)

Update IPV6 network address counter.


unsigned int

MAPPING_GetNumNodesInIPv6Network(Node*node, in6_addrsubnetAddr, unsigned intsubnetPrefixLen)

Get Num of nodes in IPV6 network.


NetworkType

MAPPING_GetNetworkIPVersion(const char*addrString)

Get Network version IPv4/IPv6.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

NetworkType

MAPPING_GetNetworkType(const char*addrString)

Identify network type from addrString.


void

MAPPING_GetIpv6InterfaceInfoForInterface(Node *nodenode, NodeId nodeIdnodeId, intinterfaceIndex,


in6_addr*globalAddr, in6_addr*subnetAddr, unsigned int*subnetPrefixLen)

Get IPV6 interface information for a interface.


BOOL

MAPPING_GetIpv6GlobalAddress(Node *nodenode, NodeId nodeIdnodeId, unsigned inttla, unsigned intnla, unsigned


intsla, in6_addr *addr6)

Get IPV6 global address.


BOOL

MAPPING_GetIpv6GlobalAddressForInterface(Node *node, NodeIdnodeId, intinterfaceIndex, in6_addr *addr6,


BOOLisDeprecated)

Get IPV6 global address for a node's nth interface.


void

MAPPING_CreateIpv6GlobalUnicastAddr(unsigned inttla, unsigned intnla, unsigned intsla, intaddressCounter,


in6_addr*globalAddr)

Create IPv6 Global Unicast Address from tla nla sla


void

MAPPING_CreateIpv6GlobalUnicastAddr(AddressMapType *map, in6_addrIPv6subnetAddress, uunsigned


intIPv6subnetPrefixLen, intaddressCounter, in6_addr*globalAddr)

Create IPv6 Global Unicast Address.


void

MAPPING_CreateIpv6LinkLocalAddr(in6_addr*globalAddr, in6_addr*linkLocalAddr, unsigned intsubnetPrefixLen)

Create IPv6 link local Address.


void

MAPPING_CreateIpv6SiteLocalAddr(in6_addr*globalAddr, in6_addr*siteLocalAddr, unsigned shortsiteCounter,


unsigned intsubnetPrefixLen)

Create IPv6 site local Address.


void

MAPPING_CreateIpv6MulticastAddr(in6_addr*globalAddr, in6_addr*multicastAddr)

Create ipv6 multicast address.


void

MAPPING_CreateIpv6SubnetAddr(unsigned inttla, unsigned intnla, unsigned intsla, unsigned


int*IPv6subnetPrefixLen, in6_addr*IPv6subnetAddress)

create subnet addr for IPV6 address.


NodeId

MAPPING_GetNodeIdFromGlobalAddr(Node *node, in6_addr*globalAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Get node id from Global Address.


NodeId

MAPPING_GetNodeIdFromLinkLayerAddr(Node *node, NodeAddresslinkLayerAddr)

Get node id from Link layer Address.


NodeAddress

MAPPING_CreateIpv6LinkLayerAddr(unsigned intnodeId, intinterfaceId)

Create IPv6 link layer Address.


BOOL

MAPPING_IsIpv6AddressOfThisNode(Node*node, const NodeAddressnodeId, in6_addr*globalAddr)

checks whether the ipv6 address is of this node.


BOOL

MAPPING_IsNodeInThisIpRange(Node*node, NodeIdnodeId, NodeAddressstartRange, NodeAddressendRange)

checks whether the node is in given range of : Addresses.


BOOL

MAPPING_IsIpAddressOfThisNode(Node*node, const NodeAddressnodeId, NodeAddressaddr)

checks whether the ipv4 address is of this node.


BOOL

MAPPING_GetInterfaceAddressForSubnet(Node*node, NodeIdnodeId, in6_addr*ipv6SubnetAddr, unsigned


intprefixLenth, in6_addr*ipv6InterfaceAddr, int*interfaceIndex)

Get interface address for subnet using ipv6 addr.


BOOL

MAPPING_GetInterfaceAddressForSubnet(const AddressMapType*map, NodeIdnodeId, in6_addr*ipv6SubnetAddr,


unsigned intprefixLenth, in6_addr*ipv6InterfaceAddr, int*interfaceIndex)

Get interface address for subnet using ipv6 addr.


BOOL

MAPPING_GetInterfaceAddressForSubnet(Node* nodenode, NodeId nodeIdnodeId, unsigned inttla, unsigned intnla,


unsigned intsla, in6_addr*ipv6Addr, int*interfaceIndex)

Get interface address for subnet using tla nla sla.


BOOL

; MAPPING_GetInterfaceAddressForSubnet(const AddressMapType*map, NodeIdnodeId, unsigned inttla, unsigned


intnla, unsigned intsla, in6_addr*ipv6Addr, int*interfaceIndex)

Get interface address for subnet using tla nla sla.


int

MAPPING_GetInterfaceFromLinkLayerAddress(Node*node, const NodeAddresslinkLayerAddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Get interface from link layer address.


int

MAPPING_GetInterfaceIndexFromInterfaceAddress(Node*node, AddressinterfaceAddress)

Get interface index from interface address.


BOOL

MAPPING_GetIpv6GlobalAddress(Node*node, NodeIdnodeId, in6_addrsubnetAddr, UInt32prefixLen, in6_addr*addr6)

Get ipv6 global address


Address

MAPPING_GetDefaultInterfaceAddressInfoFromNodeId(Node *nodenode, NodeAddress nodeIdnodeId, NetworkType


networktypenetworktype)

Get default interface address based on network type


void

Mapping_AutoCreateIPv6SubnetAddress(NodeAddressipAddress, subnetString)

Create IPv6 Testing Address Prefix (RFC 2471)from : ipv4 address.


NodeAddress

MAPPING_GetSubnetAddressFromInterfaceAddress(Node *nodenode, NodeAddressinterfaceAddress)

Get subnet address from interface address.


BOOL

MAPPING_GetSubnetAddressFromInterfaceAddress(Node *node, in6_addr*ipv6InterfaceAddr, in6_addr*ipv6SubnetAddr)

Get ipv6 network Prefix from interface address.


BOOL

MAPPING_GetPrefixLengthForInterfaceAddress(Node*node, in6_addr*ipv6InterfaceAddr, unsigned intprefixLenth)

Get prefix length for interface address.


NetworkProtocolType

MAPPING_GetNetworkProtocolTypeForNode(NodeAddressnodeId, const NodeInput *nodeInput)

Get Network Protocol Type for the node.

Constant / Data Structure Detail

Constant

INVALID_MAPPING0xffffffff

Constant

Indicates Invalid Mapping


MAX_INTERFACE_ADDRESSES2

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Constant

max no of addressees assigned to an interface


NODE_HASH_SIZE32

Structure

Defines node hash size. Hashes the nodeIds using a mod NODE_HASH_SIZE hash.
NetworkProperty

Structure

Describes the property of a network.


AddressMappingType

Structure

Describes the type of address mapping.


AddressReverseMappingType

Structure

Describes the type of reverse address mapping.


SubnetListType

Structure

Used to determine what the next address counter should be for each subnet address. This is needed to allow different SUBNET/LINK
statements to declare the same subnet address.
AddressMapType

Structure

Describes the detailed information of Node ID <--> IP address mappings.


nodeIdToNodePtr

Describes the nodeId and corresponding nodePtr.

Function / Macro Detail


Function / Macro
MADDR6_SCOPE(a)

Format
Multicast Address Scope.

IS_MULTIADDR6(a)

Checks whether an address is multicast address.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

CLR_ADDR6(a)

Set an address with 0 values.

IS_CLR_ADDR6(a)

Does an address have the value of 0 (Cleared).

COPY_ADDR6(from, to)

Copies from-ipv6 address to to-ipv6 address.

SAME_ADDR6(a, b)

Checks if a and b address is same address.

IS_ANYADDR6(a)

Checks whether the address is any address or not.

IS_LOOPADDR6(a)

Checks whether it is loopback address.

CMP_ADDR6(a, b)

Compaires two addresses.

IS_IPV4ADDR6(a)

Checks whether it is ipv4 address.

IS_LOCALADDR6(a)

Checks whether it is local address.

IS_LINKLADDR6(a)

Checks whether it is link local address.

IS_SITELADDR6(a)

Checks whether it is site local address.

SAME_ADDR4(a, b)

Checks whether IPv4 addresses match.

IS_ANYADDR4(a)

Checks whether IPv4 address is ANY_DEST.

Address_IsSameAddress

BOOL Address_IsSameAddress (Address* addr1addr1, Address* addr2addr2)

Parameters:

Check whether both addresses(i.e. addr1 and addr2) are


same.

addr1

- Pointer to 1st address

addr2

- Pointer to 2nd address

Returns:
BOOL

Address_IsAnyAddress

- None

BOOL Address_IsAnyAddress (Address* addraddr)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Check whether addr is any address of the same type

Parameters:
addr

- Pointer to address

Returns:
BOOL

- None

Address_IsMulticastAddress

BOOL Address_IsMulticastAddress (Address* addraddr)

Parameters:

Check whether addr is a multicast address

addr

- Pointer to address

Returns:
BOOL

- None

Address_IsSubnetBroadcastAddress

BOOL Address_IsSubnetBroadcastAddress (Node* nodenode, Address* addraddr)

Parameters:

Check whether addr is a subnet broadcast address

node

- pointer to node

addr

- Pointer to address

Returns:
BOOL

- None

Address_SetToAnyAddress

void Address_SetToAnyAddress (Address* addraddr, Address* refAddrrefAddr)

Parameters:

Set addr to any address of the same type as refAddr.

addr

- Pointer to address

refAddr

- Pointer to refAddr

Returns:
void

- None

Address_AddressCoopy

void Address_AddressCoopy (Address*dstAddress, Address*srcAddress)

Parameters:

Copy srcAddress to dstAddress

dstAddress

- Destination address

srcAddress

- Source address

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Ipv6CompareAddr6

int Ipv6CompareAddr6 (in6_addra, in6_addrb)

Parameters:

Compairs to ipv6 address. if a is greater than b then returns


positive, if equals then 0, a is smaller then b then negative.

- ipv6 address.

- ipv6 address.

Returns:
- None

int

Ipv6IsAddressInNetwork

BOOL Ipv6IsAddressInNetwork (const in6_addr*globalAddr, unsigned inttla, unsigned intvla, unsigned intsla)

Parameters:

Checks whether the address is in the same network. : if in


the same network then returns TRUE, otherwise FALSE.

globalAddr

- Pointer to ipv6 address.

tla

- Top level ipv6 address.

vla

- Next level ipv6 address.

sla

- Site local ipv6 address.

Returns:
BOOL

Ipv6IsAddressInNetwork

- None

BOOL Ipv6IsAddressInNetwork (const in6_addr*globalAddr, const in6_addr*ipv6SubnetAddr, unsigned


intprefixLenth)

Parameters:
Checks whether the address is in the same network. : if in
the same network then returns TRUE, otherwise FALSE.

globalAddr

- Pointer to ipv6 address.

ipv6SubnetAddr
prefixLenth

- Pointer to ipv6 subnet address.

- prefix length of the address.

Returns:
BOOL

- TRUE if the address is in the same network, FALSE otherwise

Ipv6CheckNetworkParams

BOOL Ipv6CheckNetworkParams (unsigned int tlatla, unsigned int nlanla, unsigned int slasla)

Parameters:

Checks network parameters (tla, nla, sla)

tla

- Top level aggregation.

nla

- Next level aggregation.

sla

- Site level aggregaton.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

BOOL

- None

MAPPING_HashNodeId

void MAPPING_HashNodeId (IdToNodePtrMap*hash, NodeAddressnodeId, Node*nodePtr)

Parameters:

Hashes the nodeIds using a mod NODE_HASH_SIZE hash.


This is not thread safe.

hash

- IdToNodePtrMap pointer

nodeId

- Node id.

nodePtr

- Node poniter

Returns:
- None

void

MAPPING_GetNodePtrFromHash

Node* MAPPING_GetNodePtrFromHash (IdToNodePtrMap*hash, NodeAddressnodeId)

Parameters:

Retrieves the node pointer for nodeId from hash.

hash

- IdToNodePtrMap pointer

nodeId

- Node id.

Returns:
Node*

- Node pointer for nodeId.

MAPPING_MallocAddressMap

AddressMapType* MAPPING_MallocAddressMap ()

Parameters:

Allocates memory block of size AddressMapType.

Returns:
AddressMapType*

- Pointer to a new AddressMapType structure.

MAPPING_InitAddressMap

void MAPPING_InitAddressMap (AddressMapType*map)

Parameters:

Initializes the AddressMapType structure.

map

- A pointer of type AddressMapType.

Returns:
void

MAPPING_BuildAddressMap

- None

void MAPPING_BuildAddressMap (const NodeInput*nodeInput, NodeAddress**nodeIdArrayPtr,


AddressMapType*map)

Parameters:
Builds the address map
nodeInput

- A pointer to const NodeInput.

nodeIdArrayPtr

- A pointer to pointer of NodeAddress

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

map

- A pointer of type AddressMapType.

Returns:
void

MAPPING_GetInterfaceAddressForSubnet

- None

NodeAddress MAPPING_GetInterfaceAddressForSubnet (Node*node, NodeAddressnodeId,


NodeAddresssubnetAddress, intnumHostBits)

Parameters:
Gives Interface address for a Subnet.
node

- A pointer to node being initialized

nodeId

- Node id

subnetAddress
numHostBits

- Subnet address

- Number of host bits

Returns:
NodeAddress

MAPPING_GetInterfaceAddressForSubnet

- Interface address for the subnet.

NodeAddress MAPPING_GetInterfaceAddressForSubnet (const AddressMapType*map, NodeAddressnodeId,


NodeAddresssubnetAddress, intnumHostBits)

Parameters:
Gives Interface address for a Subnet.
map

- A pointer to address map

nodeId

- Node id

subnetAddress
numHostBits

- Subnet address

- Number of host bits

Returns:
NodeAddress

- Interface address for the subnet.

MAPPING_GetSubnetAddressForInterface

NodeAddress MAPPING_GetSubnetAddressForInterface (Node*node, NodeAddressnodeId, intinterfaceIndex)

Parameters:

Gives the Subnet address for an interface.

node

- A pointer to node being initialized.

nodeId

- Node id

interfaceIndex

- Interface index

Returns:
NodeAddress

MAPPING_GetSubnetMaskForInterface

- Subnet address for an interface.

NodeAddress MAPPING_GetSubnetMaskForInterface (Node*node, NodeAddressnodeId, intinterfaceIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Gives the Subnet mask for an interface.

Parameters:
- A pointer to node being initialized.

node

nodeId

- Node id

interfaceIndex

- Interface index

Returns:
NodeAddress

- Subnet mask for an interface.

MAPPING_GetNumHostBitsForInterface

int MAPPING_GetNumHostBitsForInterface (Node*node, NodeAddressnodeId, intinterfaceIndex)

Parameters:

Gives the number of host bits for an interface.

- A pointer to node being initialized.

node

nodeId

- Node id

interfaceIndex

- Interface index

Returns:
int

MAPPING_GetInterfaceInfoForInterface

- The number of host bits for an interface.

void MAPPING_GetInterfaceInfoForInterface (Node*node, NodeAddressnodeId, intinterfaceIndex,


NodeAddress*interfaceAddress, NodeAddress*subnetAddress, NodeAddress*subnetMask, int*numHostBits)

Parameters:
Gives the Interface information for an interface.
node

- A pointer to node being initialized.

nodeId

- Node id

interfaceIndex

- Interface index

interfaceAddress
subnetAddress
subnetMask

- Interface address, int pointer.

- Subnet address, NodeAddress pointer.

- Subnet mask, NodeAddress pointer.

numHostBits

- Number of host bits, int pointer.

Returns:
void

MAPPING_GetInterfaceAddressForInterface

- None

NodeAddress MAPPING_GetInterfaceAddressForInterface (Node*node, NodeAddressnodeId,


intinterfaceIndex)

Parameters:
Gives the Interface address for an interface.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

node

- A pointer to the node being initialized.

nodeId

- Node id

interfaceIndex

- Interface index

Returns:
NodeAddress

- Interface address for an interface.

MAPPING_GetInterfaceAddressForInterface

Address MAPPING_GetInterfaceAddressForInterface (NetworkTypenetType, intrelativeInfInx)

Parameters:

Get node interface Address according to the network


specific interface index. Overloaded function for ATM
compatibility.

netType

- Network type of the interface.

relativeInfInx

- Inrerface index related to networkType.

Returns:
Address

- Return Address.

MAPPING_GetNodeIdFromInterfaceAddress

NodeAddress MAPPING_GetNodeIdFromInterfaceAddress (Node*node, NodeAddressinterfaceAddress)

Parameters:

Gives Node id from an interface address.

node

- A pointer to node being initialized.

interfaceAddress

- Interface address

Returns:
NodeAddress

- None

MAPPING_GetNodeIdFromInterfaceAddress

NodeAddress MAPPING_GetNodeIdFromInterfaceAddress (Node*node, AddressinterfaceAddress)

Parameters:

Gives Node id from an interface address. Overloaded for


IPv6

node

- A pointer to node being initialized.

interfaceAddress

- Interface address

Returns:
NodeAddress

- None

MAPPING_GetDefaultInterfaceAddressFromNodeId

NodeAddress MAPPING_GetDefaultInterfaceAddressFromNodeId (Node*node, NodeAddressnodeId)

Parameters:

Gives default interface address from a node id.

node

- A pointer to node being initialized.

nodeId

- Node id

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

NodeAddress

- Default interface address from the node id.

MAPPING_GetNumNodesInSubnet

unsigned int MAPPING_GetNumNodesInSubnet (Node*node, NodeAddresssubnetAddress)

Parameters:

Gives the number of nodes in a subnet.

- A pointer to node being initialized.

node

subnetAddress

- Subnet address

Returns:
unsigned int

- Number of nodes in a subnet.

MAPPING_GetSubnetAddressCounter

unsigned int MAPPING_GetSubnetAddressCounter (AddressMapType*map, NodeAddresssubnetAddress)

Parameters:

Gives the subnet address counter.

map

- A pointer to AddressMapType.

subnetAddress

- Subnet address

Returns:
unsigned int

MAPPING_UpdateSubnetAddressCounter

- The subnet address counter.

void MAPPING_UpdateSubnetAddressCounter (AddressMapType*map, NodeAddresssubnetAddress,


intaddressCounter)

Parameters:
Updates the subnet address counter.
map

- A pointer to AddressMapType.

subnetAddress

- Subnet address

addressCounter

- Address counter

Returns:
- None

void

MAPPING_GetInterfaceIndexFromInterfaceAddress

int MAPPING_GetInterfaceIndexFromInterfaceAddress (Node*node, NodeAddressinterfaceAddress)

Parameters:

Gets the node's interface index for the given address.

node

- A pointer to node being initialized.

interfaceAddress

- Interface address

Returns:
int

MAPPING_GetNodeInfoFromAtmNetInfo

- The interface index.

Address MAPPING_GetNodeInfoFromAtmNetInfo (unsigned int*index, unsigned int*genIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Get node interface Address, generic interfaceIndex and Atm


related interfaceIndex from ATM Network information.

Parameters:
index

- return atm related interface index of a

genIndex

- return generic interface index of a node.

Returns:
Address

- Return valid ATM Address related to Network information if genIndex is not equal to -1.

MAPPING_GetInterfaceIdForDestAddress

unsigned int MAPPING_GetInterfaceIdForDestAddress (Node*node, NodeIdnodeId, NodeAddressdestAddr)

Parameters:

For a given destination address find its interface index

node

- A pointer to node being initialized.

nodeId

- Node ID

destAddr

- Destination address.

Returns:
unsigned int

MAPPING_GetSubnetMaskForDestAddress

- None

NodeAddress MAPPING_GetSubnetMaskForDestAddress (Node*node, NodeIdnodeId,


NodeAddressdestAddr)

Parameters:
For a given nodeId & destination address find the subnet
mask for the associated network

node

- A pointer to node being initialized.

nodeId

- Node ID

destAddr

- Destination address.

Returns:
NodeAddress

- None

MAPPING_GetInterfaceAddrForNodeIdAndIntfId

NodeAddress MAPPING_GetInterfaceAddrForNodeIdAndIntfId (Node*node, NodeIdnodeId, intintfId)

Parameters:

For a given nodeId & InterfaceId find the associated IPAddress

node

- The pointer to the node.

nodeId

- Node ID

intfId

- Interface ID.

Returns:
NodeAddress

MAPPING_GetIPv6NetworkAddressCounter

- None

unsigned int MAPPING_GetIPv6NetworkAddressCounter (AddressMapType*map, in6_addrsubnetAddr,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

unsigned intsubnetPrefixLen)

Parameters:
Get IPV6 network address counter.
map

- The address map.

subnetAddr

- The IPv6 address.

subnetPrefixLen

- The prefix length.

Returns:
unsigned int

MAPPING_UpdateIPv6NetworkAddressCounter

- The current counter.

void MAPPING_UpdateIPv6NetworkAddressCounter (AddressMapType*map, in6_addrsubnetAddr, unsigned


intsubnetPrefixLen, intaddressCounter)

Parameters:
Update IPV6 network address counter.
map

- The address map.

subnetAddr

- The IPv6 address.

subnetPrefixLen
addressCounter

- The prefix length.

- The new counter value.

Returns:
void

MAPPING_GetNumNodesInIPv6Network

- None

unsigned int MAPPING_GetNumNodesInIPv6Network (Node*node, in6_addrsubnetAddr, unsigned


intsubnetPrefixLen)

Parameters:
Get Num of nodes in IPV6 network.
node

- The pointer to the node.

subnetAddr

- The IPv6 address.

subnetPrefixLen

- The prefix length.

Returns:
unsigned int

- None

MAPPING_GetNetworkIPVersion

NetworkType MAPPING_GetNetworkIPVersion (const char*addrString)

Parameters:

Get Network version IPv4/IPv6.

addrString

- The address string

Returns:
NetworkType

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

MAPPING_GetNetworkType

NetworkType MAPPING_GetNetworkType (const char*addrString)

Parameters:

Identify network type from addrString.

addrString

- The address string

Returns:
NetworkType

MAPPING_GetIpv6InterfaceInfoForInterface

- None

void MAPPING_GetIpv6InterfaceInfoForInterface (Node *nodenode, NodeId nodeIdnodeId,


intinterfaceIndex, in6_addr*globalAddr, in6_addr*subnetAddr, unsigned int*subnetPrefixLen)

Parameters:
Get IPV6 interface information for a interface.
node

- The node.

nodeId

- Node Id

interfaceIndex

- The interface index.

globalAddr

- The global IPv6 address.

subnetAddr

- The subnet IPv6 address.

subnetPrefixLen

- THe subnet prefex length.

Returns:
- None

void

MAPPING_GetIpv6GlobalAddress

BOOL MAPPING_GetIpv6GlobalAddress (Node *nodenode, NodeId nodeIdnodeId, unsigned inttla, unsigned


intnla, unsigned intsla, in6_addr *addr6)

Parameters:
Get IPV6 global address.
node

- The node

nodeId

- The node's id

tla

- Top level aggregation

nla

- Next level aggregation

sla

- Site level aggregation

addr6

- The global IPv6 address.

Returns:
BOOL

MAPPING_GetIpv6GlobalAddressForInterface

- None

BOOL MAPPING_GetIpv6GlobalAddressForInterface (Node *node, NodeIdnodeId, intinterfaceIndex,


in6_addr *addr6, BOOLisDeprecated)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

Parameters:
Get IPV6 global address for a node's nth interface.
node

- The node

nodeId

- The node's id

interfaceIndex
addr6

- The interface index.

- The global IPv6 address.

isDeprecated

- Return deprecated address (if valid)

Returns:
BOOL

MAPPING_CreateIpv6GlobalUnicastAddr

- None

void MAPPING_CreateIpv6GlobalUnicastAddr (unsigned inttla, unsigned intnla, unsigned intsla,


intaddressCounter, in6_addr*globalAddr)

Parameters:
Create IPv6 Global Unicast Address from tla nla sla
tla

- Top level aggregation

nla

- Next level aggregation

sla

- Site level aggregation

addressCounter
globalAddr

- The address counter.

- The global IPv6 address.

Returns:
void

MAPPING_CreateIpv6GlobalUnicastAddr

- None

void MAPPING_CreateIpv6GlobalUnicastAddr (AddressMapType *map, in6_addrIPv6subnetAddress,


uunsigned intIPv6subnetPrefixLen, intaddressCounter, in6_addr*globalAddr)

Parameters:
Create IPv6 Global Unicast Address.
map

- The address map.

IPv6subnetAddress

- The subnet address.

IPv6subnetPrefixLen
addressCounter
globalAddr

- The prefix length.

- The address counter.

- The global IPv6 address.

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

MAPPING_CreateIpv6LinkLocalAddr

void MAPPING_CreateIpv6LinkLocalAddr (in6_addr*globalAddr, in6_addr*linkLocalAddr, unsigned


intsubnetPrefixLen)

Parameters:
Create IPv6 link local Address.
globalAddr

- The global IPv6 address.

linkLocalAddr

- The subnet IPv6 address.

subnetPrefixLen

- The subnet prefix length.

Returns:
void

MAPPING_CreateIpv6SiteLocalAddr

- None

void MAPPING_CreateIpv6SiteLocalAddr (in6_addr*globalAddr, in6_addr*siteLocalAddr, unsigned


shortsiteCounter, unsigned intsubnetPrefixLen)

Parameters:
Create IPv6 site local Address.
globalAddr

- The global IPv6 address.

siteLocalAddr
siteCounter

- The subnet IPv6 address.

- The counter to use.

subnetPrefixLen

- The subnet prefix length.

Returns:
void

- None

MAPPING_CreateIpv6MulticastAddr

void MAPPING_CreateIpv6MulticastAddr (in6_addr*globalAddr, in6_addr*multicastAddr)

Parameters:

Create ipv6 multicast address.

globalAddr

- The global IPv6 address.

multicastAddr

- The multicast IPv6 address.

Returns:
void

MAPPING_CreateIpv6SubnetAddr

- None

void MAPPING_CreateIpv6SubnetAddr (unsigned inttla, unsigned intnla, unsigned intsla, unsigned


int*IPv6subnetPrefixLen, in6_addr*IPv6subnetAddress)

Parameters:
create subnet addr for IPV6 address.
tla

- Top level aggregation.

nla

- Next level aggregation.

sla

- Site level aggregation.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

IPv6subnetPrefixLen
IPv6subnetAddress

- The IPv6 prefix length.

- The IPv6 subnet address.

Returns:
void

- None

MAPPING_GetNodeIdFromGlobalAddr

NodeId MAPPING_GetNodeIdFromGlobalAddr (Node *node, in6_addr*globalAddr)

Parameters:

Get node id from Global Address.

node

- The node.

globalAddr

- The global IPv6 address.

Returns:
NodeId

- None

MAPPING_GetNodeIdFromLinkLayerAddr

NodeId MAPPING_GetNodeIdFromLinkLayerAddr (Node *node, NodeAddresslinkLayerAddr)

Parameters:

Get node id from Link layer Address.

node

- The node.

linkLayerAddr

- The link layer address.

Returns:
NodeId

- None

MAPPING_CreateIpv6LinkLayerAddr

NodeAddress MAPPING_CreateIpv6LinkLayerAddr (unsigned intnodeId, intinterfaceId)

Parameters:

Create IPv6 link layer Address.

nodeId

- The node's id.

interfaceId

- The interface id.

Returns:
NodeAddress

- None

MAPPING_IsIpv6AddressOfThisNode

BOOL MAPPING_IsIpv6AddressOfThisNode (Node*node, const NodeAddressnodeId, in6_addr*globalAddr)

Parameters:

checks whether the ipv6 address is of this node.

node

- The node id.

nodeId

- The node's address.

globalAddr

- The global IPv6 address.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

BOOL

MAPPING_IsNodeInThisIpRange

- None

BOOL MAPPING_IsNodeInThisIpRange (Node*node, NodeIdnodeId, NodeAddressstartRange,


NodeAddressendRange)

Parameters:
checks whether the node is in given range of : Addresses.
node

- The node.

nodeId

- The node id.

startRange
endRange

- The starting address.

- The end address.

Returns:
BOOL

- None

MAPPING_IsIpAddressOfThisNode

BOOL MAPPING_IsIpAddressOfThisNode (Node*node, const NodeAddressnodeId, NodeAddressaddr)

Parameters:

checks whether the ipv4 address is of this node.

node

- The node.

nodeId
addr

- The node id.

- The address.

Returns:
BOOL

MAPPING_GetInterfaceAddressForSubnet

- None

BOOL MAPPING_GetInterfaceAddressForSubnet (Node*node, NodeIdnodeId, in6_addr*ipv6SubnetAddr,


unsigned intprefixLenth, in6_addr*ipv6InterfaceAddr, int*interfaceIndex)

Parameters:
Get interface address for subnet using ipv6 addr.
node

- The node.

nodeId

- The node id.

ipv6SubnetAddr
prefixLenth

- The subnet address.

- The subnet prefix length.

ipv6InterfaceAddr
interfaceIndex

- The ipv6 interface address.

- The interface index.

Returns:
BOOL

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

MAPPING_GetInterfaceAddressForSubnet

BOOL MAPPING_GetInterfaceAddressForSubnet (const AddressMapType*map, NodeIdnodeId,


in6_addr*ipv6SubnetAddr, unsigned intprefixLenth, in6_addr*ipv6InterfaceAddr, int*interfaceIndex)

Parameters:
Get interface address for subnet using ipv6 addr.
map

- The address map.

nodeId

- The node id.

ipv6SubnetAddr
prefixLenth

- The subnet address.

- The subnet prefix length.

ipv6InterfaceAddr
interfaceIndex

- The ipv6 interface address.

- The interface index.

Returns:
BOOL

MAPPING_GetInterfaceAddressForSubnet

- None

BOOL MAPPING_GetInterfaceAddressForSubnet (Node* nodenode, NodeId nodeIdnodeId, unsigned inttla,


unsigned intnla, unsigned intsla, in6_addr*ipv6Addr, int*interfaceIndex)

Parameters:
Get interface address for subnet using tla nla sla.
node

- The node.

nodeId

- The node id.

tla

- Top level aggregation.

nla

- Next level aggregation.

sla

- Site level aggregation.

ipv6Addr

- The ipv6 interface address.

interfaceIndex

- The interface index.

Returns:
BOOL

; MAPPING_GetInterfaceAddressForSubnet

- None

BOOL ; MAPPING_GetInterfaceAddressForSubnet (const AddressMapType*map, NodeIdnodeId, unsigned


inttla, unsigned intnla, unsigned intsla, in6_addr*ipv6Addr, int*interfaceIndex)

Parameters:
Get interface address for subnet using tla nla sla.
map

- The address map.

nodeId
tla

- The node id.

- Top level aggregation.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

nla

- Next level aggregation.

sla

- Site level aggregation.

ipv6Addr

- The ipv6 interface address.

interfaceIndex

- The interface index.

Returns:
- None

BOOL

MAPPING_GetInterfaceFromLinkLayerAddress

int MAPPING_GetInterfaceFromLinkLayerAddress (Node*node, const NodeAddresslinkLayerAddr)

Parameters:

Get interface from link layer address.

- The node.

node

linkLayerAddr

- The link layer address.

Returns:
int

- None

MAPPING_GetInterfaceIndexFromInterfaceAddress

int MAPPING_GetInterfaceIndexFromInterfaceAddress (Node*node, AddressinterfaceAddress)

Parameters:

Get interface index from interface address.

- The node.

node

interfaceAddress

- The interface address.

Returns:
int

MAPPING_GetIpv6GlobalAddress

- None

BOOL MAPPING_GetIpv6GlobalAddress (Node*node, NodeIdnodeId, in6_addrsubnetAddr,


UInt32prefixLen, in6_addr*addr6)

Parameters:
Get ipv6 global address
node

- The node.

nodeId

- The node id

subnetAddr
prefixLen
addr6

- The subnet address.

- The subnet prefix length.

- The IPv6 address.

Returns:
BOOL

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

MAPPING_GetDefaultInterfaceAddressInfoFromNodeId

Address MAPPING_GetDefaultInterfaceAddressInfoFromNodeId (Node *nodenode, NodeAddress


nodeIdnodeId, NetworkType networktypenetworktype)

Parameters:
Get default interface address based on network type
node

- The node.

nodeId

- The node id.

networktype

- The network type.

Returns:
Address

- None

Mapping_AutoCreateIPv6SubnetAddress

void Mapping_AutoCreateIPv6SubnetAddress (NodeAddressipAddress, subnetString)

Parameters:

Create IPv6 Testing Address Prefix (RFC 2471)from : ipv4


address.

ipAddress

- The IPv4 address.


- char*

subnetString

Returns:
void

MAPPING_GetSubnetAddressFromInterfaceAddress

- NONE

NodeAddress MAPPING_GetSubnetAddressFromInterfaceAddress (Node *nodenode,


NodeAddressinterfaceAddress)

Parameters:
Get subnet address from interface address.
node

- The node address.

interfaceAddress

- The interface address.

Returns:
NodeAddress

MAPPING_GetSubnetAddressFromInterfaceAddress

- subnet address

BOOL MAPPING_GetSubnetAddressFromInterfaceAddress (Node *node, in6_addr*ipv6InterfaceAddr,


in6_addr*ipv6SubnetAddr)

Parameters:
Get ipv6 network Prefix from interface address.
node

- The node.

ipv6InterfaceAddr
ipv6SubnetAddr

- The IPv6 interface address.

- The subnet address pointer .

Returns:
BOOL

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MAPPING

MAPPING_GetPrefixLengthForInterfaceAddress

BOOL MAPPING_GetPrefixLengthForInterfaceAddress (Node*node, in6_addr*ipv6InterfaceAddr, unsigned


intprefixLenth)

Parameters:
Get prefix length for interface address.
node

- The node.

ipv6InterfaceAddr
prefixLenth

- The IPV6 interface address.

- The interface prefix length.

Returns:
BOOL

MAPPING_GetNetworkProtocolTypeForNode

- None

NetworkProtocolType MAPPING_GetNetworkProtocolTypeForNode (NodeAddressnodeId, const NodeInput


*nodeInput)

Parameters:
Get Network Protocol Type for the node.
nodeId

- The node id.

nodeInput

- The node input file

Returns:
NetworkProtocolType

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MAPPING.html[10/28/2011 1:29:40 PM]

MEMORY

QualNet 5.2 API Reference


MEMORY
This file describes the memory management data structures and functions.
Constant / Data Structure Summary
Type

Name

STRUCT

MemoryUsageData

Defines the parameters collected by the memory system. Restricted to kernel use.

Function / Macro Summary


Return Type

Summary

void

MEM_CreateThreadData()

Creates partition-specific space for collecting memory usage statistics. This is used in threaded versions of QualNet, but not in
distributed versions, currently.
void

MEM_InitializeThreadData(MemoryUsageData*data)

Sets the partition-specific memory data for this partition.


void

MEM_PrintThreadData()

Prints the partition-specific memory data.


void

MEM_ReportPartitionUsage(intpartitionId, UInt32totalAllocatedMemory, UInt32totalFreedMemory,


UInt32totalPeakUsage)

Prints out the total memory used by this partition.


void

MEM_ReportTotalUsage(UInt32totalAllocatedMemory, UInt32totalFreedMemory, UInt32totalPeakUsage)

Prints out the total memory usage statistics for the simulation. In a parallel run, the peak usage is the sum of the partition's peak usage
and might not be precisely accurate.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MEMORY.html[10/28/2011 1:29:51 PM]

MEMORY

Constant / Data Structure Detail

Structure

MemoryUsageData

Defines the parameters collected by the memory system. Restricted to kernel use.

Function / Macro Detail


Function / Macro
MEM_CreateThreadData

Format
void MEM_CreateThreadData ()

Parameters:

Creates partition-specific space for collecting


memory usage statistics. This is used in
threaded versions of QualNet, but not in
distributed versions, currently.
MEM_InitializeThreadData

Returns:

Parameters:

Sets the partition-specific memory data for


this partition.

void

- None

void MEM_InitializeThreadData (MemoryUsageData*data)

data

- the data

Returns:
void

- None

MEM_PrintThreadData

void MEM_PrintThreadData ()

Parameters:

Prints the partition-specific memory data.

Returns:
void

MEM_ReportPartitionUsage

- None

void MEM_ReportPartitionUsage (intpartitionId, UInt32totalAllocatedMemory, UInt32totalFreedMemory,


UInt32totalPeakUsage)

Parameters:
Prints out the total memory used by this
partition.

partitionId

- the partition number

totalAllocatedMemory
totalFreedMemory

- sum of all MEM_malloc calls

- sum of all MEM_free calls

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MEMORY.html[10/28/2011 1:29:51 PM]

MEMORY

totalPeakUsage

- peak usage of allocated memory

Returns:
void

- None

MEM_ReportTotalUsage

void MEM_ReportTotalUsage (UInt32totalAllocatedMemory, UInt32totalFreedMemory, UInt32totalPeakUsage)

Parameters:

Prints out the total memory usage statistics


for the simulation. In a parallel run, the peak
usage is the sum of the partition's peak usage
and might not be precisely accurate.

totalAllocatedMemory
totalFreedMemory
totalPeakUsage

- sum of all MEM_malloc calls

- sum of all MEM_free calls

- peak usage of allocated memory

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MEMORY.html[10/28/2011 1:29:51 PM]

MESSAGE

QualNet 5.2 API Reference


MESSAGE
This file describes the message structure used to implement events and functions for message operations.
Constant / Data Structure Summary
Type

Name

CONSTANT

MSG_MAX_HDR_SIZE

Maximum Header Size

CONSTANT

SMALL_INFO_SPACE_SIZE

Size of small Info field. Should be larger than all commonly used info field data structures, especially PropTxInfo and PropRxInfo.

CONSTANT

MSG_PAYLOAD_LIST_MAX

Maximum message payload list

CONSTANT

MAX_CACHED_PAYLOAD_SIZE

Maximum cached payload size

CONSTANT

MSG_INFO_LIST_MAX

Maximum message info list

CONSTANT

MAX_INFO_FIELDS

Maximum number of info fields

CONSTANT

MAX_HEADERS

Maximum number of headers

ENUMERATION

MessageInfoType

Type of information in the info field. One message can only have up to one info field with a specific info type.

STRUCT

MessageInfoHeader

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

This is a structure which contains information about a info field.

STRUCT

Message

This is the main data strucure that represents a discrete event in qualnet. This is used to represent timer as well as to simulate actual
sending of packets across the network.

Function / Macro Summary


Return Type

Summary

void

MESSAGE_PrintMessage(Node*node, Message*msg)

void

MESSAGE_Send(Node*node, Message*msg, clocktypedelay, boolisMT)

Function call used to send a message within QualNet. When a message is sent using this mechanism, only the pointer to the message is
actually sent through the system. So the user has to be careful not to do anything with the content of the pointer once MESSAGE_Send
has been called.
void

MESSAGE_SendMT(Node*node, Message*msg, clocktypedelay)

Function call used to send a message from independent threads running within QualNet, for example those associated with external
interfaces.
void

MESSAGE_RemoteSend(Node*node, NodeIddestNodeId, Message*msg, clocktypedelay)

Function used to send a message to a node that might be on a remote partition. The system will make a shallow copy of the message,
meaning it can't contain any pointers in the info field or the packet itself. This function is very unsafe. If you use it, your program will
probably crash. Only I can use it.
void

MESSAGE_RouteReceivedRemoteEvent(Node*node, Message*msg)

Counterpart to MESSAGE_RemoteSend, this function allows models that send remote messages to provide special handling for them on
the receiving partition. This function is called in real time as the messages are received, so must be used carefully.
void

MESSAGE_CancelSelfMsg(Node*node, Message*msgToCancelPtr)

Function call used to cancel a event message in the QualNet scheduler. The Message must be a self message (timer) .i.e. a message a
node sent to itself. The msgToCancelPtr must a pointer to the original message that needs to be canceled.
Message*

MESSAGE_Alloc(Node*node, intlayerType, intprotocol, inteventType)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Allocate a new Message structure. This is called when a new message has to be sent through the system. The last three parameters
indicate the layerType, protocol and the eventType that will be set for this message.
Message*

MESSAGE_Alloc(PartitionData*partition, intlayerType, intprotocol, inteventType)

Allocate a new Message structure. This is called when a new message has to be sent through the system. The last three parameters
indicate the layerType, protocol and the eventType that will be set for this message.
Message*

MESSAGE_AllocMT(PartitionData*partition, intlayerType, intprotocol, inteventType)

Mutli-thread safe version of MESSAGE_Alloc for use by worker threads.


char*

MESSAGE_InfoFieldAlloc(Node*node, intinfoSize)

Allocate space for one "info" field


char*

MESSAGE_InfoFieldAlloc(PartitionData*partition, intinfoSize)

Allocate space for one "info" field


char*

MESSAGE_InfoFieldAllocMT(PartitionData*partition, intinfoSize)

Multi-thread safe version of MESSAGE_InfoFieldAlloc


void

MESSAGE_InfoFieldFree(Node*node, MessageInfoHeader*hdrPtr)

Free space for one "info" field


char*

MESSAGE_AddInfo(Node*node, Message*msg, intinfoSize, unsigned shortinfoType)

Allocate one "info" field with given info type for the message. This function is used for the delivery of data for messages which are
NOT packets as well as the delivery of extra information for messages which are packets. If a "info" field with the same info type has
previously been allocated for the message, it will be replaced by a new "info" field with the specified size. Once this function has been
called, MESSAGE_ReturnInfo function can be used to get a pointer to the allocated space for the info field in the message structure.
char*

MESSAGE_AddInfo(PartitionData*partition, Message*msg, intinfoSize, unsigned shortinfoType)

Allocate one "info" field with given info type for the message. This function is used for the delivery of data for messages which are
NOT packets as well as the delivery of extra information for messages which are packets. If a "info" field with the same info type has
previously been allocated for the message, it will be replaced by a new "info" field with the specified size. Once this function has been
called, MESSAGE_ReturnInfo function can be used to get a pointer to the allocated space for the info field in the message structure.
void

MESSAGE_RemoveInfo(Node*node, Message*msg, unsigned shortinfoType)

Remove one "info" field with given info type from the info array of the message.
char *

MESSAGE_InfoAlloc(Node*node, Message*msg, intinfoSize)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Allocate the default "info" field for the message. This function is similar to MESSAGE_AddInfo. The difference is that it assumes the
type of the info field to be allocated is INFO_TYPE_DEFAULT.
char *

MESSAGE_InfoAlloc(PartitionData*partition, Message*msg, intinfoSize)

Allocate the default "info" field for the message. This function is similar to MESSAGE_AddInfo. The difference is that it assumes the
type of the info field to be allocated is INFO_TYPE_DEFAULT.
int

MESSAGE_ReturnInfoSize(Message*msg, unsigned shortinfoType, intfragmentNumber)

Returns the size of a "info" field with given info type in the info array of the message.
int

MESSAGE_ReturnInfoSize(Message*msg, unsigned shortinfoType)

Returns the size of a "info" field with given info type in the info array of the message.
char*

MESSAGE_ReturnInfo(Message*msg, unsigned shortinfoType)

Returns a pointer to the "info" field with given info type in the info array of the message.
void

MESSAGE_CopyInfo(Node*node, Message*dsgMsg, Message*srcMsg)

Copy the "info" fields of the source message to the destination message.
void

MESSAGE_CopyInfo(Node*node, Message*dsgMsg, MessageInfoHeader*srcInfo)

Copy the "info" fields of the source info header to the destination message.
void

MESSAGE_FragmentPacket(Node*node, Message*msg, intfragUnit, Message***fragList, int*numFrags,


TraceProtocolTypeprotocolType)

Fragment one packet into multiple fragments Note: The original packet will be freed in this function. The array for storing pointers to
fragments will be dynamically allocated. The caller of this function will need to free the memory.
Message*

MESSAGE_ReassemblePacket(Node*node, Message**fragList, intnumFrags, TraceProtocolTypeprotocolType)

Reassemble multiple fragments into one packet Note: All the fragments will be freed in this function.
Message*

MESSAGE_PackMessage(Node*node, Message*msgList, TraceProtocolTypeorigProtocol, int*actualPktSize)

Pack a list of messages to be one message structure Whole contents of the list messages will be put as payload of the new message. So
the packet size of the new message cannot be directly used now. The original lis of msgs will be freed.
Message*

MESSAGE_UnpackMessage(Node*node, Message*msg, boolcopyInfo, boolfreeOld)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Unpack a super message to the original list of messages The list of messages were stored as payload of this super message.
void

MESSAGE_PacketAlloc(Node*node, Message*msg, intpacketSize, TraceProtocolTypeoriginalProtocol)

Allocate the "payload" field for the packet to be delivered. Add additional free space in front of the packet for headers that might be
added to the packet. This function can be called from the application layer or anywhere else (e.g TCP, IP) that a packet may originiate
from. The "packetSize" variable will be set to the "packetSize" parameter specified in the function call. Once this function has been
called the "packet" variable in the message structure can be used to access this space.
void

MESSAGE_PacketAlloc(PartitionData*partition, Message*msg, intpacketSize, TraceProtocolTypeoriginalProtocol,


boolisMT)

Allocate the "payload" field for the packet to be delivered. Add additional free space in front of the packet for headers that might be
added to the packet. This function can be called from the application layer or anywhere else (e.g TCP, IP) that a packet may originiate
from. The "packetSize" variable will be set to the "packetSize" parameter specified in the function call. Once this function has been
called the "packet" variable in the message structure can be used to access this space.
void

MESSAGE_AddHeader(Node*node, Message*msg, inthdrSize, TraceProtocolTypetraceProtocol)

This function is called to reserve additional space for a header of size "hdrSize" for the packet enclosed in the message. The
"packetSize" variable in the message structure will be increased by "hdrSize". Since the header has to be prepended to the current
packet, after this function is called the "packet" variable in the message structure will point the space occupied by this new header.
void

MESSAGE_RemoveHeader(Node*node, Message*msg, inthdrSize, TraceProtocolTypetraceProtocol)

This function is called to remove a header from the packet. The "packetSize" variable in the message will be decreased by "hdrSize".
char*

MESSAGE_ReturnHeader(Message*msg, intheader)

This is kind of a hack so that MAC protocols (dot11) that need to peak at a packet that still has the PHY header can return the contents
after the first (N) headers without first removing those headers.
void

MESSAGE_ExpandPacket(Node*node, Message*msg, intsize)

Expand packet by a specified size


void

MESSAGE_ShrinkPacket(Node*node, Message*msg, intsize)

This function is called to shrink packet by a specified size.


void

MESSAGE_Free(PartitionData*partition, Message*msg)

When the message is no longer needed it can be freed. Firstly the "payload" and "info" fields of the message are freed. Then the
message itself is freed. It is important to remember to free the message. Otherwise there will nasty memory leaks in the program.
void

MESSAGE_Free(Node*node, Message*msg)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

When the message is no longer needed it can be freed. Firstly the "payload" and "info" fields of the message are freed. Then the
message itself is freed. It is important to remember to free the message. Otherwise there will nasty memory leaks in the program.
void

MESSAGE_FreeList(Node*node, Message*msg)

Free a list of message until the next pointer of the message is NULL.
Message*

MESSAGE_Duplicate(Node*node, Message*msg)

Create a new message which is an exact duplicate of the message supplied as the parameter to the function and return the new message.
Message*

MESSAGE_Duplicate(PartitionData*partition, Message*msg, boolisMT)

Create a new message which is an exact duplicate of the message supplied as the parameter to the function and return the new message.
Message*

MESSAGE_DuplicateMT(PartitionData*partition, Message*msg)

Create a new message which is an exact duplicate of the message supplied as the parameter to the function and return the new message.
char*

MESSAGE_PayloadAlloc(Node*node, intpayloadSize)

Allocate a character payload out of the free list, if possible otherwise via malloc.
char*

MESSAGE_PayloadAlloc(PartitionData*partition, intpayloadSize, boolisMT)

Allocate a character payload out of the free list, if possible otherwise via malloc.
void

MESSAGE_PayloadFree(PartitionData*partition, Char*payload, intpayloadSize)

Return a character payload to the free list, if possible otherwise free it.
void

MESSAGE_PayloadFree(Node*node, Char*payload, intpayloadSize)

Return a character payload to the free list, if possible otherwise free it.
void

MESSAGE_FreeList(Node*node, Message*msg)

Free a list of messages until the next pointer of the message is NULL.
int

MESSAGE_ReturnNumFrags(Message*msg)

Returns the number of fragments used to create a TCP packet.


int

MESSAGE_ReturnFragSeqNum(Message*msg, intfragmentNumber)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Returns the sequence number of a particular fragments in the TCP packet.


int

MESSAGE_ReturnFragSize(Message*msg, intfragmentNumber)

Returns the size of a particular fragment in the TCP packet.


int

MESSAGE_ReturnFragNumInfos(Message*msg, intfragmentNumber)

Returns the number of info fields associated with a particular fragment in the TCP packet.
void

MESSAGE_AppendInfo(Node*node, Message*msg, intinfosize, shortinfoType)

Appends the "info" fields of the source message to the destination message.
void

MESSAGE_AppendInfo(Node*node, Message*dsgMsg, MessageInfoHeader*srcInfo)

Appends the "info" fields of the source message to the destination message.
void

MESSAGE_AppendInfo(Node*node, Message*dsgMsg, Message*srcMsg)

Appends the "info" fields of the source message to the destination message.
size_t

MESSAGE_SizeOf()

Returns the size of a message. Used in place of sizeof() in the kernel code to allow for users to add more fields to the message.
BOOL

MESSAGE_FragmentPacket(Node*node, Message*&msg, Message*&fragmentedMsg, Message*&remainingMsg, intfragUnit,


TraceProtocolTypeprotocolType, boolfreeOriginalMsg)

Fragment one packet into TWO fragments Note:(i) This API treats the original packet as raw packet and does not take account of
fragmentation related information like fragment id. The caller of this API will have to itself put in logic for distinguishing the
fragmented packets (ii) Overloaded MESSAGE_FragmentPacket
Message*

MESSAGE_ReassemblePacket(Node*node, Message*fragMsg1, Message*fragMsg2, TraceProtocolTypeprotocolType)

Reassemble TWO fragments into one packet Note: (i) None of the fragments will be freed in this API. The caller of this API will itself
have to free the fragments (ii) Overloaded MESSAGE_ReassemblePacket
void

MESSAGE_SendAsEarlyAsPossible(Node*node, Message*msg)

This function is used primarily by external interfaces to inject events into the Simulator as soon as possible without causing problems for
parallel execution.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Constant / Data Structure Detail

Constant

MSG_MAX_HDR_SIZE512

Constant

Maximum Header Size


SMALL_INFO_SPACE_SIZE112

Constant

Size of small Info field. Should be larger than all commonly used info field data structures, especially PropTxInfo and PropRxInfo.
MSG_PAYLOAD_LIST_MAX1000

Constant

Maximum message payload list


MAX_CACHED_PAYLOAD_SIZE1024

Constant

Maximum cached payload size


MSG_INFO_LIST_MAX1000

Constant

Maximum message info list


MAX_INFO_FIELDS12

Constant

Maximum number of info fields


MAX_HEADERS10

Enumeration

Maximum number of headers


MessageInfoType

Structure

Type of information in the info field. One message can only have up to one info field with a specific info type.
MessageInfoHeader

Structure

This is a structure which contains information about a info field.


Message

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

This is the main data strucure that represents a discrete event in qualnet. This is used to represent timer as well as to simulate actual
sending of packets across the network.

Function / Macro Detail


Function / Macro
MESSAGE_PrintMessage

Format
void MESSAGE_PrintMessage (Node*node, Message*msg)

Parameters:
node
msg

- node which is sending message

- message to be printed

Returns:
- NULL

void

MESSAGE_Send

void MESSAGE_Send (Node*node, Message*msg, clocktypedelay, boolisMT)

Parameters:

Function call used to send a message within


QualNet. When a message is sent using this
mechanism, only the pointer to the message is
actually sent through the system. So the user
has to be careful not to do anything with the
content of the pointer once MESSAGE_Send
has been called.

node
msg

- node which is sending message

- message to be delivered

delay
isMT

- delay suffered by this message.

- is the function being called from a thread?

Returns:
- NULL

void

MESSAGE_SendMT

void MESSAGE_SendMT (Node*node, Message*msg, clocktypedelay)

Parameters:

Function call used to send a message from


independent threads running within QualNet,
for example those associated with external
interfaces.

node
msg

- node which is sending message

- message to be delivered

delay

- delay suffered by this message.

Returns:
void

- NULL

MESSAGE_RemoteSend

void MESSAGE_RemoteSend (Node*node, NodeIddestNodeId, Message*msg, clocktypedelay)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Function used to send a message to a node


that might be on a remote partition. The
system will make a shallow copy of the
message, meaning it can't contain any
pointers in the info field or the packet itself.
This function is very unsafe. If you use it,
your program will probably crash. Only I can
use it.

node

- node which is sending message

destNodeId
msg

- nodeId of receiving node

- message to be delivered

delay

- delay suffered by this message.

Returns:
void

- NULL

MESSAGE_RouteReceivedRemoteEvent

void MESSAGE_RouteReceivedRemoteEvent (Node*node, Message*msg)

Parameters:

Counterpart to MESSAGE_RemoteSend, this


function allows models that send remote
messages to provide special handling for them
on the receiving partition. This function is
called in real time as the messages are
received, so must be used carefully.

node
msg

- node which is sending message

- message to be delivered

Returns:
void

- NULL

MESSAGE_CancelSelfMsg

void MESSAGE_CancelSelfMsg (Node*node, Message*msgToCancelPtr)

Parameters:

Function call used to cancel a event message


in the QualNet scheduler. The Message must
be a self message (timer) .i.e. a message a
node sent to itself. The msgToCancelPtr must
a pointer to the original message that needs to
be canceled.

node

- node which is sending message

msgToCancelPtr

- message to be cancelled

Returns:
void

- NULL

MESSAGE_Alloc

Message* MESSAGE_Alloc (Node*node, intlayerType, intprotocol, inteventType)

Parameters:

Allocate a new Message structure. This is


called when a new message has to be sent
through the system. The last three parameters
indicate the layerType, protocol and the
eventType that will be set for this message.

node

- node which is allocating message

layerType
protocol

- Layer type to be set for this message

- Protocol to be set for this message

eventType

- event type to be set for this message

Returns:
Message*

- Pointer to allocated message structure

MESSAGE_Alloc

Message* MESSAGE_Alloc (PartitionData*partition, intlayerType, intprotocol, inteventType)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Allocate a new Message structure. This is


called when a new message has to be sent
through the system. The last three parameters
indicate the layerType, protocol and the
eventType that will be set for this message.

partition

- partition that is allocating message

layerType

- Layer type to be set for this message

protocol

- Protocol to be set for this message

eventType

- event type to be set for this message

Returns:
- Pointer to allocated message structure

Message*

MESSAGE_AllocMT

Message* MESSAGE_AllocMT (PartitionData*partition, intlayerType, intprotocol, inteventType)

Parameters:

Mutli-thread safe version of


MESSAGE_Alloc for use by worker threads.

partition

- partition that is allocating message

layerType

- Layer type to be set for this message

protocol

- Protocol to be set for this message

eventType

- event type to be set for this message

Returns:
- Pointer to allocated message structure

Message*

MESSAGE_InfoFieldAlloc

char* MESSAGE_InfoFieldAlloc (Node*node, intinfoSize)

Parameters:

Allocate space for one "info" field

node

- node which is allocating the space.

infoSize

- size of the space to be allocated

Returns:
char*

- pointer to the allocated space.

MESSAGE_InfoFieldAlloc

char* MESSAGE_InfoFieldAlloc (PartitionData*partition, intinfoSize)

Parameters:

Allocate space for one "info" field

partition
infoSize

- partition which is allocating the space.

- size of the space to be allocated

Returns:
char*

MESSAGE_InfoFieldAllocMT

- pointer to the allocated space.

char* MESSAGE_InfoFieldAllocMT (PartitionData*partition, intinfoSize)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Multi-thread safe version of


MESSAGE_InfoFieldAlloc

Parameters:
partition
infoSize

- partition which is allocating the space.

- size of the space to be allocated

Returns:
- pointer to the allocated space.

char*

MESSAGE_InfoFieldFree

void MESSAGE_InfoFieldFree (Node*node, MessageInfoHeader*hdrPtr)

Parameters:

Free space for one "info" field

node

- node which is allocating the space.

hdrPtr

- pointer to the "info" field

Returns:
- NULL

void

MESSAGE_AddInfo

char* MESSAGE_AddInfo (Node*node, Message*msg, intinfoSize, unsigned shortinfoType)

Parameters:

Allocate one "info" field with given info type


for the message. This function is used for the
delivery of data for messages which are NOT
packets as well as the delivery of extra
information for messages which are packets.
If a "info" field with the same info type has
previously been allocated for the message, it
will be replaced by a new "info" field with
the specified size. Once this function has
been called, MESSAGE_ReturnInfo function
can be used to get a pointer to the allocated
space for the info field in the message
structure.
MESSAGE_AddInfo

char* MESSAGE_AddInfo (PartitionData*partition, Message*msg, intinfoSize, unsigned shortinfoType)

Parameters:

Allocate one "info" field with given info type


for the message. This function is used for the
delivery of data for messages which are NOT
packets as well as the delivery of extra
information for messages which are packets.
If a "info" field with the same info type has
previously been allocated for the message, it
will be replaced by a new "info" field with
the specified size. Once this function has
been called, MESSAGE_ReturnInfo function
can be used to get a pointer to the allocated

node
msg

- node which is allocating the info field.

- message for which "info" field

infoSize

- size of the "info" field to be allocated

infoType

- type of the "info" field to be allocated.

Returns:
char*

- Pointer to the added info field

partition
msg

- partition which is allocating the info field.

- message for which "info" field

infoSize

- size of the "info" field to be allocated

infoType

- type of the "info" field to be allocated.

Returns:
char*

- Pointer to the added info field

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

space for the info field in the message


structure.
MESSAGE_RemoveInfo

void MESSAGE_RemoveInfo (Node*node, Message*msg, unsigned shortinfoType)

Parameters:

Remove one "info" field with given info type


from the info array of the message.

node
msg

- node which is removing info field.

- message for which "info" field

infoType

- type of the "info" field to be removed.

Returns:
void

- NULL

MESSAGE_InfoAlloc

char * MESSAGE_InfoAlloc (Node*node, Message*msg, intinfoSize)

Parameters:

Allocate the default "info" field for the


message. This function is similar to
MESSAGE_AddInfo. The difference is that it
assumes the type of the info field to be
allocated is INFO_TYPE_DEFAULT.

node
msg

- node which is allocating the info field.

- message for which "info" field

infoSize

- size of the "info" field to be allocated

Returns:
char *

- None

MESSAGE_InfoAlloc

char * MESSAGE_InfoAlloc (PartitionData*partition, Message*msg, intinfoSize)

Parameters:

Allocate the default "info" field for the


message. This function is similar to
MESSAGE_AddInfo. The difference is that it
assumes the type of the info field to be
allocated is INFO_TYPE_DEFAULT.

partition
msg

- partition which is allocating the info field.

- message for which "info" field

infoSize

- size of the "info" field to be allocated

Returns:
char *

- None

MESSAGE_ReturnInfoSize

int MESSAGE_ReturnInfoSize (Message*msg, unsigned shortinfoType, intfragmentNumber)

Parameters:

Returns the size of a "info" field with given


info type in the info array of the message.

msg

- message for which "info" field

infoType

- type of the "info" field.

fragmentNumber

- Location of the fragment in the TCP packet

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

- size of the info field.

int

MESSAGE_ReturnInfoSize

int MESSAGE_ReturnInfoSize (Message*msg, unsigned shortinfoType)

Parameters:

Returns the size of a "info" field with given


info type in the info array of the message.

msg

- message for which "info" field

infoType

- type of the "info" field.

Returns:
- size of the info field.

int

MESSAGE_ReturnInfo

char* MESSAGE_ReturnInfo (Message*msg, unsigned shortinfoType)

Parameters:

Returns a pointer to the "info" field with


given info type in the info array of the
message.

msg

- message for which "info" field

infoType

- type of the "info" field to be returned.

Returns:
- Pointer to the "info" field with given type. NULL if not found.

char*

MESSAGE_CopyInfo

void MESSAGE_CopyInfo (Node*node, Message*dsgMsg, Message*srcMsg)

Parameters:

Copy the "info" fields of the source message


to the destination message.

node

- Node which is copying the info fields

dsgMsg

- Destination message

srcMsg

- Source message

Returns:
void

- NULL

MESSAGE_CopyInfo

void MESSAGE_CopyInfo (Node*node, Message*dsgMsg, MessageInfoHeader*srcInfo)

Parameters:

Copy the "info" fields of the source info


header to the destination message.

node

- Node which is copying the info fields

dsgMsg

- Destination message

srcInfo

- Info Header structure

Returns:
void

- NULL

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

MESSAGE_FragmentPacket

void MESSAGE_FragmentPacket (Node*node, Message*msg, intfragUnit, Message***fragList, int*numFrags,


TraceProtocolTypeprotocolType)

Parameters:
Fragment one packet into multiple fragments
Note: The original packet will be freed in this
function. The array for storing pointers to
fragments will be dynamically allocated. The
caller of this function will need to free the
memory.

node
msg

- node which is fragmenting the packet

- The packet to be fragmented

fragUnit

- The unit size for fragmenting the packet

fragList

- A list of fragments created.

numFrags

- Number of fragments in the fragment list.

protocolType

- Protocol type for packet tracing.

Returns:
void

- NULL

MESSAGE_ReassemblePacket

Message* MESSAGE_ReassemblePacket (Node*node, Message**fragList, intnumFrags, TraceProtocolTypeprotocolType)

Parameters:

Reassemble multiple fragments into one


packet Note: All the fragments will be freed
in this function.

node

- node which is assembling the packet

fragList

- A list of fragments.

numFrags

- Number of fragments in the fragment list.

protocolType

- Protocol type for packet tracing.

Returns:
Message*

- The reassembled packet.

MESSAGE_PackMessage

Message* MESSAGE_PackMessage (Node*node, Message*msgList, TraceProtocolTypeorigProtocol, int*actualPktSize)

Parameters:

Pack a list of messages to be one message


structure Whole contents of the list messages
will be put as payload of the new message.
So the packet size of the new message cannot
be directly used now. The original lis of msgs
will be freed.

node

- Pointer to node.

msgList

- Pointer to a list of messages

origProtocol

- Protocol allocating this packet

actualPktSize

- For return sum of packet size of msgs in list

Returns:
Message*

MESSAGE_UnpackMessage

- The super msg contains a list of msgs as payload

Message* MESSAGE_UnpackMessage (Node*node, Message*msg, boolcopyInfo, boolfreeOld)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Unpack a super message to the original list of


messages The list of messages were stored as
payload of this super message.

Parameters:
node
msg

- Pointer to node.

- Pointer to the supper msg contains list of msgs

copyInfo
freeOld

- Whether copy info from old msg to first msg

- Whether the original message should be freed

Returns:
Message*

- A list of messages unpacked from original msg

MESSAGE_PacketAlloc

void MESSAGE_PacketAlloc (Node*node, Message*msg, intpacketSize, TraceProtocolTypeoriginalProtocol)

Parameters:

Allocate the "payload" field for the packet to


be delivered. Add additional free space in
front of the packet for headers that might be
added to the packet. This function can be
called from the application layer or anywhere
else (e.g TCP, IP) that a packet may
originiate from. The "packetSize" variable
will be set to the "packetSize" parameter
specified in the function call. Once this
function has been called the "packet" variable
in the message structure can be used to access
this space.
MESSAGE_PacketAlloc

node
msg

- node which is allocating the packet

- message for which packet has to be allocated

packetSize

- size of the packet to be allocated

originalProtocol

- Protocol allocating this packet

Returns:
void

- NULL

void MESSAGE_PacketAlloc (PartitionData*partition, Message*msg, intpacketSize, TraceProtocolTypeoriginalProtocol,


boolisMT)

Parameters:
Allocate the "payload" field for the packet to
be delivered. Add additional free space in
front of the packet for headers that might be
added to the packet. This function can be
called from the application layer or anywhere
else (e.g TCP, IP) that a packet may
originiate from. The "packetSize" variable
will be set to the "packetSize" parameter
specified in the function call. Once this
function has been called the "packet" variable
in the message structure can be used to access
this space.

partition
msg

- artition which is allocating the packet

- message for which packet has to be allocated

packetSize

- size of the packet to be allocated

originalProtocol
isMT

- Protocol allocating this packet

- Is this packet being created from a worker thread

Returns:
void

- NULL

MESSAGE_AddHeader

void MESSAGE_AddHeader (Node*node, Message*msg, inthdrSize, TraceProtocolTypetraceProtocol)

Parameters:

This function is called to reserve additional

node

- node which is adding header

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

space for a header of size "hdrSize" for the


packet enclosed in the message. The
"packetSize" variable in the message structure
will be increased by "hdrSize". Since the
header has to be prepended to the current
packet, after this function is called the
"packet" variable in the message structure
will point the space occupied by this new
header.

msg

- message for which header has to be added

hdrSize

- size of the header to be added

traceProtocol

- protocol name, from trace.h

Returns:
- NULL

void

MESSAGE_RemoveHeader

void MESSAGE_RemoveHeader (Node*node, Message*msg, inthdrSize, TraceProtocolTypetraceProtocol)

Parameters:

This function is called to remove a header


from the packet. The "packetSize" variable in
the message will be decreased by "hdrSize".

node
msg

- node which is removing the packet header

- message for which header is being removed

hdrSize

- size of the header being removed

traceProtocol

- protocol removing this header.

Returns:
- NULL

void

MESSAGE_ReturnHeader

char* MESSAGE_ReturnHeader (Message*msg, intheader)

Parameters:

This is kind of a hack so that MAC protocols


(dot11) that need to peak at a packet that still
has the PHY header can return the contents
after the first (N) headers without first
removing those headers.

msg

- message containing a packet with headers

header

- number of the header to return.

Returns:
char*

- the packet starting at the header'th header

MESSAGE_ExpandPacket

void MESSAGE_ExpandPacket (Node*node, Message*msg, intsize)

Parameters:

Expand packet by a specified size

node
msg

- node which is expanding the packet

- message which is to be expanded

size

- size to expand

Returns:
void

MESSAGE_ShrinkPacket

- NULL

void MESSAGE_ShrinkPacket (Node*node, Message*msg, intsize)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

This function is called to shrink packet by a


specified size.

Parameters:
node
msg

- node which is shrinking packet

- message whose packet is be shrinked

size

- size to shrink

Returns:
void

- NULL

MESSAGE_Free

void MESSAGE_Free (PartitionData*partition, Message*msg)

Parameters:

When the message is no longer needed it can


be freed. Firstly the "payload" and "info"
fields of the message are freed. Then the
message itself is freed. It is important to
remember to free the message. Otherwise
there will nasty memory leaks in the program.

partition
msg

- partition which is freeing the message

- message which has to be freed

Returns:
void

- NULL

MESSAGE_Free

void MESSAGE_Free (Node*node, Message*msg)

Parameters:

When the message is no longer needed it can


be freed. Firstly the "payload" and "info"
fields of the message are freed. Then the
message itself is freed. It is important to
remember to free the message. Otherwise
there will nasty memory leaks in the program.

node
msg

- node which is freeing the message

- message which has to be freed

Returns:
void

- NULL

MESSAGE_FreeList

void MESSAGE_FreeList (Node*node, Message*msg)

Parameters:

Free a list of message until the next pointer


of the message is NULL.

node
msg

- node which is freeing the message

- message which has to be freed

Returns:
void

- NULL

MESSAGE_Duplicate

Message* MESSAGE_Duplicate (Node*node, Message*msg)

Parameters:

Create a new message which is an exact


duplicate of the message supplied as the
parameter to the function and return the new

node
msg

- node is calling message copy

- message for which duplicate has to be made

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

message.

Returns:
Message*

- Pointer to the new message

MESSAGE_Duplicate

Message* MESSAGE_Duplicate (PartitionData*partition, Message*msg, boolisMT)

Parameters:

Create a new message which is an exact


duplicate of the message supplied as the
parameter to the function and return the new
message.

partition
msg

- partition is calling message copy

- message for which duplicate has to be made

isMT

- Is this function being called from the context

Returns:
Message*

- Pointer to the new message

MESSAGE_DuplicateMT

Message* MESSAGE_DuplicateMT (PartitionData*partition, Message*msg)

Parameters:

Create a new message which is an exact


duplicate of the message supplied as the
parameter to the function and return the new
message.

partition
msg

- partition is calling message copy

- message for which duplicate has to be made

Returns:
Message*

- Pointer to the new message

MESSAGE_PayloadAlloc

char* MESSAGE_PayloadAlloc (Node*node, intpayloadSize)

Parameters:

Allocate a character payload out of the free


list, if possible otherwise via malloc.

node

- node which is allocating payload

payloadSize

- size of the field to be allocated

Returns:
char*

- pointer to the allocated memory

MESSAGE_PayloadAlloc

char* MESSAGE_PayloadAlloc (PartitionData*partition, intpayloadSize, boolisMT)

Parameters:

Allocate a character payload out of the free


list, if possible otherwise via malloc.

partition

- partition which is allocating payload

payloadSize
isMT

- size of the field to be allocated

- Is this packet being created from a worker thread

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

char*

- pointer to the allocated memory

MESSAGE_PayloadFree

void MESSAGE_PayloadFree (PartitionData*partition, Char*payload, intpayloadSize)

Parameters:

Return a character payload to the free list, if


possible otherwise free it.

partition
payload

- partition which is freeing payload

- Pointer to the payload field

payloadSize

- size of the payload field

Returns:
- NULL

void

MESSAGE_PayloadFree

void MESSAGE_PayloadFree (Node*node, Char*payload, intpayloadSize)

Parameters:

Return a character payload to the free list, if


possible otherwise free it.

- node which is freeing payload

node

payload

- Pointer to the payload field

payloadSize

- size of the payload field

Returns:
- NULL

void

MESSAGE_FreeList

void MESSAGE_FreeList (Node*node, Message*msg)

Parameters:

Free a list of messages until the next pointer


of the message is NULL.

- node which is freeing the message

node
msg

- message which has to be freed

Returns:
- NULL

void

MESSAGE_ReturnNumFrags

int MESSAGE_ReturnNumFrags (Message*msg)

Parameters:

Returns the number of fragments used to


create a TCP packet.

msg

- message for which "info" field

Returns:
int

- Number of Fragments. 0 if none.

MESSAGE_ReturnFragSeqNum

int MESSAGE_ReturnFragSeqNum (Message*msg, intfragmentNumber)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Returns the sequence number of a particular


fragments in the TCP packet.

msg

- message for which "info" field

fragmentNumber

- fragment location in the TCP message.

Returns:
- Sequence number of the fragment. -1 if none.

int

MESSAGE_ReturnFragSize

int MESSAGE_ReturnFragSize (Message*msg, intfragmentNumber)

Parameters:

Returns the size of a particular fragment in


the TCP packet.

msg

- message for which "info" field

fragmentNumber

- fragment location in the TCP message.

Returns:
- Sequence number of the fragment. 0 if none.

int

MESSAGE_ReturnFragNumInfos

int MESSAGE_ReturnFragNumInfos (Message*msg, intfragmentNumber)

Parameters:

Returns the number of info fields associated


with a particular fragment in the TCP packet.

msg

- message for which "info" field

fragmentNumber

- fragment location in the TCP message.

Returns:
- Sequence number of the fragment. 0 if none.

int

MESSAGE_AppendInfo

void MESSAGE_AppendInfo (Node*node, Message*msg, intinfosize, shortinfoType)

Parameters:

Appends the "info" fields of the source


message to the destination message.

node
msg

- Node which is copying the info fields

- Destination message

infosize

- size of the info field

infoType

- type of info field.

Returns:
void

- NULL

MESSAGE_AppendInfo

void MESSAGE_AppendInfo (Node*node, Message*dsgMsg, MessageInfoHeader*srcInfo)

Parameters:

Appends the "info" fields of the source


message to the destination message.

node

- Node which is copying the info fields

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

dsgMsg

- Destination message

srcInfo

- Source message info vector

Returns:
void

- NULL

MESSAGE_AppendInfo

void MESSAGE_AppendInfo (Node*node, Message*dsgMsg, Message*srcMsg)

Parameters:

Appends the "info" fields of the source


message to the destination message.

node

- Node which is copying the info fields

dsgMsg

- Destination message

srcMsg

- Source message

Returns:
void

- NULL

MESSAGE_SizeOf

size_t MESSAGE_SizeOf ()

Parameters:

Returns the size of a message. Used in place


of sizeof() in the kernel code to allow for
users to add more fields to the message.

Returns:

MESSAGE_FragmentPacket

BOOL MESSAGE_FragmentPacket (Node*node, Message*&msg, Message*&fragmentedMsg, Message*&remainingMsg,


intfragUnit, TraceProtocolTypeprotocolType, boolfreeOriginalMsg)

size_t

- sizeof(msg)

Parameters:
Fragment one packet into TWO fragments
Note:(i) This API treats the original packet as
raw packet and does not take account of
fragmentation related information like
fragment id. The caller of this API will have
to itself put in logic for distinguishing the
fragmented packets (ii) Overloaded
MESSAGE_FragmentPacket

node
msg

- node which is fragmenting the packet

- The packet to be fragmented

fragmentedMsg
remainingMsg
fragUnit

- First fragment

- Remaining packet

- The unit size for fragmenting the packet

protocolType

- Protocol type for packet tracing.

freeOriginalMsg

- If TRUE, then original msg is set to NULL

Returns:
BOOL

MESSAGE_ReassemblePacket

- TRUE if any fragment is created, FALSE otherwise

Message* MESSAGE_ReassemblePacket (Node*node, Message*fragMsg1, Message*fragMsg2,


TraceProtocolTypeprotocolType)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MESSAGE

Parameters:
Reassemble TWO fragments into one packet
Note: (i) None of the fragments will be freed
in this API. The caller of this API will itself
have to free the fragments (ii) Overloaded
MESSAGE_ReassemblePacket

node

- node which is assembling the packet

fragMsg1

- First fragment

fragMsg2

- Second fragment

protocolType

- Protocol type for packet tracing.

Returns:
Message*

- The reassembled packet.

MESSAGE_SendAsEarlyAsPossible

void MESSAGE_SendAsEarlyAsPossible (Node*node, Message*msg)

Parameters:

This function is used primarily by external


interfaces to inject events into the Simulator
as soon as possible without causing problems
for parallel execution.

node
msg

- node which is sending message

- message to be delivered

Returns:
void

- NULL

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MESSAGE.html[10/28/2011 1:30:01 PM]

MOBILITY

QualNet 5.2 API Reference


MOBILITY
This file describes data structures and functions used by mobility models.
Constant / Data Structure Summary
Type

Name

CONSTANT

DEFAULT_DISTANCE_GRANULARITY

Defines the default distance granurality

CONSTANT

NUM_NODE_PLACEMENT_TYPES

Defines the number of node placement schemes

CONSTANT

NUM_MOBILITY_TYPES

Defines the number of mobility models

CONSTANT

NUM_PAST_MOBILITY_EVENTS

Number of past mobility models stored

ENUMERATION

NodePlacementType

Specifies different node placement schemes

ENUMERATION

MobilityType

Specifies different mobility models

STRUCT

MobilityHeap

A Heap that determines the earliest time

STRUCT

MobilityElement

Defines all the element of mobility model.

STRUCT

MobilityRemainder

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

A structure that defines the next states of the elements of mobility model.

STRUCT

MobilityData

This structure keeps the data related to mobility model. It also holds the variables which are static and variable during the simulation.
Buffer caches future position updates as well.

Function / Macro Summary


Return Type

Summary

void

MOBILITY_InsertEvent(MobilityHeap*heapPtr, Node*node)

Inserts an event.
void

MOBILITY_DeleteEvent(MobilityHeap*heapPtr, Node*node)

Deletes an event.
void

MOBILITY_HeapFixDownEvent(MobilityHeap*heapPtr, inti)

Inserts an event and sort out the heap downwards


void

MOBILITY_AllocateNodePositions(intnumNodes, NodeAddress*nodeIdArray, NodePositions**nodePositions,


int**nodePlacementTypeCounts, NodeInput*nodeInput, intseedVal)

Allocates memory for nodePositions and mobilityData Note: This function is called before NODE_CreateNode(). It cannot access Node
structure
void

MOBILITY_PreInitialize(NodeAddressnodeId, MobilityData*mobilityData, NodeInput*nodeInput, intseedVal)

Initializes most variables in mobilityData. (Node positions are set in MOBILITY_SetNodePositions().) Note: This function is called
before NODE_CreateNode(). It cannot access Node structure
void

MOBILITY_PostInitialize(Node*node, NodeInput*nodeInput)

Initializes variables in mobilityData not initialized by MOBILITY_PreInitialize().


void

MOBILITY_UpdatePathProfiles(MobilityHeap*pathProfileHeap, clocktypenextEventTime, clocktype*upperBoundTime)

Updates the path profiles.


void

MOBILITY_Finalize(Node*node)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

Called at the end of simulation to collect the results of the simulation of the mobility data.
void

MOBILITY_ProcessEvent(Node*node)

Models the behaviour of the mobility models on receiving a message.


void

MOBILITY_AddANewDestination(MobilityData*mobilityData, clocktypearrivalTime, Coordinatesdest,


Orientationorientation, doublezValue)

Adds a new destination.


BOOL

MOBILITY_NextPosition(Node*node, MobilityElement*element)

Update next node position for static mobility models


clocktype

MOBILITY_NextMoveTime(Node*node)

Determines the time of next movement.


MobilityElement*

MOBILITY_ReturnMobilityElement(Node*node, intsequenceNum)

Used to get the mobility element.


void

MOBILITY_InsertANewEvent(Node*node, clocktypenextMoveTime, Coordinatesposition, Orientationorientation,


doublespeed)

Inserts a new event.


bool

MOBILITY_NodeIsIndoors(Node*node)

Returns whether the node is indoors.


void

MOBILITY_SetIndoors(Node*node, boolindoors)

Sets the node's indoor variable.


void

MOBILITY_ReturnCoordinates(Node*node, Coordinatesposition)

Returns the coordinate.


void

MOBILITY_ReturnOrientation(Node*node, Orientation*orientation)

Returns the node orientation.


void

MOBILITY_ReturnInstantaneousSpeed(Node*node, double*speed)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

Returns instantaneous speed of a node.


void

MOBILITY_ReturnSequenceNum(Node*node, int*sequenceNum)

Returns a sequence number for the current position.


void

MOBILITY_SetNodePositions(intnumNodes, NodePositions*nodePositions, int*nodePlacementTypeCounts,


TerrainData*terrainData, NodeInput*nodeInput, RandomSeedseed, clocktypemaxSimTime)

Set positions of nodes


void

MOBILITY_PostInitializePartition(PartitionData*partitionData)

Initialization of mobility models that most be done after partition is created; MOBILITY_SetNodePositions would be too early
void

MOBILITY_NodePlacementFinalize(PartitionData*partitionData)

Finalize mobility models


void

MOBILITY_ChangeGroundNode(Node*node, BOOLbefore, BOOLafter)

Change GroundNode value..


void

MOBILITY_ChangePositionGranularity(Node*node)

Change Mobility-Position-Granularity value..

Constant / Data Structure Detail

Constant

DEFAULT_DISTANCE_GRANULARITY1

Constant

Defines the default distance granurality


NUM_NODE_PLACEMENT_TYPES7

Constant

Defines the number of node placement schemes


NUM_MOBILITY_TYPES5

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

Constant

Defines the number of mobility models


NUM_PAST_MOBILITY_EVENTS2

Enumeration

Number of past mobility models stored


NodePlacementType

Enumeration

Specifies different node placement schemes


MobilityType

Structure

Specifies different mobility models


MobilityHeap

Structure

A Heap that determines the earliest time


MobilityElement

Structure

Defines all the element of mobility model.


MobilityRemainder

Structure

A structure that defines the next states of the elements of mobility model.
MobilityData

This structure keeps the data related to mobility model. It also holds the variables which are static and variable during the simulation.
Buffer caches future position updates as well.

Function / Macro Detail


Function / Macro
MOBILITY_InsertEvent

Format
void MOBILITY_InsertEvent (MobilityHeap*heapPtr, Node*node)

Parameters:

Inserts an event.

heapPtr
node

- A pointer of type MobilityHeap.

- A pointer to node.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

void

- None

MOBILITY_DeleteEvent

void MOBILITY_DeleteEvent (MobilityHeap*heapPtr, Node*node)

Parameters:

Deletes an event.

heapPtr
node

- A pointer of type MobilityHeap.

- A pointer to node.

Returns:
void

- None

MOBILITY_HeapFixDownEvent

void MOBILITY_HeapFixDownEvent (MobilityHeap*heapPtr, inti)

Parameters:

Inserts an event and sort out the heap


downwards

heapPtr
i

- A pointer of type MobilityHeap.

- index

Returns:
void

MOBILITY_AllocateNodePositions

- None

void MOBILITY_AllocateNodePositions (intnumNodes, NodeAddress*nodeIdArray, NodePositions**nodePositions,


int**nodePlacementTypeCounts, NodeInput*nodeInput, intseedVal)

Parameters:
Allocates memory for nodePositions and
mobilityData Note: This function is called
before NODE_CreateNode(). It cannot access
Node structure

numNodes

- number of nodes

nodeIdArray

- array of nodeId

nodePositions

- pointer to the array

nodePlacementTypeCounts
nodeInput
seedVal

- array of placement type counts

- configuration input

- seed for random number seeds

Returns:
void

- None

MOBILITY_PreInitialize

void MOBILITY_PreInitialize (NodeAddressnodeId, MobilityData*mobilityData, NodeInput*nodeInput, intseedVal)

Parameters:

Initializes most variables in mobilityData.


(Node positions are set in
MOBILITY_SetNodePositions().) Note: This

nodeId

- nodeId

mobilityData

- mobilityData to be initialized

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

function is called before


NODE_CreateNode(). It cannot access Node
structure

nodeInput
seedVal

- configuration input

- seed for random number seeds

Returns:
void

- None

MOBILITY_PostInitialize

void MOBILITY_PostInitialize (Node*node, NodeInput*nodeInput)

Parameters:

Initializes variables in mobilityData not


initialized by MOBILITY_PreInitialize().

node

- node being initialized

nodeInput

- structure containing contents of input file

Returns:
void

MOBILITY_UpdatePathProfiles

- None

void MOBILITY_UpdatePathProfiles (MobilityHeap*pathProfileHeap, clocktypenextEventTime,


clocktype*upperBoundTime)

Parameters:
Updates the path profiles.
pathProfileHeap
nextEventTime

- MobilityHeap structure.

- Next event time.

upperBoundTime

- Upper bound time.

Returns:
void

- None

MOBILITY_Finalize

void MOBILITY_Finalize (Node*node)

Parameters:

Called at the end of simulation to collect the


results of the simulation of the mobility data.

node

- Node for which results are to be collected.

Returns:
void

- None

MOBILITY_ProcessEvent

void MOBILITY_ProcessEvent (Node*node)

Parameters:

Models the behaviour of the mobility models


on receiving a message.

node

- Node which received the message

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

MOBILITY_AddANewDestination

void MOBILITY_AddANewDestination (MobilityData*mobilityData, clocktypearrivalTime, Coordinatesdest,


Orientationorientation, doublezValue)

Parameters:
Adds a new destination.
mobilityData
arrivalTime
dest

- MobilityData of the node

- Arrival time

- Destination

orientation
zValue

- Orientation

- original zValue

Returns:
void

- None

MOBILITY_NextPosition

BOOL MOBILITY_NextPosition (Node*node, MobilityElement*element)

Parameters:

Update next node position for static mobility


models

node

- Node to be updated

element

- next mobility update

Returns:
BOOL

- None

MOBILITY_NextMoveTime

clocktype MOBILITY_NextMoveTime (Node*node)

Parameters:

Determines the time of next movement.

node

- Pointer to node.

Returns:
clocktype

- Next time of movement.

MOBILITY_ReturnMobilityElement

MobilityElement* MOBILITY_ReturnMobilityElement (Node*node, intsequenceNum)

Parameters:

Used to get the mobility element.

node

- Pointer to node.

sequenceNum

- Sequence number.

Returns:
MobilityElement*

MOBILITY_InsertANewEvent

- None

void MOBILITY_InsertANewEvent (Node*node, clocktypenextMoveTime, Coordinatesposition, Orientationorientation,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

doublespeed)

Parameters:
Inserts a new event.
node

- Pointer to node.

nextMoveTime
position

- Position of the node.

orientation
speed

- Time of next movement.

- Node orientation.

- Speed of the node.

Returns:
void

- None

MOBILITY_NodeIsIndoors

bool MOBILITY_NodeIsIndoors (Node*node)

Parameters:

Returns whether the node is indoors.

node

- Pointer to node.

Returns:
bool

- returns true if indoors.

MOBILITY_SetIndoors

void MOBILITY_SetIndoors (Node*node, boolindoors)

Parameters:

Sets the node's indoor variable.

node

- Pointer to node.

indoors

- true if the node is indoors.

Returns:
void

- None

MOBILITY_ReturnCoordinates

void MOBILITY_ReturnCoordinates (Node*node, Coordinatesposition)

Parameters:

Returns the coordinate.

node

- Pointer to node.

position

- Position of the node.

Returns:
void

- None

MOBILITY_ReturnOrientation

void MOBILITY_ReturnOrientation (Node*node, Orientation*orientation)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

Returns the node orientation.

node

- Pointer to node.

orientation

- Pointer to Orientation.

Returns:
- None

void

MOBILITY_ReturnInstantaneousSpeed

void MOBILITY_ReturnInstantaneousSpeed (Node*node, double*speed)

Parameters:

Returns instantaneous speed of a node.

node

- Pointer to node.

speed

- Speed of the node, double pointer.

Returns:
void

- None

MOBILITY_ReturnSequenceNum

void MOBILITY_ReturnSequenceNum (Node*node, int*sequenceNum)

Parameters:

Returns a sequence number for the current


position.

node

- Pointer to node.

sequenceNum

- Sequence number.

Returns:
void

MOBILITY_SetNodePositions

- None

void MOBILITY_SetNodePositions (intnumNodes, NodePositions*nodePositions, int*nodePlacementTypeCounts,


TerrainData*terrainData, NodeInput*nodeInput, RandomSeedseed, clocktypemaxSimTime)

Parameters:
Set positions of nodes
numNodes

- Defines the number of nodes to be distributed.

nodePositions

- Pointer to NodePositionInfo. States

nodePlacementTypeCounts
terrainData
nodeInput
seed

- Array of placement type counts

- Terrain data.

- Pointer to NodeInput, defines the

- Stores the seed value.

maxSimTime

- Maximum simulation time.

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

MOBILITY_PostInitializePartition

void MOBILITY_PostInitializePartition (PartitionData*partitionData)

Parameters:

Initialization of mobility models that most be


done after partition is created;
MOBILITY_SetNodePositions would be too
early

partitionData

- Pointer to the partition data

Returns:
- None

void

MOBILITY_NodePlacementFinalize

void MOBILITY_NodePlacementFinalize (PartitionData*partitionData)

Parameters:

Finalize mobility models

partitionData

- Pointer to the partition data

Returns:
- None

void

MOBILITY_ChangeGroundNode

void MOBILITY_ChangeGroundNode (Node*node, BOOLbefore, BOOLafter)

Parameters:

Change GroundNode value..

node

- Pointer to node being initialized.

before
after

- Orginal value for Ground-Node variable

- new value for Ground-Node variable.

Returns:
void

- None

MOBILITY_ChangePositionGranularity

void MOBILITY_ChangePositionGranularity (Node*node)

Parameters:

Change Mobility-Position-Granularity value..

node

- Pointer to node being initialized.

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MOBILITY

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MOBILITY.html[10/28/2011 1:30:18 PM]

MUTEX

QualNet 5.2 API Reference


MUTEX
This file describes objects for use in creating critical regions (synchronized access) for global variables or data structures that have to be shared between threads.
Function / Macro Summary
Return Type

Summary

None

QNThreadLock(QNThreadMutexmutex)

This constructor is used to begin a critical region.


None

QNPartitionLock(QNPartitionMutexmutex)

This constructor is used to begin a critical region.

Function / Macro Detail


Function / Macro
QNThreadLock

Format
None QNThreadLock (QNThreadMutexmutex)

Parameters:

This constructor is used to begin a critical


region.

mutex

- Pointer to the Thread mutex to lock for this

Returns:
None

- None

QNPartitionLock

None QNPartitionLock (QNPartitionMutexmutex)

Parameters:

This constructor is used to begin a critical


region.

mutex

- Pointer to the Partition mutex to lock

Returns:
None

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MUTEX.html[10/28/2011 1:30:29 PM]

MUTEX

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/MUTEX.html[10/28/2011 1:30:29 PM]

NETWORK LAYER

QualNet 5.2 API Reference


NETWORK LAYER
This file describes the data structures and functions used by the Network Layer.
Constant / Data Structure Summary
Type

Name

CONSTANT

DEFAULT_IP_QUEUE_COUNT

Default number of output queue per interface

CONSTANT

DEFAULT_CPU_QUEUE_SIZE

Default size of CPU queue (in byte)

CONSTANT

DEFAULT_NETWORK_INPUT_QUEUE_SIZE

Default size in bytes of an input queue, if it's not specified in the input file with the IP-QUEUE-PRIORITY-INPUT-QUEUE-SIZE
parameter.

CONSTANT

DEFAULT_NETWORK_OUTPUT_QUEUE_SIZE

Default size in bytes of an output queue, if it's not specified in the input file with the IP-QUEUE-PRIORITY-QUEUE-SIZE parameter.

CONSTANT

DEFAULT_ETHERNET_MTU

Default Ethernet MTU(Maximum transmission unit) in bytes. QualNet does not model Ethernet yet, but this value is used (in the init
functions in network/fifoqueue.c and network/redqueue.c) to compute the initial number of Message * instances that are used to store
packets in queues.Regardless, the buffer capacity of a queue is not the number of Message * instances, but a certain number of bytes, as
expected.

CONSTANT

IP_MAXPACKET

Maximum IP packet size

CONSTANT

NETWORK_IP_UNLIMITED_BACKPLANE_THROUGHPUT

Maximum throughput of backplane of network.

ENUMERATION

NetworkIpBackplaneStatusType

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NETWORK LAYER.html[10/28/2011 1:30:44 PM]

NETWORK LAYER

Status of backplane (either busy or idle)

ENUMERATION

NetworkRoutingAdminDistanceType

Administrative distance of different routing protocol

ENUMERATION

NetworkRoutingProtocolType

Enlisted different network/routing protocol

ENUMERATION

ManagementReportType

Type of management report message

ENUMERATION

ManagementResponseType

Type of management response message

STRUCT

NetworkData

Main data structure of network layer

STRUCT

ManagementReport

data structure of management report

STRUCT

ManagementResponse

data structure of management response

Function / Macro Summary


Return Type

Summary

void

NETWORK_ManagementReport(Node*node, intinterfaceIndex, ManagementReport*report,


ManagementReportResponse*resp)

Deliver a MAC management request to the NETWORK layer


void

NetworkGetInterfaceInfo()(Node*node, intinterfaceIndex, Address*address)

Returns interface information for a interface. Information means its address and type
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NETWORK LAYER.html[10/28/2011 1:30:44 PM]

NETWORK LAYER

void

NetworkIpGetInterfaceAddressString(Node*node, intinterfaceIndex, const char*ipAddrString)

ipAddrString is filled in by interface's ipv6 address in character format.


NetworkType

NetworkIpGetInterfaceType(Node*node, intinterfaceIndex)

Returns type of network (ipv4 or ipv6) the interface.


void

NETWORK_ReceivePacketFromMacLayer(Node*node, Message*message, NodeAddresslastHopAddress, intinterfaceIndex)

Network-layer receives packets from MAC layer, now check Overloaded Function to support Mac Address type of IP and call proper
function
void

NETWORK_Reset(Node*node, intinterfaceIndex)

Reset Network protocols and/or layer.


void

NETWORK_AddResetFunctionList(Node*node, intinterfaceIndex)

Add which protocols to be reset to a fuction list pointer.

Constant / Data Structure Detail

Constant

DEFAULT_IP_QUEUE_COUNT3

Constant

Default number of output queue per interface


DEFAULT_CPU_QUEUE_SIZE640000

Constant

Default size of CPU queue (in byte)


DEFAULT_NETWORK_INPUT_QUEUE_SIZE150000

Constant

Default size in bytes of an input queue, if it's not specified in the input file with the IP-QUEUE-PRIORITY-INPUT-QUEUE-SIZE
parameter.
DEFAULT_NETWORK_OUTPUT_QUEUE_SIZE150000

Default size in bytes of an output queue, if it's not specified in the input file with the IP-QUEUE-PRIORITY-QUEUE-SIZE parameter.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NETWORK LAYER.html[10/28/2011 1:30:44 PM]

NETWORK LAYER

Constant

DEFAULT_ETHERNET_MTU1500

Constant

Default Ethernet MTU(Maximum transmission unit) in bytes. QualNet does not model Ethernet yet, but this value is used (in the init
functions in network/fifoqueue.c and network/redqueue.c) to compute the initial number of Message * instances that are used to store
packets in queues.Regardless, the buffer capacity of a queue is not the number of Message * instances, but a certain number of bytes,
as expected.
IP_MAXPACKET65535

Constant

Maximum IP packet size


NETWORK_IP_UNLIMITED_BACKPLANE_THROUGHPUT0

Enumeration

Maximum throughput of backplane of network.


NetworkIpBackplaneStatusType

Enumeration

Status of backplane (either busy or idle)


NetworkRoutingAdminDistanceType

Enumeration

Administrative distance of different routing protocol


NetworkRoutingProtocolType

Enumeration

Enlisted different network/routing protocol


ManagementReportType

Enumeration

Type of management report message


ManagementResponseType

Structure

Type of management response message


NetworkData

Structure

Main data structure of network layer


ManagementReport

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NETWORK LAYER.html[10/28/2011 1:30:44 PM]

NETWORK LAYER

Structure

data structure of management report


ManagementResponse

data structure of management response

Function / Macro Detail


Function / Macro
NETWORK_ManagementReport

Format
void NETWORK_ManagementReport (Node*node, intinterfaceIndex, ManagementReport*report,
ManagementReportResponse*resp)

Parameters:
Deliver a MAC management request to the
NETWORK layer

node

- Pointer to a network node

interfaceIndex
report
resp

- index of interface

- Pointer to a management report

- Pointer to a management response

Returns:
void

- None

NetworkGetInterfaceInfo()

void NetworkGetInterfaceInfo() (Node*node, intinterfaceIndex, Address*address)

Parameters:

Returns interface information for a interface.


Information means its address and type

node

- Pointer to node.

interfaceIndex
address

- interface index for which info required.

- interface info returned

Returns:
void

- NULL

NetworkIpGetInterfaceAddressString

void NetworkIpGetInterfaceAddressString (Node*node, intinterfaceIndex, const char*ipAddrString)

Parameters:

ipAddrString is filled in by interface's ipv6


address in character format.

node

- Pointer to node.

interfaceIndex
ipAddrString

- Interface index.

- Pointer to string ipv6 address.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NETWORK LAYER.html[10/28/2011 1:30:44 PM]

NETWORK LAYER

void

- None

NetworkIpGetInterfaceType

NetworkType NetworkIpGetInterfaceType (Node*node, intinterfaceIndex)

Parameters:

Returns type of network (ipv4 or ipv6) the


interface.

node

- Pointer to node.

interfaceIndex

- Interface index.

Returns:
NetworkType

NETWORK_ReceivePacketFromMacLayer

- None

void NETWORK_ReceivePacketFromMacLayer (Node*node, Message*message, NodeAddresslastHopAddress,


intinterfaceIndex)

Parameters:
Network-layer receives packets from MAC
layer, now check Overloaded Function to
support Mac Address type of IP and call
proper function

node

- Pointer to node

message

- Message received

lastHopAddress

- last hop address

interfaceIndex

- incoimg interface

Returns:
void

- None

NETWORK_Reset

void NETWORK_Reset (Node*node, intinterfaceIndex)

Parameters:

Reset Network protocols and/or layer.

node

- Pointer to node.

interfaceIndex

- Interface index.

Returns:
void

- None

NETWORK_AddResetFunctionList

void NETWORK_AddResetFunctionList (Node*node, intinterfaceIndex)

Parameters:

Add which protocols to be reset to a fuction


list pointer.

node

- Pointer to node.

interfaceIndex

- Interface index.

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NETWORK LAYER.html[10/28/2011 1:30:44 PM]

NETWORK LAYER

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NETWORK LAYER.html[10/28/2011 1:30:44 PM]

NODE

QualNet 5.2 API Reference


NODE
This file defines the Node data structure and some generic operations on nodes.
Constant / Data Structure Summary
Type

Name

ENUMERATION

NodeGlobalIndex

This enumeration contains indexes into the nodeGlobal array used for module data. For example, nodeGlobal[NodeGlobal_JNE] points
to a JneData structure that stores data related to JNE interfaces and applications.

STRUCT

Node

This struct includes all the information for a particular node. State information for each layer can be accessed from this structure.

STRUCT

NodePositions

Contains information about the initial positions of nodes.

Function / Macro Summary


Return Type

Summary

void

NODE_CreateNode(PartitionData*partitionData, NodeIdnodeId, intindex)

Function used to allocate and initialize a node.


void

NODE_ProcessEvent(Node*node, Message*msg)

Function used to call the appropriate layer to execute instructions for the message
void

NODE_PrintLocation(Node*node, intcoordinateSystemType)

Prints the node's three dimensional coordinates.


TerrainData*

NODE_GetTerrainPtr(Node*node)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NODE.html[10/28/2011 1:31:00 PM]

NODE

Get terrainData pointer.

Constant / Data Structure Detail

Enumeration

NodeGlobalIndex

Structure

This enumeration contains indexes into the nodeGlobal array used for module data. For example, nodeGlobal[NodeGlobal_JNE] points to
a JneData structure that stores data related to JNE interfaces and applications.
Node

Structure

This struct includes all the information for a particular node. State information for each layer can be accessed from this structure.
NodePositions

Contains information about the initial positions of nodes.

Function / Macro Detail


Function / Macro
NODE_CreateNode

Format
void NODE_CreateNode (PartitionData*partitionData, NodeIdnodeId, intindex)

Parameters:

Function used to allocate and initialize a


node.

partitionData
nodeId
index

- the partition that owns the node

- the node's ID

- the node's index within the partition

Returns:
void

- None

NODE_ProcessEvent

void NODE_ProcessEvent (Node*node, Message*msg)

Parameters:

Function used to call the appropriate layer to


execute instructions for the message

node
msg

- node for which message is to be delivered

- message for which instructions are to be executed

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NODE.html[10/28/2011 1:31:00 PM]

NODE

Returns:
void

- None

NODE_PrintLocation

void NODE_PrintLocation (Node*node, intcoordinateSystemType)

Parameters:

Prints the node's three dimensional


coordinates.

node

- the node

coordinateSystemType

- Cartesian or LatLonAlt

Returns:
void

- None

NODE_GetTerrainPtr

TerrainData* NODE_GetTerrainPtr (Node*node)

Parameters:

Get terrainData pointer.

node

- the node

Returns:
TerrainData*

- TerrainData pointer

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/NODE.html[10/28/2011 1:31:00 PM]

PARALLEL

QualNet 5.2 API Reference


PARALLEL
This file describes data structures and functions used for parallel programming.
Constant / Data Structure Summary
Type

Name

CONSTANT

MAX_THREADS

The maximum number of processes that can be used in parallel QualNet. Customers do not receive parallel.cpp, so cannot effectively
change this value.

ENUMERATION

SynchronizationAlgorithm

Possible algorithms to use in the parallel runtime. Synchronous is used by default.

STRUCT

LookaheadLocator

This struct is allows us to be able to remove from the LookaheadCalculator's heap. This way lookahead handles can request they be
removed. Internally, as the heap re-heapifies these locators are updated.

STRUCT

EotHeapElement

Basic data structure for simplifying lookahead calculation.

STRUCT

LookaheadCalculator

Stores a heap of EOT elements to calculate lookahead.

Function / Macro Summary


Return Type

Summary

LookaheadHandle

PARALLEL_AllocateLookaheadHandle(Node*node)

Obtains a new lookahead handle that allows a protocol to indicate minimum delay values for output. This minimum delay is called EOT
- earliest output time.
void

PARALLEL_AddLookaheadHandleToLookaheadCalculator(Node*node, LookaheadHandlelookaheadHandle,

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

clocktypeeotOfNode)

Adds a new LookaheadHandle to the lookahead calculator.


void

PARALLEL_SetLookaheadHandleEOT(Node*node, LookaheadHandlelookaheadHandle, clocktypeeot)

Protocols that use EOT will make use of this function more than any other to update the earliest output time as the simulation
progresses. Use of EOT is an all-or-nothing option. If your protocol uses EOT, it _must_ use EOT pervasively.
void

PARALLEL_RemoveLookaheadHandleFromLookaheadCalculator(Node*node, LookaheadHandlelookaheadHandle,
clocktype*eotOfNode)

Removes a LookaheadHandle from the lookahead calculator.


void

PARALLEL_SetMinimumLookaheadForInterface(Node*node, clocktypeminLookahead)

Sets a minimum delay for messages going out on this interface. This is typically set by the protocol running on that interface.
void

PARALLEL_InitLookaheadCalculator(LookaheadCalculatorlookaheadCalculator)

Initializes lookahead calculation. For kernel use only.


int

PARALLEL_AssignNodesToPartitions(intnumNodes, intnumberOfPartitions, NodeInput*nodeInput,


NodePosition*nodePos, AddressMapType*map)

Using their positions or other information, assigns each node to a partition. For kernel use only.
int

PARALLEL_GetPartitionForNode(NodeIdnodeId)

Allows parallel code to determine to what partition a node is assigned. If a Node* is available, it's much quicker to just look it up
directly
void

PARALLEL_InitializeParallelRuntime(intnumberOfThreads)

Sets global variables and stuff. For kernel use only.


void

PARALLEL_CreatePartitionThreads(intnumberOfThreads, NodeInput*nodeInput, PartitionData*partitionArray)

Creates the threads for parallel execution and starts them running. For kernel use only.
void

PARALLEL_GetRemoteMessages(PartitionData*partitionData)

Collects all the messages received from other partitions. For kernel use only.
void

PARALLEL_GetRemoteMessagesAndBarrier(PartitionData*partitionData)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

Collects all the messages received from other partitions. This function also acts as a barrier. For kernel use only.
PARALLEL_SendRemoteMessages(Message*msgList, PartitionData*partitionData, intpartitionId)

Sends one or more messages to a remote partition. For kernel use only.
PARALLEL_DeliverRemoteMessages(PartitionData*partitionData)

Delivers cached messages to all remote partitions. For kernel use only.
void

PARALLEL_SendRemoteMessagesOob(Message*msgList, PartitionData*partitionData, intpartitionId, boolisResponse)

Sends one or more messages to a remote partition. These messages are oob messages and will be processed immediately. For kernel use
only.
void

PARALLEL_SendMessageToAllPartitions(Message*msg, PartitionData*partitionData, boolfreeMsg)

Sends a message to all remote partitions, but not the current one. By default, duplicates will be sent to all remote partitions and the
original freed, but if freeMsg is false, the original message will not be freed.
PARALLEL_SendRemoteLinkMessage(Node*node, Message*msg, LinkData*link, clocktypetxDelay)

Sends one LINK message to a remote partition.


void

PARALLEL_UpdateSafeTime(PartitionData*partitionData)

A generic function for calculating the window of safe events For kernel use only.
clocktype

PARALLEL_ReturnEarliestGlobalEventTime(PartitionData*partitionData)

Returns the earliest global event time. Required for interfacing to time-sensitive external programs. For kernel use only.
void

PARALLEL_Exit(PartitionData*partitionData)

Exits from the parallel system, killing threads, etc. For kernel use only.
void

PARALLEL_SetProtocolIsNotEOTCapable(Node*node)

Currently, EOT can only be used if supported by all protocols running in the scenario. If any protocol is not capable, only the minimum
lookahead is used.
void

PARALLEL_EnableDynamicMobility()

Forces the runtime to consider mobility events when calculating EOT/ECOT. Mobility events are ignored by default. This function
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

should be called during the initialization of models where changes in position or direction of one node may affect the behavior of other
nodes.
void

PARALLEL_SetGreedy(boolgreedy)

Tells the kernel to use spin locks on barriers if true, or to use blocking barriers otherwise. In greedy mode, the Simulator needs a
dedicated CPU per partition.
bool

PARALLEL_IsGreedy()

Checks whether SetGreedy has been called.


void

PARALLEL_PreFlight(PartitionData*partitionData)

Initializes parallel operation.


void

PARALLEL_ScheduleMessagesOnPartition(PartitionData*partitionData, Message*msgList, Message**oobMessage,


bool*gotOobMessage, boolisMT)

Takes a list of messages or an OOB message and schedules them for execution on the current partition. Typically these messages have
arrived from a remote partition.
void

PARALLEL_EndSimulation(PartitionData*partitionData)

Shuts down the parallel engine, including whatever synchronization is required.


void

PARALLEL_BuildStatFile(intnumPartitions, char*statFileName, char*experimentPrefix)

Builds the final stat file when running in parallel node. Should only be called once from partition 0.
void

PARALLEL_NumberOfSynchronizations()

Return the number of synchronizations performed per partition


void

PARALLEL_StartRealTimeThread(PartitionData*partitionData)

Tells the kernel to use an independent thread to constantly update realtime.

Constant / Data Structure Detail

Constant

MAX_THREADS512

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

Enumeration

The maximum number of processes that can be used in parallel QualNet. Customers do not receive parallel.cpp, so cannot effectively
change this value.
SynchronizationAlgorithm

Structure

Possible algorithms to use in the parallel runtime. Synchronous is used by default.


LookaheadLocator

Structure

This struct is allows us to be able to remove from the LookaheadCalculator's heap. This way lookahead handles can request they be
removed. Internally, as the heap re-heapifies these locators are updated.
EotHeapElement

Structure

Basic data structure for simplifying lookahead calculation.


LookaheadCalculator

Stores a heap of EOT elements to calculate lookahead.

Function / Macro Detail


Function / Macro
PARALLEL_AllocateLookaheadHandle

Format
LookaheadHandle PARALLEL_AllocateLookaheadHandle (Node*node)

Parameters:

Obtains a new lookahead handle that allows a protocol to indicate


minimum delay values for output. This minimum delay is called EOT earliest output time.

node

- the active node

Returns:
LookaheadHandle

PARALLEL_AddLookaheadHandleToLookaheadCalculator

- Returns a reference to the node's lookahead data.

void PARALLEL_AddLookaheadHandleToLookaheadCalculator (Node*node,


LookaheadHandlelookaheadHandle, clocktypeeotOfNode)

Parameters:
Adds a new LookaheadHandle to the lookahead calculator.
node

- the active node

lookaheadHandle
eotOfNode

- the node's lookahead handle

- the node's EOT

Returns:
void
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

- None
PARALLEL_SetLookaheadHandleEOT

void PARALLEL_SetLookaheadHandleEOT (Node*node, LookaheadHandlelookaheadHandle,


clocktypeeot)

Parameters:
Protocols that use EOT will make use of this function more than any
other to update the earliest output time as the simulation progresses.
Use of EOT is an all-or-nothing option. If your protocol uses EOT, it
_must_ use EOT pervasively.

node

- the active node

lookaheadHandle
eot

- the node's lookahead handle

- the node's current EOT

Returns:
void

PARALLEL_RemoveLookaheadHandleFromLookaheadCalculator

- None

void PARALLEL_RemoveLookaheadHandleFromLookaheadCalculator (Node*node,


LookaheadHandlelookaheadHandle, clocktype*eotOfNode)

Parameters:
Removes a LookaheadHandle from the lookahead calculator.
node

- the active node

lookaheadHandle
eotOfNode

- the node's lookahead handle

- the node's current EOT

Returns:
void

- None

PARALLEL_SetMinimumLookaheadForInterface

void PARALLEL_SetMinimumLookaheadForInterface (Node*node, clocktypeminLookahead)

Parameters:

Sets a minimum delay for messages going out on this interface. This is
typically set by the protocol running on that interface.

node

- the active node

minLookahead

- the protocol's minimum lookahead

Returns:
void

- None

PARALLEL_InitLookaheadCalculator

void PARALLEL_InitLookaheadCalculator (LookaheadCalculatorlookaheadCalculator)

Parameters:

Initializes lookahead calculation. For kernel use only.

lookaheadCalculator

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

- the lookahead calculator

PARALLEL

PARALLEL_AssignNodesToPartitions

int PARALLEL_AssignNodesToPartitions (intnumNodes, intnumberOfPartitions,


NodeInput*nodeInput, NodePosition*nodePos, AddressMapType*map)

Parameters:
Using their positions or other information, assigns each node to a
partition. For kernel use only.

numNodes

- the number of nodes

numberOfPartitions
nodeInput
nodePos
map

- the number of partitions

- the input configuration file

- the node positions

- node ID <--> IP address mappings

Returns:
int

- the number of partitions used

PARALLEL_GetPartitionForNode

int PARALLEL_GetPartitionForNode (NodeIdnodeId)

Parameters:

Allows parallel code to determine to what partition a node is assigned.


If a Node* is available, it's much quicker to just look it up directly

nodeId

- the node's ID

Returns:
int

- the partition to which the node is assigned

PARALLEL_InitializeParallelRuntime

void PARALLEL_InitializeParallelRuntime (intnumberOfThreads)

Parameters:

Sets global variables and stuff. For kernel use only.

numberOfThreads

- the number of processors to use.

Returns:
void

PARALLEL_CreatePartitionThreads

- None

void PARALLEL_CreatePartitionThreads (intnumberOfThreads, NodeInput*nodeInput,


PartitionData*partitionArray)

Parameters:
Creates the threads for parallel execution and starts them running. For
kernel use only.

numberOfThreads
nodeInput

- the number of threads to create.

- the input configuration

partitionArray

- an array containing the partition data

Returns:
void

PARALLEL_GetRemoteMessages

- None

void PARALLEL_GetRemoteMessages (PartitionData*partitionData)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

Collects all the messages received from other partitions. For kernel use
only.

Parameters:
partitionData

- a pointer to the partition

Returns:
void

- None

PARALLEL_GetRemoteMessagesAndBarrier

void PARALLEL_GetRemoteMessagesAndBarrier (PartitionData*partitionData)

Parameters:

Collects all the messages received from other partitions. This function
also acts as a barrier. For kernel use only.

partitionData

- a pointer to the partition

Returns:
void

- None

PARALLEL_SendRemoteMessages

PARALLEL_SendRemoteMessages (Message*msgList, PartitionData*partitionData, intpartitionId)

Parameters:

Sends one or more messages to a remote partition. For kernel use only.

msgList

- a linked list of Messages

partitionData
partitionId

- a pointer to the partition

- the partition's ID

Returns:
- None
PARALLEL_DeliverRemoteMessages

PARALLEL_DeliverRemoteMessages (PartitionData*partitionData)

Parameters:

Delivers cached messages to all remote partitions. For kernel use only.

partitionData

- a pointer to the partition

Returns:
- None
PARALLEL_SendRemoteMessagesOob

void PARALLEL_SendRemoteMessagesOob (Message*msgList, PartitionData*partitionData,


intpartitionId, boolisResponse)

Parameters:
Sends one or more messages to a remote partition. These messages are
oob messages and will be processed immediately. For kernel use only.

msgList

- a linked list of Messages

partitionData
partitionId
isResponse

- a pointer to the partition

- the partition's ID

- if it's a response to an OOB message

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

Returns:
void

PARALLEL_SendMessageToAllPartitions

- None

void PARALLEL_SendMessageToAllPartitions (Message*msg, PartitionData*partitionData,


boolfreeMsg)

Parameters:
Sends a message to all remote partitions, but not the current one. By
default, duplicates will be sent to all remote partitions and the original
freed, but if freeMsg is false, the original message will not be freed.

msg

- the message(s) to send

partitionData
freeMsg

- the sending partition

- whether or not to free the original

Returns:
void

PARALLEL_SendRemoteLinkMessage

- None

PARALLEL_SendRemoteLinkMessage (Node*node, Message*msg, LinkData*link,


clocktypetxDelay)

Parameters:
Sends one LINK message to a remote partition.
node
msg

- the sending node

- the message to be sent

link

- info about the link

txDelay

- the transmission delay, not including propagation

Returns:
- None
PARALLEL_UpdateSafeTime

void PARALLEL_UpdateSafeTime (PartitionData*partitionData)

Parameters:

A generic function for calculating the window of safe events For kernel
use only.

partitionData

- a pointer to the partition

Returns:
void

- None

PARALLEL_ReturnEarliestGlobalEventTime

clocktype PARALLEL_ReturnEarliestGlobalEventTime (PartitionData*partitionData)

Parameters:

Returns the earliest global event time. Required for interfacing to timesensitive external programs. For kernel use only.

partitionData

- a pointer to the partition

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

clocktype

- the time of the earliest event across all partitions

PARALLEL_Exit

void PARALLEL_Exit (PartitionData*partitionData)

Parameters:

Exits from the parallel system, killing threads, etc. For kernel use only.

partitionData

- a pointer to the partition

Returns:
void

- None

PARALLEL_SetProtocolIsNotEOTCapable

void PARALLEL_SetProtocolIsNotEOTCapable (Node*node)

Parameters:

Currently, EOT can only be used if supported by all protocols running


in the scenario. If any protocol is not capable, only the minimum
lookahead is used.

node

- the node's data

Returns:
void

- None

PARALLEL_EnableDynamicMobility

void PARALLEL_EnableDynamicMobility ()

Parameters:

Forces the runtime to consider mobility events when calculating


EOT/ECOT. Mobility events are ignored by default. This function
should be called during the initialization of models where changes in
position or direction of one node may affect the behavior of other
nodes.
PARALLEL_SetGreedy

Returns:

Parameters:

Tells the kernel to use spin locks on barriers if true, or to use blocking
barriers otherwise. In greedy mode, the Simulator needs a dedicated
CPU per partition.

void

- None

void PARALLEL_SetGreedy (boolgreedy)

greedy

- should it be greedy or not?

Returns:
void

- None

PARALLEL_IsGreedy

bool PARALLEL_IsGreedy ()

Parameters:

Checks whether SetGreedy has been called.

Returns:
bool

- true if greedy mode is enabled.

PARALLEL_PreFlight

void PARALLEL_PreFlight (PartitionData*partitionData)

Parameters:

Initializes parallel operation.

partitionData

- the partition to initialize.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

Returns:
void

PARALLEL_ScheduleMessagesOnPartition

- None

void PARALLEL_ScheduleMessagesOnPartition (PartitionData*partitionData, Message*msgList,


Message**oobMessage, bool*gotOobMessage, boolisMT)

Parameters:
Takes a list of messages or an OOB message and schedules them for
execution on the current partition. Typically these messages have
arrived from a remote partition.

partitionData
msgList

- a list of normal simulation messages.

oobMessage

- an out of bounds message.

gotOobMessage
isMT

- the partition.

- returns true if Oob response is received

- is this called from a worker thread

Returns:
void

- None

PARALLEL_EndSimulation

void PARALLEL_EndSimulation (PartitionData*partitionData)

Parameters:

Shuts down the parallel engine, including whatever synchronization is


required.

partitionData

- the partition to terminate.

Returns:
void

- None

PARALLEL_BuildStatFile

void PARALLEL_BuildStatFile (intnumPartitions, char*statFileName, char*experimentPrefix)

Parameters:

Builds the final stat file when running in parallel node. Should only be
called once from partition 0.

numPartitions
statFileName

- number of partitions

- name of stat file

experimentPrefix

- experiment prefix

Returns:
void

- None

PARALLEL_NumberOfSynchronizations

void PARALLEL_NumberOfSynchronizations ()

Parameters:

Return the number of synchronizations performed per partition

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARALLEL

PARALLEL_StartRealTimeThread

void PARALLEL_StartRealTimeThread (PartitionData*partitionData)

Parameters:

Tells the kernel to use an independent thread to constantly update


realtime.

partitionData

- a pointer to the partition

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARALLEL.html[10/28/2011 1:31:14 PM]

PARTITION

QualNet 5.2 API Reference


PARTITION
This file contains declarations of some functions for partition threads.
Constant / Data Structure Summary
Type

Name

CONSTANT

NUM_SIM_TIME_STATUS_PRINTS

The number of percentage complete statements to print

CONSTANT

COMMUNICATION_ID_INVALID

A default unitialized communication ID.

CONSTANT

COMMUNICATION_DELAY_REAL_TIME

A value to indicate real time interpartition communication

STRUCT

SubnetMemberData

Data structure containing interfaceIndex and Node* for a node in a single subnet

STRUCT

PartitionSubnetMemberList

Data structure containing member data info for all nodes in a single subnet

STRUCT

PartitionSubnetData

Data structure containing subnet member data for all subnets

STRUCT

PartitionData

Contains global information for this partition.

STRUCT

SimulationProperties

Global properties of the simulation for all partitions.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

Function / Macro Summary


Return Type

Summary

void

PARTITION_GetTerrainPtr(PartitionData*partitionData)

Inline function used to get terrainData pointer.


void

PARTITION_CreateEmptyPartition(intpartitionId, intnumPartitions)

Function used to allocate and perform inititlaization of of an empty partition data structure.
void

PARTITION_InitializePartition(PartitionData*partitionData, TerrainData*terrainData, clocktypemaxSimClock,


doublestartRealTime, intnumNodes, BOOLtraceEnabled, AddressMapType*addressMapPtr,
NodePositions*nodePositions, NodeInput*nodeInput, intseedVal, int*nodePlacementTypeCounts,
char*experimentPrefix, clocktypestartSimClock)

Function used to initialize a partition.


void

PARTITION_InitializeNodes(PartitionData*partitionData)

Function used to allocate and initialize the nodes on a partition.


void

PARTITION_Finalize(PartitionData*partitionData)

Finalizes the nodes on the partition.


void

PARTITION_ProcessPartition(PartitionData*partitionData)

Creates and initializes the nodes, then processes events on this partition.
void

PARTITION_ProcessSendMT(PartitionData*partitionData)

Messages sent by worker threads outside of the main simulation event loop MUST call MESSAGE_SendMT (). This funciton then is
the other half - where the multi-thread messages are properly added to the event list.
BOOL

PARTITION_ReturnNodePointer(PartitionData*partitionData, Node**node, NodeIdnodeId, BOOLremoteOK)

Returns a pointer to the node or NULL if the node is not on this partition. If remoteOK is TRUE, returns a pointer to this partition's
proxy for a remote node if the node does not belong to this partition. This feature should be used with great care, as the proxy is
incomplete. Returns TRUE if the node is local.
void

PARTITION_NodeExists(PartitionData*partitionData, NodeIdnodeId)

Determines whether the node ID exists in the scenario. Must follow node creation.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

void

PARTITION_PrintRunTimeStats(PartitionData*partitionData)

If dynamic statistics reporting is enabled, generates statistics for enabled layers.


void

PARTITION_SchedulePartitionEvent(PartitionData*partitionData, Message*msg, clocktypeeventTime)

Schedules a generic partition-level event.


void

PARTITION_HandlePartitionEvent(PartitionData*partitionData, Message*msg)

An empty function for protocols to use that need to schedule and handle partition-level events.
void

PARTITION_ClientStateSet(PartitionData*partitionData, const char*stateName, void*clientState)

Sets or replaces a pointer to client-state, identifed by name, in the indicated partition. Allows client code, like external iterfaces, to store
their own data in the partition. The client's state pointer is set and found by name. If the caller passes a name for client state that is
already being stored, the state pointer replaces what was already there.
void*

PARTITION_ClientStateFind(PartitionData*partitionData, const char*stateName)

Looks up the requested client-state by name. Returns NULL if the state isn't present.
CommunicatorId

PARTITION_COMMUNICATION_RegisterCommunicator(PartitionData*partitionData, const char*name,


PartitionCommunicationHandlerhandler)

Allocates a message id and registers the handler that will be invoked to receive callbacks when messages are with the id are sent.
CommunicatorId

PARTITION_COMMUNICATION_FindCommunicator(PartitionData*partitionData, stdname)

Locate an already registered commincator.


void

PARTITION_COMMUNICATION_SendToPartition(PartitionData*partitionData, intpartitionId, Message*msg,


clocktypedelay)

Transmit a message to a partition.


void

PARTITION_COMMUNICATION_SendToAllPartitions(PartitionData*partitionData, Message*msg, clocktypedelay)

Transmit a message to all partitions.


std

IO_Return_Qualnet_Directory()

This will return in a string the current directory qualnet is executing from
boolean true/false if file exists

IO_SourceFileExists()

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

This will return a boolean true if file exists, and false if not
std

IO_CheckSourceLibrary()

This will return in a string the formatted yes/no line for whether the fingerprint file exists for given library
std

IO_ReturnSourceAndCompiledLibraries()

This will return in a string a list of libraries currently compiled into product as well as those which have source code available.
std

IO_ReturnExpirationDateFromLicenseFeature()

This will return in a string a list of libraries currently compiled into product as well as those which have source code available.
std

IO_ReturnExpirationDateFromNumericalDate()

This will return in a string the expiration date of the library


std

IO_ReturnExpirationDateFromNumericalDate()

This will return in a string the expiration date of the library


UInt64 containing the date

IO_ParseFlexLMDate()

Parse a FlexLM date in a platform safe way


std

IO_ReturnStatusMessageFromLibraryInfo()

This will return in a string the status message for the library used with the -print_libraries option
std

IO_ReturnStatusMessageFromLibraryInfo()

This will return in a string the library name from its index :: because flexlm won't allow std strucsts in main.cpp :: but main.cpp is the
only place flex structs are allowed
PARTITION_ShowProgress()

Print standard QualNet progress log

Constant / Data Structure Detail

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

Constant

NUM_SIM_TIME_STATUS_PRINTS100

Constant

The number of percentage complete statements to print


COMMUNICATION_ID_INVALID0

Constant

A default unitialized communication ID.


COMMUNICATION_DELAY_REAL_TIME-1

Structure

A value to indicate real time interpartition communication


SubnetMemberData

Structure

Data structure containing interfaceIndex and Node* for a node in a single subnet
PartitionSubnetMemberList

Structure

Data structure containing member data info for all nodes in a single subnet
PartitionSubnetData

Structure

Data structure containing subnet member data for all subnets


PartitionData

Structure

Contains global information for this partition.


SimulationProperties

Global properties of the simulation for all partitions.

Function / Macro Detail


Function / Macro
PARTITION_GetTerrainPtr

Format
void PARTITION_GetTerrainPtr (PartitionData*partitionData)

Parameters:

Inline function used to get terrainData pointer.

partitionData

- pointer to partitionData

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

Returns:
void

- None

PARTITION_CreateEmptyPartition

void PARTITION_CreateEmptyPartition (intpartitionId, intnumPartitions)

Parameters:

Function used to allocate and perform inititlaization of of an


empty partition data structure.

partitionId

- the partition ID, used for parallel

numPartitions

- for parallel

Returns:
void

PARTITION_InitializePartition

Function used to initialize a partition.

- None

void PARTITION_InitializePartition (PartitionData*partitionData, TerrainData*terrainData,


clocktypemaxSimClock, doublestartRealTime, intnumNodes, BOOLtraceEnabled,
AddressMapType*addressMapPtr, NodePositions*nodePositions, NodeInput*nodeInput, intseedVal,
int*nodePlacementTypeCounts, char*experimentPrefix, clocktypestartSimClock)
Parameters:
partitionData

- an empty partition data structure

terrainData

- dimensions, terrain database, etc.

maxSimClock

- length of the scenario

startRealTime
numNodes

- for synchronizing with the realtime

- number of nodes in the simulation

traceEnabled

- is packet tracing enabled?

addressMapPtr

- contains Node ID <--> IP address mappings

nodePositions

- initial node locations and partition assignments

nodeInput
seedVal

- contains all the input parameters

- the global random seed

nodePlacementTypeCounts
experimentPrefix
startSimClock

- gives information about node placemt

- the experiment name

- the simulation starting time

Returns:
void

PARTITION_InitializeNodes

- None

void PARTITION_InitializeNodes (PartitionData*partitionData)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

Function used to allocate and initialize the nodes on a partition.

Parameters:
partitionData

- an pre-initialized partition data structure

Returns:
void

- None

PARTITION_Finalize

void PARTITION_Finalize (PartitionData*partitionData)

Parameters:

Finalizes the nodes on the partition.

partitionData

- an pre-initialized partition data structure

Returns:
void

- None

PARTITION_ProcessPartition

void PARTITION_ProcessPartition (PartitionData*partitionData)

Parameters:

Creates and initializes the nodes, then processes events on this


partition.

partitionData

- an pre-initialized partition data structure

Returns:
void

- None

PARTITION_ProcessSendMT

void PARTITION_ProcessSendMT (PartitionData*partitionData)

Parameters:

Messages sent by worker threads outside of the main simulation


event loop MUST call MESSAGE_SendMT (). This funciton
then is the other half - where the multi-thread messages are
properly added to the event list.

partitionData

Returns:
void

PARTITION_ReturnNodePointer

- an pre-initialized partition data structure

- None

BOOL PARTITION_ReturnNodePointer (PartitionData*partitionData, Node**node, NodeIdnodeId,


BOOLremoteOK)

Parameters:
Returns a pointer to the node or NULL if the node is not on this
partition. If remoteOK is TRUE, returns a pointer to this
partition's proxy for a remote node if the node does not belong
to this partition. This feature should be used with great care, as
the proxy is incomplete. Returns TRUE if the node is local.

partitionData
node

- an pre-initialized partition data structure

- for returning the node pointer

nodeId

- the node's ID

remoteOK

- is it ok to return a pointer to proxy node?

Returns:
BOOL

- returns TRUE if the node is local to this partition

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

PARTITION_NodeExists

void PARTITION_NodeExists (PartitionData*partitionData, NodeIdnodeId)

Parameters:

Determines whether the node ID exists in the scenario. Must


follow node creation.

partitionData
nodeId

- an pre-initialized partition data structure

- the node's ID

Returns:
void

- None

PARTITION_PrintRunTimeStats

void PARTITION_PrintRunTimeStats (PartitionData*partitionData)

Parameters:

If dynamic statistics reporting is enabled, generates statistics for


enabled layers.

partitionData

- an pre-initialized partition data structure

Returns:
void

PARTITION_SchedulePartitionEvent

- None

void PARTITION_SchedulePartitionEvent (PartitionData*partitionData, Message*msg,


clocktypeeventTime)

Parameters:
Schedules a generic partition-level event.
partitionData
msg

- an pre-initialized partition data structure

- an event

eventTime

- the time the event should occur

Returns:
void

- None

PARTITION_HandlePartitionEvent

void PARTITION_HandlePartitionEvent (PartitionData*partitionData, Message*msg)

Parameters:

An empty function for protocols to use that need to schedule


and handle partition-level events.

partitionData
msg

- an pre-initialized partition data structure

- an event

Returns:
void

- None

PARTITION_ClientStateSet

void PARTITION_ClientStateSet (PartitionData*partitionData, const char*stateName, void*clientState)

Parameters:

Sets or replaces a pointer to client-state, identifed by name, in


the indicated partition. Allows client code, like external

partitionData

- an pre-initialized partition data structure

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

iterfaces, to store their own data in the partition. The client's


state pointer is set and found by name. If the caller passes a
name for client state that is already being stored, the state
pointer replaces what was already there.

stateName

- Name used to locate this client state

clientState

- Pointer to whatever data-structure the

Returns:
- None

void

PARTITION_ClientStateFind

void* PARTITION_ClientStateFind (PartitionData*partitionData, const char*stateName)

Parameters:

Looks up the requested client-state by name. Returns NULL if


the state isn't present.

partitionData
stateName

- an pre-initialized partition data structure

- Name used to locate this client state

Returns:
void*

PARTITION_COMMUNICATION_RegisterCommunicator

- returns the client state

CommunicatorId PARTITION_COMMUNICATION_RegisterCommunicator (PartitionData*partitionData,


const char*name, PartitionCommunicationHandlerhandler)

Parameters:
Allocates a message id and registers the handler that will be
invoked to receive callbacks when messages are with the id are
sent.

partitionData
name

- an pre-initialized partition data structure

- Your name for this type of message.

handler

- Function

Returns:
CommunicatorId

PARTITION_COMMUNICATION_FindCommunicator

- used to later when calling MESSAGE_Alloc().

CommunicatorId PARTITION_COMMUNICATION_FindCommunicator (PartitionData*partitionData,


stdname)

Parameters:
Locate an already registered commincator.
partitionData
name

- an pre-initialized partition data structure

- string

Returns:
CommunicatorId

PARTITION_COMMUNICATION_SendToPartition

- found communicator Id or COMMUNICATION_ID_INVALID if not found.

void PARTITION_COMMUNICATION_SendToPartition (PartitionData*partitionData, intpartitionId,


Message*msg, clocktypedelay)

Parameters:
Transmit a message to a partition.
partitionData

- an pre-initialized partition data structure

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

partitionId
msg

- partition to send the message to

- Message to send. You are required to follow

delay

- When the message should execute. Special delay

Returns:
void

PARTITION_COMMUNICATION_SendToAllPartitions

- None

void PARTITION_COMMUNICATION_SendToAllPartitions (PartitionData*partitionData, Message*msg,


clocktypedelay)

Parameters:
Transmit a message to all partitions.
partitionData
msg

- an pre-initialized partition data structure

- Message to send. You are required to follow

delay

- When the message should execute. Special delay

Returns:
void

- None

IO_Return_Qualnet_Directory

std IO_Return_Qualnet_Directory ()

Parameters:

This will return in a string the current directory qualnet is


executing from

Returns:
std

- string containing current qualnet directory

IO_SourceFileExists

boolean true/false if file exists IO_SourceFileExists ()

Parameters:

This will return a boolean true if file exists, and false if not

Returns:
boolean true/false if file exists

IO_CheckSourceLibrary

std IO_CheckSourceLibrary ()

Parameters:

This will return in a string the formatted yes/no line for whether
the fingerprint file exists for given library

Returns:
std

- None

- string containing list of libraries

IO_ReturnSourceAndCompiledLibraries

std IO_ReturnSourceAndCompiledLibraries ()

Parameters:

This will return in a string a list of libraries currently compiled

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

into product as well as those which have source code available.


std

- string containing list of libraries

IO_ReturnExpirationDateFromLicenseFeature

std IO_ReturnExpirationDateFromLicenseFeature ()

Parameters:

This will return in a string a list of libraries currently compiled


into product as well as those which have source code available.

Returns:
std

- string containing expiration date for this feature

IO_ReturnExpirationDateFromNumericalDate

std IO_ReturnExpirationDateFromNumericalDate ()

Parameters:

This will return in a string the expiration date of the library

Returns:
std

- string containing expiration date for this feature

IO_ReturnExpirationDateFromNumericalDate

std IO_ReturnExpirationDateFromNumericalDate ()

Parameters:

This will return in a string the expiration date of the library

Returns:
std

- string containing expiration date for this feature

IO_ParseFlexLMDate

UInt64 containing the date IO_ParseFlexLMDate ()

Parameters:

Parse a FlexLM date in a platform safe way

Returns:
UInt64 containing the date

- None

IO_ReturnStatusMessageFromLibraryInfo

std IO_ReturnStatusMessageFromLibraryInfo ()

Parameters:

This will return in a string the status message for the library
used with the -print_libraries option

Returns:
std

- string containing status message for libary

IO_ReturnStatusMessageFromLibraryInfo

std IO_ReturnStatusMessageFromLibraryInfo ()

Parameters:

This will return in a string the library name from its index ::
because flexlm won't allow std strucsts in main.cpp :: but
main.cpp is the only place flex structs are allowed

Returns:

PARTITION_ShowProgress

PARTITION_ShowProgress ()

Parameters:

std

- string containing library name

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PARTITION

Print standard QualNet progress log

Returns:
-

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PARTITION.html[10/28/2011 1:31:28 PM]

PHYSICAL LAYER

QualNet 5.2 API Reference


PHYSICAL LAYER
This file describes data structures and functions used by the Physical Layer. Most of this functionality is enabled/used in the Wireless library.
Constant / Data Structure Summary
Type

Name

CONSTANT

PHY_DEFAULT_NOISE_FACTORPHY_DEFAULT_NOISE_FACTOR

Default noise factor in physical medium

CONSTANT

PHY_DEFAULT_TEMPERATUREPHY_DEFAULT_TEMPERATURE

Default temperature of physical medium.

CONSTANT

PHY_DEFAULT_MIN_PCOM_VALUE

Default minimum pcom value threshold

CONSTANT

PHY_DEFAULT_SYNC_COLLISION_WINDOW

Default minimum pcom value threshold

ENUMERATION

PhyModel

Different phy types supported.

ENUMERATION

PhyRxModel

Different types of packet reception model

STRUCT

PhyBerEntry

SNR/BER curve entry

STRUCT

PhyBerTable

Bit Error Rate table.

STRUCT

PhyPerEntry

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

SNR/PER curve entry

STRUCT

PhyPerTable

Packet Error Rate table.

STRUCT

PhySerEntry

SNR/PER curve entry

STRUCT

PhySerTable

Symbol Error Rate table.

STRUCT

PhySignalMeasurement

Measurement of the signal of received pkt

STRUCT

AntennaModel

Structure for classifying different types of antennas.

STRUCT

AntennaOmnidirectional

Structure for an omnidirectional antenna.

STRUCT

PhyPcomItem

Used by Phy layer to store PCOM values

STRUCT

PhyData

Structure for phy layer

STRUCT

PacketPhyStatus

Used by Phy layer to report channel status to mac layer

Function / Macro Summary


Return Type

Summary

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

void

PHY_GlobalBerInit(const NodeInput*nodeInput)

Pre-load all the BER files.


void

PHY_GetSnrBerTableByName(char*tableName)

Get a pointer to a specific BER table.


int

PHY_GetSnrBerTableIndex(Node*node, intphyIndex)

Get a index of BER table used by PHY.


int

PHY_SetSnrBerTableIndex(Node*node, intphyIndex)

Set index of BER table to be used by PHY.


void

PHY_GlobalPerInit(const NodeInput*nodeInput)

Pre-load all the PER files.


void

PHY_GetSnrPerTableByName(char*tableName)

Get a pointer to a specific PER table.


void

PHY_GlobalSerInit(const NodeInput*nodeInput)

Pre-load all the SER files.


void

PHY_GetSnrSerTableByName(char*tableName)

Get a pointer to a specific SER table.


void

PHY_Init(Node*node, const NodeInput*nodeInput)

Initialize physical layer


void

PHY_CreateAPhyForMac(Node*node, const NodeInput*nodeInput, intinterfaceIndex, intnetworkAddress,


PhyModelphyModel, int*phyNumber)

Initialization function for the phy layer


void

PHY_Finalize(Node *node)

Called at the end of simulation to collect the results of the simulation of the Phy Layer.
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

void

PHY_ProcessEvent(Node*node, Message*msg)

Models the behaviour of the Phy Layer on receiving the message encapsulated in msgHdr
PhyStatusType

PHY_GetStatus(Node *node, intphyNum)

Retrieves the Phy's current status


void

PHY_SetTransmitPower(Node *node, intphyIndex, doublenewTxPower_mW)

Sets the Radio's transmit power in mW


void

PHY_SetRxSNRThreshold(Node *node, intphyIndex, doublesnr)

Sets the Radio's Rx SNR Threshold


void

PHY_SetDataRate(Node *node, intphyIndex, intdataRate)

Sets the Radio's Data Rate for both Tx and Rx


void

PHY_SetTxDataRate(Node *node, intphyIndex, intdataRate)

For radios that support different Tx and Rx data rates, this will set the Rx Data Rate. For others, it will call PHY_SetDataRate.
void

PHY_SetRxDataRate(Node *node, intphyIndex, intdataRate)

For radios that support different Tx and Rx data rates, this will set the Rx Data Rate. For others, it will call PHY_SetDataRate.
void

PHY_GetTransmitPower(Node *node, intphyIndex, double*txPower_mW)

Gets the Radio's transmit power in mW.


clocktype

PHY_GetTransmissionDelay(Node *node, intphyIndex, intsize)

Get transmission delay based on the first (usually lowest) data rate WARNING: This function call is to be replaced with
PHY_GetTransmissionDuration() with an appropriate data rate
clocktype

PHY_GetTransmissionDuration(Node *node, intphyIndex, intdataRateIndex, intsize)

Get transmission duration of a structured signal fragment.


PhyModel

PHY_GetFrameModel(Node *node, intphyNum)

Get Physical Model


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

PhyModel

PHY_GetAntennaModelType(Node *node, intphyNum)

Get Antenna Model type


void

PHY_StartTransmittingSignal(Node *node, intphyNum, Message*msg, BOOLuseMacLayerSpecifiedDelay,


clocktypedelayUntilAirborne)

Starts transmitting a packet.


void

PHY_StartTransmittingSignal(Node *node, intphyNum, Message*msg, clocktypeduration,


BOOLuseMacLayerSpecifiedDelay, clocktypedelayUntilAirborne)

Starts transmitting a packet. Function is being overloaded


void

PHY_StartTransmittingSignal(Node *node, intphyNum, Message*msg, intbitSize, BOOLuseMacLayerSpecifiedDelay,


clocktypedelayUntilAirborne)

Starts transmitting a packet.


void

PHY_SignalArrivalFromChannel(Node *node, intphyIndex, intchannelIndex, PropRxInfo*propRxInfo)

Called when a new signal arrives


void

PHY_SignalEndFromChannel(Node *node, intphyIndex, intchannelIndex, PropRxInfo*propRxInfo)

Called when the current signal ends


int

PHY_GetTxDataRate(Node *node, intphyIndex)

Get transmission data rate


int

PHY_GetRxDataRate(Node *node, intphyIndex)

Get reception data rate


int

PHY_GetTxDataRateType(Node *node, intphyIndex)

Get transmission data rate type


int

PHY_GetRxDataRateType(Node *node, intphyIndex)

Get reception data rate type


void

PHY_SetTxDataRateType(Node *node, intphyIndex, intdataRateType)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Set transmission data rate type


void

PHY_GetLowestTxDataRateType(Node*node, intphyIndex, int*dataRateType)

Get the lowest transmission data rate type


void

PHY_SetLowestTxDataRateType(Node*node, intphyIndex)

Set the lowest transmission data rate type


void

PHY_GetHighestTxDataRateType(Node*node, intphyIndex, int*dataRateType)

Get the highest transmission data rate type


void

PHY_SetHighestTxDataRateType(Node*node, intphyIndex)

Set the highest transmission data rate type


void

PHY_GetHighestTxDataRateTypeForBC(Node*node, intphyIndex, int*dataRateType)

Get the highest transmission data rate type for broadcast


void

PHY_SetHighestTxDataRateTypeForBC(Node*node, intphyIndex)

Set the highest transmission data rate type for broadcast


double

PHY_ComputeSINR(PhyData *phyData, double *signalPower_mW, double*interferencePower_mW, intbandwidth)

Compute SINR
void

PHY_SignalInterference(Node*node, intphyIndex, intchannelIndex, Message *msg, double *signalPower_mW,


double*interferencePower_mW)

Compute Power from the desired signal and interference


double

PHY_BER(PhyData *phyData, intberTableIndex, doublesinr)

Get BER
double

PHY_SER(PhyData *phyData, intperTableIndex, doublesinr)

Get SER
void

PHY_StopListeningToChannel(Node*node, intphyIndex, intchannelIndex)

BOOL

PHY_CanListenToChannel(Node*node, intphyIndex, intchannelIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Check if it can listen to the channel


BOOL

PHY_IsListeningToChannel(Node*node, intphyIndex, intchannelIndex)

Check if it is listening to the channel


void

PHY_SetTransmissionChannel(Node*node, intphyIndex, intchannelIndex)

Set the channel index used for transmission


void

PHY_GetTransmissionChannel(Node*node, intphyIndex, intchannelIndex)

Get the channel index used for transmission


BOOL

PHY_MediumIsIdle(Node*node, intphyNum)

Check if the medium is idle


BOOL

PHY_MediumIsIdleInDirection(Node*node, intphyNum, doubleazimuth)

Check if the medium is idle if sensed directionally


void

PHY_SetSensingDirection(Node*node, intphyNum, doubleazimuth)

Set the sensing direction


void

PHY_StartTransmittingSignalDirectionally(Node*node, intphyNum, Message*msg, BOOLuseMacLayerSpecifiedDelay,


clocktypedelayUntilAirborne, doubledirectionAzimuth)

Start transmitting a signal directionally


void

PHY_LockAntennaDirection(Node*node, intphyNum)

Lock the direction of antenna


void

PHY_UnlockAntennaDirection(Node*node, intphyNum)

Unlock the direction of antenna


double

PHY_GetLastSignalsAngleOfArrival(Node*node, intphyNum)

Get the AOA of the last signal


void

PHY_TerminateCurrentReceive(Node*node, intphyNum, const BOOLterminateOnlyOnReceiveError, BOOL*receiveError,


clocktype*endSignalTime)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Terminate the current signal reception


double

PHY_PropagationRange(Node*txnode, Node*node, inttxInterfaceIndex, intinterfaceIndex, intchannnelIndex,


BOOLprintAll)

Calculates an estimated radio range for the PHY. Supports only TWO-RAY and FREE-SPACE.
void

ENERGY_Init(Node*node, const intphyIndex, NodeInput*nodeInput)

This function declares energy model variables and initializes them. Moreover, the function read energy model specifications and
configures the parameters which are configurable.
void

ENERGY_PrintStats(Node*node, const intphyIndex)

To print the statistic of Energy Model.


void

Phy_ReportStatusToEnergyModel(Node*node, const intphyIndex, PhyStatusTypeprevStatus, PhyStatusTypenewStatus)

This function should be called whenever a state transition occurs in any place in PHY layer. As input parameters, the function reads the
current state and the new state of PHY layer and based on the new sates calculates the cost of the load that should be taken off the
battery. The function then interacts with battery model and updates the charge of battery.
void

Generic_UpdateCurrentLoad(Node*node, const intphyIndex)

To update the current load of generic energy model.


void

PHY_GetSteeringAngle(Node*node, intphyIndex)

Gets the current steering angle for a directional antenna from PHY models that support this.
void

PHY_CheckPacketPhyDrop(PartitionData*partition, PropChannel*propChannel, intnumNodes, intchannelIndex,


Message*msg)

This function is for Stats DB. It is to check whether need to record a drop event.

Constant / Data Structure Detail

Constant

PHY_DEFAULT_NOISE_FACTORPHY_DEFAULT_NOISE_FACTOR10.0

Default noise factor in physical medium

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Constant

PHY_DEFAULT_TEMPERATUREPHY_DEFAULT_TEMPERATURE290.0

Constant

Default temperature of physical medium.


PHY_DEFAULT_MIN_PCOM_VALUE0.0

Constant

Default minimum pcom value threshold


PHY_DEFAULT_SYNC_COLLISION_WINDOW1ms

Enumeration

Default minimum pcom value threshold


PhyModel

Enumeration

Different phy types supported.


PhyRxModel

Structure

Different types of packet reception model


PhyBerEntry

Structure

SNR/BER curve entry


PhyBerTable

Structure

Bit Error Rate table.


PhyPerEntry

Structure

SNR/PER curve entry


PhyPerTable

Structure

Packet Error Rate table.


PhySerEntry

Structure

SNR/PER curve entry


PhySerTable

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Structure

Symbol Error Rate table.


PhySignalMeasurement

Structure

Measurement of the signal of received pkt


AntennaModel

Structure

Structure for classifying different types of antennas.


AntennaOmnidirectional

Structure

Structure for an omnidirectional antenna.


PhyPcomItem

Structure

Used by Phy layer to store PCOM values


PhyData

Structure

Structure for phy layer


PacketPhyStatus

Used by Phy layer to report channel status to mac layer

Function / Macro Detail


Function / Macro
PHY_GlobalBerInit

Format
void PHY_GlobalBerInit (const NodeInput*nodeInput)

Parameters:

Pre-load all the BER files.

nodeInput

- structure containing contents of input file

Returns:
void

- None

PHY_GetSnrBerTableByName

void PHY_GetSnrBerTableByName (char*tableName)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Get a pointer to a specific BER table.

tableName

- name of the BER file

Returns:
void

- None

PHY_GetSnrBerTableIndex

int PHY_GetSnrBerTableIndex (Node*node, intphyIndex)

Parameters:

Get a index of BER table used by PHY.

node

- Node pointer

phyIndex

- interface Index

Returns:
int

- None

PHY_SetSnrBerTableIndex

int PHY_SetSnrBerTableIndex (Node*node, intphyIndex)

Parameters:

Set index of BER table to be used by PHY.

node

- Node pointer

phyIndex

- interface Index

Returns:
int

- None

PHY_GlobalPerInit

void PHY_GlobalPerInit (const NodeInput*nodeInput)

Parameters:

Pre-load all the PER files.

nodeInput

- structure containing contents of input file

Returns:
void

- None

PHY_GetSnrPerTableByName

void PHY_GetSnrPerTableByName (char*tableName)

Parameters:

Get a pointer to a specific PER table.

tableName

- name of the PER file

Returns:
void

- None

PHY_GlobalSerInit

void PHY_GlobalSerInit (const NodeInput*nodeInput)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Pre-load all the SER files.

nodeInput

- structure containing contents of input file

Returns:
void

- None

PHY_GetSnrSerTableByName

void PHY_GetSnrSerTableByName (char*tableName)

Parameters:

Get a pointer to a specific SER table.

tableName

- name of the SER file

Returns:
void

- None

PHY_Init

void PHY_Init (Node*node, const NodeInput*nodeInput)

Parameters:

Initialize physical layer

node

- node being initialized

nodeInput

- structure containing contents of input file

Returns:
void

PHY_CreateAPhyForMac

- None

void PHY_CreateAPhyForMac (Node*node, const NodeInput*nodeInput, intinterfaceIndex, intnetworkAddress,


PhyModelphyModel, int*phyNumber)

Parameters:
Initialization function for the phy layer
node

- node being initialized

nodeInput

- structure containing contents of input file

interfaceIndex

- interface being initialized.

networkAddress

- address of the interface.

phyModel

- Which phisical model is used.

phyNumber

- returned value to be used as phyIndex

Returns:
void

- None

PHY_Finalize

void PHY_Finalize (Node *node)

Parameters:

Called at the end of simulation to collect the


results of the simulation of the Phy Layer.

node

- node for which results are to be collected

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Returns:
void

- None

PHY_ProcessEvent

void PHY_ProcessEvent (Node*node, Message*msg)

Parameters:

Models the behaviour of the Phy Layer on


receiving the message encapsulated in
msgHdr

node
msg

- node which received the message

- message received by the layer

Returns:
void

- None

PHY_GetStatus

PhyStatusType PHY_GetStatus (Node *node, intphyNum)

Parameters:

Retrieves the Phy's current status

node

- node for which stats are to be collected

phyNum

- interface for which stats are to be collected

Returns:
PhyStatusType

- status of interface.

PHY_SetTransmitPower

void PHY_SetTransmitPower (Node *node, intphyIndex, doublenewTxPower_mW)

Parameters:

Sets the Radio's transmit power in mW

node

- node for which transmit power is to be set

phyIndex

- interface for which transmit power is to be set

newTxPower_mW

- transmit power(mW)

Returns:
void

- None

PHY_SetRxSNRThreshold

void PHY_SetRxSNRThreshold (Node *node, intphyIndex, doublesnr)

Parameters:

Sets the Radio's Rx SNR Threshold

node

- node for which transmit power is to be set

phyIndex
snr

- interface for which transmit power is to be set

- threshold value to be set

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

PHY_SetDataRate

void PHY_SetDataRate (Node *node, intphyIndex, intdataRate)

Parameters:

Sets the Radio's Data Rate for both Tx and


Rx

node

- node for which transmit power is to be set

phyIndex

- interface for which transmit power is to be set

dataRate

- dataRate value to be set

Returns:
void

- None

PHY_SetTxDataRate

void PHY_SetTxDataRate (Node *node, intphyIndex, intdataRate)

Parameters:

For radios that support different Tx and Rx


data rates, this will set the Rx Data Rate. For
others, it will call PHY_SetDataRate.

node

- node for which transmit power is to be set

phyIndex

- interface for which transmit power is to be set

dataRate

- dataRate value to be set

Returns:
void

- None

PHY_SetRxDataRate

void PHY_SetRxDataRate (Node *node, intphyIndex, intdataRate)

Parameters:

For radios that support different Tx and Rx


data rates, this will set the Rx Data Rate. For
others, it will call PHY_SetDataRate.

node

- node for which transmit power is to be set

phyIndex

- interface for which transmit power is to be set

dataRate

- dataRate value to be set

Returns:
void

- None

PHY_GetTransmitPower

void PHY_GetTransmitPower (Node *node, intphyIndex, double*txPower_mW)

Parameters:

Gets the Radio's transmit power in mW.

node

- Node that is

phyIndex

- interface index.

txPower_mW

- transmit power(mW)

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

void

- None

PHY_GetTransmissionDelay

clocktype PHY_GetTransmissionDelay (Node *node, intphyIndex, intsize)

Parameters:

Get transmission delay based on the first


(usually lowest) data rate WARNING: This
function call is to be replaced with
PHY_GetTransmissionDuration() with an
appropriate data rate

node

- node pointer to node

phyIndex
size

- interface index

- size of the frame in bytes

Returns:
clocktype

- transmission delay.

PHY_GetTransmissionDuration

clocktype PHY_GetTransmissionDuration (Node *node, intphyIndex, intdataRateIndex, intsize)

Parameters:

Get transmission duration of a structured


signal fragment.

node

- node pointer to node

phyIndex

- interface index.

dataRateIndex
size

- data rate.

- size of frame in bytes.

Returns:
clocktype

- transmission duration

PHY_GetFrameModel

PhyModel PHY_GetFrameModel (Node *node, intphyNum)

Parameters:

Get Physical Model

node

- node pointer to node

phyNum

- interface index

Returns:
PhyModel

- Physical Model

PHY_GetAntennaModelType

PhyModel PHY_GetAntennaModelType (Node *node, intphyNum)

Parameters:

Get Antenna Model type

node

- node pointer to node

phyNum

- interface index

Returns:
PhyModel

- Physical Model

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

PHY_StartTransmittingSignal

void PHY_StartTransmittingSignal (Node *node, intphyNum, Message*msg, BOOLuseMacLayerSpecifiedDelay,


clocktypedelayUntilAirborne)

Parameters:
Starts transmitting a packet.
node

- node pointer to node

phyNum
msg

- interface index

- packet to be sent

useMacLayerSpecifiedDelay
delayUntilAirborne

- use delay specified by MAC

- delay until airborne

Returns:
void

PHY_StartTransmittingSignal

- None

void PHY_StartTransmittingSignal (Node *node, intphyNum, Message*msg, clocktypeduration,


BOOLuseMacLayerSpecifiedDelay, clocktypedelayUntilAirborne)

Parameters:
Starts transmitting a packet. Function is being
overloaded

node

- node pointer to node

phyNum
msg

- interface index

- packet to be sent

duration

- specified transmission delay

useMacLayerSpecifiedDelay
delayUntilAirborne

- use delay specified by MAC

- delay until airborne

Returns:
void

PHY_StartTransmittingSignal

- None

void PHY_StartTransmittingSignal (Node *node, intphyNum, Message*msg, intbitSize,


BOOLuseMacLayerSpecifiedDelay, clocktypedelayUntilAirborne)

Parameters:
Starts transmitting a packet.
node

- node pointer to node

phyNum
msg

- interface index

- packet to be sent

bitSize

- specified size of the packet in bits

useMacLayerSpecifiedDelay

- use delay specified by MAC

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

delayUntilAirborne

- delay until airborne

Returns:
- None

void

PHY_SignalArrivalFromChannel

void PHY_SignalArrivalFromChannel (Node *node, intphyIndex, intchannelIndex, PropRxInfo*propRxInfo)

Parameters:

Called when a new signal arrives

- node pointer to node

node

phyIndex

- interface index

channelIndex
propRxInfo

- channel index

- information on the arrived signal

Returns:
- None

void

PHY_SignalEndFromChannel

void PHY_SignalEndFromChannel (Node *node, intphyIndex, intchannelIndex, PropRxInfo*propRxInfo)

Parameters:

Called when the current signal ends

- node pointer to node

node

phyIndex

- interface index

channelIndex
propRxInfo

- channel index

- information on the arrived signal

Returns:
- None

void

PHY_GetTxDataRate

int PHY_GetTxDataRate (Node *node, intphyIndex)

Parameters:

Get transmission data rate

- node pointer to node

node

phyIndex

- interface index

Returns:
int

- None

PHY_GetRxDataRate

int PHY_GetRxDataRate (Node *node, intphyIndex)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Get reception data rate

- node pointer to node

node

phyIndex

- interface index

Returns:
int

- None

PHY_GetTxDataRateType

int PHY_GetTxDataRateType (Node *node, intphyIndex)

Parameters:

Get transmission data rate type

- node pointer to node

node

phyIndex

- interface index

Returns:
int

- None

PHY_GetRxDataRateType

int PHY_GetRxDataRateType (Node *node, intphyIndex)

Parameters:

Get reception data rate type

- node pointer to node

node

phyIndex

- interface index

Returns:
int

- None

PHY_SetTxDataRateType

void PHY_SetTxDataRateType (Node *node, intphyIndex, intdataRateType)

Parameters:

Set transmission data rate type

node

- node pointer to node

phyIndex

- interface index

dataRateType

- rate of data

Returns:
void

- None

PHY_GetLowestTxDataRateType

void PHY_GetLowestTxDataRateType (Node*node, intphyIndex, int*dataRateType)

Parameters:

Get the lowest transmission data rate type

node

- node pointer to node

phyIndex

- interface index

dataRateType

- rate of data

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Returns:
void

- None

PHY_SetLowestTxDataRateType

void PHY_SetLowestTxDataRateType (Node*node, intphyIndex)

Parameters:

Set the lowest transmission data rate type

node

- node pointer to node

phyIndex

- interface index

Returns:
void

- None

PHY_GetHighestTxDataRateType

void PHY_GetHighestTxDataRateType (Node*node, intphyIndex, int*dataRateType)

Parameters:

Get the highest transmission data rate type

node

- node pointer to node

phyIndex

- interface index

dataRateType

- rate of data

Returns:
void

- None

PHY_SetHighestTxDataRateType

void PHY_SetHighestTxDataRateType (Node*node, intphyIndex)

Parameters:

Set the highest transmission data rate type

node

- node pointer to node

phyIndex

- interface index

Returns:
void

- None

PHY_GetHighestTxDataRateTypeForBC

void PHY_GetHighestTxDataRateTypeForBC (Node*node, intphyIndex, int*dataRateType)

Parameters:

Get the highest transmission data rate type for


broadcast

node

- node pointer to node

phyIndex

- interface index

dataRateType

- rate of data

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

void

- None

PHY_SetHighestTxDataRateTypeForBC

void PHY_SetHighestTxDataRateTypeForBC (Node*node, intphyIndex)

Parameters:

Set the highest transmission data rate type for


broadcast

node

- node pointer to node

phyIndex

- interface index

Returns:
void

- None

PHY_ComputeSINR

double PHY_ComputeSINR (PhyData *phyData, double *signalPower_mW, double*interferencePower_mW, intbandwidth)

Parameters:

Compute SINR

phyData

- PHY layer data

signalPower_mW

- Signal power

interferencePower_mW
bandwidth

- Interference power

- Bandwidth

Returns:
double

PHY_SignalInterference

- Signal to Interference and Noise Ratio

void PHY_SignalInterference (Node*node, intphyIndex, intchannelIndex, Message *msg, double *signalPower_mW,


double*interferencePower_mW)

Parameters:
Compute Power from the desired signal and
interference

node

- Node that is being

phyIndex

- interface number

channelIndex
msg

- channel index

- message including desired signal

signalPower_mW

- power from the desired signal

interferencePower_mW

- power from interfering signals

Returns:
void

- None

PHY_BER

double PHY_BER (PhyData *phyData, intberTableIndex, doublesinr)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Get BER

phyData

- PHY layer data

berTableIndex
sinr

- index for BER tables

- Signal to Interference and Noise Ratio

Returns:
double

- Bit Error Rate

PHY_SER

double PHY_SER (PhyData *phyData, intperTableIndex, doublesinr)

Parameters:

Get SER

phyData

- PHY layer data

perTableIndex
sinr

- index for SER tables

- Signal to Interference and Noise Ratio

Returns:
double

- Packet Error Rate

PHY_StopListeningToChannel

void PHY_StopListeningToChannel (Node*node, intphyIndex, intchannelIndex)

Parameters:
node

- Node that is being

phyIndex

- interface number

channelIndex

- channel index

Returns:
void

- None

PHY_CanListenToChannel

BOOL PHY_CanListenToChannel (Node*node, intphyIndex, intchannelIndex)

Parameters:

Check if it can listen to the channel

node

- Node that is being

phyIndex

- interface number

channelIndex

- channel index

Returns:
BOOL

- None

PHY_IsListeningToChannel

BOOL PHY_IsListeningToChannel (Node*node, intphyIndex, intchannelIndex)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Check if it is listening to the channel

node

- Node that is being

phyIndex

- interface number

channelIndex

- channel index

Returns:
BOOL

- None

PHY_SetTransmissionChannel

void PHY_SetTransmissionChannel (Node*node, intphyIndex, intchannelIndex)

Parameters:

Set the channel index used for transmission

node

- Node that is being

phyIndex

- interface number

channelIndex

- channel index

Returns:
void

- None

PHY_GetTransmissionChannel

void PHY_GetTransmissionChannel (Node*node, intphyIndex, intchannelIndex)

Parameters:

Get the channel index used for transmission

node

- Node that is being

phyIndex

- interface number

channelIndex

- channel index

Returns:
void

- None

PHY_MediumIsIdle

BOOL PHY_MediumIsIdle (Node*node, intphyNum)

Parameters:

Check if the medium is idle

node

- Node that is being

phyNum

- interface number

Returns:
BOOL

- None

PHY_MediumIsIdleInDirection

BOOL PHY_MediumIsIdleInDirection (Node*node, intphyNum, doubleazimuth)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Check if the medium is idle if sensed


directionally

node

- Node that is being

phyNum

- interface number

azimuth

- azimuth (in degrees)

Returns:
BOOL

- None

PHY_SetSensingDirection

void PHY_SetSensingDirection (Node*node, intphyNum, doubleazimuth)

Parameters:

Set the sensing direction

node

- Node that is being

phyNum

- interface number

azimuth

- azimuth (in degrees)

Returns:
void

PHY_StartTransmittingSignalDirectionally

- None

void PHY_StartTransmittingSignalDirectionally (Node*node, intphyNum, Message*msg,


BOOLuseMacLayerSpecifiedDelay, clocktypedelayUntilAirborne, doubledirectionAzimuth)

Parameters:
Start transmitting a signal directionally
node

- Node that is

phyNum
msg

- interface number

- signal to transmit

useMacLayerSpecifiedDelay
delayUntilAirborne
directionAzimuth

- use delay specified by MAC

- delay until airborne

- azimuth to transmit the signal

Returns:
void

- None

PHY_LockAntennaDirection

void PHY_LockAntennaDirection (Node*node, intphyNum)

Parameters:

Lock the direction of antenna

node

- Node that is being

phyNum

- interface number

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

void

- None

PHY_UnlockAntennaDirection

void PHY_UnlockAntennaDirection (Node*node, intphyNum)

Parameters:

Unlock the direction of antenna

node

- Node that is being

phyNum

- interface number

Returns:
void

- None

PHY_GetLastSignalsAngleOfArrival

double PHY_GetLastSignalsAngleOfArrival (Node*node, intphyNum)

Parameters:

Get the AOA of the last signal

node

- Node that is being

phyNum

- interface number

Returns:
double

PHY_TerminateCurrentReceive

- AOA

void PHY_TerminateCurrentReceive (Node*node, intphyNum, const BOOLterminateOnlyOnReceiveError,


BOOL*receiveError, clocktype*endSignalTime)

Parameters:
Terminate the current signal reception
node

- Node pointer that the

phyNum

- interface number

terminateOnlyOnReceiveError
receiveError

- terminate only when

- if error happened

endSignalTime

- end of signal

Returns:
void

PHY_PropagationRange

- None

double PHY_PropagationRange (Node*txnode, Node*node, inttxInterfaceIndex, intinterfaceIndex, intchannnelIndex,


BOOLprintAll)

Parameters:
Calculates an estimated radio range for the
PHY. Supports only TWO-RAY and FREESPACE.

txnode
node

- the Tx node of interest

- the Rx node of interest

txInterfaceIndex

- the interface for the TX node

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

interfaceIndex
channnelIndex
printAll

- the interface for the Rx node

- the index of the channel

- if TRUE, prints the range for all data

Returns:
double

- the range in meters

ENERGY_Init

void ENERGY_Init (Node*node, const intphyIndex, NodeInput*nodeInput)

Parameters:

This function declares energy model variables


and initializes them. Moreover, the function
read energy model specifications and
configures the parameters which are
configurable.

node

- the node of interest.

phyIndex

- the PHY index.

nodeInput

- the node input.

Returns:
void

- None

ENERGY_PrintStats

void ENERGY_PrintStats (Node*node, const intphyIndex)

Parameters:

To print the statistic of Energy Model.

node

- the node of interest.

phyIndex

- the PHY index.

Returns:
void

- None

Phy_ReportStatusToEnergyModel

void Phy_ReportStatusToEnergyModel (Node*node, const intphyIndex, PhyStatusTypeprevStatus, PhyStatusTypenewStatus)

Parameters:

This function should be called whenever a


state transition occurs in any place in PHY
layer. As input parameters, the function reads
the current state and the new state of PHY
layer and based on the new sates calculates
the cost of the load that should be taken off
the battery. The function then interacts with
battery model and updates the charge of
battery.

node

phyIndex

- the PHY index.

prevStatus
newStatus

- the the previous status.

- the the new status.

Returns:
void

Generic_UpdateCurrentLoad

- the node of interest.

- None

void Generic_UpdateCurrentLoad (Node*node, const intphyIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

To update the current load of generic energy


model.

Parameters:
node

- the node of interest.

phyIndex

- the PHY index.

Returns:
void

- None

PHY_GetSteeringAngle

void PHY_GetSteeringAngle (Node*node, intphyIndex)

Parameters:

Gets the current steering angle for a


directional antenna from PHY models that
support this.

node

- node being used

phyIndex

- physical to be initialized

Returns:
void

PHY_CheckPacketPhyDrop

- None

void PHY_CheckPacketPhyDrop (PartitionData*partition, PropChannel*propChannel, intnumNodes, intchannelIndex,


Message*msg)

Parameters:
This function is for Stats DB. It is to check
whether need to record a drop event.

partition

- partition where receiver is located

propChannel
numNodes

- channel information

- Number of nodes in the partition

channelIndex
msg

- Index of the propagation channel

- Message under propagation

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PHYSICAL LAYER

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PHYSICAL LAYER.html[10/28/2011 1:31:43 PM]

PROPAGATION

QualNet 5.2 API Reference


PROPAGATION
This file describes data structures and functions used by propagation models.
Constant / Data Structure Summary
Type

Name

CONSTANT

BOLTZMANN_CONSTANT

Boltzmann constant

CONSTANT

NEGATIVE_PATHLOSS_dB

Path loss in dB (used as an invalid value)

CONSTANT

SPEED_OF_LIGHT

Defines the value of speed of light

CONSTANT

PROP_DEFAULT_PROPAGATION_LIMIT_dBm

Default value for propagation limit.

CONSTANT

PROP_DEFAULT_SHADOWING_MEAN_dB

Default mean value for shadowing in dB

CONSTANT

MAX_NUM_ELEVATION_SAMPLES

Maximum number of sample would be taken.

ENUMERATION

PathlossModel

Different type of path loss.

ENUMERATION

ShadowingModel

Different type of shadowing used.

ENUMERATION

FadingModel

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

Different type of fading used.

ENUMERATION

propagationEnvironment

Different type of propagation environment.

ENUMERATION

LoSIndicator

Indicated if the path is Line of sight OR non-Line of sight

ENUMERATION

SuburbanTerrainType

Terrain types for Suburban-foliage model

ENUMERATION

IndoorLinkType

Link types for Indoor model

ENUMERATION

LinkType

Link types for model

STRUCT

PropPathProfile

Structure that keeps track of all propertice of a path.

STRUCT

PropChannel

structure of a channel.

STRUCT

PropProfile

Main structure of propagation profile

STRUCT

PropData

Main structure of propagation data.

STRUCT

PropTxInfo

This structure is used for fields related to channel layer information that need to be sent with a message.

STRUCT

PropRxInfo

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

This structure is used for fields related to channel layer information that need to be received with a message.

Function / Macro Summary


Return Type

Summary

MACRO

PROP_NumberChannels(node)

Get the number of channel.


MACRO

PROP_ChannelWavelength(node, channelIndex)

Get wavelength of channel having index channelIndex


void

PROP_GlobalInit(PartitionData*partitionData, NodeInput*nodeInput)

Initialization function for propagation This function is called from each partition, not from each node
void

PROP_PartitionlInit(PartitionData*partitionData, NodeInput*nodeInput)

Initialize some partition specific data structures. This function is called from each partition, not from each node This function is only
called for non-MPI
void

PROP_Init(Node*node, intchannelIndex, NodeInput*nodeInput)

Initialization function for propagation functions. This function is called from each node.
void

PROP_ProcessEvent(Node*node, Message*msg)

To receive message.
void

PROP_Finalize(Node*node)

To collect various result.


double

PROP_PathlossFreeSpace(doubledistance, doublewavelength)

Calculates pathloss using free space model.


double

PROP_PathlossTwoRay(doubledistance, doublewavelength, floattxAntennaHeight, floatrxAntennaHeight)

To calculate path loss of a channel.


file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

double

PROP_PathlossOpar(doubledistance, doubleOverlappingDistance, doublefrequency,


ObstructionTypeobstructiontype)

Calculates extra path attenuation using opar model.


void

PROP_CalculatePathloss(Node*node, NodeIdtxNodeId, NodeIdrxNodeId, intchannelIndex, doublewavelength,


floattxAntennaHeight, floatrxAntennaHeight, PropPathProfile*pathProfile, boolforBinning)

To calculate path loss of a channel.


void

PROP_CalculateFading(PropTxInfo*propTxInfo, Node*node2, intchannelIndex, clocktypecurrentTime,


float*fading_dB, double*channelReal, double*channelImag)

To calculate fading between two node.


BOOL

PROP_CalculateRxPowerAndPropagationDelay(Message*msg, intchannelIndex, PropChannel*propChannel,


PropTxInfo*propTxInfo, Node*txNode, Node*rxNode, PropPathProfile*pathProfile)

This function will be called by QualNet wireless propagation code to calculate rxPower and prop delay for a specific signal from a
specific tx node to a specific rx node.
BOOL

PROP_CalculateRxPowerAndPropagationDelay(Message*msg, intchannelIndex, PropChannel*propChannel,


PropTxInfo*propTxInfo, Node*txNode, Node*rxNode, PropPathProfile*pathProfile)

This function will be called by QualNet wireless propagation code to calculate rxPower and prop delay for a specific signal from a
specific tx node to a specific rx node.
void

PROP_MotionObtainfadingStretchingFactor(PropTxInfo*propTxInfo, Node*receiver, intchannelIndex)

Get a stretching factor for fast moving objects.


void

PROP_UpdatePathProfiles(Node*node)

UpdatePathProfiles
void

PROP_ReleaseSignal(Node*node, Message*msg, intphyIndex, intchannelIndex, floattxPower_dBm,


clocktypeduration, clocktypedelayUntilAirborne)

Release (transmit) the signal


void

PROP_SubscribeChannel(Node*node, intphyIndex, intchannelIndex)

Start subscribing (listening to) a channel


void

PROP_UnsubscribeChannel(Node*node, intphyIndex, intchannelIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

Stop subscription of (listening to) a channel


void

PROP_UnreferenceSignal(Node*node, Message*msg)

Unreference a signal (internal use)


void

PROP_CalculateInterNodePathLossOnChannel(Node*node, intchannelIndex, int*numNodesOnChannel,


NodeAddress*nodeIdList, float**pathloss_dB, float**distance)

Calculate inter-node pathloss, distance values between all the nodes on a given channel
clocktype

PROP_CalculatePropagationDelay(doubledistance, doublepropSpeed, PartitionData*partitionData,


intchannelIndex, intcoordinateSystemType, Coordinates*fromPosition, Coordinates*toPosition)

Calculate the wireless propagation delay for the given distance and propagation speed.
void

PROP_Reset(Node*node, intphyIndex, char*newChannelListenable)

Reset previous channel remove/add node to propChannel for signal delivery, in propagation_private.
void

PROP_AddNodeToList(Node*node, intchannelIndex)

add node to propChannel nodeList need to make sure that node is not already exists in list before adding.
void

PROP_RemoveNodeFromList(Node*node, intchannelIndex)

remove node from propChannel nodeList need to make sure that all the interface from that node is not listing on that channel before
removing.
double

PROP_GetChannelFrequency(Node*node, intchannelIndex)

Get channel frequency from profile for PropChannel.


void

PROP_SetChannelFrequency(Node*node, intchannelIndex, doublechannelFrequency)

Set channel frequency from profile for PropChannel.


double

PROP_GetChannelWavelength(Node*node, intchannelIndex)

Get channel wavelength from profile for PropChannel.


void

PROP_SetChannelWavelength(Node*node, intchannelIndex, doublechannelWavelength)

Set channel wavelength from profile for PropChannel.


double

PROP_GetChannelDopplerFrequency(Node*node, intchannelIndex)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

Get channel doppler freq from profile for PropChannel.


void

PROP_SetChannelDopplerFrequency(Node*node, intchannelIndex, doublechannelDopplerFrequency)

Set channel doppler freq from profile for PropChannel.

Constant / Data Structure Detail

Constant

BOLTZMANN_CONSTANT1.379e-23

Constant

Boltzmann constant
NEGATIVE_PATHLOSS_dB-1.0

Constant

Path loss in dB (used as an invalid value)


SPEED_OF_LIGHT3.0e8

Constant

Defines the value of speed of light


PROP_DEFAULT_PROPAGATION_LIMIT_dBm-111.0

Constant

Default value for propagation limit.


PROP_DEFAULT_SHADOWING_MEAN_dB4.0

Constant

Default mean value for shadowing in dB


MAX_NUM_ELEVATION_SAMPLES16384

Enumeration

Maximum number of sample would be taken.


PathlossModel

Enumeration

Different type of path loss.


ShadowingModel

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

Enumeration

Different type of shadowing used.


FadingModel

Enumeration

Different type of fading used.


propagationEnvironment

Enumeration

Different type of propagation environment.


LoSIndicator

Enumeration

Indicated if the path is Line of sight OR non-Line of sight


SuburbanTerrainType

Enumeration

Terrain types for Suburban-foliage model


IndoorLinkType

Enumeration

Link types for Indoor model


LinkType

Structure

Link types for model


PropPathProfile

Structure

Structure that keeps track of all propertice of a path.


PropChannel

Structure

structure of a channel.
PropProfile

Structure

Main structure of propagation profile


PropData

Main structure of propagation data.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

Structure

PropTxInfo

Structure

This structure is used for fields related to channel layer information that need to be sent with a message.
PropRxInfo

This structure is used for fields related to channel layer information that need to be received with a message.

Function / Macro Detail


Function / Macro
PROP_NumberChannels(node)

Format
Get the number of channel.

PROP_ChannelWavelength(node,
channelIndex)

Get wavelength of channel having index channelIndex

PROP_GlobalInit

void PROP_GlobalInit (PartitionData*partitionData, NodeInput*nodeInput)

Parameters:

Initialization function for propagation This


function is called from each partition, not from
each node

partitionData
nodeInput

- structure shared among nodes

- structure containing contents of input file

Returns:
void

- None

PROP_PartitionlInit

void PROP_PartitionlInit (PartitionData*partitionData, NodeInput*nodeInput)

Parameters:

Initialize some partition specific data structures.


This function is called from each partition, not
from each node This function is only called for
non-MPI

partitionData
nodeInput

- structure shared among nodes

- structure containing contents of input file

Returns:
void

- None

PROP_Init

void PROP_Init (Node*node, intchannelIndex, NodeInput*nodeInput)

Parameters:

Initialization function for propagation functions.


This function is called from each node.

node

- node being initialized.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

channelIndex
nodeInput

- channel being initialized.

- structure containing contents of input file

Returns:
void

- None

PROP_ProcessEvent

void PROP_ProcessEvent (Node*node, Message*msg)

Parameters:

To receive message.

node
msg

- Node that is

- message received by the layer

Returns:
void

- None

PROP_Finalize

void PROP_Finalize (Node*node)

Parameters:

To collect various result.

node

- node for which results are to be collected

Returns:
void

- None

PROP_PathlossFreeSpace

double PROP_PathlossFreeSpace (doubledistance, doublewavelength)

Parameters:

Calculates pathloss using free space model.

distance

- distance (meters) between two nodes

wavelength

- wavelength used for propagation.

Returns:
double

- pathloss in db

PROP_PathlossTwoRay

double PROP_PathlossTwoRay (doubledistance, doublewavelength, floattxAntennaHeight, floatrxAntennaHeight)

Parameters:

To calculate path loss of a channel.

distance

- distance (meters) between two nodes

wavelength

- wavelength used for propagation.

txAntennaHeight

- tranmitting antenna hight.

rxAntennaHeight

- receiving antenna hight.

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

double

PROP_PathlossOpar

- pathloss in db

double PROP_PathlossOpar (doubledistance, doubleOverlappingDistance, doublefrequency,


ObstructionTypeobstructiontype)

Parameters:
Calculates extra path attenuation using opar model.
distance

- distance (meters) between two nodes

OverlappingDistance
frequency

- overlapping distance

- frequency used for propagation.

obstructiontype

- obstruction type

Returns:
double

PROP_CalculatePathloss

- extra path attenuation in db

void PROP_CalculatePathloss (Node*node, NodeIdtxNodeId, NodeIdrxNodeId, intchannelIndex, doublewavelength,


floattxAntennaHeight, floatrxAntennaHeight, PropPathProfile*pathProfile, boolforBinning)

Parameters:
To calculate path loss of a channel.
node

- Node that is

txNodeId

- including for debugging

rxNodeId

- including for debugging

channelIndex
wavelength

- channel number.

- wavelength used for propagation.

txAntennaHeight

- tranmitting antenna hight.

rxAntennaHeight

- receiving antenna hight.

pathProfile
forBinning

- characteristics of path.

- disables some features to support

Returns:
void

PROP_CalculateFading

- None

void PROP_CalculateFading (PropTxInfo*propTxInfo, Node*node2, intchannelIndex, clocktypecurrentTime,


float*fading_dB, double*channelReal, double*channelImag)

Parameters:
To calculate fading between two node.
propTxInfo
node2

- Information about the transmitter

- receiver

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

channelIndex
currentTime
fading_dB

- channel number

- current simulation time

- calculated fading store here.

channelReal

- for cooperative comm

channelImag

- for cooperative comm

Returns:
void

PROP_CalculateRxPowerAndPropagationDelay

- None

BOOL PROP_CalculateRxPowerAndPropagationDelay (Message*msg, intchannelIndex, PropChannel*propChannel,


PropTxInfo*propTxInfo, Node*txNode, Node*rxNode, PropPathProfile*pathProfile)

Parameters:
This function will be called by QualNet wireless
propagation code to calculate rxPower and prop
delay for a specific signal from a specific tx node
to a specific rx node.

msg

- Signal to be propagated

channelIndex
propChannel
propTxInfo

- Channel that the signal is propagated

- Info of the propagation channel

- Transmission parameers of the tx node

txNode

- Point to the Tx node

rxNode

- Point to the Rx node

pathProfile

- For returning results

Returns:
BOOL

PROP_CalculateRxPowerAndPropagationDelay

- If FALSE, indicate the two nodes cannot comm TRUE means two nodes can communicate

BOOL PROP_CalculateRxPowerAndPropagationDelay (Message*msg, intchannelIndex, PropChannel*propChannel,


PropTxInfo*propTxInfo, Node*txNode, Node*rxNode, PropPathProfile*pathProfile)

Parameters:
This function will be called by QualNet wireless
propagation code to calculate rxPower and prop
delay for a specific signal from a specific tx node
to a specific rx node.

msg

- Signal to be propagated

channelIndex
propChannel
propTxInfo

- Channel that the signal is propagated

- Info of the propagation channel

- Transmission parameers of the tx node

txNode

- Point to the Tx node

rxNode

- Point to the Rx node

pathProfile

- For returning results

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

Returns:
BOOL

- If FALSE, indicate the two nodes cannot comm TRUE means two nodes can communicate

PROP_MotionObtainfadingStretchingFactor

void PROP_MotionObtainfadingStretchingFactor (PropTxInfo*propTxInfo, Node*receiver, intchannelIndex)

Parameters:

Get a stretching factor for fast moving objects.

propTxInfo
receiver

- Transmitter information

- Receiver node.

channelIndex

- channel number

Returns:
void

- None

PROP_UpdatePathProfiles

void PROP_UpdatePathProfiles (Node*node)

Parameters:

UpdatePathProfiles

node

- Node that is

Returns:
void

PROP_ReleaseSignal

- None

void PROP_ReleaseSignal (Node*node, Message*msg, intphyIndex, intchannelIndex, floattxPower_dBm,


clocktypeduration, clocktypedelayUntilAirborne)

Parameters:
Release (transmit) the signal
node
msg

- Node that is

- Signal to be transmitted

phyIndex

- PHY data index

channelIndex
txPower_dBm
duration

- chanel index

- transmitting power

- transmission duration

delayUntilAirborne

- delay until airborne

Returns:
void

- None

PROP_SubscribeChannel

void PROP_SubscribeChannel (Node*node, intphyIndex, intchannelIndex)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

Start subscribing (listening to) a channel

node

- Node that is

phyIndex

- interface index

channelIndex

- chanel index

Returns:
void

- None

PROP_UnsubscribeChannel

void PROP_UnsubscribeChannel (Node*node, intphyIndex, intchannelIndex)

Parameters:

Stop subscription of (listening to) a channel

node

- Node that is

phyIndex

- interface index

channelIndex

- chanel index

Returns:
void

- None

PROP_UnreferenceSignal

void PROP_UnreferenceSignal (Node*node, Message*msg)

Parameters:

Unreference a signal (internal use)

node
msg

- Node that is

- Signal to be unreferenced

Returns:
void

PROP_CalculateInterNodePathLossOnChannel

- None

void PROP_CalculateInterNodePathLossOnChannel (Node*node, intchannelIndex, int*numNodesOnChannel,


NodeAddress*nodeIdList, float**pathloss_dB, float**distance)

Parameters:
Calculate inter-node pathloss, distance values
between all the nodes on a given channel

node

- any valid node

channelIndex

- selected channel instance

numNodesOnChannel
nodeIdList

- list of (numNodesOnChannel) nodeIds

pathloss_dB
distance

- number of nodes using this channel

- 2D pathloss array for nodes in

- 2D array of inter-node distances

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

void

PROP_CalculatePropagationDelay

- None

clocktype PROP_CalculatePropagationDelay (doubledistance, doublepropSpeed, PartitionData*partitionData,


intchannelIndex, intcoordinateSystemType, Coordinates*fromPosition, Coordinates*toPosition)

Parameters:
Calculate the wireless propagation delay for the
given distance and propagation speed.

distance

- Propagation distance

propSpeed

- Propagation speed

partitionData
channelIndex

- Partition data

- Channel index or -1 for p2p

coordinateSystemType
fromPosition
toPosition

- Coordinate system type

- Source position

- Destination position

Returns:
- Calculated propagation delay COMMENTS :: + partitionData can be used to get the simulation time or
terrain data + channelIndex indicates the channel for scenarios with multiple channels Wireless p2p link or microwave
links don't use propagation channels. -1 will be passed in which indicate p2p/microwave links. + fromPosition and
toPosition are not used right now. They can be used to calculate location specific delay.

clocktype

PROP_Reset

void PROP_Reset (Node*node, intphyIndex, char*newChannelListenable)

Parameters:

Reset previous channel remove/add node to


propChannel for signal delivery, in
propagation_private.

node

- Node that is being instantiated in

phyIndex

- interface index

newChannelListenable

- new channel

Returns:
void

- None

PROP_AddNodeToList

void PROP_AddNodeToList (Node*node, intchannelIndex)

Parameters:

add node to propChannel nodeList need to make


sure that node is not already exists in list before
adding.

node

- the node

channelIndex

- channel index

Returns:
void

- None

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

PROP_RemoveNodeFromList

void PROP_RemoveNodeFromList (Node*node, intchannelIndex)

Parameters:

remove node from propChannel nodeList need to


make sure that all the interface from that node is
not listing on that channel before removing.

node

- the node

channelIndex

- channel index

Returns:
void

- None

PROP_GetChannelFrequency

double PROP_GetChannelFrequency (Node*node, intchannelIndex)

Parameters:

Get channel frequency from profile for


PropChannel.

node

- the node

channelIndex

- channel index

Returns:
double

- channel frequency

PROP_SetChannelFrequency

void PROP_SetChannelFrequency (Node*node, intchannelIndex, doublechannelFrequency)

Parameters:

Set channel frequency from profile for


PropChannel.

node

- the node

channelIndex

- channel index

channelFrequency

- new channel frequency

Returns:
void

- None

PROP_GetChannelWavelength

double PROP_GetChannelWavelength (Node*node, intchannelIndex)

Parameters:

Get channel wavelength from profile for


PropChannel.

node

- the node

channelIndex

- channel index

Returns:
double

- channel wavelength

PROP_SetChannelWavelength

void PROP_SetChannelWavelength (Node*node, intchannelIndex, doublechannelWavelength)

Parameters:

Set channel wavelength from profile for

node

- the node

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

PROPAGATION

PropChannel.
channelIndex

- channel index

channelWavelength

- new channel wavelength

Returns:
void

- None

PROP_GetChannelDopplerFrequency

double PROP_GetChannelDopplerFrequency (Node*node, intchannelIndex)

Parameters:

Get channel doppler freq from profile for


PropChannel.

node

- the node

channelIndex

- channel index

Returns:
double

- channel doppler freq

PROP_SetChannelDopplerFrequency

void PROP_SetChannelDopplerFrequency (Node*node, intchannelIndex, doublechannelDopplerFrequency)

Parameters:

Set channel doppler freq from profile for


PropChannel.

node

- the node

channelIndex

- channel index

channelDopplerFrequency

- new channel doppler freq

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/PROPAGATION.html[10/28/2011 1:31:53 PM]

QUEUES

QualNet 5.2 API Reference


QUEUES
This file describes the member functions of the queue base class.
Constant / Data Structure Summary
Type

Name

CONSTANT

DEQUEUE_NEXT_PACKET

Denotes position of packet in the queue for dequeue operation

CONSTANT

ALL_PRIORITIES

This macro is used to specify that queue and scheduler operations not consider priority value of queue or packet

CONSTANT

QOS_DEFAULT_INTERFACE_OBSERVATION_INTERVAL

This macro is used to specify the interface observation interval for Qos Routing. Ref.(Qospf.h see
QOSPF_DEFAULT_INTERFACE_OBSERVATION_INTERVAL)

CONSTANT

STATISTICS_RESOLUTION

This macro is used to support overflow issue to account for long delay network such as in space applications, or simply very very long
simulations, divide delays by STATISTICS_RESOLUTION during runtime, and multiply by STATISTICS_RESOLUTION at the end
of the simulation when IO_PrintStat'ing

CONSTANT

DEFAULT_QUEUE_DELAY_WEIGHT_FACTOR

This macro is used to define the weight to assign to the most recent delay in calculating an exponential moving average. The value is
fairly large because the queue delay is used for QoS routing decisions.

CONSTANT

PACKET_ARRAY_INFO_FIELD_SIZE

The Queue structure will store a field of data in addition to the Message itself, with a maximum size of this value

ENUMERATION

QueueBehavior

This enumeration is used by both queues and schedulers to determine the queue behavior.

ENUMERATION

QueueOperation

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

This enumeration is used by both queues and schedulers to determine the operation of the retrieve functions.

STRUCT

PacketArrayEntry

This structure represents an entry in the array of stored messages. The infoField (perhaps this should be renamed to prevent confusion)
will store a queue algorithm dependent amount of data about each Message, as well as the simulation time that Message was inserted.

STRUCT

QueueAgeInfo

This structure contains information for each packet inserted into the queue to uniquely identify it so that it can be removed from the
queue due to age.

Function / Macro Summary


Return Type

Summary

void

Queue(Message*msg, const void*infoField, BOOL*QueueIsFull, const clocktypecurrentTime, const


doubleserviceTag)

This function prototype determines the arguments that need to be passed to a queue data structure in order to insert a message into it.
The infoField parameter has a specified size infoFieldSize, which is set at Initialization, and points to the structure that should be stored
along with the Message.
BOOL

Queue(Message**msg, const intindex, const QueueOperationoperation, const clocktypecurrentTime,


double*serviceTag)

This function prototype determines the arguments that need to be passed to a queue data structure in order to dequeue, peek at, or drop a
message in its array of stored messages. It now includes the "DropFunction" functionality as well.
BOOL

Queue()

This function prototype returns a Boolean value of true if the array of stored messages is empty, false otherwise.
int

Queue()

This function prototype returns the number of bytes stored in the array.
int

Queue()

This function prototype returns free space in number of bytes in the queue.
int

Queue()

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

This function prototype returns the number of Messages stored in the packetArray.
int

Queue()

This function prototype returns the size of the Queue


void

Queue(doubleserviceTag)

Set the service tag of the queue


int

Queue(Queue*oldQueue)

This function is proposed to replicate the state of the queue, as if it had been the operative queue all along. If there are packets in the
existing queue, they are transferred one-by-one into the new queue. This can result in additional drops of packets that had previously
been stored. This function returns the number of additional drops.
void

Queue(BOOLsuspend)

This function is proposed to identify and tag misbehaved queue at the interface, so that they can be punished.
void

Queue(int*qDelayVal, int*totalTransmissionVal, const clocktypecurrentTime, BOOLisResetTotalTransmissionVal)

This function is proposed for qos information update for Qos Routings like Qospf.
int

Queue()

This function prototype returns the number of bytes dequeued, not dropped, during a given period. This period starts at the beginning of
the simulation, and restarts whenever the Queue resetPeriod function is called.
clocktype

Queue()

This function prototype returns the queue utilization, or the amount of time that the queue is nonempty, during a given period. This
period starts at the beginning of the simulation, and restarts whenever the queue resetPeriod function is called.
clocktype

Queue()

This function prototype returns the average time a packet spends in the queue, during a given period. This period starts at the beginning
of the simulation, and restarts whenever the QueueResetPeriodFunctionType function is called.
void

Queue(clocktypecurrentTime)

This function prototype resets the current period statistics variables, and sets the currentPeriodStartTime to the currentTime.
clocktype

Queue()

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

This function prototype returns the currentPeriodStartTime.


void

Queue(Node*node, const char*layer, const intinterfaceIndex, const intinstanceId, const


char*invokingProtocol, const char*splStatStr)

This function prototype outputs the final statistics for this queue. The layer, protocol, interfaceAddress, and instanceId parameters are
given to IO_PrintStat with each of the queue's statistics.
void

Queue(Node*node, const charqueueTypeString[], const intqueueSize, const intinterfaceIndex, const


intqueueNumber, const intinfoFieldSize, const BOOLenableQueueStat, const BOOLshowQueueInGui, const
clocktypecurrentTime, const void*configInfo)

This function runs queue initialization routine. Any algorithm specific configurable parameters will be kept in a structure and after
feeding that structure the structure pointer will be sent to this function via that void pointer configInfo. Some parameters includes default
values, to prevent breaking existing models. [Uses: vide Pseudo code]

Constant / Data Structure Detail

Constant

DEQUEUE_NEXT_PACKET0

Constant

Denotes position of packet in the queue for dequeue operation


ALL_PRIORITIES-1

Constant

This macro is used to specify that queue and scheduler operations not consider priority value of queue or packet
QOS_DEFAULT_INTERFACE_OBSERVATION_INTERVAL2 * SECOND

Constant

This macro is used to specify the interface observation interval for Qos Routing. Ref.(Qospf.h see
QOSPF_DEFAULT_INTERFACE_OBSERVATION_INTERVAL)
STATISTICS_RESOLUTION1 * MICRO_SECOND

Constant

This macro is used to support overflow issue to account for long delay network such as in space applications, or simply very very long
simulations, divide delays by STATISTICS_RESOLUTION during runtime, and multiply by STATISTICS_RESOLUTION at the end of the
simulation when IO_PrintStat'ing
DEFAULT_QUEUE_DELAY_WEIGHT_FACTOR0.1

Constant

This macro is used to define the weight to assign to the most recent delay in calculating an exponential moving average. The value is
fairly large because the queue delay is used for QoS routing decisions.
PACKET_ARRAY_INFO_FIELD_SIZE32

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

Enumeration

The Queue structure will store a field of data in addition to the Message itself, with a maximum size of this value
QueueBehavior

Enumeration

This enumeration is used by both queues and schedulers to determine the queue behavior.
QueueOperation

Structure

This enumeration is used by both queues and schedulers to determine the operation of the retrieve functions.
PacketArrayEntry

Structure

This structure represents an entry in the array of stored messages. The infoField (perhaps this should be renamed to prevent confusion)
will store a queue algorithm dependent amount of data about each Message, as well as the simulation time that Message was inserted.
QueueAgeInfo

This structure contains information for each packet inserted into the queue to uniquely identify it so that it can be removed from the queue
due to age.

Function / Macro Detail


Function / Macro
Queue

Format
void Queue (Message*msg, const void*infoField, BOOL*QueueIsFull, const clocktypecurrentTime, const doubleserviceTag)

Parameters:

This function prototype determines the


arguments that need to be passed to a queue
data structure in order to insert a message into
it. The infoField parameter has a specified
size infoFieldSize, which is set at
Initialization, and points to the structure that
should be stored along with the Message.

msg

- Pointer to Message structure

infoField

- The infoField parameter

QueueIsFull

- returns Queue occupancy status

currentTime

- Current Simulation time

serviceTag

- ServiceTag

Returns:
void

Queue

- Null

BOOL Queue (Message**msg, const intindex, const QueueOperationoperation, const clocktypecurrentTime,


double*serviceTag)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

Parameters:
This function prototype determines the
arguments that need to be passed to a queue
data structure in order to dequeue, peek at, or
drop a message in its array of stored
messages. It now includes the
"DropFunction" functionality as well.

msg

- The retrieved msg


- The position of the packet in the queue

index

operation

- The retrieval mode

currentTime
serviceTag

- Current Simulation time

- ServiceTag = NULL

Returns:
- TRUE or FALSE

BOOL

Queue

BOOL Queue ()

Parameters:

This function prototype returns a Boolean


value of true if the array of stored messages is
empty, false otherwise.

Returns:

Queue

int Queue ()

Parameters:

This function prototype returns the number of


bytes stored in the array.

Returns:

- TRUE or FALSE

BOOL

int

- Integer

Queue

int Queue ()

Parameters:

This function prototype returns free space in


number of bytes in the queue.

Returns:
int

- number of bytes free.

Queue

int Queue ()

Parameters:

This function prototype returns the number of


Messages stored in the packetArray.

Returns:
int

- Integer

Queue

int Queue ()

Parameters:

This function prototype returns the size of the


Queue

Returns:
int

- Integer

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

Queue

void Queue (doubleserviceTag)

Parameters:

Set the service tag of the queue

serviceTag

- the value of the service tag

Returns:
- NULL

void

Queue

int Queue (Queue*oldQueue)

Parameters:

This function is proposed to replicate the


state of the queue, as if it had been the
operative queue all along. If there are packets
in the existing queue, they are transferred
one-by-one into the new queue. This can
result in additional drops of packets that had
previously been stored. This function returns
the number of additional drops.
Queue

void Queue (BOOLsuspend)

Parameters:

This function is proposed to identify and tag


misbehaved queue at the interface, so that
they can be punished.

oldQueue

- Old queue pointer

Returns:
int

- Old packetArray

suspend

- The queue status

Returns:
void

- Null

Queue

void Queue (int*qDelayVal, int*totalTransmissionVal, const clocktypecurrentTime, BOOLisResetTotalTransmissionVal)

Parameters:

This function is proposed for qos information


update for Qos Routings like Qospf.

qDelayVal

- Returning qDelay value

totalTransmissionVal
currentTime

- Returning totalTransmission value

- Current simulation time

isResetTotalTransmissionVal

- Default false

Returns:
void

- Null

Queue

int Queue ()

Parameters:

This function prototype returns the number of

Returns:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

bytes dequeued, not dropped, during a given


period. This period starts at the beginning of
the simulation, and restarts whenever the
Queue resetPeriod function is called.
Queue

clocktype Queue ()

Parameters:

This function prototype returns the queue


utilization, or the amount of time that the
queue is nonempty, during a given period.
This period starts at the beginning of the
simulation, and restarts whenever the queue
resetPeriod function is called.
Queue

Returns:

clocktype Queue ()

Parameters:

This function prototype returns the average


time a packet spends in the queue, during a
given period. This period starts at the
beginning of the simulation, and restarts
whenever the
QueueResetPeriodFunctionType function is
called.
Queue

Returns:

Parameters:

This function prototype resets the current


period statistics variables, and sets the
currentPeriodStartTime to the currentTime.

int

- Integer

clocktype

clocktype

- Utilize Time.

- Queue Delays.

void Queue (clocktypecurrentTime)

currentTime

Returns:
- Null

void

Queue

clocktype Queue ()

Parameters:

This function prototype returns the


currentPeriodStartTime.

Returns:
clocktype

Queue

- Current simulation time.

- Current period start time.

void Queue (Node*node, const char*layer, const intinterfaceIndex, const intinstanceId, const char*invokingProtocol, const
char*splStatStr)

Parameters:
This function prototype outputs the final
statistics for this queue. The layer, protocol,
interfaceAddress, and instanceId parameters
are given to IO_PrintStat with each of the
queue's statistics.

node

- Pointer to Node structure

layer

- The layer string

interfaceIndex

- The interface index

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

instanceId

- Instance Ids

invokingProtocol
splStatStr

- The protocol string

- Special string for stat print

Returns:
void

Queue

This function runs queue initialization


routine. Any algorithm specific configurable
parameters will be kept in a structure and
after feeding that structure the structure
pointer will be sent to this function via that
void pointer configInfo. Some parameters
includes default values, to prevent breaking
existing models. [Uses: vide Pseudo code]

- Null

void Queue (Node*node, const charqueueTypeString[], const intqueueSize, const intinterfaceIndex, const intqueueNumber,
const intinfoFieldSize, const BOOLenableQueueStat, const BOOLshowQueueInGui, const clocktypecurrentTime, const
void*configInfo)
Parameters:
node

- Node pointer

queueTypeString[]
queueSize

- Queue type string

- Queue size in bytes

interfaceIndex
queueNumber

- used to set random seed

- used to set random seed

infoFieldSize

- Default infoFieldSize = 0

enableQueueStat
showQueueInGui
currentTime
configInfo

- Default enableQueueStat = false

- If want to show this Queue in GUI

- Current simulation time

- pointer to a structure that contains

Returns:
void

- Null

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

QUEUES

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/QUEUES.html[10/28/2011 1:32:12 PM]

RANDOM NUMBERS

QualNet 5.2 API Reference


RANDOM NUMBERS
This file describes functions to generate pseudo-random number streams.
Constant / Data Structure Summary
Type

Name

ENUMERATION

RandomDistributionType

Random function types

ENUMERATION

RandomDataType

Used for parsing input strings.

STRUCT

ValueProbabilityPair

Stores one data point in a user defined distribution.

STRUCT

ArbitraryDistribution

Stores a user defined distribution.

Function / Macro Summary


Return Type

Summary

void

RANDOM_SetSeed(RandomSeedseed, UInt32globalSeed, UInt32nodeId, UInt32protocolId, UInt32instanceId)

Chooses from a set of pre-defined independent random seeds. The parameter names here are recommend invariants for use in selecting
seeds, but other values could be used instead.
double

RANDOM_erand(RandomSeedseed)

Returns a uniform distribution in [0.0 .. 1.0]


Int32

RANDOM_jrand(RandomSeedseed)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

RANDOM NUMBERS

Returns an integer uniformly distributed between -2^31 and 2^31.


Int32

RANDOM_nrand(RandomSeedseed)

Returns an integer uniformly distributed between 0 and 2^31.


void

RANDOM_LoadUserDistributions(NodeInput*nodeInput)

Loads all user defined distributions.


void

RandomDistribution.init()

Initializes the random distribution


void

RandomDistribution.setDistributionUniform(Tmin, Tmax)

Sets the distribution to uniform. With this function, even integer types return values between [min, max), meaning to get a boolean
distribution, use 0, 2.
void

RandomDistribution.setDistributionUniformInteger(Tmin, Tmax)

This one gives [min, max] for integers.


void

RandomDistribution.setDistributionExponential(Tmean)

Sets the distribution to exponential with the given mean.


void

RandomDistribution.setDistributionGaussian(Tsigma)

Sets the distribution to Gaussian with the given sigma


void

RandomDistribution.setDistributionGaussianInt(Tsigma)

Sets the distribution to Gaussian with the given sigma


void

RandomDistribution.setDistributionPareto(Tval1, Tval2, doublealpha)

Sets the distribution to the truncated Pareto distribution


void

RandomDistribution.setDistributionPareto4(Tval1, Tval2, Tval3, doublealpha)

Sets the distribution to the truncated Pareto distribution


void

RandomDistribution.setDistributionGeneralPareto(Tval1, Tval2, doublealpha)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

RANDOM NUMBERS

Sets the distribution to general Pareto distribution


void

RandomDistribution.setDistributionParetoUntruncated(doublealpha)

Sets the distribution to the truncated Pareto distribution


void

RandomDistribution.setDistributionDeterministic(Tval)

The distribution will always return val.


void

RandomDistribution.setDistributionNull()

The distribution will return 0. This is used for initialization.


int

RandomDistribution.setDistribution(char*inputString, char*printStr, RandomDataTypedataType)

Sets the distribution by parsing string input.


T

RandomDistribution.getRandomNumber(RandomSeedseed, Node*node)

These two functions return the next random number from the defined distribution.
void

RandomDistribution.setSeed(UInt32globalSeed, UInt32nodeId, UInt32protocolId, UInt32instanceId)

Calls RANDOM_SetSeed on the member seed.


void

RandomDistribution.setSeed(RandomSeedseed)

Copies the parameter seed into the member seed.

Constant / Data Structure Detail

Enumeration

RandomDistributionType

Enumeration

Random function types


RandomDataType

Structure

Used for parsing input strings.


ValueProbabilityPair

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

RANDOM NUMBERS

Structure

Stores one data point in a user defined distribution.


ArbitraryDistribution

Stores a user defined distribution.

Function / Macro Detail


Function / Macro
RANDOM_SetSeed

Format
void RANDOM_SetSeed (RandomSeedseed, UInt32globalSeed, UInt32nodeId, UInt32protocolId,
UInt32instanceId)

Parameters:
Chooses from a set of pre-defined independent random
seeds. The parameter names here are recommend
invariants for use in selecting seeds, but other values could
be used instead.

seed

- the seed to be set.

globalSeed
nodeId

- the scenario's global seed, i.e. SEED in the

- the node's ID

protocolId

- the protocol number, as defined in the layer

instanceId

- the instance of this protocol, often the

Returns:
- None

void

RANDOM_erand

double RANDOM_erand (RandomSeedseed)

Parameters:

Returns a uniform distribution in [0.0 .. 1.0]

seed

- the seed for this random stream.

Returns:
double

- a random number

RANDOM_jrand

Int32 RANDOM_jrand (RandomSeedseed)

Parameters:

Returns an integer uniformly distributed between -2^31


and 2^31.

seed

- the seed for this random stream.

Returns:
Int32

- a random number

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

RANDOM NUMBERS

RANDOM_nrand

Int32 RANDOM_nrand (RandomSeedseed)

Parameters:

Returns an integer uniformly distributed between 0 and


2^31.

seed

- the seed for this random stream.

Returns:
Int32

- a random number

RANDOM_LoadUserDistributions

void RANDOM_LoadUserDistributions (NodeInput*nodeInput)

Parameters:

Loads all user defined distributions.

nodeInput

- the .config file

Returns:
void

- None

RandomDistribution.init

void RandomDistribution.init ()

Parameters:

Initializes the random distribution

Returns:
void

- None

RandomDistribution.setDistributionUniform

void RandomDistribution.setDistributionUniform (Tmin, Tmax)

Parameters:

Sets the distribution to uniform. With this function, even


integer types return values between [min, max), meaning
to get a boolean distribution, use 0, 2.

min

- the low end of the range

max

- the high end of the range

Returns:
void

- None

RandomDistribution.setDistributionUniformInteger

void RandomDistribution.setDistributionUniformInteger (Tmin, Tmax)

Parameters:

This one gives [min, max] for integers.

min

- the low end of the range

max

- the high end of the range

Returns:
void

- None

RandomDistribution.setDistributionExponential

void RandomDistribution.setDistributionExponential (Tmean)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

RANDOM NUMBERS

Sets the distribution to exponential with the given mean.

mean

- the mean value of the distribution

Returns:
- None

void

RandomDistribution.setDistributionGaussian

void RandomDistribution.setDistributionGaussian (Tsigma)

Parameters:

Sets the distribution to Gaussian with the given sigma

sigma

- the sigma value

Returns:
- None

void

RandomDistribution.setDistributionGaussianInt

void RandomDistribution.setDistributionGaussianInt (Tsigma)

Parameters:

Sets the distribution to Gaussian with the given sigma

sigma

- the sigma value

Returns:
- None

void

RandomDistribution.setDistributionPareto

void RandomDistribution.setDistributionPareto (Tval1, Tval2, doublealpha)

Parameters:

Sets the distribution to the truncated Pareto distribution

val1

- the low end of the range

val2

- the high end of the range

alpha

- the alpha value

Returns:
- None

void

RandomDistribution.setDistributionPareto4

void RandomDistribution.setDistributionPareto4 (Tval1, Tval2, Tval3, doublealpha)

Parameters:

Sets the distribution to the truncated Pareto distribution

val1

- the minimum value of Pareto distribution

val2

- the low end of the range

val3

- the high end of the range

alpha

- the alpha value

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

RANDOM NUMBERS

- None

void

RandomDistribution.setDistributionGeneralPareto

void RandomDistribution.setDistributionGeneralPareto (Tval1, Tval2, doublealpha)

Parameters:

Sets the distribution to general Pareto distribution

val1

- the low end of the range

val2

- the high end of the range

alpha

- the alpha value

Returns:
void

- None

RandomDistribution.setDistributionParetoUntruncated

void RandomDistribution.setDistributionParetoUntruncated (doublealpha)

Parameters:

Sets the distribution to the truncated Pareto distribution

alpha

- the alpha value

Returns:
void

- None

RandomDistribution.setDistributionDeterministic

void RandomDistribution.setDistributionDeterministic (Tval)

Parameters:

The distribution will always return val.

val

- the value to return

Returns:
void

- None

RandomDistribution.setDistributionNull

void RandomDistribution.setDistributionNull ()

Parameters:

The distribution will return 0. This is used for


initialization.

Returns:
void

- None

RandomDistribution.setDistribution

int RandomDistribution.setDistribution (char*inputString, char*printStr, RandomDataTypedataType)

Parameters:

Sets the distribution by parsing string input.

inputString

- the input string, typically from a line

printStr

- usually the name of the calling

dataType

- the data type of the template class is

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

RANDOM NUMBERS

int

- returns the number of tokens read from the input string

RandomDistribution.getRandomNumber

T RandomDistribution.getRandomNumber (RandomSeedseed, Node*node)

Parameters:

These two functions return the next random number from


the defined distribution.

seed

- when the seed parameter is present, it is used in

node

- the node parameter is required to look up user

Returns:
T

- the random value

RandomDistribution.setSeed

void RandomDistribution.setSeed (UInt32globalSeed, UInt32nodeId, UInt32protocolId, UInt32instanceId)

Parameters:

Calls RANDOM_SetSeed on the member seed.

globalSeed
nodeId

- the scenario's global seed, i.e. SEED in the

- the node's ID

protocolId

- the protocol number, as defined in the layer

instanceId

- the instance of this protocol, often the

Returns:
void

- None

RandomDistribution.setSeed

void RandomDistribution.setSeed (RandomSeedseed)

Parameters:

Copies the parameter seed into the member seed.

seed

- an already initialized seed.

Returns:
void

- None

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

RANDOM NUMBERS

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/RANDOM NUMBERS.html[10/28/2011 1:32:25 PM]

SCHEDULERS

QualNet 5.2 API Reference


SCHEDULERS
This file describes the member functions of the scheduler base class.
Constant / Data Structure Summary
Type

Name

CONSTANT

DEFAULT_QUEUE_COUNT

Default number of queue per interface

STRUCT

QueueData

This structure contains pointers to queue structures, default function behaviors, and statistics for the scheduler

Function / Macro Summary


Return Type

Summary

QueueData*

Scheduler(intpriority)

Returns pointer to QueueData associated with the queue. this is a Private


int

Scheduler()

Returns number of queues under this Scheduler


int

Scheduler(intqueueIndex)

Returns Priority for the queues under this Scheduler


BOOL

Scheduler(const intpriority)

Returns a Boolean value of TRUE if the array of stored messages in each queue that the scheduler controls are empty, and FALSE
otherwise
BOOL

Scheduler(const intpriority)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SCHEDULERS.html[10/28/2011 1:32:35 PM]

SCHEDULERS

This function prototype returns the total number of bytes stored in the array of either a specific queue, or all queues that the scheduler
controls.
int

Scheduler(const intpriority)

This function prototype returns the number of messages stored in the array of either a specific queue, or all queues that the scheduler
controls.
void

Scheduler(intqueueIndex, int*qDelayVal, int*totalTransmissionVal, const clocktypecurrentTime,


BOOLisResetTotalTransmissionVal)

This function enable Qos monitoring for all queues that the scheduler controls.
void

Scheduler(intpriority, intpacketSize, const clocktypecurrentTime)

This function enable data collection for performance study of schedulers.


void

Scheduler(Node*node, const char*layer, const intinterfaceIndex, const intinstanceId, const


char*invokingProtocol, const char*splStatStr)

This function invokes queue finalization.


void

SCHEDULER_Setup(Scheduler**scheduler, const charschedulerTypeString[], BOOLenableSchedulerStat, const


char*graphDataStr)

This function runs the generic and then algorithm-specific scheduler initialization routine.
int

GenericPacketClassifier(Scheduler*scheduler, intpktPriority)

Classify a packet for a specific queue

Constant / Data Structure Detail

Constant

DEFAULT_QUEUE_COUNT3

Structure

Default number of queue per interface


QueueData

This structure contains pointers to queue structures, default function behaviors, and statistics for the scheduler

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SCHEDULERS.html[10/28/2011 1:32:35 PM]

SCHEDULERS

Function / Macro Detail


Function / Macro
Scheduler

Format
QueueData* Scheduler (intpriority)

Parameters:

Returns pointer to QueueData associated with


the queue. this is a Private

priority

- Queue priority

Returns:
QueueData*

Scheduler

int Scheduler ()

Parameters:

Returns number of queues under this


Scheduler

Returns:
int

- Pointer of queue

- Number of queue.

Scheduler

int Scheduler (intqueueIndex)

Parameters:

Returns Priority for the queues under this


Scheduler

queueIndex

- Queue index

Returns:
int

- Return priority of a queue

Scheduler

BOOL Scheduler (const intpriority)

Parameters:

Returns a Boolean value of TRUE if the array


of stored messages in each queue that the
scheduler controls are empty, and FALSE
otherwise

priority

- Priority of a queue

Returns:
BOOL

- TRUE or FALSE

Scheduler

BOOL Scheduler (const intpriority)

Parameters:

This function prototype returns the total


number of bytes stored in the array of either a
specific queue, or all queues that the
scheduler controls.

priority

Returns:
BOOL

Scheduler

- Priority of a queue

- TRUE or FALSE

int Scheduler (const intpriority)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SCHEDULERS.html[10/28/2011 1:32:35 PM]

SCHEDULERS

This function prototype returns the number of


messages stored in the array of either a
specific queue, or all queues that the
scheduler controls.

Parameters:
priority

Returns:
int

Scheduler

- Priority of a queue

- Bytes in queue is used.

void Scheduler (intqueueIndex, int*qDelayVal, int*totalTransmissionVal, const clocktypecurrentTime,


BOOLisResetTotalTransmissionVal)

Parameters:
This function enable Qos monitoring for all
queues that the scheduler controls.

queueIndex
qDelayVal

- Queue index

- Queue delay

totalTransmissionVal
currentTime

- Transmission value

- Current simulation time

isResetTotalTransmissionVal

- Total Transmission is set or not

Returns:
- Null

void

Scheduler

void Scheduler (intpriority, intpacketSize, const clocktypecurrentTime)

Parameters:

This function enable data collection for


performance study of schedulers.

priority

- Priority of the queue

packetSize

- Size of packet

currentTime

- Current simulation time

Returns:
- Null

void

Scheduler

void Scheduler (Node*node, const char*layer, const intinterfaceIndex, const intinstanceId, const char*invokingProtocol,
const char*splStatStr)

Parameters:
This function invokes queue finalization.
node

- Pointer to Node structure

layer

- The layer string

interfaceIndex
instanceId

- Interface Index

- Instance Ids

invokingProtocol

- The protocol string

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SCHEDULERS.html[10/28/2011 1:32:35 PM]

SCHEDULERS

splStatStr

- Special string for stat print

Returns:
- Null

void

SCHEDULER_Setup

void SCHEDULER_Setup (Scheduler**scheduler, const charschedulerTypeString[], BOOLenableSchedulerStat, const


char*graphDataStr)

Parameters:
This function runs the generic and then
algorithm-specific scheduler initialization
routine.

scheduler

- Pointer of pointer to Scheduler class

schedulerTypeString[]
enableSchedulerStat
graphDataStr

- Scheduler Type string

- Scheduler Statistics is set YES or NO

- Scheduler's graph statistics is set or not

Returns:
- Null

void

GenericPacketClassifier

int GenericPacketClassifier (Scheduler*scheduler, intpktPriority)

Parameters:

Classify a packet for a specific queue

scheduler

- Pointer to a Scheduler class.

pktPriority

- Incoming packet's priority

Returns:
int

- Integer.

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SCHEDULERS.html[10/28/2011 1:32:35 PM]

SLIDING-WINDOW

QualNet 5.2 API Reference


SLIDING-WINDOW
This file describes data structures and functions to implement a sliding window.
Constant / Data Structure Summary
Type

Name

STRUCT

MsTmWin

sliding time window averager structure

Function / Macro Summary


Return Type

Summary

void

MsTmWinInit(MsTmWin*pWin, clocktypesSize, intnSlot, doubleweight, clocktypetheTime)

initialize time sliding window with the given parameters


void

MsTmWinInit(MsTmWin*pWin, clocktypesSize, intnSlot, doubleweight, clocktypetheTime)

resets time sliding window with the given parameters


void

MsTmWinNewData(MsTmWin*pWin, doubledata, clocktypetheTime)

updates time sliding window with the given new data


clocktype

MsTmWinWinSize(MsTmWin*pWin, clocktypetheTime)

returns the window size


double

MsTmWinSum(MsTmWin*pWin, clocktypetheTime)

computes the data sum of the window


double

MsTmWinAvg(MsTmWin*pWin, clocktypetheTime)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SLIDING-WINDOW.html[10/28/2011 1:32:44 PM]

SLIDING-WINDOW

computes the data average of the window


double

MsTmWinTotalSum(MsTmWin*pWin, clocktypetheTime)

computes the total data sum


double

MsTmWinTotalAvg(MsTmWin*pWin, clocktypetheTime)

computes the total data average

Constant / Data Structure Detail

Structure

MsTmWin

sliding time window averager structure

Function / Macro Detail


Function / Macro
MsTmWinInit

Format
void MsTmWinInit (MsTmWin*pWin, clocktypesSize, intnSlot, doubleweight, clocktypetheTime)

Parameters:

initialize time sliding window with the given


parameters

pWin

- pointer to the time sliding window

sSize

- sliding window slot size

nSlot

- sliding window number of slots

weight

- weight for average computation

theTime

- the current time

Returns:
- None

void

MsTmWinInit

void MsTmWinInit (MsTmWin*pWin, clocktypesSize, intnSlot, doubleweight, clocktypetheTime)

Parameters:

resets time sliding window with the given


parameters

pWin

- pointer to the time sliding window

sSize

- sliding window slot size

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SLIDING-WINDOW.html[10/28/2011 1:32:44 PM]

SLIDING-WINDOW

nSlot

- sliding window number of slots

weight

- weight for average computation

theTime

- the current time

Returns:
void

- None

MsTmWinNewData

void MsTmWinNewData (MsTmWin*pWin, doubledata, clocktypetheTime)

Parameters:

updates time sliding window with the given


new data

pWin

- pointer to the time sliding window

data

- new data

theTime

- the current time

Returns:
void

- None

MsTmWinWinSize

clocktype MsTmWinWinSize (MsTmWin*pWin, clocktypetheTime)

Parameters:

returns the window size

pWin

- pointer to the time sliding window

theTime

- the current time

Returns:
clocktype

- the window size based on the current time

MsTmWinSum

double MsTmWinSum (MsTmWin*pWin, clocktypetheTime)

Parameters:

computes the data sum of the window

pWin

- pointer to the time sliding window

theTime

- the current time

Returns:
double

- the data sum of the window

MsTmWinAvg

double MsTmWinAvg (MsTmWin*pWin, clocktypetheTime)

Parameters:

computes the data average of the window

pWin

- pointer to the time sliding window

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SLIDING-WINDOW.html[10/28/2011 1:32:44 PM]

SLIDING-WINDOW

theTime

- the current time

Returns:
double

- the data average of the window

MsTmWinTotalSum

double MsTmWinTotalSum (MsTmWin*pWin, clocktypetheTime)

Parameters:

computes the total data sum

pWin

- pointer to the time sliding window

theTime

- the current time

Returns:
double

- the total data sum

MsTmWinTotalAvg

double MsTmWinTotalAvg (MsTmWin*pWin, clocktypetheTime)

Parameters:

computes the total data average

pWin

- pointer to the time sliding window

theTime

- the current time

Returns:
double

- the total data average

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/SLIDING-WINDOW.html[10/28/2011 1:32:44 PM]

TRACE

QualNet 5.2 API Reference


TRACE
This file describes data structures and functions used for packet tracing.
Constant / Data Structure Summary
Type

Name

CONSTANT

MAX_TRACE_LENGTH

Buffer for an XML trace record.

CONSTANT

TRACE_STRING_LENGTH

Generic maximum length of a string. The maximum length of any line in the input file is 3x this value.

ENUMERATION

TraceDirectionType

Different direction of packet tracing

ENUMERATION

PacketActionType

Different types of action on packet

ENUMERATION

PacketDirection

Direction of packet with respect to the node

ENUMERATION

TraceLayerType

Keeps track of which layer is being traced.

ENUMERATION

TraceIncludedHeadersType

Specifies if included headers are output.

ENUMERATION

PacketActionCommentType

Gives specific comments on the packet action here packet drop.

ENUMERATION

TraceProtocolType

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRACE.html[10/28/2011 1:32:58 PM]

TRACE

Enlisting all the possible traces

STRUCT

TraceData

Keeps track of which protocol is being traced.

STRUCT

PktQueue

Gives details of the packet queue

STRUCT

ActionData

Keeps track of protocol action

Function / Macro Summary


Return Type

Summary

void

TRACE_Initialize(Node*node, const NodeInput*nodeInput)

Initialize necessary trace information before simulation starts.


BOOL

TRACE_IsTraceAll(Node*node)

Determine if TRACE-ALL is enabled from configuration file.


void

TRACE_PrintTrace(Node*node, Message*message, TraceLayerTypelayerType, PacketDirectionpktDirection,


ActionData*actionData)

Print trace information to file. To be used with Tracer.


void

TRACE_PrintTrace(Node*node, Message*message, TraceLayerTypelayerType, PacketDirectionpktDirection,


ActionData*actionData, NetworkTypenetType)

Print trace information to file. To be used with Tracer.


void

TRACE_EnableTraceXML(Node*node, TraceProtocolTypeprotocol, char*protocolName, TracePrintXMLFnxmlPrintFn,


BOOLwriteMap)

Enable XML trace for a particular protocol.


void

TRACE_EnableTraceXML(Node*node, TraceProtocolTypeprotocol, char*protocolName, TracePrintXMLFnxmlPrintFn,


BOOLwriteMap)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRACE.html[10/28/2011 1:32:58 PM]

TRACE

Enable XML trace for a particular protocol.


void

TRACE_DisableTraceXML(Node*node, TraceProtocolTypeprotocol, char*protocolName, BOOLwriteMap)

Disable XML trace for a particular protocol.


void

TRACE_WriteToBufferXML(Node*node, char*buf)

Write trace information to a buffer, which will then be printed to a file.


void

TRACE_WriteTraceHeader(FILE*fp)

Write trace header information to the partition's trace file


void

TRACE_WriteXMLTraceTail(FILE*fp)

Write trace tail information to the partition's trace file

Constant / Data Structure Detail

Constant

MAX_TRACE_LENGTH(4090)

Constant

Buffer for an XML trace record.


TRACE_STRING_LENGTH400

Enumeration

Generic maximum length of a string. The maximum length of any line in the input file is 3x this value.
TraceDirectionType

Enumeration

Different direction of packet tracing


PacketActionType

Enumeration

Different types of action on packet


PacketDirection

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRACE.html[10/28/2011 1:32:58 PM]

TRACE

Enumeration

Direction of packet with respect to the node


TraceLayerType

Enumeration

Keeps track of which layer is being traced.


TraceIncludedHeadersType

Enumeration

Specifies if included headers are output.


PacketActionCommentType

Enumeration

Gives specific comments on the packet action here packet drop.


TraceProtocolType

Structure

Enlisting all the possible traces


TraceData

Structure

Keeps track of which protocol is being traced.


PktQueue

Structure

Gives details of the packet queue


ActionData

Keeps track of protocol action

Function / Macro Detail


Function / Macro
TRACE_Initialize

Format
void TRACE_Initialize (Node*node, const NodeInput*nodeInput)

Parameters:

Initialize necessary trace information before


simulation starts.

node

- this node

nodeInput

- access to configuration file

Returns:
file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRACE.html[10/28/2011 1:32:58 PM]

TRACE

void

- NULL

TRACE_IsTraceAll

BOOL TRACE_IsTraceAll (Node*node)

Parameters:

Determine if TRACE-ALL is enabled from


configuration file.

node

- this node

Returns:
BOOL

TRACE_PrintTrace

- TRUE if TRACE-ALL is enabled, FALSE otherwise.

void TRACE_PrintTrace (Node*node, Message*message, TraceLayerTypelayerType, PacketDirectionpktDirection,


ActionData*actionData)

Parameters:
Print trace information to file. To be used
with Tracer.

node

- this node

message

- Packet to print trace info from.

layerType

- Layer that is calling this function.

pktDirection
actionData

- If the packet is coming out of

- more details about the packet action

Returns:
void

TRACE_PrintTrace

- NULL

void TRACE_PrintTrace (Node*node, Message*message, TraceLayerTypelayerType, PacketDirectionpktDirection,


ActionData*actionData, NetworkTypenetType)

Parameters:
Print trace information to file. To be used
with Tracer.

node

- this node

message

- Packet to print trace info from.

layerType

- Layer that is calling this function.

pktDirection
actionData
netType

- If the packet is coming out of

- more details about the packet action

- The network type.

Returns:
void

TRACE_EnableTraceXML

- NULL

void TRACE_EnableTraceXML (Node*node, TraceProtocolTypeprotocol, char*protocolName,


TracePrintXMLFnxmlPrintFn, BOOLwriteMap)

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRACE.html[10/28/2011 1:32:58 PM]

TRACE

Parameters:
Enable XML trace for a particular protocol.
node

- this node

protocol

- protocol to enable trace for

protocolName
xmlPrintFn
writeMap

- name of protocol

- callback function

- flag to print protocol ID map

Returns:
void

TRACE_EnableTraceXML

- NULL

void TRACE_EnableTraceXML (Node*node, TraceProtocolTypeprotocol, char*protocolName,


TracePrintXMLFnxmlPrintFn, BOOLwriteMap)

Parameters:
Enable XML trace for a particular protocol.
node

- this node

protocol

- protocol to enable trace for

protocolName
xmlPrintFn
writeMap

- name of protocol

- callback function

- flag to print protocol ID map

Returns:
void

- NULL

TRACE_DisableTraceXML

void TRACE_DisableTraceXML (Node*node, TraceProtocolTypeprotocol, char*protocolName, BOOLwriteMap)

Parameters:

Disable XML trace for a particular protocol.

node

- this node

protocol

- protocol to enable trace for

protocolName
writeMap

- name of protocol

- flag to print protocol ID map

Returns:
void

- NULL

TRACE_WriteToBufferXML

void TRACE_WriteToBufferXML (Node*node, char*buf)

Parameters:

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRACE.html[10/28/2011 1:32:58 PM]

TRACE

Write trace information to a buffer, which


will then be printed to a file.

node
buf

- This node.

- Content to print to trace file.

Returns:
void

- NULL

TRACE_WriteTraceHeader

void TRACE_WriteTraceHeader (FILE*fp)

Parameters:

Write trace header information to the


partition's trace file

fp

- pointer to the trace file.

Returns:
void

- NULL

TRACE_WriteXMLTraceTail

void TRACE_WriteXMLTraceTail (FILE*fp)

Parameters:

Write trace tail information to the partition's


trace file

fp

- pointer to the trace file.

Returns:
void

- NULL

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRACE.html[10/28/2011 1:32:58 PM]

TRANSPORT LAYER

QualNet 5.2 API Reference


TRANSPORT LAYER
This file describes data structures and functions used by the Tansport Layer.
Constant / Data Structure Summary
Type

Name

CONSTANT

TRANSPORT_DELAY

Delay to process a packet in transport layer

ENUMERATION

TransportProtocol

Enlisting different transport layer protocol

STRUCT

TransportData

Main data structure of transport layer

Constant / Data Structure Detail

Constant

TRANSPORT_DELAY(1 * MICRO_SECOND)

Enumeration

Delay to process a packet in transport layer


TransportProtocol

Structure

Enlisting different transport layer protocol


TransportData

Main data structure of transport layer

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRANSPORT LAYER.html[10/28/2011 1:33:17 PM]

TRANSPORT LAYER

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/TRANSPORT LAYER.html[10/28/2011 1:33:17 PM]

USER

QualNet 5.2 API Reference


USER
This file describes data structures and functions used by the User Layer.
Constant / Data Structure Summary
Type

Name

CONSTANT

USER_PHONE_STARTUP_DELAY

Delay from a cellphone is powered on until it can start working.

CONSTANT

USER_INCREASE_DISSATISFACTION

The step value that the user dissatisfaction degree is increased each time.

CONSTANT

USER_CECREASE_DISSATISFACTION

The step value that the user dissatisfaction degree is decreased each time.

ENUMERATION

UserApplicationStatus

Status of an user application session.

STRUCT

UserAppInfo

Data structure stores information of one user application session.

STRUCT

UserStatus

Data structure stores statuses of a user

STRUCT

struct_user_str

Data structure stores information of a user

Function / Macro Summary

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/USER.html[10/28/2011 1:33:27 PM]

USER

Return Type

Summary

void

USER_HandleCallUpdate(Node*node, UserApplicationStatusappStatus)

Reaction to the status change of an application session


void

USER_HandleUserLayerEvent(Node*node, Message*msg)

Handle messages and events for user layer


void

USER_SetTrafficPattern(Node*node)

Set a user's traffic pattern based on its profile.


void

USER_SetApplicationArrival(Node*node)

Schedule an application arrival time.

Constant / Data Structure Detail

Constant

USER_PHONE_STARTUP_DELAY5S

Constant

Delay from a cellphone is powered on until it can start working.


USER_INCREASE_DISSATISFACTION0.1

Constant

The step value that the user dissatisfaction degree is increased each time.
USER_CECREASE_DISSATISFACTION-0.1

Enumeration

The step value that the user dissatisfaction degree is decreased each time.
UserApplicationStatus

Structure

Status of an user application session.


UserAppInfo

Structure

Data structure stores information of one user application session.


UserStatus

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/USER.html[10/28/2011 1:33:27 PM]

USER

Structure

Data structure stores statuses of a user


struct_user_str

Data structure stores information of a user

Function / Macro Detail


Function / Macro
USER_HandleCallUpdate

Format
void USER_HandleCallUpdate (Node*node, UserApplicationStatusappStatus)

Parameters:

Reaction to the status change of an


application session

node

- Pointer to node.

appStatus

- New status of the app session

Returns:
void

- NULL

USER_HandleUserLayerEvent

void USER_HandleUserLayerEvent (Node*node, Message*msg)

Parameters:

Handle messages and events for user layer

node
msg

- Pointer to node.

- The event

Returns:
void

- NULL

USER_SetTrafficPattern

void USER_SetTrafficPattern (Node*node)

Parameters:

Set a user's traffic pattern based on its profile.

node

- Pointer to node.

Returns:
void

- NULL

USER_SetApplicationArrival

void USER_SetApplicationArrival (Node*node)

Parameters:

Schedule an application arrival time.

node

- Pointer to node.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/USER.html[10/28/2011 1:33:27 PM]

USER

Returns:
void

- NULL

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/USER.html[10/28/2011 1:33:27 PM]

WALLCLOCK

QualNet 5.2 API Reference


WALLCLOCK
This file describes methods of the WallClock class whose primary use is to keep track of the amount of real time that has passed during the simulation.
Function / Macro Summary
Return Type

Summary

BOOL

WallClock(void)

This method returns true if the WallClock is currently in the paused state.
double

WallClock()

Return the real time multiple


void

WallClock(void)

Pausing of the WallClock can be disabled by any external interface ambassador. Permission to pause is all or nothing, so if any external
interface disables pause, no pausing is allowed. As an example, a simulation using IPNE and HLA is run. If the IPNE code disables
pausing, then HLA won't be able to pause the WallClock or in other words the wall clock's value for time just keeps running.
void

WallClock(void)

Allows pausing of the WallClock


double

WallClock(void)

Get the amount of time, in seconds, spent paused.

Function / Macro Detail


Function / Macro
WallClock

Format
BOOL WallClock (void)

Parameters:
void

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/WALLCLOCK.html[10/28/2011 1:33:42 PM]

WALLCLOCK

This method returns true if the WallClock is


currently in the paused state.

- None
Returns:
BOOL

- TRUE or FALSE

WallClock

double WallClock ()

Parameters:

Return the real time multiple

Returns:
double

- None

WallClock

void WallClock (void)

Parameters:

Pausing of the WallClock can be disabled by


any external interface ambassador.
Permission to pause is all or nothing, so if
any external interface disables pause, no
pausing is allowed. As an example, a
simulation using IPNE and HLA is run. If the
IPNE code disables pausing, then HLA won't
be able to pause the WallClock or in other
words the wall clock's value for time just
keeps running.
WallClock

void WallClock (void)

Parameters:

Allows pausing of the WallClock

void

- None

Returns:
void

void

- None

- None

Returns:
void

- None

WallClock

double WallClock (void)

Parameters:

Get the amount of time, in seconds, spent


paused.

void

- None

Returns:
double

- The amount of time paused, in seconds.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/WALLCLOCK.html[10/28/2011 1:33:42 PM]

WALLCLOCK

Contact QualNet Support for questions pertaining to the QualNet API Reference. This document is confidential and proprietary.
It may not be reproduced or distributed without the expressed written consent of Scalable Network Technologies.

QualNet is a Registered Trademark of Scalable Network Technologies.

Copyright 2001-2011 Scalable Network Technologies, Inc. All rights reserved.

file:///X|/Documentation/QualNet%20Documentation/QualNet%205.2/API%20Reference/API%20Reference/WALLCLOCK.html[10/28/2011 1:33:42 PM]

You might also like