pull/2/head
Jeff Weston 2019-09-11 12:06:47 -04:00
parent 8e24aea5ed
commit 4ecd0ad025
204 changed files with 29178 additions and 10600 deletions

72
BUILD.TXT Normal file
View File

@ -0,0 +1,72 @@
Building NORM
=============
NORM can be built using the Waf build tool, included in the distribution.
To see a full list of options, run:
./waf -h
Configuring
-----------
To perform the configure checks, run:
./waf configure
Some options for the configure step:
--prefix=<DIR> - Directory to install files to (Default - /usr/local)
--debug - Builds a debug build (with debugging symbols), otherwise an
optimized library is built.
--build-python - Builds the Python extension
--build-java - Builds the Java extension
You must set the JAVA_HOME environment variable to the location of your
JDK directory
Building
--------
To build the library, simply run:
./waf
To build examples along with the library, run:
./waf --targets=ex1,ex2,...
Where ex1,ex2 is the name of the example you want to build (see ./waf list).
Additionally, you can add the "--targets=*" flag to build all the example
programs.
Installing
----------
To install, run:
./waf install
This will install the compiled library and headers to wherever your prefix was
specified. (See configure flags)
Uninstalling
------------
Waf tracks the files it installs, so run:
./waf uninstall
to remove all files from a previous ./waf install
Cleaning
--------
./waf clean
will delete all compiled files and configuration settings.
./waf distclean
will do the same as clean, and additionally delete the waf cache files.

File diff suppressed because it is too large Load Diff

Binary file not shown.

177
NormSocketBindingNotes.txt Normal file
View File

@ -0,0 +1,177 @@
NORM SOCKET BINDING NOTES
=========================
NORM supports a number of socket binding options to allow for multiple paradigms of use. The default operation of NORM involves two separate sockets:
1) a "tx_socket" used for sender transmission and reception of unicast feedback, and
2) a "rx_socket" used for reception of packets sent to the "session" address/port
By default both sockets are bound to INADDR_ANY with the rx_socket using the "session port" number and the
tx_socket using a port freely assigned by the operating system unless the NormSetTxPort() API is invoked. The INADDR_ANY binding allows the sockets to receive packets from any remote address/port thus support NORM's typical multicast operation compatible with both unicast and multicast feedback and even "many-to-one" unicast reception (if unicast feedback is set via NormSetDefaultUnicastNack()).
Some optional binding behaviors are invoked depending upon some additional NORM API calls. For example, the "rx_socket" can be optionally bound to the session address. This restricts the rx_socket to receive only packets specifically directed to the configured session address. The session address must be a multicast address or valid local IP address for this to work. And in the latter case, the NormSession MUST be operated
only as a NORM receiver (i.e., NormStartSender() will result in transmissions to self only!)
The rationale for the separate tx_socket and rx_socket usage was to enable NORM senders to detect when unicast feedback is used so that proper protocol behaviors are invoked (e.g. NORM_CMD(REPAIR_ADV)). Note that the code base _may_ be eventually updated so this is no longer necessary (e.g. through use of the "recvmsg()" system call
with proper socket configuration to receive UDP packet destination address header information). It may still be the case that a use case for separate send/recv sockets may persist and the code will continue to support that although it is possible that it may become the optional behavior rather than the default.
bind semantics: localAddr / localPort
connect semantics: remoteAddr / remotePort
+-------------------------------+-------------------------------+---------------------------------------+
| bind() state | connect() state | |
+---------------+---------------+---------------+---------------+ Behaviors |
| localAddr | localPort | remoteAddr | remotePort | |
+---------------+---------------+---------------+---------------+---------------------------------------+
| INADDR_ANY | 0 | NONE | OS-assigned port, sendto() any |
+---------------+---------------+---------------+---------------+---------------------------------------+
| INADDR_ANY | <port> | NONE | from any to <*/port>, sendto() any |
+---------------+---------------+---------------+---------------+---------------------------------------+
| <addr> | <port> | NONE | from any to <addr/port>. sendto() any |
+---------------+---------------+---------------+---------------+---------------------------------------+
| INADDR_ANY | <port> | remoteAddr | remotePort | from remote to <*/port> |
+---------------+---------------+---------------+---------------+---------------------------------------+
| <addr> | <port> | remoteAddr | remotePort | from remote to <addr/port> only |
+---------------+---------------+---------------+---------------+---------------------------------------+
The Rules:
If you don't bind(), you don't receive anything.
If you connect() you can only send to the specified connected addr / port.
Cannot connect to multicast addr.
Can only bind to multicast or valid local IP addr
With port reuse, each multicast socket will get a copy of matching inbound multicast packets. In fact, with an INADDR_ANY bind, the socket will get packets for _any_ group joined if the port number matches. But with an inbound unicast packet, only one socket with closest matching binding will get the packet. This includes
the bind() (i.e. local addr/port) _and_ connect() (i.e. remote addr/port) state with regard to the incoming packet where the most specific match is considered the best match.
Thus these bind/connect combinations are important in order to achieve some desired set of behaviors.
DESIRED BEHAVIORS:
1) NORM sender / receiver operation with feedback to the session port and/or unicast feedback.
2) Binding packet reception for socket(s) to specific address(es) with or without port reuse
NormSetTxPort() currently has option to bind the tx_socket to a specific local address (txAddress)
NormSetRxPortReuse() currently has option to bind rx_socket to multicast session address.
TBD - Need to add "NormSetRxAddress()" to bind rx_socket to non-session local address
3) Connecting socket(s) to remote unicast addr/port so that reused port demuxing works properly
(This is probably applicable only to unicast sessions)
So, the following conditions should be true to "connect" the socket:
1) Session address is unicast
2) Port reuse is true.
XXX - finish these thoughts and revise the implementation!!!!!
REQUIREMENTS
Enumerate some use cases and the corresponding socket behavior requirements
1) Default: sender/receiver multicast operation w/ mcast and ucast feedback
tx_socket : sendto() session addr/port,sender(s) addr/port
recvfrom() receiver src addr/port to local ucast addr
rx_socket : recvfrom() sender addr/port to session addr/port
If rxAddr is unspecified, can also receive to unicast
2) Sender-only one-to-many
tx_socket : sendto() session addr/port,sender(s) addr/port
recvfrom() receiver src addr/port to local ucast addr
rx_socket : recvfrom() sender addr/port to session addr/port (mcast feedback)
3) Receive-only many-to-one unicasts
tx_socket : sendto() senders addr/port
rx_socket : recvfrom() senders addr/port to session port
4) Bi-directional unicast
tx_socket : sendto() session addr/port
rx_socket : recvfrom() session addr/* to session port
IMPLEMENTATION NOTES:
1) Default binding
rx_socket : INADDR_ANY / <sessionPort>
tx_socket : INADDR_ANY / 0 (any port)
Implementation Details:
This is the default behavior if none of the additional API calls described below are made.
---------------------------------------------------------------------------
2) The NormSetTxPort(txPort, enableReuse, txAddr) lets this be modified by:
a) if (txPort != sessionPort) tx_socket is bound to <txPort>
b) if (txPort == sessionPort) rx_socket is used for transmission, too
c) if "enableReuse" is true, PORT/ADDR REUSE is set for tx_socket
d) if txAddr is valid, the tx_socket (or (TBD) rx_socket if txPort == sessionPort) is bound
to the given <txAddr> which must be a valid IP addr for the host (This means only
unicast packets for that address are received on that socket. Thus the binding is _not_
made for the rx_socket case if the session address is a multicast address!
Implementation Details:
TBD
---------------------------------------------------------------------------
3) The NormSetRxPortReuse(enable, bindToSessionAddr) modifies the default binding as follows:
a) If <enable> is "true", PORT/ADDR REUSE is set for the rx_socket
b) if <bindToSessionAddr> is "true" _and_ the session address is multicast, the rx_socket
binding is <sessionAddr> / <sessionPort>. This enables the same port number to be
reused for different multicast session addresses _and_ restricts the rx_socket to receive
only packets destined for the sessionAddr. In this case, unicast feedback to the rx_socket
(i.e. in the case of above where txPort == sessionPort) will NOT work!
TBD - The code resolves this conflict by ...
Implementation Details:
TBD
---------------------------------------------------------------------------
4) The NormSetTxOnly() causes only the tx_socket to be opened and no rx_socket is opened. In fact,
the rx_socket is closed if it is already open (unless txPort == sessionPort ala above)
Implementation Details:
TBD

Binary file not shown.

Binary file not shown.

83
README-Java.txt Normal file
View File

@ -0,0 +1,83 @@
Java JNI bindings for NORM
==========================
By:
Jason Rush <jason.rush@gd-ais.com>
Peter Griffin <peter.griffin@gd-ais.com>
The Java JNI bindings for NORM provide Java bindings for the NORM C API.
For documentation about the main NORM API calls, refer to the NORM Developers
guide in the regular NORM distribution.
------------
Requirements
------------
Java JNI bindings for NORM requires at least Java 1.5; however, it has also
been tested with Java 1.6.
The NORM library should be built prior to building the Java JNI bindings since
they link against it.
Apache Ant is required for building the class files and jar file.
------------
Building
------------
The build files for Java JNI bindings for NORM are located in the
makefiles/java directory.
To build the NORM jar file, execute Apache Ant in the makefiles/java directory:
ant jar
This will produce a norm-<version>.jar file in the lib/ directory.
To build the accompanying NORM native bindings library, execute make in the
makefiles/java directory with the correct make file for your system:
make -f Makefile.linux
This will produce a libmil_navy_nrl_norm.so file in the lib/ directory.
------------
Installation
------------
The norm-<version>.jar file must be on the classpath.
The libmil_navy_nrl_norm.so file must be installed in a location that Java
will search at runtime for native libraries. The search path is dependent
upon the operating system:
Windows:
Windows system directories
Current working directory
PATH environment variable
Unix:
Current working directory
LD_LIBRARY_PATH environment variable
You can also specify the directory with the java.library.path Java system
property on startup:
java -Djava.library.path=<dir> ...
Finally the native library can also be installed in the JRE's library
directory. This allows all programs that use the JRE to access the library:
<JRE_HOME>/lib/i386/
If you observe an "java.lang.UnsatisfiedLinkError" exception while running
your application, you do not have the libmil_navy_nrl_norm.so installed in
the correct location.
------------
Examples
------------
Examples using the Java JNI bindings for NORM are provided in the examples/java
directory.

43
README-PyNorm.txt Normal file
View File

@ -0,0 +1,43 @@
PyNORM - Python Wrapper for NORM & Extras
=========================================
By: Tom Wambold <wambold@itd.nrl.navy.mil>
PyNORM provides a thin wrapper around the NORM C API in the main package. It
also provides several additional modules in the extra package to provide higher
level usage of NORM.
For documentation about the main NORM API calls, refer to the NORM Developers
guide in the regular NORM distribution.
Also, the files in the examples/python directory have a lot of good info on how
to use the library. For simple apps, see the normFileSend and normFileReceive
scripts.
------------
Requirements
------------
PyNORM has been tested on Python versions 2.5 and 2.6. The code may work on
earlier versions, but was not tested.
PyNORM requires NORM to be built as a shared library (.so, .dylib, .dll), so
that Python's "ctypes" module can load it. Ctypes will look for the library
in similar places as your system's compiler. On UNIX systems, this is usually
/usr/lib and /usr/local/lib, etc. On Windows, this searches folders in the
PATH environment variable.
On Windows, PyNORM requires the "PyWin32" module, available at:
http://sf.net/projects/pywin32
-----------------------
"Extra" Package Modules
-----------------------
manager.py:
This provides a callback-driven event loop for NORM. It operates on a
separate thread, calling registered functions in response to NORM events.
logparser.py:
This provides a function to reads NORM debug "reports" (printed at debug
level 3 or higher) from a log file, and parses them into Python objects.

View File

@ -13,16 +13,11 @@ modification, are permitted provided that:
(1) source code distributions retain this paragraph in its entirety,
(2) distributions including binary code include this paragraph in
its entirety in the documentation or other materials provided
with the distribution, and
(3) all advertising materials mentioning features or use of this
(2) all advertising materials mentioning features or use of this
software display the following acknowledgment:
"This product includes software written and developed
by Brian Adamson and Joe Macker of the Naval Research
Laboratory (NRL)."
by the Naval Research Laboratory (NRL)."
The name of NRL, the name(s) of NRL employee(s), or any entity
of the United States Government may not be used to endorse or
@ -43,7 +38,7 @@ purposes, the authors would prefer that the code not be
re-distributed so that users will obtain the latest (and most
debugged/improved) release from the official NORM web site:
<http://norm.pf.itd.nrl.navy.mil>
<http://cs.itd.nrl.navy.mil/work/norm>
SOURCE CODE
@ -63,15 +58,14 @@ The following items can be build from this source code release:
be provided as additional documentation in the future)
3) norm (or norm.exe (WIN32) - command-line "demo" application
2) norm (or norm.exe (WIN32) - command-line "demo" application
built from "common/normApp.cpp"
(The included "Norm User's Guide" provides a rough overview
of how to use this demo app. This document requires some
updating to be accurate and complete. This demo application
of how to use this demo app. This demo application
is useful for file transfers (and streaming on Unix))
4) normTest (or normTest.exe (WIN32)) - very simple test application
3) normTest (or normTest.exe (WIN32)) - very simple test application
(The "normTest" application (see "common/normTest.cpp") is really
just a simple playground for preliminary testing of the NORM
@ -80,7 +74,7 @@ The following items can be build from this source code release:
(and better-documented) examples of NORM API usage will be
provided in the future.
5) There is also an "examples" directory in the source code tree
4) There is also an "examples" directory in the source code tree
that contains some simplified examples of NORM API usage. The
example set will be expanded as time progresses.

View File

@ -1,12 +1,44 @@
TODO:
0) Fix implementation of NORM_DATA_FLAG_REPAIR.
2) Add mechanism to allow window-based control of NORM server
transmission rate.
7) Build "norm daemon" using API.
10) Release wxNormChat project
11) Test, release "naft" (updated "raft") for reliable UDP streaming.
13) Fix ns-2 issue when Agent/NORM is attached to ns-2 node ZERO and
results in a NormNode attempting to be assigned NORM_NODE_NONE as
a node id.
14) IMPORTANT: double check ACKing in reponse to watermark polling and
relation to cc feedback suppression, etc ... watermark acks should
be unicast and not affect cc feedback?
17) Set objectId in TX_FLUSH_COMPLETED and TX_WATERMARK_COMPLETED events.
18) Add APIs for managing remote server state kept at receiver
22) Implement LDPC FEC code within NORM as alternative to Reed Solomon
23) Add ability to control receiver cache on a per-sender basis?
(max_pending_range, etc)
26) Add API calls to get error information
27) Add API calls to read logged statistics
=========================
COMPLETED:
1) Implement unicast feedback of NACK messages and server
re-advertisement for suppressing the unicast feedback.
(COMPLETED)
2) Add mechanism to allow window-based control of NORM server
transmission rate.
3) Implement TFMCC and/or PGM-CC congestion control mechanisms
within NORM. (TFMCC COMPLETED)
@ -24,35 +56,17 @@
6) Implement and document simple API to control and access NORM
features. (COMPLETED and enhancement in progress)
7) Build "norm daemon" using API.
8) JAVA API for NRL NORM Protocol library (COMPLETED - Thanks Peter Griffin & Jason Rush)
8) JAVA API for NRL NORM Protocol library
9) Correct/complete user guide for "norm" demo app (COMPLETED)
9) Correct/complete user guide for "norm" demo app
10) Release wxNormChat project
11) Test, release "naft" (updated "raft") for reliable streaming.
12) Can we eliminate rapid clr norm-cc probing when data is
not being actively sent? (COMPLETED)
13) Fix ns-2 issue when Agent/NORM is attached to ns-2 node ZERO and
results in a NormNode attempting to be assigned NORM_NODE_NONE as
a node id.
14) IMPORTANT: double check ACKing in reponse to watermark polling and
relation to cc feedback suppression, etc ... watermark acks should
be unicast and not effect cc feedback?
15) Implement TX_OBJECT_SENT event (COMPLETED)
16) Set NORM_DATA "NORM_FLAG_REPAIR" properly
17) Set objectId in TX_FLUSH_COMPLETED and TX_WATERMARK_COMPLETED events.
18) Add APIs for managing remote server state kept at receiver
19) Fix "activity_timer" interval setting (COMPLETED)
20) Fix issue related to setting tx cache count_max > 256!
@ -63,12 +77,7 @@
(COMPLETED - reimplemented, adding tx_repair_pending index to use
instead of seeking each time)
22) Implement LDPC FEC code within NORM as alternative to Reed Solomon
23) Add ability to control receiver cache on a per-sender basis?
(max_pending_range, etc)
24) Look at NormStreamObject::StreamAdvance() for "push-enabled" streams
(COMPLETED)
25) Improved, consistent socket binding options

View File

@ -1,5 +1,138 @@
NORM Version History
Version 1.5b1
=============
- Added option to set NORM receiver "rx cache count max", i.e. the
maximum number of pending object for which the receiver will keep
state (per sender). The "NormSetRxCacheLimit()" API call was added
to control this option.
- Implemented timer-based flow control so that NORM sender apps will not
force purge of old buffered objects (or stream data) for which there is
"recent" NACK activity. What is considered "recent" is based upon
"flowControlFactor*GRTT_sender*(1 + backoffFactor)". Note that a
"flowControlFactor" of 2.0 is default, but can be adjusted. A
new API call "NormSetFlowControl()" will be provided for this. Note that
if insufficient buffering is allocated, this flow control may limit
transmission rate for a given (delay*bandwidth, packetLoss conditions.
However, the likely alternative (if flow control is disabled) is that
reliability would not be perfectly maintained. Note that enabling the
sender "push" option of course overrides the flow control for streams.
For file/data objects, the app could choose to explicitly cancel
(dequeue) objects or disable the flow control if the app wishes to "push
ahead" regardless of impact to reliability. Note that when "pushing",
NORM strives to provide whatever reliability is possible given the
buffering/delay/bandwidth constraints the app imposes.
- Fixed problem with NormServeNode::PassiveRepairCheck() that caused
NORM to sometimes falsely acknowledge an object that was not yet
received (Thanks to Jeff Bush for finding this one).
- Added initial option for Explicit Congestion Notification (ECN) support
in "real-world" code. This includes raw packet capture (via ProtoCap)
so that ECN header info can be examined and setting ECT-Capable Transport
(ECT) bits in IP TOS/Trafffic Class header field.
- Fixed bug in NORM API "NormFileGetName()" call that would overrun buffer
(Thanks to Adrian Cox)
- Fixed bug with NORM probe_timer "lockup" when tx_rate is set to 0.0
(Thanks again to Adrian Cox)
- Added experimental receiver "real-time" buffer management option.
(not yet in API). Causes receiver to enqueue new data in favor of
old, incomplete data when buffer-constrained. _May_ be useful for
apps where receipt of "fresh" data is more important than reliability.
- Added "requeue" option to "norm" test app to allow multiple retransmissions
of a file to be "stitched" together by a NORM receiver. See the
NormRequeueObject() API call. Thanks to Keith Hogie/ Ed Criscuolo
for suggesting this.
- Enhanced NormSetRxPortReuse() behavior when bindSessionToAddr is true
such that for unicast sessions a UDP socket "connect()" call is made
to effectively "bind" the NormSession rx_socket to the remote
unicast addr. This _should_ enable proper demultiplexing of
multiple unicast sessions using the same port. (Note that this
same technique _may_ be adopted in the future for Source-Specific
Multicast (SSM) support as well where a NormSession is associated
with a specific remote single sender.)
- Added code to NormServerNode::Activate() so that when a previously
INACTIVE remote sender becomes active again (reactivated) that
the receiver automatically kicks off a new cycle of self-initiated
NACKing for any pending objects. Note this code applies when
the "reactivation" is due to a non-object message (e.g. NORM_CMD)
as reception of an object message (NORM_DATA/ NORM_INFO) will
re-awaken NACKing as needed anyway.
(Thanks to Jeff Bush for helping determine the utility of this)
- The NORM source code tree has been re-organized.
- Added Python language binding to NORM API, examples, etc
(Thanks to Tom Wambold)
- Added WAF build scripts, etc (Thanks again to Tom Wambold)
- iPhone Makefile added (Thanks yet again to Tom Wambold)
- Bug fix to NORM receiver "rx_object_table" and "rx_pending_mask"
interplay in NormSenderNode class. (Thanks to Dave Talmage for
stressing NORM enough to find this)
- Bug fix with parsing of "limit" command in normApp.cpp
(Thanks again to Dave Talmage)
- Fixed bug in "NormSessionMgr::NewSession()" where a call
was made to NormSession::SetTxPort() that should not
have been!
- Changed API calls to use "SetTx-XXX" and "SetRx-XXX" more
consistently instead of "SetTransmit-XXX", etc. Sorry for
a change to a couple of key API calls, but this will be
nicer in the long term.
- Fixed problems with NormSession::SenderQueueAppCmd() and
NormSession::SenderQueueSquelch() where there as two different
mis-uses of the NormSession::msg_pool. Thanks to Richard Edell
(MITRE) for finding this one.
- Fixed problem introduced with new support of multiple "fec_id"
types (this version) where receiver processing of NORM_CMD
messages with FecPayloadId content (e.g. FLUSH, SQUELCH, etc)
_before_ reception of NORM_DATA would result in erroneous
messages being generated.
Thanks again to Richard Edell (MITRE) for identifying this.
- Added optional parameter to NormSetCongestionControl() to allow
NORM-CC operation to collect feedback but NOT actually adjust
transmission rate. Also added NORM_TX_RATE_CHANGED notification
to inform app of when rate change (or suggested change) occurs.
- Fixed issue where a small object where INFO was received but no
DATA was not causing receiver NACK process to start upon FLUSH
receipt as it should. (Thanks to John Unger for finding this!)
- Updated JAVA JNI binding code courtesy patches from Kenn Fynn
(Dark Corner Software)
- Fixed bug where remote sender fec_id value was not cached when
only NORM_INFO has been received (thanks to Qingjun Xiao of GSU)
- Added NormSetAutoAckingNodes() API call (and underlying code) to
allow sender acking node list to be "auto populated" based on
hearing any message from a receiver (and/or optionally sender).
Also added NormGetNextAckingNode() API call to allow iteration
through acking node list to determine status (learn of who is
listening, etc). A feature _may_ be added to notify the
sender application when new receivers are detected (and added
to the list) and maybe even allow per-receiver control of whether
an ACK should be solicited or not. I.e., the acking node list would
become more of a "tracked" receiver list.
- Added enhanced congestion control feature where the receiver always
limits the reported rate back to the sender at no more than double
the observed receive rate. Adds LIMIT flag to feedback cc flags
to facilitate this reporting. This is not part of RFC 5740 but not
incompatible with it ... just works a little better. In the future,
another way to do this might be to adjust the reported loss value
accordingly ... and that would be RFC 5740 compliant although there
should be an errata or addendum to the RFC for this.
- Added ECN-based congestion control and simple loss-tolerant
congestion control options. These will be better documented and
perhaps extended in the future.
- Added extended precision loss estimate reporting by using "RESERVED"
field in CC feedback extension header. Again, non-RFC 5740 but
backwards compatible. This helps over large bandwidth-delay links
to get to higher data rates. Some more work will be done in this area
such as perhaps returning to some form of slow start (exponential increase)
behavior after many consecutive RTT with no congestion events. Probably should
mirror the return to slow start behavior that occurs when data transmission is
idle. This needs to be evaluated as NORM may start being unfairly aggressive
in such environments.
- This code has the beginnings of an approach to enable automated population
of the sender "acking node list"
- This code release needs to be more fully documented, but was important
to get online since it has _many_ improvements over the prior
"stable release"
Version 1.4b3
=============
- Fixed many (hopefully all) cases where NORM_DATA message FLAG_REPAIR
@ -21,6 +154,9 @@ Version 1.4b3
- Fixed issue with NormSession::QueueTxObject() where ASSERT() failure
occurred depending upon previous tx object enqueue/dequeue history
(Thanks to Jeff Bush for finding this one)
- Changed repeated scheduling of receiver remote sender inactivity
timer to ensure that busy CPU doesn't result in premature
inactivity indication.
- Fixed issue with fix for stream lockup problem from below.
(this is in version 1.4b3a)

View File

@ -1,70 +0,0 @@
#ifndef _NORM_ENCODER_RS8
#define _NORM_ENCODER_RS8
#include "protoDebug.h"
#include "protoDefs.h" // for UINT16
// (TBD) We're going to need to have a "NormEncoder" base class and then allow for variants
class NormEncoder
{
// Methods
public:
NormEncoder();
~NormEncoder();
bool Init(int numData, int numParity, int vectorSize);
void Destroy();
// "Encode" must be called in order of source vector0, vector1, vector2, etc
void Encode(unsigned char *dataVector, unsigned char **parityVectorList);
int GetNumData() {return ndata;}
int GetNumParity() {return npar;}
int GetVectorSize() {return vector_size;}
// Members
private:
int ndata; // max data pkts per block (k)
int npar; // No. of parity packets (n-k)
int vector_size; // Size of biggest vector to encode
unsigned char* enc_matrix;
int enc_index;
}; // end class NormEncoder
class NormDecoder
{
public:
NormDecoder();
~NormDecoder();
bool Init(int numData, int numParity, int vectorSize);
// Note: "erasureLocs" must be in order from lowest to highest!
int Decode(unsigned char** vectorList, int ndata, UINT16 erasureCount, UINT16* erasureLocs);
int NumParity() {return npar;}
int VectorSize() {return vector_size;}
void Destroy();
// Members
private:
bool InvertDecodingMatrix(); // used in Decode() method
int ndata; // max data pkts per block (k)
int npar; // No. of parity packets (n-k)
int vector_size; // Size of biggest vector to encode
unsigned char* enc_matrix;
unsigned char* dec_matrix;
int* parity_loc;
// These "inv_" members are used in InvertDecodingMatrix()
int* inv_ndxc;
int* inv_ndxr;
int* inv_pivt;
unsigned char* inv_id_row;
unsigned char* inv_temp_row;
}; // end class NormDecoder
#endif // _NORM_ENCODER_RS8

347
doc/NormDeveloperGuide.html Normal file

File diff suppressed because one or more lines are too long

BIN
doc/NormDeveloperGuide.pdf Normal file

Binary file not shown.

6985
doc/NormDeveloperGuide.xml Normal file

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

BIN
doc/NormUserGuide.pdf Normal file

Binary file not shown.

1163
doc/NormUserGuide.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,65 @@
NORM API Examples
=================
================= NORM API Examples =================
This directory contains some purposely simplified examples of NORM
API usage. See comments in the source code files on how to build
these on Unix platforms. Eventually, "Makefiles" (and hopefully
"configure" scripts) will be provided as well as Visual C++
project files for Win32 builds.
This directory contains some purposely simplified examples of NORM
API usage. See comments in the source code files on how to build
these on Unix platforms. Eventually, "Makefiles" (and hopefully
"waf" configure/build scripts) will be provided as well as Visual
C++ project files for Win32 builds.
The following example programs are included:
The following example programs are included:
(These two programs use a hard-coded multicast address and port,
but take a file name and directory name, respectively, as a
command-line argument to determine the file sent and the directory
to which receive files are stored.)
normFileSend.cpp - simple file transmission program. Sends one
normFileSend.cpp - simple file transmission program. Sends one
file and exits.
normFileRecv.cpp - simple file reception program. Receives one
normFileRecv.cpp - simple file reception program. Receives one
file and exits.
(These two programs use a hard-coded multicast address and port,
but take a file name and directory name, respectively, as a
command-line argument to determine the file sent and the
directory to which receive files are stored.)
Other examples will be added later including examples using the
"NormGetDescriptor()" function to allow NORM API events to be
multiplexed with other possible application events (e.g. other I/O
or Windows messages, etc).
------------- Brian Adamson <mailto:adamson@itd.nrl.navy.mil> 9
June 2005
normDataSend.cpp - simple NORM_OBJECT_DATA transmission program.
Sends a series of data objects of random size.
In this example, the NORM_INFO for the objects
is set with some text with some "info" about
the object.
normDataRecv.cpp - simple NORM_OBJECT_DATA reception program. This
receives the data objects that "normDataSend"
transmits and validates their correctness, in
part based on the "info" embedded in the
NORM_INFO.
java - There is a README.TXT in the java directory.
It explains the java examples, how to build
them, and how to run them.
NOTES:
Althought the normDataSend/Recv example use relatively small data
object sizes, the _intended_ use of NORM_OBJECT_DATA is for bulkier
content stored in application memory space.
For "messaging" applications that use modestly small message
sizes, the NORM_OBJECT_STREAM transport option in NORM is likely
to provide more efficient service than NORM_OBJECT_DATA for small
objects due to the packet level Forward Error Correction (FEC)
based packet recovery mechanism that NORM uses.
In the future, a similar "simple" example pair will be provided to
illustrate the NORM_OBJECT_STREAM form of transport. Meanwhile,
the "normTest.cpp" file in the "norm/src/common" directory
provides an example of the NORM API calls related to this.
Other examples will be added later including examples using the
"NormGetDescriptor()" function to allow NORM API events to be
multiplexed with other possible application events (e.g. other I/O
or Windows messages, etc).
Brian Adamson
<mailto:adamson@itd.nrl.navy.mil>
20 August 2010

View File

@ -0,0 +1,58 @@
import mil.navy.nrl.norm.NormEvent;
import mil.navy.nrl.norm.NormFile;
import mil.navy.nrl.norm.NormInstance;
import mil.navy.nrl.norm.NormNode;
import mil.navy.nrl.norm.NormObject;
import mil.navy.nrl.norm.NormSession;
import mil.navy.nrl.norm.enums.NormEventType;
import mil.navy.nrl.norm.enums.NormObjectType;
/**
* Example code to receive a file from the NormFileSend example.
*
* @author Jason Rush
*/
public class NormFileRecv {
public static void main(String[] args) throws Throwable {
if (args.length != 1) {
System.err.println("Usage: NormFileRecv <rxCachePath>");
return;
}
NormInstance instance = new NormInstance();
instance.setCacheDirectory(args[0]);
NormSession session = instance.createSession("224.1.2.3", 6003,
NormNode.NORM_NODE_ANY);
session.startReceiver(1024 * 1024);
NormEvent event;
while ((event = instance.getNextEvent()) != null) {
NormEventType eventType = event.getType();
NormObject normObject = event.getObject();
System.out.println(eventType);
switch (eventType) {
case NORM_RX_OBJECT_INFO:
byte[] info = normObject.getInfo();
String infoStr = new String(info, "US-ASCII");
System.out.println("Info: " + infoStr);
break;
case NORM_RX_OBJECT_COMPLETED:
if (normObject.getType() == NormObjectType.NORM_OBJECT_FILE) {
NormFile normFile = (NormFile)normObject;
String filename = normFile.getName();
System.out.println("NormFileObject: " + filename);
}
break;
}
}
session.stopReceiver();
session.destroySession();
instance.destroyInstance();
}
}

View File

@ -0,0 +1,44 @@
import java.nio.ByteBuffer;
import mil.navy.nrl.norm.NormEvent;
import mil.navy.nrl.norm.NormInstance;
import mil.navy.nrl.norm.NormNode;
import mil.navy.nrl.norm.NormSession;
import mil.navy.nrl.norm.enums.NormEventType;
/**
* Example code to send a file to the NormFileRecv example.
*
* @author Jason Rush
*/
public class NormFileSend {
public static void main(String[] args) throws Throwable {
if (args.length != 1) {
System.err.println("Usage: NormFileSend <filename>");
return;
}
NormInstance instance = new NormInstance();
NormSession session = instance.createSession("224.1.2.3", 6003,
NormNode.NORM_NODE_ANY);
session.startSender(1, 1024 * 1024, 1400, (short)64, (short)16);
// Enqueue some data
ByteBuffer byteBuffer = ByteBuffer.allocateDirect(1024);
session.dataEnqueue(byteBuffer, 0, 1024);
// Enqueue a file
session.fileEnqueue(args[0]);
NormEvent event;
while ((event = instance.getNextEvent()) != null) {
NormEventType eventType = event.getType();
System.out.println(eventType);
}
session.stopSender();
session.destroySession();
instance.destroyInstance();
}
}

View File

@ -0,0 +1,103 @@
import mil.navy.nrl.norm.*;
import mil.navy.nrl.norm.enums.NormEventType;
import mil.navy.nrl.norm.enums.NormObjectType;
/**
* The ... class ...
* <p/>
* Created by scmijt
* Date: Feb 14, 2010
* Time: 11:10:50 AM
*/
public class NormFileSendRecv extends Thread {
NormInstance instance;
NormSession session;
String fileToSend;
public NormFileSendRecv(String cacheDirectory, String fileToSend) throws Throwable {
instance = new NormInstance();
instance.setCacheDirectory(cacheDirectory);
session = instance.createSession("224.1.2.3", 6003,
NormNode.NORM_NODE_ANY);
session.setLoopback(true);
this.fileToSend=fileToSend;
start();
sendFile();
session.destroySession();
instance.destroyInstance();
}
public void run() {
try {
receive();
} catch (Throwable throwable) {
throwable.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
public void receive() throws Throwable {
session.startReceiver(1024 * 1024);
NormEvent event;
while ((event = instance.getNextEvent()) != null) {
NormEventType eventType = event.getType();
NormObject normObject = event.getObject();
System.out.println("NORM: Received something !!!!");
System.out.println(eventType);
switch (eventType) {
case NORM_RX_OBJECT_INFO:
byte[] info = normObject.getInfo();
String infoStr = new String(info, "US-ASCII");
System.out.println("Info: " + infoStr);
break;
case NORM_RX_OBJECT_COMPLETED:
if (normObject.getType() == NormObjectType.NORM_OBJECT_FILE) {
NormFile normFile = (NormFile)normObject;
String filename = normFile.getName();
System.out.println("NormFileObject: " + filename);
}
break;
}
}
session.stopReceiver();
}
public void sendFile() throws Throwable {
session.startSender(1, 1024 * 1024, 1400, (short)64, (short)16);
// Enqueue some data
// byte buffer[] = "Hello to the other norm node!!!!!!".getBytes();
// session.dataEnqueue(buffer, 0, buffer.length);
// Enqueue a file
session.fileEnqueue(fileToSend);
NormEvent event;
while ((event = instance.getNextEvent()) != null) {
NormEventType eventType = event.getType();
System.out.println(eventType);
}
session.stopSender();
}
public static void main(String[] args) throws Throwable {
if (args.length != 2) {
System.err.println("Usage: NormFileSendRecv <rxCachePath> <sendFile>");
return;
}
new NormFileSendRecv(args[0], args[1]);
}
}

View File

@ -0,0 +1,109 @@
import java.io.IOException;
import java.net.InetAddress;
import mil.navy.nrl.norm.NormEvent;
import mil.navy.nrl.norm.NormInstance;
import mil.navy.nrl.norm.NormNode;
import mil.navy.nrl.norm.NormObject;
import mil.navy.nrl.norm.NormSession;
import mil.navy.nrl.norm.NormStream;
import mil.navy.nrl.norm.enums.NormEventType;
public class NormStreamRecv {
static final long SESSION_BUFFER_SIZE = 1024 * 1024;
static final int SEGMENT_SIZE = 1400;
static final int BLOCK_SIZE = 64;
static final int PARITY_SEGMENTS = 16;
static final String DEST_ADDRESS = "224.1.2.3";
static final int DEST_PORT = 6003;
public static void main(String[] args) {
NormInstance instance = null;
NormSession session = null;
String destAddress = DEST_ADDRESS;
int destPort = DEST_PORT;
try {
int length = 0;
int offset = 0;
byte[] buf = new byte[65536];
boolean useUnicastNACKs = false;
if (args.length > 0) {
// dest addr is arg 1
InetAddress mcastAddr = InetAddress.getByName(args[0]);
useUnicastNACKs = ! mcastAddr.isMulticastAddress();
destAddress = args[0];
if (useUnicastNACKs)
System.err.println("Using unicast NACKs");
}
if (args.length > 1) {
// port is arg 2
destPort = Integer.parseInt(args[1]);
}
instance = new NormInstance();
session = instance.createSession(destAddress, destPort,
NormNode.NORM_NODE_ANY);
session.setDefaultUnicastNack(useUnicastNACKs);
session.startReceiver(SESSION_BUFFER_SIZE);
boolean streamIsAlive = true;
NormEvent event;
while ((null != (event = instance.getNextEvent())) && streamIsAlive) {
NormEventType eventType = event.getType();
NormObject normObject = event.getObject();
//System.err.println(eventType);
switch (eventType) {
case NORM_RX_OBJECT_NEW:
//System.err.println("New stream");
break;
case NORM_RX_OBJECT_UPDATED: // Stream updated = data to read ....
//System.err.println("An update!");
if (normObject instanceof NormStream) {
int numRead = 0;
NormStream normStreamobj;
normStreamobj = (NormStream)normObject;
// Read as much as possible, writing
// everything to System.out.
while (0 < (numRead = normStreamobj.read(buf, 0, buf.length))) {
if (-1 != numRead) {
System.out.write(buf, 0, numRead);
}
}
} else {
System.err.print("Expected NormStream. Got ");
System.err.println(normObject);
}
break;
case NORM_RX_OBJECT_COMPLETED:
//System.err.println("Stream end");
streamIsAlive = false;
break;
}
}
}
catch (IOException ex) {
System.err.println(ex);
}
catch (NumberFormatException ex) {
System.err.println("Usage: NormStreamRecv [host-name [port]]");
System.err.println("Default host-name: " + DEST_ADDRESS);
System.err.println("Default port: " + DEST_PORT);
}
if (null != session) {
session.stopReceiver();
session.destroySession();
}
if (null != instance) {
instance.destroyInstance();
}
}
}

View File

@ -0,0 +1,110 @@
import java.io.IOException;
import mil.navy.nrl.norm.NormEvent;
import mil.navy.nrl.norm.NormInstance;
import mil.navy.nrl.norm.NormNode;
import mil.navy.nrl.norm.NormSession;
import mil.navy.nrl.norm.NormStream;
import mil.navy.nrl.norm.enums.NormEventType;
public class NormStreamSend {
static final long REPAIR_WINDOW_SIZE = 1024 * 1024;
static final long SESSION_BUFFER_SIZE = 1024 * 1024;
static final int SEGMENT_SIZE = 1400;
static final int BLOCK_SIZE = 64;
static final int PARITY_SEGMENTS = 16;
static final String DEST_ADDRESS = "224.1.2.3";
static final int DEST_PORT = 6003;
public static void main(String[] args) {
NormInstance instance = null;
NormSession session = null;
NormStream stream = null;
String destAddress = DEST_ADDRESS;
int destPort = DEST_PORT;
try {
int length = 0;
int offset = 0;
byte[] buf = new byte[65536];
if (args.length > 0) {
destAddress = args[0];
}
if (args.length > 1) {
destPort = Integer.parseInt(args[1]);
}
instance = new NormInstance();
session = instance.createSession(destAddress, destPort,
NormNode.NORM_NODE_ANY);
String ccStr = System.getProperty("Norm.CC", "off");
if (ccStr.equalsIgnoreCase("on")) {
session.setCongestionControl(true, true);
System.out.println("Set Congestion Control to " + ccStr);
}
session.startSender(1, SESSION_BUFFER_SIZE,
SEGMENT_SIZE, BLOCK_SIZE, PARITY_SEGMENTS);
stream = session.streamOpen(REPAIR_WINDOW_SIZE);
while (-1 != (length = System.in.read(buf, 0, buf.length))) {
int numWritten = 0;
offset = 0;
while (length != (numWritten = stream.write(buf, offset, length))) {
length -= numWritten;
offset += numWritten;
NormEvent event = instance.getNextEvent();
NormEventType eventType = event.getType();
while ((eventType != NormEventType.NORM_TX_QUEUE_EMPTY) &&
(eventType != NormEventType.NORM_TX_QUEUE_VACANCY)) {
event = instance.getNextEvent();
eventType = event.getType();
}
}
stream.markEom();
//System.err.println("Wrote " + numWritten);
//System.err.println("... Done!");
// TODO: Create a new buf each time I'm successful writing
// all of it?
}
stream.flush();
System.err.println("End of file!");
}
catch (IOException ex) {
System.err.println(ex);
}
catch (NumberFormatException ex) {
System.err.println("Usage: NormStreamSend [host-name [port]]");
System.err.println("Default host-name: " + DEST_ADDRESS);
System.err.println("Default port: " + DEST_PORT);
}
if (null != stream) {
System.err.println("Closing stream");
stream.close(true);
}
if (null != session) {
System.err.println("Stopping sender");
session.stopSender();
System.err.println("Destroying session");
session.destroySession();
}
if (null != instance) {
System.err.println("Destroying instance");
instance.destroyInstance();
}
System.err.println("That's all folks!");
}
}

72
examples/java/README.TXT Normal file
View File

@ -0,0 +1,72 @@
================= NORM Java API Examples =================
This directory contains some purposely simplified examples of NORM
Java API usage. See comments below on how to build and run these on
Unix platforms. Eventually, "build.xml" will be provided.
The following example programs are included:
(These two programs use a hard-coded multicast address and port,
but take a file name and directory name, respectively, as a
command-line argument to determine the file sent and the directory
to which receive files are stored.)
NormFileSend.java - simple file transmission program. Sends one
file. The address is 224.1.2.3:6003.
NormFileRecv.java - simple file reception program. Receives one
file. The address is 224.1.2.3:6003.
NormFileSendRecv.java - One application that sends a file to itself.
The address is 224.1.2.3:6003.
NormStreamSend.java - This is an example of writing to a NORM stream.
It reads from STDIN and writes to the
stream. Specify the stream address on the command
line or use the default address, 224.1.2.3:6003.
Enable congestion control by setting the Java
system property Norm.CC to "on"
(i.e. -DNorm.CC=on).
NormStreamRecv.java - This is an example of reading from a NORM
stream. It writes to STDOUT and writes from the
stream. Specify the stream address on the command
line or use the default address, 224.1.2.3:6003.
COMPILING THE Java API EXAMPLES
After you build the JNI and the Norm Java jar file, you can compile
the examples in this directory all at one go:
javac -cp ../../lib/norm-1.0.0.jar *.java
RUNNING THE Java API EXAMPLES
You can use the shell scripts supplied to run the similarly named
example programs.
filesend.sh - Run NormFileSend
filerecv.sh - Run NormFileRecv
streamsend.sh - Run NormStreamSend
streamrecv.sh - Run NormStreamRecv
Alternatively, you can run any example program by invoking java. You
must define the system property java.library.path and set the
classpath so that java can find the norm jar file as well as the local
classes. For example, to run NormStreamSend:
java -Djava.library.path=../../lib -cp .:../../lib/norm-1.0.0.jar NormStreamSend
NOTE ABOUT NormStreamSend
NormStreamSend supports NORM's TCP-friendly congestion control.
Enable that by setting the system property Norm.CC to "on". You can
do that in streamsend.sh or you can do that on the command line:
java -DNorm.CC=on -Djava.library.path=../../lib -cp .:../../lib/norm-1.0.0.jar NormStreamSend

2
examples/java/filerecv.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
java -Djava.library.path=../../lib -cp .:../../lib/norm-1.0.0.jar NormFileRecv $@

2
examples/java/filesend.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
java -Djava.library.path=../../lib -cp .:../../lib/norm-1.0.0.jar NormFileSend $@

2
examples/java/streamrecv.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
java -Djava.library.path=../../lib -cp .:../../lib/norm-1.0.0.jar NormStreamRecv $@

4
examples/java/streamsend.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
# Enable TCP-friendly congestion control with:
# -DNorm.CC=on
java -Djava.library.path=../../lib -cp .:../../lib/norm-1.0.0.jar NormStreamSend $@

View File

@ -0,0 +1,119 @@
// This example uses the NORM API and demonstrates the use
// of NORM_OBJECT_DATA transmission and reception.
// The "data" sent and received are simple text messages
// of randomly-varying length.
XXXX - THIS CODE IS NOT YET COMPLETE !!!!!
#include <normApi.h>
// We use some "protolib" functions for
// cross-platform portability
#include <protoDebug.h>
#include <protoTime.h>
void Usage()
{
fprintf(stderr, "Usage: normDataExample [send][recv]\n");
}
int main(int argc, char* argv[])
{
bool send = false;
bool recv = false;
// Parse any command-line arguments
int i = 1;
while (i < argc)
{
if (!strcmp("send", argv[i]))
{
send = true;
}
else if (!strcmp("recv", argv[i]))
{
recv = true;
}
else
{
fprintf(stderr, "normDataExample error: invalid command-line option!\n");
Usage();
return -1;
}
return 0;
}
if (!send && !recv)
{
fprintf(stderr, "normDataExample error: not configured as sender or receiver!\n");
Usage();
return -1;
}
// 1) Create a NORM API "NormInstance"
NormInstanceHandle instance = NormCreateInstance();
if (NORM_INSTANCE_INVALID == instance)
{
fprintf(stderr, "normDataExample error: NormCreateInstance() failure!\n");
return -1;
}
// 2) Create a NormSession using default "automatic" local node id
NormSessionHandle session = NormCreateSession(instance,
"224.1.2.3",
6003,
NORM_NODE_ANY);
if (NORM_SESSION_INVALID == instance)
{
fprintf(stderr, "normDataExample error: NormCreateSession() failure!\n");
return -1;
}
// Enable some debugging output here
//SetDebugLevel(2);
// Uncomment to turn on debug NORM message tracing
NormSetMessageTrace(session, true);
// 3) Start receiver operation, if applicable
if (recv)
{
// Start receiver w/ 1MByte buffer per sender
if (!NormStartReceiver(session, 1024*1024))
{
fprintf(stderr, "normDataExample error: NormStartReceiver() failure!\n");
return -1;
}
}
// 4) Start receiver operation, if applicable
if (send)
{
// a) Pick a random sender "sessionId"
// (seed the random generation so we get a new one each time)
struct timeval currentTime;
ProtoSystemTime(currentTime);
srand(currentTime.tv_sec); // seed random number generator
NormSessionId sessionId = (NormSessionId)rand();
// b) Set sender rate or congestion control operation
NormSetTxRate(session, 256.0e+03); // in bits/second
}
// Enter loop waiting for and handling NormEvents ...
// (We illustrate usage of a NormDescriptor for this
// with our WaitForNormEvent() routine.)
// When set to "send" the "interval" is used to
NormDescriptor normDescriptor = NormGetDescriptor(instance);
bool keepGoing = true;
while (keepGoing)
{
boolWaitForNormEvent(normDescriptor, timeDelay)
} // end while (keepGoing)
} // end main()

248
examples/normDataRecv.cpp Normal file
View File

@ -0,0 +1,248 @@
/******************************************************************************
Simple NORM_OBJECT_DATA receiver example app using the NORM API
USAGE:
normDataRecv
BUILD (Unix):
g++ -o normDataRecv normDataRecv.cpp -D_FILE_OFFSET_BITS=64 -I../include/ \
../lib/libnorm.a ../protolib/lib/libProtokit.a \
-lpthread
(for MacOS/BSD, add "-lresolv")
(for Solaris, add "-lnsl -lsocket -lresolv")
******************************************************************************/
// Notes:
// 1) The program exits once a single file has been received ...
// 2) The received file is written to the <rxCacheDirectory>
// 3) The program also will exit on <CTRL-C> from user
// 4) "normDataRecv" should be started before "normFileSend"
#include "normApi.h" // for NORM API
#include "normMessage.h"
#include "protoAddress.h" // for ProtoAddress for easy mcast test
#include <stdio.h> // for printf(), etc
#include <stdlib.h> // for srand()
#include <string.h> // for strrchr()
#include <sys/time.h> // for gettimeofday()
// Usage: normDataRecv [addr <addr>/<port>]
#include "protoBitmask.h"
void Usage()
{
fprintf(stderr, "Usage: normDataRecv [addr <addr>/<port>]\n");
}
int main(int argc, char* argv[])
{
// Initialize default parameters.
char sessionAddr[256];
strcpy(sessionAddr, "224.1.2.3");
UINT16 sessionPort = 6003;
// Parse command-line for any parameters
int i = 1;
while (i < argc)
{
if (0 == strcmp("addr", argv[1]))
{
i++;
if (i == argc)
{
fprintf(stderr, "normDataRecv error: missing \"addr\" arguments\n");
Usage();
return -1;
}
strcpy(sessionAddr, argv[i++]);
char* ptr = strchr(sessionAddr, '/');
if (NULL != ptr)
{
*ptr = '\0';
sessionPort = atoi(ptr+1);
}
}
else
{
fprintf(stderr, "normDataRecv error: invalid command \"%s\"\n", argv[i]);
Usage();
return -1;
}
}
// 1) Create a NORM API "NormInstance"
NormInstanceHandle instance = NormCreateInstance();
// 2) Create a NormSession using default "automatic" local node id
NormSessionHandle session = NormCreateSession(instance,
sessionAddr,
sessionPort,
NORM_NODE_ANY);
// NOTE: These are debugging routines available
// (not necessary for normal app use)
NormSetDebugLevel(3);
// Uncomment to turn on debug NORM message tracing
//NormSetMessageTrace(session, true);
// Uncomment to turn on some random packet loss for testing
//NormSetRxLoss(session, 10.0); // 10% packet loss
struct timeval currentTime;
gettimeofday(&currentTime, NULL);
// Uncomment to get different packet loss patterns from run to run
srand(currentTime.tv_sec); // seed random number generator
// Uncomment if unicast NACKing is desired
// (We "cheat" here and use the Protolib "ProtoAddress" class
// that NORM happens to use under the hood as well)
ProtoAddress theAddr;
theAddr.ResolveFromString(sessionAddr);
if (!theAddr.IsMulticast())
{
NormSetDefaultUnicastNack(session, true);
// Set the tx port equal to session port so sender socket
// and make it "connected" to the remote sender address (sessionAddr) and port (sessionPort+1)
// (This assumes the remote sender address/port is known (sessionAddr/sessionPort+1 in this case)
NormSetTxPort(session, sessionPort);
NormSetRxPortReuse(session, true, NULL, sessionAddr, sessionPort+1);
}
else
{
// Uncomment to allow multiple NORM processes on same session port number
//NormSetRxPortReuse(session, true, sessionAddr);
}
// 3) Start the receiver with 1 Mbyte buffer per sender
NormStartReceiver(session, 1024*1024);
struct timeval startTime, endTime; // to measure object transfer time
// 4) Enter NORM event loop
bool keepGoing = true;
while (keepGoing)
{
NormEvent theEvent;
if (!NormGetNextEvent(instance, &theEvent)) continue;
switch (theEvent.type)
{
case NORM_RX_OBJECT_NEW:
gettimeofday(&startTime, NULL);
fprintf(stderr, "normDataRecv: NORM_RX_OBJECT_NEW event ...\n");
break;
case NORM_RX_OBJECT_INFO:
// Assume info contains '/' delimited <path/fileName> string
//fprintf(stderr, "normDataRecv: NORM_RX_OBJECT_INFO event ...\n");
if (NORM_OBJECT_DATA == NormObjectGetType(theEvent.object))
{
char dataInfo[8192];
unsigned int nameLen = NormObjectGetInfo(theEvent.object, dataInfo, 8191);
dataInfo[nameLen] = '\0';
//fprintf(stderr, "normDataRecv: info = \"%s\"\n", dataInfo);
}
break;
case NORM_RX_OBJECT_UPDATED:
{
//fprintf(stderr, "normDataRecv: NORM_RX_OBJECT_UPDATE event ...\n");
// Uncomment this stuff to monitor file receive progress
// (At high packet rates, you may want to be careful here and
// only calculate/post updates occasionally rather than for
// each and every RX_OBJECT_UPDATE event)
//NormSize objectSize = NormObjectGetSize(theEvent.object);
//NormSize completed = objectSize - NormObjectGetBytesPending(theEvent.object);
//double percentComplete = 100.0 * ((double)completed/(double)objectSize);
//fprintf(stderr, "normDataRecv: object>%p completion status %lu/%lu (%3.0lf%%)\n",
// theEvent.object, (unsigned long)completed, (unsigned long)objectSize, percentComplete);
break;
}
case NORM_RX_OBJECT_COMPLETED:
{
gettimeofday(&endTime, NULL);
fprintf(stderr, "normDataRecv: NORM_RX_OBJECT_COMPLETED event ...\n");
unsigned int objSize = NormObjectGetSize(theEvent.object);
const char* dataPtr = NormDataAccessData(theEvent.object);
// Validate that the data is complete/accurate
// a) compare data size against the size embedded in the "INFO"
char dataInfo[8192];
unsigned int nameLen = NormObjectGetInfo(theEvent.object, dataInfo, 8191);
dataInfo[nameLen] = '\0';
unsigned int dataCount, dataLen;
if (2 != sscanf(dataInfo, "NORM_OBJECT_DATA count>%u size>%u", &dataCount, &dataLen))
{
fprintf(stderr, "normDataRecv error: received NORM_OBJECT_DATA with invalid INFO?!\n");
return -1;
}
if (objSize != dataLen)
{
fprintf(stderr, "normDataRecv error: received NORM_OBJECT_DATA with bad object size?!\n");
return -1;
}
// b) check the data content
char data = *dataPtr;
for (unsigned int i = 0; i < dataLen; i++)
{
if (dataPtr[i] != data)
{
fprintf(stderr, "normDataRecv error: received bad NORM_OBJECT_DATA!\n");
return -1;
}
}
double transferTime = endTime.tv_sec - startTime.tv_sec;
if (endTime.tv_usec > startTime.tv_usec)
transferTime += 1.0e-06 * (double)(endTime.tv_usec - startTime.tv_usec);
else
transferTime -= 1.0e-06 * (double)(startTime.tv_usec - endTime.tv_usec);
double transferRate = (8.0/1000.0) * (double)objSize / transferTime;
fprintf(stderr, "normDataRecv: transfer duration %lf sec at %lf kbps\n", transferTime, transferRate);
//fprintf(stderr, "normDataRecv: object>%p count>%d size>%u data>%.64s ...\n",
// theEvent.object, dataCount, objSize, dataPtr);
// NOTE: Since we did not "retain" or "detach data" from this
// received data object, it (and its data) will be deleted upon
// the next call to "NormGetNextEvent()".
//keepGoing = false;
break;
}
case NORM_RX_OBJECT_ABORTED:
fprintf(stderr, "normDataRecv: NORM_RX_OBJECT_ABORTED event ...\n");
break;
case NORM_REMOTE_SENDER_NEW:
fprintf(stderr, "normDataRecv: NORM_REMOTE_SENDER_NEW event ...\n");
break;
case NORM_REMOTE_SENDER_ACTIVE:
fprintf(stderr, "normDataRecv: NORM_REMOTE_SENDER_ACTIVE event ...\n");
break;
case NORM_REMOTE_SENDER_INACTIVE:
fprintf(stderr, "normDataRecv: NORM_REMOTE_SENDER_INACTIVE event ...\n");
break;
default:
//fprintf(stderr, "normDataRecv: Got event type: %d\n", theEvent.type);
break;
} // end switch(theEvent.type)
}
NormStopReceiver(session);
NormDestroySession(session);
NormDestroyInstance(instance);
fprintf(stderr, "normDataRecv: Done.\n");
return 0;
} // end main()

227
examples/normDataSend.cpp Normal file
View File

@ -0,0 +1,227 @@
/******************************************************************************
Simple NORM_OBJECT_DATA sender example app using the NORM API
USAGE:
normSendData
BUILD (Unix):
g++ -o normDataSend normDataSend.cpp -D_FILE_OFFSET_BITS=64 -I../common/ \
-I../protolib/include ../lib/libnorm.a ../protolib/lib/libProtokit.a \
-lpthread
(for MacOS/BSD, add "-lresolv")
(for Solaris, add "-lnsl -lsocket -lresolv")
******************************************************************************/
// Notes:
// 1) A single file is sent.
// 2) The program exits upon NORM_TX_FLUSH_COMPLETED notification (or user <CTRL-C>)
// 3) NORM receiver should be started first (before sender starts)
#include "normApi.h" // for NORM API
#include "protoDefs.h" // for ProtoSystemTime()
#include "protoDebug.h" // for SetDebugLevel(), etc
#include "protoAddress.h" // for ProtoAddress for easy mcast test
#include <stdio.h> // for printf(), etc
#include <stdlib.h> // for srand()
#include <string.h> // for strrchr()
// Usage: normDataSend [addr <addr>/<port>]
void Usage()
{
fprintf(stderr, "Usage: normDataSend [addr <addr>/<port>]\n");
}
int main(int argc, char* argv[])
{
// Initialize default parameters.
char sessionAddr[256];
strcpy(sessionAddr, "224.1.2.3");
UINT16 sessionPort = 6003;
// Parse command-line for any parameters
int i = 1;
while (i < argc)
{
if (0 == strcmp("addr", argv[1]))
{
i++;
if (i == argc)
{
fprintf(stderr, "normDataSend error: missing \"addr\" arguments\n");
Usage();
return -1;
}
strcpy(sessionAddr, argv[i++]);
char* ptr = strchr(sessionAddr, '/');
if (NULL != ptr)
{
*ptr = '\0';
sessionPort = atoi(ptr+1);
}
}
else
{
fprintf(stderr, "normDataSend error: invalid command \"%s\"\n", argv[i]);
Usage();
return -1;
}
}
// Is the session an mcast addr?
ProtoAddress theAddr;
theAddr.ResolveFromString(sessionAddr);
bool isMulticastSession = theAddr.IsMulticast();
// 1) Create a NORM API "NormInstance"
NormInstanceHandle instance = NormCreateInstance();
// 2) Create a NormSession using default "automatic" local node id
NormSessionHandle session = NormCreateSession(instance,
sessionAddr,
sessionPort,
NORM_NODE_ANY);
// NOTE: These are some debugging routines available
// (not necessary for normal app use)
NormSetDebugLevel(3);
// Uncomment to turn on debug NORM message tracing
//NormSetMessageTrace(session, true);
// Uncomment to turn on some random packet loss
//NormSetTxLoss(session, 10.0); // 10% packet loss
struct timeval currentTime;
ProtoSystemTime(currentTime);
// Uncomment to get different packet loss patterns from run to run
// (and a different sender sessionId)
srand(currentTime.tv_sec); // seed random number generator
// 3) Set transmission rate
NormSetTxRate(session, 2.0e+06); // in bits/second
// Uncomment to enable TCP-friendly congestion control
//NormSetCongestionControl(session, true);
// Uncomment to use a _specific_ transmit port number
// (Can be the same as session port (rx port), but this
// is _not_ recommended for mcast sessions when unicast feedback may be
// possible! - must be called _before_ NormStartSender())
if (!isMulticastSession)
{
NormSetTxPort(session, sessionPort+1, true);
// Uncomment to set the session to only open
// a single socket for transmission.
// This also "connects" the sender to session (receiver) addr/port
// (unicast nacking _and_ "txPort == rxPort" MUST be used by receivers)
NormSetTxOnly(session, true, true);
}
// Uncomment to allow multiple NORM processes on same session port number
// Note that port reuse only works well for mcast.
// if (isMulticastSession) NormSetRxPortReuse(session, true);
// 4) Start the sender using a random "sessionId"
NormSessionId sessionId = (NormSessionId)rand();
TRACE("starting NORM sender ...\n");
NormStartSender(session, sessionId, 1024*1024, 1400, 64, 16);
// Uncomment to set large tx socket buffer size
// (might be needed for high rate sessions)
//NormSetTxSocketBuffer(session, 512000);
// 5) Enqueue the first data message
// (we enqueue text strings of random length as object content)
unsigned int MAX_COUNT = 1; // number of objects to send, zero means unlimited
const int MIN_LENGTH = 460000; // min object size (in bytes)
const int MAX_LENGTH = 460000; // max object size (in bytes)
unsigned int dataCount = 0;
int dataLen = MIN_LENGTH + rand() % (MAX_LENGTH - MIN_LENGTH + 1);
char* dataMsg = new char[dataLen];
ASSERT(NULL != dataMsg);
char data = 'a';
memset(dataMsg, data, dataLen); // set message content with 'dummy' data
// Provide some "info" about this message
char dataInfo[256];
sprintf(dataInfo, "NORM_OBJECT_DATA count>%d size>%d", dataCount, dataLen);
// Enqueue the data object
NormObjectHandle dataObj =
NormDataEnqueue(session, dataMsg, dataLen, dataInfo, strlen(dataInfo));
ASSERT(NORM_OBJECT_INVALID != dataObj);
dataCount++;
// 6) Enter NORM event loop
bool keepGoing = true;
while (keepGoing)
{
NormEvent theEvent;
if (!NormGetNextEvent(instance, &theEvent)) continue;
switch (theEvent.type)
{
case NORM_TX_QUEUE_VACANCY:
//fprintf(stderr, "normDataSend: NORM_TX_QUEUE_VACANCY event...\n");
break;
case NORM_TX_QUEUE_EMPTY:
{
if ((0 == MAX_COUNT) || (dataCount < MAX_COUNT))
{
// Enqueue another data object when norm tx queue goes empty
//fprintf(stderr, "normDataSend: NORM_TX_QUEUE_EMPTY event...\n");
dataLen = MIN_LENGTH + rand() % (MAX_LENGTH - MIN_LENGTH + 1);
dataMsg = new char[dataLen];
ASSERT(NULL != dataMsg);
memset(dataMsg, data, dataLen);
sprintf(dataInfo, "NORM_OBJECT_DATA count>%d size>%d data>%.64s ...", dataCount, dataLen, dataMsg);
NormObjectHandle dataObj =
NormDataEnqueue(session, dataMsg, dataLen, dataInfo, strlen(dataInfo));
// Note that flow control timer may have prevented NormDataEnqueue()
// from succeeding even though we got a NORM_TX_QUEUE_EMPTY notification
// (The underlying NORM code could be tightened up a bit here!)
if (NORM_OBJECT_INVALID != dataObj)
{
dataCount++;
if (++data > 'z') data = 'a';
}
else
{
TRACE("normDataSend: FLOW CONTROL CONDITION?\n");
}
}
break;
}
case NORM_TX_OBJECT_PURGED:
{
//fprintf(stderr, "normDataSend: NORM_TX_OBJECT_PURGED event ...\n");
char* dataPtr = NormDataDetachData(theEvent.object);
delete[] dataPtr;
break;
}
case NORM_TX_FLUSH_COMPLETED:
fprintf(stderr, "normDataSend: NORM_TX_FLUSH_COMPLETED event ...\n");
break;
default:
//TRACE("normDataSend: Got event type: %d\n", theEvent.type);
break;
} // end switch(theEvent.type)
} // end while (NormGetNextEvent())
NormStopSender(session);
NormDestroySession(session);
NormDestroyInstance(instance);
fprintf(stderr, "normDataSend: Done.\n");
return 0;
} // end main()

View File

@ -7,9 +7,9 @@
BUILD (Unix):
g++ -o normFileRecv normFileRecv.cpp -D_FILE_OFFSET_BITS=64 -DPROTO_DEBUG \
-I../common/ -I../protolib/common ../unix/libnorm.a \
../protolib/unix/libProtokit.a -lpthread
g++ -o normFileRecv normFileRecv.cpp -D_FILE_OFFSET_BITS=64 -I../common/ \
-I../protolib/include ../lib/libnorm.a ../protolib/lib/libProtokit.a \
-lpthread
(for MacOS/BSD, add "-lresolv")
(for Solaris, add "-lnsl -lsocket -lresolv")
@ -65,7 +65,7 @@ int main(int argc, char* argv[])
// Uncomment to turn on debug NORM message tracing
//NormSetMessageTrace(session, true);
// Uncomment to turn on some random packet loss for testing
//NormSetRxLoss(session, 10.0); // 10% packet loss
NormSetRxLoss(session, 10.0); // 10% packet loss
struct timeval currentTime;
ProtoSystemTime(currentTime);
// Uncomment to get different packet loss patterns from run to run
@ -83,9 +83,10 @@ int main(int argc, char* argv[])
// 5) Enter NORM event loop
bool keepGoing = true;
NormEvent theEvent;
while (keepGoing && NormGetNextEvent(instance, &theEvent))
while (keepGoing)
{
NormEvent theEvent;
if (!NormGetNextEvent(instance, &theEvent)) continue;
switch (theEvent.type)
{
case NORM_RX_OBJECT_NEW:
@ -127,7 +128,7 @@ int main(int argc, char* argv[])
// only calculate/post updates occasionally rather than for
// each and every RX_OBJECT_UPDATE event)
NormSize objectSize = NormObjectGetSize(theEvent.object);
fprintf(stderr, "sizeof(NormSize) = %d\n", sizeof(NormSize));
fprintf(stderr, "sizeof(NormSize) = %d\n", (int)sizeof(NormSize));
NormSize completed = objectSize - NormObjectGetBytesPending(theEvent.object);
double percentComplete = 100.0 * ((double)completed/(double)objectSize);
fprintf(stderr, "normFileRecv: completion status %lu/%lu (%3.0lf%%)\n",

View File

@ -8,7 +8,7 @@
BUILD (Unix):
g++ -o normFileSend normFileSend.cpp -D_FILE_OFFSET_BITS=64 -I../common/ \
-I../protolib/common ../unix/libnorm.a ../protolib/unix/libProtokit.a \
-I../protolib/include ../lib/libnorm.a ../protolib/lib/libProtokit.a \
-lpthread
(for MacOS/BSD, add "-lresolv")
@ -81,7 +81,7 @@ int main(int argc, char* argv[])
srand(currentTime.tv_sec); // seed random number generator
// 3) Set transmission rate
NormSetTransmitRate(session, 256.0e+03); // in bits/second
NormSetTxRate(session, 25600.0e+03); // in bits/second
// Uncomment to use a _specific_ transmit port number
// (Can be the same as session port (rx port), but this
@ -110,9 +110,10 @@ int main(int argc, char* argv[])
// 6) Enter NORM event loop
bool keepGoing = true;
NormEvent theEvent;
while (keepGoing && NormGetNextEvent(instance, &theEvent))
while (keepGoing)
{
NormEvent theEvent;
if (!NormGetNextEvent(instance, &theEvent)) continue;
switch (theEvent.type)
{
case NORM_TX_QUEUE_VACANCY:

238
examples/normStreamRecv.cpp Normal file
View File

@ -0,0 +1,238 @@
/******************************************************************************
Simple NORM_OBJECT_STREAM receiver example app using the NORM API
(expects NORM message stream of text messages with 2-byte length header (network byte order))
USAGE:
normStreamRecv
BUILD (Unix):
g++ -o normStreamRecv normStreamRecv.cpp -D_FILE_OFFSET_BITS=64 -I../include/ \
./lib/libnorm.a ../protolib/lib/libProtokit.a -lpthread
(for MacOS/BSD, add "-lresolv")
(for Solaris, add "-lnsl -lsocket -lresolv")
******************************************************************************/
// Notes:
// 1) The program also will exit on <CTRL-C> from user
// 2) "normStreamRecv" should be started before "normStreamSend" but can join stream in progress.
// 3) This example is designed to receive a single stream from a single sender (could be modified
// to support multiple streams and/or senders)
#include "normApi.h" // for NORM API
#include <stdio.h> // for printf(), etc
#include <stdlib.h> // for srand()
#include <string.h> // for strrchr()
#include <sys/time.h> // for gettimeofday()
#include <arpa/inet.h> // for ntohs()
int main(int argc, char* argv[])
{
// 0) Some default params
const unsigned int MSG_LENGTH_MAX = 5000;
// 1) Create a NORM API "NormInstance"
NormInstanceHandle instance = NormCreateInstance();
// 2) Create a NormSession using default "automatic" local node id
NormSessionHandle session = NormCreateSession(instance,
"127.0.0.1",
6003,
NORM_NODE_ANY);
// NOTE: These are debugging routines available
// (not necessary for normal app use)
// (Need to include "protolib/common/protoDebug.h" for this
NormSetDebugLevel(3);
// Uncomment to turn on debug NORM message tracing
//NormSetMessageTrace(session, true);
// Uncomment to write debug output to file "normLog.txt"
//NormOpenDebugLog(instance, "normLog.txt");
// Uncomment to turn on some random packet loss for testing
//NormSetRxLoss(session, 10.0); // 10% packet loss
struct timeval currentTime;
gettimeofday(&currentTime, NULL);
// Uncomment to get different packet loss patterns from run to run
srand(currentTime.tv_sec); // seed random number generator
// Uncomment to enable rx port reuse (this plus unique NormNodeId's enables same-machine send/recv)
NormSetRxPortReuse(session, true);
// 3) Start the receiver with 1 Mbyte buffer per sender
NormStartReceiver(session, 8*1024*1024);
NormSetSilentReceiver(session, true);
if (!NormSetRxSocketBuffer(session, 8*1024*1024))
perror("normStreamRecv error: unable to set requested socket buffer size");
// We use these variables to keep track of our recv stream
// and to buffer reading from the recv stream
NormObjectHandle stream = NORM_OBJECT_INVALID; // we use this to make sure we're handling the correct (only) stream
bool msgSync = false;
char msgBuffer[MSG_LENGTH_MAX];
UINT16 msgLen = 0;
UINT16 msgIndex = 0;
// 4) Enter NORM event loop
bool keepGoing = true;
while (keepGoing)
{
NormEvent theEvent;
if (!NormGetNextEvent(instance, &theEvent)) continue;
switch (theEvent.type)
{
case NORM_RX_OBJECT_NEW:
fprintf(stderr, "normStreamRecv: NORM_RX_OBJECT_NEW event ...\n");
if (NORM_OBJECT_INVALID == stream)
{
if (NORM_OBJECT_STREAM == NormObjectGetType(theEvent.object))
{
stream = theEvent.object;
msgLen = msgIndex = 0; // init stream reading state
msgSync = false;
}
else
{
fprintf(stderr, "normStreamRecv error: received NORM_RX_OBJECT_NEW for non-stream object?!\n");
}
}
else
{
fprintf(stderr, "normStreamRecv error: received NORM_RX_OBJECT_NEW while already receiving stream?!\n");
}
break;
case NORM_RX_OBJECT_INFO:
{
// Assume info contains NULL-terminated string
//fprintf(stderr, "normStreamRecv: NORM_RX_OBJECT_INFO event ...\n");
if (theEvent.object != stream)
{
fprintf(stderr, "normStreamRecv error: received NORM_RX_OBJECT_UPDATED for unhandled object?!\n");
break;
}
char streamInfo[8192];
unsigned int infoLen = NormObjectGetInfo(theEvent.object, streamInfo, 8191);
streamInfo[infoLen] = '\0';
fprintf(stderr, "normStreamRecv: NORM_RX_OBJECT_INFO event, info = \"%s\"\n", streamInfo);
break;
}
case NORM_RX_OBJECT_UPDATED:
{
//fprintf(stderr, "normStreamRecv: NORM_RX_OBJECT_UPDATED event ...\n");
if (theEvent.object != stream)
{
fprintf(stderr, "normStreamRecv error: received NORM_RX_OBJECT_UPDATED for unhandled object?!\n");
break;
}
while (1)
{
// If we're not "in sync", seek message start
if (!msgSync)
{
msgSync = NormStreamSeekMsgStart(stream);
if (!msgSync) break; // wait for next NORM_RX_OBJECT_UPDATED to re-sync
}
if (msgIndex < 2)
{
// We still need to read the 2-byte message header for the next message
unsigned int numBytes = 2 - msgIndex;
if (!NormStreamRead(stream, msgBuffer+msgIndex, &numBytes))
{
fprintf(stderr, "normStreamRecv error: broken stream detected, re-syncing ...\n");
msgLen = msgIndex = 0;
msgSync = false;
continue; // try to re-sync and read again
}
msgIndex += numBytes;
if (msgIndex < 2) break; // wait for next NORM_RX_OBJECT_UPDATED to read more
memcpy(&msgLen, msgBuffer, 2);
msgLen = ntohs(msgLen);
if ((msgLen < 2) || (msgLen > MSG_LENGTH_MAX))
{
fprintf(stderr, "normStreamRecv error: message received with invalid length?!\n");
msgLen = msgIndex = 0;
msgSync = false;
continue; // try to re-sync and read again
}
}
// Read "content" portion of message (note "msgIndex" accounts for length "header"
unsigned int numBytes = msgLen - msgIndex;
if (!NormStreamRead(stream, msgBuffer+msgIndex, &numBytes))
{
fprintf(stderr, "normStreamRecv error: broken stream detected, re-syncing ...\n");
msgLen = msgIndex = 0;
msgSync = false;
continue; // try to re-sync and read again
}
msgIndex += numBytes;
if (msgIndex == msgLen)
{
// Complete message read
//fprintf(stderr, "normStreamRecv msg: %s\n", msgBuffer+2);
msgLen = msgIndex = 0; // reset state variables for next message
}
else
{
break; // wait for next NORM_RX_OBJECT_UPDATED to read more
}
} // end while(1) (NormStreamRead() loop)
break;
}
case NORM_RX_OBJECT_COMPLETED:
{
fprintf(stderr, "normStreamRecv: NORM_RX_OBJECT_COMPLETED event ...\n");
if (stream == theEvent.object)
{
fprintf(stderr, "normStreamRecv: current stream completed ...\n");
stream = NORM_OBJECT_INVALID;
}
break;
}
case NORM_RX_OBJECT_ABORTED:
fprintf(stderr, "normStreamRecv: NORM_RX_OBJECT_ABORTED event ...\n");
if (stream == theEvent.object)
{
fprintf(stderr, "normStreamRecv error: current stream aborted ...\n");
stream = NORM_OBJECT_INVALID;
}
break;
case NORM_REMOTE_SENDER_NEW:
fprintf(stderr, "normStreamRecv: NORM_REMOTE_SENDER_NEW event ...\n");
break;
case NORM_REMOTE_SENDER_ACTIVE:
fprintf(stderr, "normStreamRecv: NORM_REMOTE_SENDER_ACTIVE event ...\n");
break;
case NORM_REMOTE_SENDER_INACTIVE:
fprintf(stderr, "normStreamRecv: NORM_REMOTE_SENDER_INACTIVE event ...\n");
break;
case NORM_GRTT_UPDATED:
fprintf(stderr, "normStreamRecv: NORM_GRTT_UPDATED event ...\n");
break;
default:
fprintf(stderr, "normStreamRecv: Got event type: %d\n", theEvent.type);
} // end switch(theEvent.type)
}
NormStopReceiver(session);
NormDestroySession(session);
NormDestroyInstance(instance);
fprintf(stderr, "normStreamRecv: Done.\n");
return 0;
} // end main()

290
examples/normStreamSend.cpp Normal file
View File

@ -0,0 +1,290 @@
/******************************************************************************
Simple NORM_OBJECT_DATA sender example app using the NORM API
USAGE:
normSendStream
BUILD (Unix):
g++ -o normStreamSend normStreamSend.cpp -D_FILE_OFFSET_BITS=64 -I../include/ \
../lib/libnorm.a ../protolib/lib/libProtokit.a -lpthread
(for MacOS/BSD, add "-lresolv")
(for Solaris, add "-lnsl -lsocket -lresolv")
******************************************************************************/
// Notes:
// 1) A single file is sent.
// 2) The program exits upon NORM_TX_FLUSH_COMPLETED notification (or user <CTRL-C>)
// 3) NORM receiver should be started first (before sender starts)
#include "normApi.h" // for NORM API
#include <stdio.h> // for printf(), etc
#include <stdlib.h> // for srand()
#include <string.h> // for strrchr()
#include <sys/time.h> // for gettimeofday()
#include <arpa/inet.h> // for htons()
int main(int argc, char* argv[])
{
// 0) Default parameter values
const unsigned int MSG_LENGTH_MIN = 1400;
const unsigned int MSG_LENGTH_MAX = 1400;
UINT32 streamBufferSize = 4*1024*1024; // 1 Mbyte stream buffer size
double normRate = 1.0e+07; // 1 Mbps default NORM tx rate for fixed rate operation (bits/sec units here)
double msgRate = -1.0; //1e+06; // 32 kbits/sec default message rate
// 1) Create a NORM API "NormInstance"
NormInstanceHandle instance = NormCreateInstance();
// 2) Create a NormSession using default "automatic" local node id (based on IP addr)
// TBD - add an option to set a specific NormNodeId
NormSessionHandle session = NormCreateSession(instance,
"loon", //"224.1.2.3",
6003,
1);//NORM_NODE_ANY);
// NOTE: These are some debugging routines available
// (not necessary for normal app use)
NormSetDebugLevel(3);
// Uncomment to turn on debug NORM message tracing
//NormSetMessageTrace(session, true);
// Uncomment to turn on some random packet loss
//NormSetTxLoss(session, 25.0); // 25% packet loss for testing purposes
struct timeval currentTime;
gettimeofday(&currentTime, NULL);
// Uncomment to get different packet loss patterns from run to run
// (and a different sender sessionId)
srand(currentTime.tv_sec); // seed random number generator
// 3) Set transmission rate
NormSetTxRate(session, normRate); // in bits/second
//NormSetFlowControl(session, 0.0);
// Init GRTT to low value (3 msec)
//NormSetGrttEstimate(session, 1.0e-03);
// Disable receiver backoffs (for lower latency, high speed performance)
// (For large group sizes, the default backoff factor is RECOMMENDED)
NormSetBackoffFactor(session, 2.0);
// Uncomment to use a _specific_ transmit port number
// (Can be the same as session port (rx port), but this
// is _not_ recommended when unicast feedback may be
// possible! - must be called _before_ NormStartSender())
//NormSetTxPort(session, 6001);
// Uncomment to enable TCP-friendly congestion control
//NormSetCongestionControl(session, true);
// Uncomment to enable rx port reuse (this plus unique NormNodeId's enables same-machine send/recv)
NormSetRxPortReuse(session, true);
// 4) Start the sender using a random "sessionId"
NormSessionId sessionId = (NormSessionId)rand();
NormStartSender(session, sessionId, 4*1024*1024, 1300, 64, 16);
// Uncomment to set large tx socket buffer size
// (may be needed to achieve very high packet output rates)
//NormSetTxSocketBuffer(session, 512000);
// 5) Enqueue the NORM_OBJECT_STREAM object
// Provide some "info" about this stream (the info is OPTIONAL)
char dataInfo[256];
sprintf(dataInfo, "NORM_OBJECT_STREAM message stream ...");
NormObjectHandle stream = NormStreamOpen(session, streamBufferSize, dataInfo, strlen(dataInfo) + 1);
if (NORM_OBJECT_INVALID == stream)
{
fprintf(stderr, "normStreamSend NormStreamOpen() error!\n");
return -1;
}
// 6) Write the first stream message
// (we enqueue text strings of random length as messages)
// ( a 2-byte network byte order length "header" is in each message)
unsigned int msgCount = 0;
char data = 'a';
char msgData[MSG_LENGTH_MAX];
UINT16 msgLen = MSG_LENGTH_MIN + (rand() % (MSG_LENGTH_MAX - MSG_LENGTH_MIN + 1));
// set 2 byte message header (length in network byte order)
UINT16 msgHeader = htons(msgLen);
memcpy(msgData, &msgHeader, 2); // 2-byte message length "header"
memset(msgData + 2, data, msgLen - 3); // n-byte message content
msgData[msgLen - 1] = '\0'; // 1-byte NULL-termination
// Write the message (as much as stream buffer will accept)
unsigned int bytesWritten = NormStreamWrite(stream, msgData, msgLen);
bool vacancy = (bytesWritten == msgLen);
// Initialize the "delayTime" used in "select()" loop below
// based on whether message was competely written to stream
// (i.e. wait according to "msgRate" (configured bytes per second))
double delayTime;
if (vacancy)
{
// Complete message was written, wait msg interval time
NormStreamMarkEom(stream);
msgCount++;
delayTime = (msgRate > 0.0) ? ((double)msgLen / msgRate) : 0.0;
}
else
{
// wait indefinitely for NORM_TX_QUEUE_VACANCY event
// to finish writing current message to stream
delayTime = -1.0;
}
// 6) We keep a running "timeAccumulator" value to maintain the proper
// _average_ message transmission rate. (TBD - impose "max" accumulation limit)
double timeAccumulator = 0.0;
struct timeval lastTime;
gettimeofday(&lastTime, NULL);
// 7) We use a "select()" call to wait for NORM events or message interval timeout
int normfd = NormGetDescriptor(instance);
fd_set fdset;
struct timeval timeout;
// 6) Enter NORM event loop
bool keepGoing = true;
while (keepGoing)
{
FD_SET(normfd, &fdset);
struct timeval* timeoutPtr;
if (delayTime < 0.0)
{
timeoutPtr = NULL; // wait indefinitely (i.e. for queue vacancy)
}
else
{
if (delayTime > timeAccumulator)
delayTime -= timeAccumulator;
else
delayTime = 0.0;
timeout.tv_sec = (unsigned long)delayTime;
timeout.tv_usec = (unsigned long)(1.0e+06 * (delayTime - (double)timeout.tv_sec));
timeoutPtr = &timeout;
}
int result = select(normfd+1, &fdset, NULL, NULL, timeoutPtr);
if (result > 0)
{
// Get and handle NORM API event
NormEvent theEvent;
if (NormGetNextEvent(instance, &theEvent))
{
switch (theEvent.type)
{
case NORM_TX_QUEUE_EMPTY:
case NORM_TX_QUEUE_VACANCY:
{
/*
if (NORM_TX_QUEUE_VACANCY == theEvent.type)
fprintf(stderr, "normStreamSend: NORM_TX_QUEUE_VACANCY event ...\n");
else
fprintf(stderr, "normStreamSend: NORM_TX_QUEUE_EMPTY event ...\n");
*/
if (!vacancy)
{
// Finish writing remaining pending message content (as much as can be written)
bytesWritten += NormStreamWrite(stream, msgData + bytesWritten, msgLen - bytesWritten);
if (bytesWritten == msgLen)
{
// Complete message was written, wait msg interval time
NormStreamMarkEom(stream);
msgCount++;
delayTime = (msgRate > 0.0) ? ((double)msgLen / msgRate) : 0.0;
vacancy = true;
}
}
break;
}
case NORM_TX_OBJECT_PURGED:
fprintf(stderr, "normStreamSend: NORM_TX_OBJECT_PURGED event ...\n");
break;
case NORM_TX_FLUSH_COMPLETED:
fprintf(stderr, "normStreamSend: NORM_TX_FLUSH_COMPLETED event ...\n");
break;
case NORM_GRTT_UPDATED:
fprintf(stderr, "normStreamRecv: NORM_GRTT_UPDATED event ...\n");
break;
default:
fprintf(stderr, "normStreamSend: Got event type: %d\n", theEvent.type);
} // end switch(theEvent.type)
} // end if (NormGetNextEvent())
}
else if (result < 0)
{
// select() error
perror("normStreamSend: select() error");
break;
}
// This code writes _new_ message(s) to the stream _if_ there is "vacancy"
// and it is time based on "msgRate" and how much time has passed since "lastTime"
struct timeval currentTime;
gettimeofday(&currentTime, NULL);
double timeDelta = (double)(currentTime.tv_sec - lastTime.tv_sec);
if (currentTime.tv_usec > lastTime.tv_usec)
timeDelta += 1.0e-06 * (currentTime.tv_usec - lastTime.tv_usec);
else
timeDelta -= 1.0e-06 * (lastTime.tv_usec - currentTime.tv_usec);
timeAccumulator += timeDelta;
while (vacancy && (timeAccumulator > delayTime))
{
timeAccumulator -= delayTime; // subtract last message tx duration from accumulator
// Fill buffer with new message "data" text character (a-z)
if (++data > 'z') data = 'a';
msgLen = MSG_LENGTH_MIN + (rand() % (MSG_LENGTH_MAX - MSG_LENGTH_MIN + 1));
// set 2 byte message header (length in network byte order)
msgHeader = htons(msgLen);
memcpy(msgData, &msgHeader, 2); // 2-byte message length "header"
memset(msgData+2, data, msgLen-3); // n-byte message content
msgData[msgLen - 1] = '\0'; // 1-byte NULL-termination
bytesWritten = NormStreamWrite(stream, msgData, msgLen);
if (bytesWritten < msgLen)
{
// wait indefinitely for NORM_TX_QUEUE_VACANCY event
// to finish writing current message to stream
vacancy = false;
delayTime = -1.0;
//fprintf(stderr, "norm tx stream buffer full, time accumulator = %lf\n", timeAccumulator);
}
else
{
// Complete message was written, wait msg interval time
NormStreamMarkEom(stream);
msgCount++;
delayTime = (msgRate > 0.0) ? ((double)msgLen / msgRate) : 0.0;
}
}
if (timeAccumulator <= delayTime)
{
delayTime -= timeAccumulator;
timeAccumulator = 0.0;
}
lastTime = currentTime;
} // end while (keepGoing)
NormStopSender(session);
NormDestroySession(session);
NormDestroyInstance(instance);
fprintf(stderr, "normDataSend: Done.\n");
return 0;
} // end main()

64
examples/python/debugStats.py Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env python
'''
Example of live plotting of pipe logging data.
This has some problems still...
'''
import sys
import Queue
from optparse import OptionParser
import Gnuplot
# Include the local pynorm in the module search path
sys.path.insert(0, "../")
from pynorm.extra.pipeparser import PipeParser
USAGE = 'usage: %s [options]' % sys.argv[0]
DEFAULT_PIPE = 'normtest'
def get_option_parser():
parser = OptionParser(usage=USAGE)
parser.set_defaults(pipe=DEFAULT_PIPE)
parser.add_option('-p', '--pipe',
help='The pipe to connect to (default %s)' % DEFAULT_PIPE)
return parser
def main(argv):
(opts, args) = get_option_parser().parse_args(argv)
if len(args) != 1:
print USAGE
return 1
pipep = PipeParser(opts.pipe)
pipep.start()
g = Gnuplot.Gnuplot()
g('set data style lines')
g.title('FEC Buffer Usage')
g.xlabel('Time (s)')
g.ylabel('FEC Usage')
ydata = []
while True:
try:
report = pipep.reports.get(False)
except Queue.Empty:
continue
try:
ydata.append(report['remote'][0]['fec_cur'])
g.plot(list(enumerate(ydata)))
except IndexError:
continue
pipep.reports.task_done()
print "Exiting..."
# g.reset()
# g.close()
# del g
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@ -0,0 +1,45 @@
#!/usr/bin/env python
'''
Example showing reading debug info from a pipe.
'''
import sys
import Queue
from optparse import OptionParser
from pynorm.extra.pipeparser import PipeParser
USAGE = 'usage: %s [options]' % sys.argv[0]
DEFAULT_PIPE = 'normtest'
def get_option_parser():
parser = OptionParser(usage=USAGE)
parser.set_defaults(pipe=DEFAULT_PIPE)
parser.add_option('-p', '--pipe',
help='The pipe to connect to (default %s)' % DEFAULT_PIPE)
return parser
def main(argv):
(opts, args) = get_option_parser().parse_args(argv)
if len(args) != 1:
print USAGE
return 1
pipep = PipeParser(opts.pipe)
pipep.start()
while True:
try:
report = pipep.reports.get(True, 3)
except Queue.Empty:
continue
try:
print report['time'], report['remote'][0]['fec_cur']
except IndexError:
pass
pipep.reports.task_done()
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@ -0,0 +1,94 @@
#!/usr/bin/env python
'''
Simple NORM file receiver example app using Python NORM API
Shows the usage of the event manager.
'''
import sys
import os.path
from optparse import OptionParser
sys.path.insert(0, '../')
import pynorm
from pynorm.extra.manager import Manager, StopManager
USAGE = 'usage: %s [options] <cacheDir>' % sys.argv[0]
DEFAULT_ADDR = '224.1.2.3'
DEFAULT_PORT = 6003
DEFAULT_PIPE = 'normtest'
def get_option_parser():
parser = OptionParser(usage=USAGE)
parser.set_defaults(address=DEFAULT_ADDR, port=DEFAULT_PORT, debug=0,
pipe=DEFAULT_PIPE)
parser.add_option('-a', '--address',
help='The IP address to bind to (default %s)' % DEFAULT_ADDR)
parser.add_option('-p', '--port', type=int,
help='The port number to listen on (default %i)' % DEFAULT_PORT)
parser.add_option('-i', '--iface',
help='The inteface to transmit multicast on.')
parser.add_option('-d', '--debug', type=int, help='Debug level')
parser.add_option('-e', '--pipe', help='Pipe name for logging.')
return parser
def main(argv):
(opts, args) = get_option_parser().parse_args(argv)
if len(args) != 2:
print get_option_parser().get_usage()
return 1
path = os.path.abspath(args[1])
instance = pynorm.Instance()
instance.setCacheDirectory(path)
try:
instance.openDebugPipe(opts.pipe)
except pynorm.NormError:
print 'Could not connect to pipe, disabling...'
pynorm.setDebugLevel(opts.debug)
manager = Manager(instance)
manager.register(pynorm.NORM_RX_OBJECT_INFO, newObject, path)
# manager.register(pynorm.NORM_RX_OBJECT_UPDATED, updatedObject)
manager.register(pynorm.NORM_RX_OBJECT_COMPLETED, complete)
manager.register(pynorm.NORM_RX_OBJECT_ABORTED, abort)
manager.start()
session = instance.createSession(opts.address, opts.port)
if opts.iface:
session.setMulticastInterface(opts.iface)
session.startReceiver(1024*1024)
print 'Starting listener on %s:%i' % (opts.address, opts.port)
try:
while True:
manager.join(2)
except KeyboardInterrupt:
pass
print 'Exiting...'
instance.stop()
manager.join()
return 0
def newObject(event, path):
print 'Filename = %s' % event.object.getInfo()
event.object.filename = os.path.join(path, event.object.getInfo())
print 'Downloading file %s' % event.object.filename
def updatedObject(event):
print 'File %s - %i bytes left to download' % (event.object.filename,
event.object.bytesPending)
def complete(event):
print 'File %s completed' % event.object.filename
raise StopManager()
def abort(event):
print 'File %s aborted' % event.object.filename
raise StopManager()
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@ -0,0 +1,117 @@
#!/usr/bin/env python
'''
Simple NORM file sender example app using Python NORM API
'''
import sys
import os.path
import pickle
from optparse import OptionParser
from random import randint
import pynorm
import pynorm.constants as c
DEFAULT_ADDR = '224.1.2.3'
DEFAULT_PORT = 6003
def get_option_parser():
parser = OptionParser()
parser.set_defaults(address=DEFAULT_ADDR, port=DEFAULT_PORT)
parser.add_option('-s', '--send',
help='The file to send.')
parser.add_option('-r', '--receive',
help='The directory to cache recieved files.')
parser.add_option('-a', '--address',
help='The IP address to bind to (default %s)' % DEFAULT_ADDR)
parser.add_option('-p', '--port', type=int,
help='The port number to listen on (default %i)' % DEFAULT_PORT)
parser.add_option('-i', '--iface',
help='The inteface to transmit multicast on.')
return parser
def main(argv):
(opts, args) = get_option_parser().parse_args(argv)
if len(args) != 1:
print 'Error: Invalid arguments'
print get_option_parser().format_help()
return 1
if opts.send is None and opts.receive is None:
print 'No operation specified!'
print 'Must provide a --send or --receive flag!'
print get_option_parser().format_help()
return 1
instance = pynorm.Instance()
session = instance.createSession(opts.address, opts.port)
if opts.iface:
session.setMulticastInterface(opts.iface)
session.setTxRate(256e10)
session.startReceiver(1024*1024)
session.startSender(randint(0, 1000), 1024**2, 1400, 64, 16)
if opts.receive is not None:
path = os.path.abspath(opts.receive)
instance.setCacheDirectory(path)
print 'Setting cache directory to %s' % path
if opts.send is not None:
filepath = os.path.abspath(opts.send)
filename = opts.send[opts.send.rfind('/')+1:]
print 'Sending file %s' % filename
session.fileEnqueue(filepath, filename)
try:
for event in instance:
if event.type == c.NORM_TX_FLUSH_COMPLETED:
if event.object.type == c.NORM_OBJECT_FILE:
print 'Flush completed for file %s' % event.object.filename
elif event.type == c.NORM_RX_OBJECT_INFO:
if event.object.type == c.NORM_OBJECT_FILE:
event.object.filename = os.path.join(path, event.object.info)
print 'Downloading file %s' % event.object.filename
elif event.object.type == c.NORM_OBJECT_DATA:
# I put the sender node ID in the info field
# If it doesn't match ours, we dont care about it
if int(event.object.info) != session.nodeId:
event.object.cancel()
elif event.type == c.NORM_RX_OBJECT_UPDATED:
if event.object.type == c.NORM_OBJECT_FILE:
print 'File %s - %i bytes left to download' % (
event.object.filename, event.object.bytesPending)
# Let the sender know how much we have done
data = pickle.dumps((event.object.filename, event.object.bytesPending), -1)
session.dataEnqueue(data, str(event.object.sender.id))
elif event == 'NORM_RX_OBJECT_COMPLETED':
if event.object.type == c.NORM_OBJECT_FILE:
print 'File %s completed' % event.object.filename
elif event.object.type == c.NORM_OBJECT_DATA:
try:
# This fails sometimes, not sure why yet, so ignore errors
filename, pending = pickle.loads(event.object.accessData())
except KeyError:
continue
print 'Node %i - File: %s - Pending: %i' % (event.object.sender.id, filename, pending)
elif event == 'NORM_RX_OBJECT_ABORTED':
if event.object.type == c.NORM_OBJECT_FILE:
print 'File %s aborted' % event.object.filename
except KeyboardInterrupt:
pass
print 'Exiting.'
return 0
# end main
if __name__ == '__main__':
sys.exit(main(sys.argv))

71
examples/python/normFileRecv.py Executable file
View File

@ -0,0 +1,71 @@
#!/usr/bin/env python
'''
Simple NORM file receiver example app using Python NORM API
'''
import sys, os.path
from optparse import OptionParser
import pynorm
USAGE = 'usage: %s [options] <cacheDir>' % sys.argv[0]
DEFAULT_ADDR = '224.1.2.3'
DEFAULT_PORT = 6003
def get_option_parser():
parser = OptionParser(usage=USAGE)
parser.set_defaults(address=DEFAULT_ADDR, port=DEFAULT_PORT)
parser.add_option('-a', '--address',
help='The IP address to bind to (default %s)' % DEFAULT_ADDR)
parser.add_option('-p', '--port', type=int,
help='The port number to listen on (default %i)' % DEFAULT_PORT)
parser.add_option('-i', '--iface',
help='The inteface to transmit multicast on.')
return parser
def main(argv):
(opts, args) = get_option_parser().parse_args(argv)
if len(args) != 2:
print get_option_parser().get_usage()
return 1
path = os.path.abspath(args[1])
instance = pynorm.Instance()
instance.setCacheDirectory(path)
session = instance.createSession(opts.address, opts.port)
if opts.iface:
session.setMulticastInterface(opts.iface)
session.startReceiver(1024*1024)
try:
for event in instance:
if event == 'NORM_RX_OBJECT_INFO':
event.object.filename = os.path.join(path, event.object.info)
print 'Downloading file %s' % event.object.filename
elif event == 'NORM_RX_OBJECT_UPDATED':
print 'File %s - %i bytes left to download' % (
event.object.filename, event.object.bytesPending)
elif event == 'NORM_RX_OBJECT_COMPLETED':
print 'File %s completed' % event.object.filename
return 0
elif event == 'NORM_RX_OBJECT_ABORTED':
print 'File %s aborted' % event.object.filename
return 1
else:
print event
except KeyboardInterrupt:
pass
print 'Exiting.'
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))

64
examples/python/normFileSend.py Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env python
'''
Simple NORM file sender example app using Python NORM API
'''
import sys, os.path
from optparse import OptionParser
from random import randint
import pynorm
USAGE = 'usage: %s [options] <file>' % sys.argv[0]
DEFAULT_ADDR = '224.1.2.3'
DEFAULT_PORT = 6003
def get_option_parser():
parser = OptionParser(usage=USAGE)
parser.set_defaults(address=DEFAULT_ADDR, port=DEFAULT_PORT)
parser.add_option('-a', '--address',
help='The IP address to bind to (default %s)' % DEFAULT_ADDR)
parser.add_option('-p', '--port', type=int,
help='The port number to listen on (default %i)' % DEFAULT_PORT)
parser.add_option('-i', '--iface',
help='The inteface to transmit multicast on.')
return parser
def main(argv):
(opts, args) = get_option_parser().parse_args(argv)
if len(args) != 2:
print get_option_parser().get_usage()
return 1
filepath = os.path.abspath(args[1])
filename = args[1][args[1].rfind('/')+1:]
instance = pynorm.Instance()
session = instance.createSession(opts.address, opts.port)
if opts.iface:
session.setMulticastInterface(opts.iface)
session.setTxRate(256e10)
session.startSender(randint(0, 1000), 1024**2, 1400, 64, 16)
print 'Sending file %s' % filename
session.fileEnqueue(filepath, filename)
try:
for event in instance:
if event == 'NORM_TX_FLUSH_COMPLETED':
print 'Flush completed, exiting.'
return 0
else:
print event
except KeyboardInterrupt:
pass
print 'Exiting.'
return 0
# end main
if __name__ == '__main__':
sys.exit(main(sys.argv))

102
examples/python/rawRecv.py Executable file
View File

@ -0,0 +1,102 @@
#!/usr/bin/env python
'''
Example of using the NORM library directly.
You really shouldn't need to do this. Use the pretty API instead.
But its here if you need it.
'''
import sys
import os.path
import ctypes
from optparse import OptionParser
from pynorm.core import libnorm, NormEventStruct
import pynorm.constants as c
USAGE = 'usage: %s [options] <cacheDir>' % sys.argv[0]
DEFAULT_ADDR = '224.1.2.3'
DEFAULT_PORT = 6003
def get_option_parser():
parser = OptionParser(usage=USAGE)
parser.set_defaults(address=DEFAULT_ADDR, port=DEFAULT_PORT)
parser.add_option('-a', '--address'
help='The IP address to bind to (default %s)' % DEFAULT_ADDR)
parser.add_option('-p', '--port', type=int,
help='The port number to listen on (default %i)' % DEFAULT_PORT)
parser.add_option('-i', '--iface',
help='The inteface to transmit multicast on.')
return parser
def main(argv):
(opts, args) = get_option_parser().parse_args(argv)
if len(args) != 2:
print get_option_parser().get_usage()
return 1
path = os.path.abspath(args[1])
instance = libnorm.NormCreateInstance(False)
session = libnorm.NormCreateSession(instance, opts.address, opts.port,
c.NORM_NODE_ANY)
if opts.iface:
libnorm.NormSetMulticastInterface(session, opts.iface)
libnorm.NormSetCacheDirectory(instance, path)
libnorm.NormStartReceiver(session, 1024*1024)
theEvent = NormEventStruct()
try:
while libnorm.NormGetNextEvent(instance, ctypes.byref(theEvent)):
if theEvent.type == c.NORM_RX_OBJECT_NEW:
print 'rawRecv.py: NORM_RX_OBJECT_NEW event ...'
elif theEvent.type == c.NORM_RX_OBJECT_INFO:
print 'rafRecv.py: NORM_RX_OBJECT_INFO event ...'
if c.NORM_OBJECT_FILE == libnorm.NormObjectGetType(theEvent.object):
length = libnorm.NormObjectGetInfoLength(theEvent.object)
buffer = ctypes.create_string_buffer(length)
recv = libnorm.NormObjectGetInfo(theEvent.object, buffer, length)
if recv == 0:
print 'Error'
filename = os.path.join(path, buffer.value)
print 'Filename - %s' % filename
libnorm.NormFileRename(theEvent.object, filename)
elif theEvent.type == c.NORM_RX_OBJECT_UPDATED:
size = libnorm.NormObjectGetSize(theEvent.object)
completed = size - libnorm.NormObjectGetBytesPending(theEvent.object)
percent = 100.0 * (float(completed) / float(size))
print '%.1f completed' % percent
elif theEvent.type == c.NORM_RX_OBJECT_COMPLETED:
print 'Complete'
return 0
elif theEvent.type == c.NORM_RX_OBJECT_ABORTED:
print 'Aborted'
return 0
elif theEvent.type == c.NORM_REMOTE_SENDER_NEW:
print 'New sender'
elif theEvent.type == c.NORM_REMOTE_SENDER_ACTIVE:
print 'Sender active'
elif theEvent.type == c.NORM_REMOTE_SENDER_INACTIVE:
print 'Sender inactive'
except KeyboardInterrupt:
pass
libnorm.NormStopReceiver(session)
libnorm.NormDestroySession(session)
libnorm.NormDestroyInstance(instance)
print 'Exiting.'
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))

107
examples/python/streamChat.py Executable file
View File

@ -0,0 +1,107 @@
#!/usr/bin/env python
'''
Simple NORM file receiver example app using Python NORM API
Shows off streaming with a super simple chat app.
'''
import sys
import os.path
import curses
import curses.textpad
from threading import Thread
from optparse import OptionParser
from random import randint
import pynorm
from pynorm.extra.manager import Manager, StopManager
USAGE = 'usage: %s [options] name' % sys.argv[0]
DEFAULT_ADDR = '224.1.2.3'
DEFAULT_PORT = 6003
def get_option_parser():
parser = OptionParser(usage=USAGE)
parser.set_defaults(address=DEFAULT_ADDR, port=DEFAULT_PORT)
parser.add_option('-a', '--address',
help='The IP address to bind to (default %s)' % DEFAULT_ADDR)
parser.add_option('-p', '--port', type=int,
help='The port number to listen on (default %i)' % DEFAULT_PORT)
parser.add_option('-i', '--iface',
help='The inteface to transmit multicast on.')
return parser
def main(argv):
(opts, args) = get_option_parser().parse_args(argv)
if len(args) != 2:
print get_option_parser().get_usage()
return 1
instance = pynorm.Instance()
session = instance.createSession(opts.address, opts.port)
if opts.iface:
session.setMulticastInterface(opts.iface)
session.startReceiver(1024*1024)
session.startSender(randint(0, 1000), 1024**2, 1400, 64, 16)
stream = session.streamOpen(1024*1024)
gui = Gui(stream, args[1])
manager = Manager(instance)
manager.register(pynorm.NORM_RX_OBJECT_UPDATED,
lambda e: gui.showText(e.object.streamRead(1024)[1]))
# manager.register(pynorm.NORM_RX_OBJECT_INFO,
# lambda e: gui.showText('%s joined the chat' % e.object.info))
manager.start()
try:
curses.wrapper(gui)
except KeyboardInterrupt:
pass
print 'Exiting...'
stream.streamClose(True)
instance.stop()
manager.join()
return 0
class Gui(object):
def __init__(self, stream, name):
self.stream = stream
self.name = name
self.curline = 0
def __call__(self, stdscr):
self.stdscr = stdscr
maxy, maxx = stdscr.getmaxyx()
self.chatwin = curses.newwin(maxy - 2, maxx, 0, 0)
self.chatwin.scrollok(True)
typewin = curses.newwin(1, maxx, maxy-1, 0)
textbox = curses.textpad.Textbox(typewin)
while True:
self.send(textbox.edit())
typewin.erase()
def send(self, text):
msg = '%s: %s' % (self.name, text)
self.stream.streamWrite(msg)
self.stream.streamFlush(True)
self.showText(msg)
def showText(self, msg):
maxy, maxx = self.stdscr.getmaxyx()
if self.curline >= maxy:
self.curline = maxy - 1
self.chatwin.addstr(self.curline, 0, msg)
self.curline += 1
self.chatwin.refresh()
if __name__ == '__main__':
sys.exit(main(sys.argv))

View File

@ -47,6 +47,17 @@ typedef uint32_t UINT32;
// C++ code continues to evolve. But, until this notice
// is removed, the API shouldn't be considered final.
#ifndef __cplusplus
# include <stdbool.h>
# define DEFAULT(arg)
#else
# define DEFAULT(arg) = arg
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** NORM API Types */
typedef const void* NormInstanceHandle;
extern NORM_API_LINKAGE
@ -78,69 +89,89 @@ typedef off_t NormSize;
#endif // WIN32
NORM_API_LINKAGE
enum NormObjectType
typedef enum NormObjectType
{
NORM_OBJECT_NONE,
NORM_OBJECT_DATA,
NORM_OBJECT_FILE,
NORM_OBJECT_STREAM
};
} NormObjectType;
NORM_API_LINKAGE
enum NormFlushMode
typedef enum NormFlushMode
{
NORM_FLUSH_NONE,
NORM_FLUSH_PASSIVE,
NORM_FLUSH_ACTIVE
};
} NormFlushMode;
NORM_API_LINKAGE
enum NormNackingMode
typedef enum NormNackingMode
{
NORM_NACK_NONE,
NORM_NACK_INFO_ONLY,
NORM_NACK_NORMAL
};
} NormNackingMode;
NORM_API_LINKAGE
enum NormAckingStatus
typedef enum NormAckingStatus
{
NORM_ACK_INVALID,
NORM_ACK_FAILURE,
NORM_ACK_PENDING,
NORM_ACK_SUCCESS
};
} NormAckingStatus;
NORM_API_LINKAGE
enum NormProbingMode
typedef enum NormTrackingStatus
{
NORM_TRACK_NONE,
NORM_TRACK_RECEIVERS,
NORM_TRACK_SENDERS,
NORM_TRACK_ALL
} NormTrackingStatus;
NORM_API_LINKAGE
typedef enum NormProbingMode
{
NORM_PROBE_NONE,
NORM_PROBE_PASSIVE,
NORM_PROBE_ACTIVE
};
} NormProbingMode;
NORM_API_LINKAGE
enum NormRepairBoundary
typedef enum NormSyncPolicy
{
NORM_SYNC_CURRENT, // attempt to receiver current/new objects only
NORM_SYNC_ALL // attempt to receive old and new objects
} NormSyncPolicy;
NORM_API_LINKAGE
typedef enum NormRepairBoundary
{
NORM_BOUNDARY_BLOCK,
NORM_BOUNDARY_OBJECT
};
} NormRepairBoundary;
NORM_API_LINKAGE
enum NormEventType
typedef enum NormEventType
{
NORM_EVENT_INVALID = 0,
NORM_TX_QUEUE_VACANCY,
NORM_TX_QUEUE_EMPTY,
NORM_TX_FLUSH_COMPLETED,
NORM_TX_WATERMARK_COMPLETED,
NORM_TX_CMD_SENT,
NORM_TX_OBJECT_SENT,
NORM_TX_OBJECT_PURGED,
NORM_TX_RATE_CHANGED,
NORM_LOCAL_SENDER_CLOSED,
NORM_REMOTE_SENDER_NEW,
NORM_REMOTE_SENDER_ACTIVE,
NORM_REMOTE_SENDER_INACTIVE,
NORM_REMOTE_SENDER_PURGED,
NORM_RX_CMD_NEW,
NORM_RX_OBJECT_NEW,
NORM_RX_OBJECT_INFO,
NORM_RX_OBJECT_UPDATED,
@ -149,7 +180,7 @@ enum NormEventType
NORM_GRTT_UPDATED,
NORM_CC_ACTIVE,
NORM_CC_INACTIVE
};
} NormEventType;
typedef struct
{
@ -162,7 +193,7 @@ typedef struct
/** NORM API General Initialization and Operation Functions */
NORM_API_LINKAGE
NormInstanceHandle NormCreateInstance(bool priorityBoost = false);
NormInstanceHandle NormCreateInstance(bool priorityBoost DEFAULT(false));
NORM_API_LINKAGE
void NormDestroyInstance(NormInstanceHandle instanceHandle);
@ -190,7 +221,7 @@ bool NormSetCacheDirectory(NormInstanceHandle instanceHandle,
// This call blocks until the next NormEvent is ready unless asynchronous
// notification is used (see below)
NORM_API_LINKAGE
bool NormGetNextEvent(NormInstanceHandle instanceHandle, NormEvent* theEvent);
bool NormGetNextEvent(NormInstanceHandle instanceHandle, NormEvent* theEvent, bool waitForEvent DEFAULT(true));
// The "NormGetDescriptor()" function returns a HANDLE (WIN32) or
// a file descriptor (UNIX) which can be used for async notification
@ -230,14 +261,45 @@ const void* NormGetUserData(NormSessionHandle sessionHandle);
NORM_API_LINKAGE
NormNodeId NormGetLocalNodeId(NormSessionHandle sessionHandle);
NORM_API_LINKAGE
void NormSetTxPort(NormSessionHandle sessionHandle,
UINT16 txPortNumber);
bool NormSetTxPort(NormSessionHandle sessionHandle,
UINT16 txPortNumber,
bool enableReuse DEFAULT(false),
const char* txBindAddress DEFAULT((const char*)0)); // if non-NULL, bind() to <txBindAddress>/<txPortNumber>
NORM_API_LINKAGE
UINT16 NormGetTxPort(NormSessionHandle sessionHandle);
NORM_API_LINKAGE
void NormSetTxOnly(NormSessionHandle sessionHandle,
bool txOnly,
bool connectToSessionAddress DEFAULT(false));
// This does not affect the rx_socket binding if already bound
// (i.e., just affects where NORM packets are sent)
NORM_API_LINKAGE
bool NormChangeDestination(NormSessionHandle sessionHandle,
const char* sessionAddress,
UINT16 sessionPort);
NORM_API_LINKAGE
void NormSetRxPortReuse(NormSessionHandle sessionHandle,
bool enable,
bool bindToSessionAddress = true);
bool enableReuse,
const char* rxBindAddress DEFAULT((const char*)0), // if non-NULL, bind() to <rxBindAddress>/<sessionPort>
const char* senderAddress DEFAULT((const char*)0), // if non-NULL, connect() to <senderAddress>/<senderPort>
UINT16 senderPort DEFAULT(0));
NORM_API_LINKAGE
UINT16 NormGetRxPort(NormSessionHandle sessionHandle);
// TBD - We should probably have a "NormSetCCMode(NormCCMode ccMode)" function for users
NORM_API_LINKAGE
void NormSetEcnSupport(NormSessionHandle sessionHandle,
bool ecnEnable, // enables NORM ECN (congestion control) support
bool ignoreLoss DEFAULT(false), // With "ecnEnable", use ECN-only, ignoring packet loss
bool tolerateLoss DEFAULT(false)); // loss-tolerant congestion control, ecnEnable or not, ignoreLoss = false
NORM_API_LINKAGE
bool NormSetMulticastInterface(NormSessionHandle sessionHandle,
@ -255,19 +317,50 @@ NORM_API_LINKAGE
bool NormSetLoopback(NormSessionHandle sessionHandle,
bool loopback);
NORM_API_LINKAGE
bool NormSetFragmentation(NormSessionHandle sessionHandle,
bool fragmentation);
// Special functions for debug support
NORM_API_LINKAGE
void NormSetMessageTrace(NormSessionHandle sessionHandle, bool state);
NORM_API_LINKAGE
void NormSetTxLoss(NormSessionHandle sessionHandle, double percent);
NORM_API_LINKAGE
void NormSetRxLoss(NormSessionHandle sessionHandle, double percent);
NORM_API_LINKAGE
bool NormOpenDebugLog(NormInstanceHandle instanceHandle, const char *path);
NORM_API_LINKAGE
void NormCloseDebugLog(NormInstanceHandle instanceHandle);
NORM_API_LINKAGE
bool NormOpenDebugPipe(NormInstanceHandle instanceHandle, const char *pipeName);
NORM_API_LINKAGE
void NormCloseDebugPipe(NormInstanceHandle instanceHandle);
NORM_API_LINKAGE
void NormSetDebugLevel(unsigned int level);
NORM_API_LINKAGE
unsigned int NormGetDebugLevel();
NORM_API_LINKAGE
void NormSetReportInterval(NormSessionHandle sessionHandle, double interval);
NORM_API_LINKAGE
double NormGetReportInterval(NormSessionHandle sessionHandle);
/** NORM Sender Functions */
NORM_API_LINKAGE
bool NormStartSender(NormSessionHandle sessionHandle,
NormSessionId sessionId,
NormSessionId instanceId,
UINT32 bufferSpace,
UINT16 segmentSize,
unsigned char numData,
@ -277,27 +370,31 @@ NORM_API_LINKAGE
void NormStopSender(NormSessionHandle sessionHandle);
NORM_API_LINKAGE
double NormGetTransmitRate(NormSessionHandle sessionHandle);
NORM_API_LINKAGE
void NormSetTransmitRate(NormSessionHandle sessionHandle,
void NormSetTxRate(NormSessionHandle sessionHandle,
double bitsPerSecond);
NORM_API_LINKAGE
double NormGetTxRate(NormSessionHandle sessionHandle);
NORM_API_LINKAGE
bool NormSetTxSocketBuffer(NormSessionHandle sessionHandle,
unsigned int bufferSize);
NORM_API_LINKAGE
void NormSetCongestionControl(NormSessionHandle sessionHandle,
bool state);
void NormSetFlowControl(NormSessionHandle sessionHandle,
double flowControlFactor);
NORM_API_LINKAGE
void NormSetTransmitRateBounds(NormSessionHandle sessionHandle,
void NormSetCongestionControl(NormSessionHandle sessionHandle,
bool enable,
bool adjustRate DEFAULT(true));
NORM_API_LINKAGE
void NormSetTxRateBounds(NormSessionHandle sessionHandle,
double rateMin,
double rateMax);
NORM_API_LINKAGE
void NormSetTransmitCacheBounds(NormSessionHandle sessionHandle,
void NormSetTxCacheBounds(NormSessionHandle sessionHandle,
NormSize sizeMax,
UINT32 countMin,
UINT32 countMax);
@ -341,25 +438,28 @@ void NormSetTxRobustFactor(NormSessionHandle sessionHandle,
NORM_API_LINKAGE
NormObjectHandle NormFileEnqueue(NormSessionHandle sessionHandle,
const char* fileName,
const char* infoPtr = (const char*)0,
unsigned int infoLen = 0);
const char* infoPtr DEFAULT((const char*)0),
unsigned int infoLen DEFAULT(0));
NORM_API_LINKAGE
NormObjectHandle NormDataEnqueue(NormSessionHandle sessionHandle,
const char* dataPtr,
UINT32 dataLen,
const char* infoPtr = (const char*)0,
unsigned int infoLen = 0);
const char* infoPtr DEFAULT((const char*)0),
unsigned int infoLen DEFAULT(0));
NORM_API_LINKAGE
bool NormRequeueObject(NormSessionHandle sessionHandle, NormObjectHandle objectHandle);
NORM_API_LINKAGE
NormObjectHandle NormStreamOpen(NormSessionHandle sessionHandle,
UINT32 bufferSize);
UINT32 bufferSize,
const char* infoPtr DEFAULT((const char*)0),
unsigned int infoLen DEFAULT(0));
// TBD - we should add a "bool watermark" option to "graceful" stream closure???
NORM_API_LINKAGE
void NormStreamClose(NormObjectHandle streamHandle, bool graceful = false);
void NormStreamClose(NormObjectHandle streamHandle, bool graceful DEFAULT(false));
NORM_API_LINKAGE
unsigned int NormStreamWrite(NormObjectHandle streamHandle,
@ -368,8 +468,8 @@ unsigned int NormStreamWrite(NormObjectHandle streamHandle,
NORM_API_LINKAGE
void NormStreamFlush(NormObjectHandle streamHandle,
bool eom = false,
NormFlushMode flushMode = NORM_FLUSH_PASSIVE);
bool eom DEFAULT(false),
NormFlushMode flushMode DEFAULT(NORM_FLUSH_PASSIVE));
NORM_API_LINKAGE
void NormStreamSetAutoFlush(NormObjectHandle streamHandle,
@ -387,7 +487,10 @@ void NormStreamMarkEom(NormObjectHandle streamHandle);
NORM_API_LINKAGE
bool NormSetWatermark(NormSessionHandle sessionHandle,
NormObjectHandle objectHandle);
NormObjectHandle objectHandle,
bool overrideFlush DEFAULT(false));
NORM_API_LINKAGE
bool NormResetWatermark(NormSessionHandle sessionHandle);
NORM_API_LINKAGE
void NormCancelWatermark(NormSessionHandle sessionHandle);
@ -400,9 +503,27 @@ NORM_API_LINKAGE
void NormRemoveAckingNode(NormSessionHandle sessionHandle,
NormNodeId nodeId);
NORM_API_LINKAGE
void NormSetAutoAckingNodes(NormSessionHandle sessionHandle,
NormTrackingStatus trackingStatus);
NORM_API_LINKAGE
NormAckingStatus NormGetAckingStatus(NormSessionHandle sessionHandle,
NormNodeId nodeId = NORM_NODE_ANY);
NormNodeId nodeId DEFAULT(NORM_NODE_ANY));
NORM_API_LINKAGE
bool NormGetNextAckingNode(NormSessionHandle sessionHandle,
NormNodeId* nodeId,
NormAckingStatus* ackingStatus);
NORM_API_LINKAGE
bool NormSendCommand(NormSessionHandle sessionHandle,
const char* cmdBuffer,
unsigned int cmdLength,
bool robust DEFAULT(false));
NORM_API_LINKAGE
void NormCancelCommand(NormSessionHandle sessionHandle);
/* NORM Receiver Functions */
@ -413,6 +534,10 @@ bool NormStartReceiver(NormSessionHandle sessionHandle,
NORM_API_LINKAGE
void NormStopReceiver(NormSessionHandle sessionHandle);
NORM_API_LINKAGE
void NormSetRxCacheLimit(NormSessionHandle sessionHandle,
unsigned short countMax);
NORM_API_LINKAGE
bool NormSetRxSocketBuffer(NormSessionHandle sessionHandle,
unsigned int bufferSize);
@ -420,7 +545,7 @@ bool NormSetRxSocketBuffer(NormSessionHandle sessionHandle,
NORM_API_LINKAGE
void NormSetSilentReceiver(NormSessionHandle sessionHandle,
bool silent,
int maxDelay = -1);
int maxDelay DEFAULT(-1));
NORM_API_LINKAGE
void NormSetDefaultUnicastNack(NormSessionHandle sessionHandle,
@ -430,12 +555,16 @@ NORM_API_LINKAGE
void NormNodeSetUnicastNack(NormNodeHandle remoteSender,
bool unicastNacks);
NORM_API_LINKAGE
void NormSetDefaultSyncPolicy(NormSessionHandle sessionHandle,
NormSyncPolicy syncPolicy);
NORM_API_LINKAGE
void NormSetDefaultNackingMode(NormSessionHandle sessionHandle,
NormNackingMode nackingMode);
NORM_API_LINKAGE
void NormNodeSetNackingMode(NormNodeHandle nodeHandle,
void NormNodeSetNackingMode(NormNodeHandle remoteSender,
NormNackingMode nackingMode);
NORM_API_LINKAGE
@ -447,7 +576,7 @@ void NormSetDefaultRepairBoundary(NormSessionHandle sessionHandle,
NormRepairBoundary repairBoundary);
NORM_API_LINKAGE
void NormNodeSetRepairBoundary(NormNodeHandle nodeHandle,
void NormNodeSetRepairBoundary(NormNodeHandle remoteSender,
NormRepairBoundary repairBoundary);
NORM_API_LINKAGE
@ -455,7 +584,7 @@ void NormSetDefaultRxRobustFactor(NormSessionHandle sessionHandle,
int robustFactor);
NORM_API_LINKAGE
void NormNodeSetRxRobustFactor(NormNodeHandle nodeHandle,
void NormNodeSetRxRobustFactor(NormNodeHandle remoteSender,
int robustFactor);
NORM_API_LINKAGE
@ -469,6 +598,8 @@ bool NormStreamSeekMsgStart(NormObjectHandle streamHandle);
NORM_API_LINKAGE
UINT32 NormStreamGetReadOffset(NormObjectHandle streamHandle);
NORM_API_LINKAGE
UINT32 NormStreamGetBufferUsage(NormObjectHandle streamHandle);
/** NORM Object Functions */
@ -511,7 +642,7 @@ bool NormFileRename(NormObjectHandle fileHandle,
const char* fileName);
NORM_API_LINKAGE
const char*volatile NormDataAccessData(NormObjectHandle objectHandle);
const char* NormDataAccessData(NormObjectHandle objectHandle);
NORM_API_LINKAGE
char* NormDataDetachData(NormObjectHandle objectHandle);
@ -528,23 +659,29 @@ NORM_API_LINKAGE
bool NormNodeGetAddress(NormNodeHandle nodeHandle,
char* addrBuffer,
unsigned int* bufferLen,
UINT16* port = (UINT16*)0);
UINT16* port DEFAULT((UINT16*)0));
NORM_API_LINKAGE
double NormNodeGetGrtt(NormNodeHandle nodeHandle);
double NormNodeGetGrtt(NormNodeHandle remoteSender);
NORM_API_LINKAGE
void NormNodeFreeBuffers(NormNodeHandle nodeHandle);
bool NormNodeGetCommand(NormNodeHandle remoteSender,
char* buffer,
unsigned int* buflen);
NORM_API_LINKAGE
void NormNodeFreeBuffers(NormNodeHandle remoteSender);
NORM_API_LINKAGE
void NormNodeDelete(NormNodeHandle remoteSender);
// The next 4 functions have not yet been implemented
// (work in progress)
NORM_API_LINKAGE
void NormNodeSetAutoDelete(NormNodeHandle nodeHandle,
void NormNodeSetAutoDelete(NormNodeHandle remoteSender,
bool autoDelete);
NORM_API_LINKAGE
void NormNodeDeleteSender(NormNodeHandle nodeHandle);
NORM_API_LINKAGE
bool NormNodeAllowSender(NormNodeId senderId);
@ -563,4 +700,8 @@ void NormNodeRelease(NormNodeHandle nodeHandle);
NORM_API_LINKAGE
UINT32 NormCountCompletedObjects(NormSessionHandle sessionHandle);
#ifdef __cplusplus
} // end extern "C"
#endif /* __cplusplus */
#endif // _NORM_API

56
include/normEncoder.h Normal file
View File

@ -0,0 +1,56 @@
/*********************************************************************
*
* AUTHORIZATION TO USE AND DISTRIBUTE
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that:
*
* (1) source code distributions retain this paragraph in its entirety,
*
* (2) distributions including binary code include this paragraph in
* its entirety in the documentation or other materials provided
* with the distribution, and
*
* (3) all advertising materials mentioning features or use of this
* software display the following acknowledgment:
*
* "This product includes software written and developed
* by Brian Adamson and Joe Macker of the Naval Research
* Laboratory (NRL)."
*
* The name of NRL, the name(s) of NRL employee(s), or any entity
* of the United States Government may not be used to endorse or
* promote products derived from this software, nor does the
* inclusion of the NRL written and developed software directly or
* indirectly suggest NRL or United States Government endorsement
* of this product.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
********************************************************************/
#ifndef _NORM_ENCODER
#define _NORM_ENCODER
#include "protokit.h" // protolib stuff
class NormEncoder
{
public:
virtual ~NormEncoder();
virtual bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize) = 0;
virtual void Destroy() = 0;
virtual void Encode(unsigned int segmentId, const char *dataVector, char **parityVectorList) = 0;
}; // end class NormEncoder
class NormDecoder
{
public:
virtual ~NormDecoder();
virtual bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize) = 0;
virtual void Destroy() = 0;
virtual int Decode(char** vectorList, unsigned int numData, unsigned int erasureCount, unsigned int* erasureLocs) = 0;
}; // end class NormDecoder
#endif // _NORM_ENCODER

View File

@ -30,43 +30,22 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
********************************************************************/
#ifndef _NORM_ENCODER
#define _NORM_ENCODER
#ifndef _NORM_ENCODER_MDP
#define _NORM_ENCODER_MDP
#include "protokit.h" // protolib stuff
#include "normEncoder.h"
class NormEncoder
{
public:
virtual ~NormEncoder();
virtual bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize) = 0;
virtual void Destroy() = 0;
virtual void Encode(const char *dataVector, char **parityVectorList) = 0;
}; // end class NormEncoder
class NormDecoder
{
public:
virtual ~NormDecoder();
virtual bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize) = 0;
virtual void Destroy() = 0;
virtual int Decode(char** vectorList, unsigned int numData, unsigned int erasureCount, unsigned int* erasureLocs) = 0;
}; // end class NormDecoder
class NormEncoderRS8a : public NormEncoder
class NormEncoderMDP : public NormEncoder
{
// Methods
public:
NormEncoderRS8a();
~NormEncoderRS8a();
NormEncoderMDP();
~NormEncoderMDP();
bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize);
void Destroy();
bool IsReady(){return (bool)(gen_poly != NULL);}
// "Encode" must be called in order of source vector0, vector1, vector2, etc
void Encode(const char *dataVector, char **parityVectorList);
// "Encode" MUST be called in order of source vector0, vector1, vector2, etc
void Encode(unsigned int segmentId, const char *dataVector, char **parityVectorList);
private:
bool CreateGeneratorPolynomial();
@ -77,15 +56,15 @@ class NormEncoderRS8a : public NormEncoder
unsigned char* gen_poly; // Ptr to generator polynomial
unsigned char* scratch; // scratch space for encoding
}; // end class NormEncoderRS8a
}; // end class NormEncoderMDP
class NormDecoderRS8a : public NormDecoder
class NormDecoderMDP : public NormDecoder
{
// Methods
public:
NormDecoderRS8a();
~NormDecoderRS8a();
NormDecoderMDP();
~NormDecoderMDP();
bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize);
int Decode(char** vectorList, unsigned int numData, unsigned int erasureCount, unsigned int* erasureLocs);
int NumParity() {return npar;}
@ -101,8 +80,7 @@ class NormDecoderRS8a : public NormDecoder
unsigned char** o_vec; // Omega vectors (pointers to "npar" vectors)
unsigned char* scratch;
}; // end class NormDecoderRS8a
}; // end class NormDecoderMDP
#endif // _NORM_ENCODER
#endif // _NORM_ENCODER_MDP

68
include/normEncoderRS16.h Normal file
View File

@ -0,0 +1,68 @@
#ifndef _NORM_ENCODER_RS16
#define _NORM_ENCODER_RS16
#include "normEncoder.h"
#include "protoDefs.h" // for UINT16
class NormEncoderRS16 : public NormEncoder
{
public:
NormEncoderRS16();
~NormEncoderRS16();
virtual bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize);
virtual void Destroy();
virtual void Encode(unsigned int segmentId, const char* dataVector, char** parityVectorList);
unsigned int GetNumData()
{return ndata;}
unsigned int GetNumParity()
{return npar;}
unsigned int GetVectorSize()
{return vector_size;}
private:
unsigned int ndata; // max data pkts per block (k)
unsigned int npar; // No. of parity packets (n-k)
unsigned int vector_size; // Size of biggest vector to encode
UINT8* enc_matrix;
unsigned int enc_index;
}; // end class NormEncoderRS16
class NormDecoderRS16 : public NormDecoder
{
public:
NormDecoderRS16();
virtual ~NormDecoderRS16();
virtual bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize);
virtual void Destroy();
virtual int Decode(char** vectorList, unsigned int numData, unsigned int erasureCount, unsigned int* erasureLocs);
unsigned int GetNumParity()
{return npar;}
unsigned int GetVectorSize()
{return vector_size;}
private:
bool InvertDecodingMatrix(); // used in Decode() method
unsigned int ndata; // max data pkts per block (k)
unsigned int npar; // No. of parity packets (n-k)
UINT16 vector_size; // Size of biggest vector to encode
UINT8* enc_matrix;
UINT8* dec_matrix;
unsigned int* parity_loc;
// These "inv_" members are used in InvertDecodingMatrix()
unsigned int* inv_ndxc;
unsigned int* inv_ndxr;
unsigned int* inv_pivt;
UINT8* inv_id_row;
UINT8* inv_temp_row;
}; // end class NormDecoderRS16
#endif // _NORM_ENCODER_RS16

69
include/normEncoderRS8.h Normal file
View File

@ -0,0 +1,69 @@
#ifndef _NORM_ENCODER_RS8
#define _NORM_ENCODER_RS8
#include "normEncoder.h"
#include "protoDefs.h" // for UINT16
class NormEncoderRS8 : public NormEncoder
{
public:
NormEncoderRS8();
~NormEncoderRS8();
virtual bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize);
virtual void Destroy();
virtual void Encode(unsigned int segmentId, const char* dataVector, char** parityVectorList);
unsigned int GetNumData()
{return ndata;}
unsigned int GetNumParity()
{return npar;}
unsigned int GetVectorSize()
{return vector_size;}
private:
unsigned int ndata; // max data pkts per block (k)
unsigned int npar; // No. of parity packets (n-k)
unsigned int vector_size; // Size of biggest vector to encode
UINT8* enc_matrix;
}; // end class NormEncoder
class NormDecoderRS8 : public NormDecoder
{
public:
NormDecoderRS8();
virtual ~NormDecoderRS8();
virtual bool Init(unsigned int numData, unsigned int numParity, UINT16 vectorSize);
virtual void Destroy();
virtual int Decode(char** vectorList, unsigned int numData, unsigned int erasureCount, unsigned int* erasureLocs);
unsigned int GetNumParity()
{return npar;}
unsigned int GetVectorSize()
{return vector_size;}
private:
bool InvertDecodingMatrix(); // used in Decode() method
unsigned int ndata; // max data pkts per block (k)
unsigned int npar; // No. of parity packets (n-k)
UINT16 vector_size; // Size of biggest vector to encode
UINT8* enc_matrix;
UINT8* dec_matrix;
unsigned int* parity_loc;
// These "inv_" members are used in InvertDecodingMatrix()
unsigned int* inv_ndxc;
unsigned int* inv_ndxr;
unsigned int* inv_pivt;
UINT8* inv_id_row;
UINT8* inv_temp_row;
}; // end class NormDecoder
#endif // _NORM_ENCODER_RS8

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,27 @@ class NormNode
void SetId(const NormNodeId& nodeId) {id = nodeId;}
inline const NormNodeId& LocalNodeId() const;
class Accumulator
{
public:
Accumulator();
void Reset()
{msb = lsb = 0;}
void Increment(unsigned long count)
{
unsigned long lsbOld = lsb;
lsb += count;
if (lsb < lsbOld) msb++;
}
double GetValue() const
{return ((((double)0xffffffff)*msb) + lsb);}
double GetScaledValue(double factor) const
{return ((((double)0xffffffff)*(factor*msb)) + (factor*lsb));}
private:
unsigned long msb;
unsigned long lsb;
};
protected:
class NormSession& session;
@ -49,7 +70,8 @@ class NormLossEstimator
bool Update(const struct timeval& currentTime,
unsigned short seqNumber,
bool ecn = false);
void SetLossEventWindow(double lossWindow) {event_window = lossWindow;}
void SetLossEventWindow(double lossWindow)
{event_window = lossWindow;}
void SetInitialLoss(double lossFraction)
{
memset(history, 0, (DEPTH+1)*sizeof(unsigned int));
@ -83,16 +105,12 @@ class NormLossEstimator2
{
public:
NormLossEstimator2();
void SetEventWindow(unsigned short windowDepth)
{event_window = windowDepth;}
void SetLossEventWindow(double theTime)
{event_window_time = theTime;}
{event_window = theTime;}
bool Update(const struct timeval& currentTime,
unsigned short seqNumber,
bool ecn = false);
double LossFraction();
bool NoLoss() {return no_loss;}
void SetInitialLoss(double lossFraction)
{
memset(history, 0, (DEPTH+1)*sizeof(unsigned int));
@ -101,23 +119,34 @@ class NormLossEstimator2
unsigned long CurrentLossInterval() {return history[0];}
unsigned int LastLossInterval() {return history[1];}
void SetIgnoreLoss(bool state)
{ignore_loss = state;}
void SetTolerateLoss(bool state)
{tolerate_loss = state;}
private:
enum {DEPTH = 8};
enum LossEventStatus
{
CONFIRMED = 0,
CONFIRMING = 1,
SEEKING = 2
};
// Members
bool init;
bool ignore_loss;
bool tolerate_loss;
unsigned long lag_mask;
unsigned int lag_depth;
unsigned long lag_test_bit;
unsigned short lag_index;
unsigned short event_window;
unsigned short event_index;
double event_window_time;
double event_index_time;
bool seeking_loss_event;
bool no_loss;
double initial_loss;
double event_window;
struct timeval event_time;
struct timeval event_time_orig; // (TBD - remove this, it's not used);
LossEventStatus seeking_loss_event;
unsigned long history[9]; // loss interval history
double discount[9];
@ -128,6 +157,7 @@ class NormLossEstimator2
{init = true; Sync(theSequence);}
void Sync(unsigned short theSequence)
{lag_index = theSequence;}
void ChangeLagDepth(unsigned int theDepth)
{
theDepth = (theDepth > 20) ? 20 : theDepth;
@ -177,6 +207,8 @@ class NormCCNode : public NormNode
bool HasRtt() const {return rtt_confirmed;}
double GetRtt() const {return rtt;}
double GetRttSample() const {return rtt_sample;}
double GetRttSqMean() const {return rtt_sqmean;}
double GetLoss() const {return loss;}
double GetRate() const {return rate;}
UINT16 GetCCSequence() const {return cc_sequence;}
@ -188,10 +220,16 @@ class NormCCNode : public NormNode
void SetClrStatus(bool state) {is_clr = state;}
void SetPlrStatus(bool state) {is_plr = state;}
void SetRttStatus(bool state) {rtt_confirmed = state;}
void SetRtt(double value) {rtt = value;}
void SetRtt(double value)
{
rtt_sqmean = sqrt(value);
rtt = rtt_sample = value;
}
double UpdateRtt(double value)
{
rtt = 0.9*rtt + 0.1 * value;
rtt_sample = value; // save last rtt sample
rtt_sqmean = 0.9*rtt_sqmean + 0.1*sqrt(value);
rtt = 0.9*rtt + 0.1*value;
return rtt;
}
void SetLoss(double value) {loss = value;}
@ -205,20 +243,35 @@ class NormCCNode : public NormNode
bool is_active;
struct timeval feedback_time; // time of last received feedback
double rtt; // in seconds
double rtt_sqmean; // ave sqrt(rtt), EWMA smoothed
double rtt_sample; // last rtt sample value
double loss; // loss fraction
double rate; // in bytes per second
UINT16 cc_sequence;
}; // end class NormCCNode
class NormServerNode : public NormNode
class NormSenderNode : public NormNode
{
public:
enum ObjectStatus {OBJ_INVALID, OBJ_NEW, OBJ_PENDING, OBJ_COMPLETE};
enum RepairBoundary {BLOCK_BOUNDARY, OBJECT_BOUNDARY};
NormServerNode(class NormSession& theSession, NormNodeId nodeId);
~NormServerNode();
enum SyncPolicy
{
SYNC_CURRENT, // sync to detect transmit point, iff NORM_DATA from first FEC block
SYNC_ALL // permiscuously sync as far back as possible
};
NormSenderNode(class NormSession& theSession, NormNodeId nodeId);
~NormSenderNode();
void SetInstanceId(UINT16 instanceId)
{instance_id = instanceId;}
// Parameters
NormObject::NackingMode GetDefaultNackingMode() const
@ -229,12 +282,17 @@ class NormServerNode : public NormNode
// Should generally inherit NormSession::GetRxRobustFactor()
void SetRobustFactor(int value);
NormServerNode::RepairBoundary GetRepairBoundary() const
RepairBoundary GetRepairBoundary() const
{return repair_boundary;}
// (TBD) force an appropriate RepairCheck on boundary change???
void SetRepairBoundary(RepairBoundary repairBoundary)
{repair_boundary = repairBoundary;}
SyncPolicy GetSyncPolicy() const
{return sync_policy;}
void SetSyncPolicy(SyncPolicy syncPolicy)
{sync_policy = syncPolicy;}
bool UnicastNacks() {return unicast_nacks;}
void SetUnicastNacks(bool state) {unicast_nacks = state;}
@ -247,6 +305,8 @@ class NormServerNode : public NormNode
bool ecnStatus = false);
double LossEstimate() {return loss_estimator.LossFraction();}
void CheckCCFeedback();
void UpdateRecvRate(const struct timeval& currentTime,
unsigned short msgSize);
@ -262,7 +322,7 @@ class NormServerNode : public NormNode
UINT16 GetInstanceId() {return instance_id;}
bool IsOpen() const {return is_open;}
void Close();
bool AllocateBuffers(UINT16 segmentSize, UINT16 numData, UINT16 numParity);
bool AllocateBuffers(UINT8 fecId, UINT16 fecInstanceId, UINT8 fecM, UINT16 segmentSize, UINT16 numData, UINT16 numParity);
bool BuffersAllocated() {return (0 != segment_size);}
void FreeBuffers();
void Activate(bool isObjectMsg);
@ -272,21 +332,25 @@ class NormServerNode : public NormNode
ObjectStatus UpdateSyncStatus(const NormObjectId& objectId);
ObjectStatus GetObjectStatus(const NormObjectId& objectId) const;
bool GetFirstPending(NormObjectId& objectId)
UINT8 GetFecFieldSize() const
{return fec_m;}
bool GetFirstPending(NormObjectId& objectId) const
{
UINT32 index;
bool result = rx_pending_mask.GetFirstSet(index);
objectId = (UINT16)index;
return result;
}
bool GetNextPending(NormObjectId& objectId)
bool GetNextPending(NormObjectId& objectId) const
{
UINT32 index = (UINT16)objectId;
bool result = rx_pending_mask.GetNextSet(index);
objectId = (UINT16)index;
return result;
}
bool GetLastPending(NormObjectId& objectId)
bool GetLastPending(NormObjectId& objectId) const
{
UINT32 index;
bool result = rx_pending_mask.GetLastSet(index);
@ -347,18 +411,37 @@ class NormServerNode : public NormNode
void CalculateGrttResponse(const struct timeval& currentTime,
struct timeval& grttResponse) const;
// Statistics kept on server
// Statistics kept on sender
unsigned long CurrentBufferUsage() const
{return (segment_size * segment_pool.CurrentUsage());}
unsigned long PeakBufferUsage() const
{return (segment_size * segment_pool.PeakUsage());}
unsigned long BufferOverunCount() const
{return segment_pool.OverunCount() + block_pool.OverrunCount();}
unsigned long RecvTotal() const {return recv_total;}
unsigned long RecvGoodput() const {return recv_goodput;}
void IncrementRecvTotal(unsigned long count) {recv_total += count;}
void IncrementRecvGoodput(unsigned long count) {recv_goodput += count;}
void ResetRecvStats() {recv_total = recv_goodput = 0;}
unsigned long CurrentStreamBufferUsage() const;
unsigned long PeakStreamBufferUsage() const;
unsigned long StreamBufferOverunCount() const;
//unsigned long RecvTotal() const {return recv_total;}
//unsigned long RecvGoodput() const {return recv_goodput;}
// returns ave bytes/sec
double GetRecvRate(double interval) const
{return recv_total.GetScaledValue(1.0 / interval);}
double GetRecvGoodput(double interval) const
{return recv_goodput.GetScaledValue(1.0 / interval);}
void IncrementRecvTotal(unsigned long count)
{recv_total.Increment(count);}
void IncrementRecvGoodput(unsigned long count)
{recv_goodput.Increment(count);}
void ResetRecvStats()
{
recv_total.Reset();
recv_goodput.Reset();
}
void IncrementResyncCount() {resync_count++;}
unsigned long ResyncCount() const {return resync_count;}
unsigned long NackCount() const {return nack_count;}
@ -367,6 +450,41 @@ class NormServerNode : public NormNode
unsigned long PendingCount() const {return rx_table.GetCount();}
unsigned long FailureCount() const {return failure_count;}
class CmdBuffer
{
public:
CmdBuffer();
~CmdBuffer();
enum {CMD_SIZE_MAX = 8192};
void SetContent(const char* data, unsigned int numBytes)
{
ASSERT(numBytes <= CMD_SIZE_MAX);
memcpy(buffer, data, numBytes);
length = numBytes;
}
const char* GetContent() const
{return buffer;}
unsigned int GetContentLength() const
{return length;}
void Append(CmdBuffer* nextBuffer)
{next = nextBuffer;}
CmdBuffer* GetNext() const
{return next;}
private:
char buffer[CMD_SIZE_MAX];
unsigned length;
CmdBuffer* next; // to support singly-linked list
}; // end class NormSenderNode::CmdBuffer
CmdBuffer* NewCmdBuffer() const;
bool ReadNextCmd(char* buffer, unsigned int* buflen);
private:
static const double DEFAULT_NOMINAL_INTERVAL;
@ -390,6 +508,7 @@ class NormServerNode : public NormNode
UINT16 instance_id;
int robust_factor;
SyncPolicy sync_policy;
bool synchronized;
NormObjectId sync_id; // only valid if(synchronized)
NormObjectId next_id; // only valid if(synchronized)
@ -399,6 +518,8 @@ class NormServerNode : public NormNode
bool is_open;
UINT16 segment_size;
UINT8 fec_id;
UINT8 fec_m;
unsigned int ndata;
unsigned int nparity;
@ -416,7 +537,7 @@ class NormServerNode : public NormNode
char** retrieval_pool;
unsigned int retrieval_index;
bool server_active;
bool sender_active;
ProtoTimer activity_timer;
ProtoTimer repair_timer;
@ -426,7 +547,7 @@ class NormServerNode : public NormNode
NormBlockId watermark_block_id;
NormSegmentId watermark_segment_id;
// Remote server grtt measurement state
// Remote sender grtt measurement state
double grtt_estimate;
UINT8 grtt_quantized;
struct timeval grtt_send_time;
@ -435,10 +556,11 @@ class NormServerNode : public NormNode
UINT8 gsize_quantized;
double backoff_factor;
// Remote server congestion control state
// Remote sender congestion control state
NormLossEstimator2 loss_estimator;
UINT16 cc_sequence;
bool cc_enable;
bool cc_feedback_needed;
double cc_rate; // ccRate at start of cc_timer
ProtoTimer cc_timer;
double rtt_estimate;
@ -449,20 +571,26 @@ class NormServerNode : public NormNode
bool slow_start;
double send_rate; // sender advertised rate
double recv_rate; // measured recv rate
double recv_rate_prev; // for recv_rate measurement
struct timeval prev_update_time; // for recv_rate measurement
unsigned long recv_accumulator; // for recv_rate measurement
Accumulator recv_accumulator; // for recv_rate measurement
double nominal_packet_size;
// Buffering of app-defined commands received from Remote sender
CmdBuffer* cmd_buffer_head; // the oldest received command is here (for FIFO)
CmdBuffer* cmd_buffer_tail; // newly-received commands appended here
CmdBuffer* cmd_buffer_pool; // we "pool" allocated buffers for possible reuse here
// For statistics tracking
unsigned long recv_total; // total recvd accumulator
unsigned long recv_goodput; // goodput recvd accumulator
Accumulator recv_total; // total recvd accumulator
Accumulator recv_goodput; // goodput recvd accumulator
unsigned long resync_count;
unsigned long nack_count;
unsigned long suppress_count;
unsigned long completion_count;
unsigned long failure_count; // usually due to re-syncs
}; // end class NormServerNode
}; // end class NormSenderNode
// Used for binary trees of NormNodes
@ -488,8 +616,8 @@ class NormNodeTree
class NormNodeTreeIterator
{
public:
NormNodeTreeIterator(const NormNodeTree& nodeTree);
void Reset();
NormNodeTreeIterator(const NormNodeTree& nodeTree, NormNode* prevNode = NULL);
void Reset(NormNode* prevNode = NULL);
NormNode* GetNextNode();
@ -512,7 +640,7 @@ class NormNodeList
void Remove(NormNode* theNode);
void DeleteNode(NormNode* theNode)
{
ASSERT(theNode);
ASSERT(NULL != theNode);
Remove(theNode);
theNode->Release();
}

View File

@ -61,8 +61,8 @@ class NormObject
class NormSession& GetSession() const {return session;}
NormNodeId LocalNodeId() const;
class NormServerNode* GetServer() const {return server;}
NormNodeId GetServerNodeId() const;
class NormSenderNode* GetSender() const {return sender;}
NormNodeId GetSenderNodeId() const;
bool IsOpen() {return (0 != segment_size);}
// Opens (inits) object for tx operation
@ -70,17 +70,21 @@ class NormObject
const char* infoPtr,
UINT16 infoLen,
UINT16 segmentSize,
UINT8 fecId,
UINT8 fecM,
UINT16 numData,
UINT16 numParity);
// Opens (inits) object for rx operation
bool Open(const NormObjectSize& objectSize,
bool RxOpen(const NormObjectSize& objectSize,
bool hasInfo,
UINT16 segmentSize,
UINT8 fecId,
UINT8 fecM,
UINT16 numData,
UINT16 numParity)
{
return Open(objectSize, (char*)NULL, hasInfo ? 1 : 0,
segmentSize, numData, numParity);
segmentSize, fecId, fecM, numData, numParity);
}
void Close();
@ -101,7 +105,7 @@ class NormObject
void SetNackingMode(NackingMode nackingMode)
{
nacking_mode = nackingMode;
// (TBD) initiate an appropriate NormServerNode::RepairCheck
// (TBD) initiate an appropriate NormSenderNode::RepairCheck
// to prompt repair process if needed
}
@ -166,9 +170,9 @@ class NormObject
bool FindRepairIndex(NormBlockId& blockId, NormSegmentId& segmentId) const;
// Methods available to server for transmission
bool NextServerMsg(NormObjectMsg* msg);
NormBlock* ServerRecoverBlock(NormBlockId blockId);
// Methods available to sender for transmission
bool NextSenderMsg(NormObjectMsg* msg);
NormBlock* SenderRecoverBlock(NormBlockId blockId);
bool CalculateBlockParity(NormBlock* block);
/*bool IsFirstPass() {return first_pass;}
@ -189,9 +193,8 @@ class NormObject
result = result ? pending_mask.Set(blockId) : false;
return result;
}
bool HandleInfoRequest();
bool HandleInfoRequest(bool holdoff);
bool HandleBlockRequest(NormBlockId nextId, NormBlockId lastId);
bool SetPending(NormBlockId blockId) {return pending_mask.Set(blockId);}
NormBlock* FindBlock(NormBlockId blockId) {return block_buffer.Find(blockId);}
bool ActivateRepairs();
bool IsRepairSet(NormBlockId blockId) {return repair_mask.Test(blockId);}
@ -205,7 +208,7 @@ class NormObject
NormBlock* StealNonPendingBlock(bool excludeBlock, NormBlockId excludeId = 0);
// Methods available to client for reception
// Methods available to receiver for reception
bool Accepted() {return accepted;}
void HandleObjectMessage(const NormObjectMsg& msg,
NormMsg::Type msgType,
@ -219,42 +222,53 @@ class NormObject
bool ReclaimSourceSegments(NormSegmentPool& segmentPool);
bool PassiveRepairCheck(NormBlockId blockId,
NormSegmentId segmentId);
bool ClientRepairCheck(CheckLevel level,
bool ReceiverRepairCheck(CheckLevel level,
NormBlockId blockId,
NormSegmentId segmentId,
bool timerActive,
bool holdoffPhase = false);
bool ReceiverRewindCheck(NormBlockId blockId,
NormSegmentId segmentId);
bool IsRepairPending(bool flush);
bool AppendRepairRequest(NormNackMsg& nack, bool flush);
void SetRepairInfo() {repair_info = true;}
bool SetRepairs(NormBlockId first, NormBlockId last)
{
return (first == last) ? repair_mask.Set(first) :
repair_mask.SetBits(first, last-first+1);
repair_mask.SetBits(first, repair_mask.Delta(last,first)+1);
}
void SetLastNackTime(const ProtoTime& theTime)
{last_nack_time = theTime;}
const ProtoTime& GetLastNackTime() const
{return last_nack_time;}
double GetNackAge() const
{return ProtoTime::Delta(ProtoTime().GetCurrentTime(), last_nack_time);}
protected:
NormObject(Type theType,
class NormSession& theSession,
class NormServerNode* theServer,
class NormSenderNode* theSender,
const NormObjectId& objectId);
void Accept() {accepted = true;}
NormObject::Type type;
class NormSession& session;
class NormServerNode* server; // NULL value indicates local (tx) object
class NormSenderNode* sender; // NULL value indicates local (tx) object
unsigned int reference_count;
NormObjectId transport_id;
NormObjectSize object_size;
UINT16 segment_size;
UINT8 fec_id;
UINT8 fec_m;
UINT16 ndata;
UINT16 nparity;
NormBlockBuffer block_buffer;
bool pending_info; // set when we need to send or recv info
ProtoSlidingMask pending_mask;
bool repair_info; // client: set when
bool repair_info; // receiver: set when
ProtoSlidingMask repair_mask;
NormBlockId current_block_id; // for suppression
NormSegmentId next_segment_id; // for suppression
@ -267,6 +281,7 @@ class NormObject
NormBlockId final_block_id;
UINT16 final_segment_size;
NackingMode nacking_mode;
ProtoTime last_nack_time; // time of last NACK received (used for flow control)
char* info_ptr;
UINT16 info_len;
@ -284,7 +299,7 @@ class NormFileObject : public NormObject
{
public:
NormFileObject(class NormSession& theSession,
class NormServerNode* theServer,
class NormSenderNode* theSender,
const NormObjectId& objectId);
~NormFileObject();
@ -302,7 +317,7 @@ class NormFileObject : public NormObject
return result;
}
bool PadToSize()
{return file.Pad(GetSize().GetOffset());}
{return file.Pad(NormObject::GetSize().GetOffset());}
virtual bool WriteSegment(NormBlockId blockId,
NormSegmentId segmentId,
@ -327,7 +342,7 @@ class NormDataObject : public NormObject
// (TBD) allow support of greater than 4GB size data objects
public:
NormDataObject(class NormSession& theSession,
class NormServerNode* theServer,
class NormSenderNode* theSender,
const NormObjectId& objectId);
~NormDataObject();
@ -372,7 +387,7 @@ class NormStreamObject : public NormObject
{
public:
NormStreamObject(class NormSession& theSession,
class NormServerNode* theServer,
class NormSenderNode* theSender,
const NormObjectId& objectId);
~NormStreamObject();
@ -409,12 +424,23 @@ class NormStreamObject : public NormObject
bool HasVacancy()
{return (stream_closing ? false : write_vacancy);}
NormBlock* StreamBlockLo()
{return stream_buffer.Find(stream_buffer.RangeLo());}
void SetLastNackTime(NormBlockId blockId, const ProtoTime& theTime)
{
NormBlock* block = stream_buffer.Find(blockId);
if (NULL != block) block->SetLastNackTime(theTime);
}
bool Read(char* buffer, unsigned int* buflen, bool findMsgStart = false);
UINT32 Write(const char* buffer, UINT32 len, bool eom = false);
UINT32 GetCurrentReadOffset() {return read_offset;}
unsigned int GetCurrentBufferUsage() const // in segments
{return segment_pool.CurrentUsage();}
bool StreamUpdateStatus(NormBlockId blockId);
// Note that the "pending_mask" should be cleared and the
// "block_buffer" emptied before "StreamResync()" is invoked
@ -423,7 +449,7 @@ class NormStreamObject : public NormObject
stream_sync = false;
StreamUpdateStatus(blockId);
}
void StreamAdvance();
bool StreamAdvance();
virtual bool WriteSegment(NormBlockId blockId,
NormSegmentId segmentId,
@ -440,11 +466,11 @@ class NormStreamObject : public NormObject
// For receive stream, we can rewind to earliest buffered offset
void Rewind();
bool LockBlocks(NormBlockId nextId, NormBlockId lastId);
bool LockBlocks(NormBlockId nextId, NormBlockId lastId, const ProtoTime& currentTime);
void UnlockBlock(NormBlockId blockId);
bool LockSegments(NormBlockId blockId, NormSegmentId firstId, NormSegmentId lastId);
NormBlockId StreamBufferLo() {return stream_buffer.RangeLo();}
NormBlockId StreamBufferLo() const {return stream_buffer.RangeLo();}
void Prune(NormBlockId blockId, bool updateStatus);
bool IsFlushPending() {return flush_pending;}
@ -456,17 +482,25 @@ class NormStreamObject : public NormObject
(ndata-1));}
NormBlockId GetNextBlockId() const
{return (server ? read_index.block : write_index.block);}
{return (sender ? read_index.block : write_index.block);}
NormSegmentId GetNextSegmentId() const
{return (server ? read_index.segment : write_index.segment);}
{return (sender ? read_index.segment : write_index.segment);}
UINT32 GetBlockPoolCount() {return block_pool.GetCount();}
void SetBlockPoolThreshold(UINT32 value)
{block_pool_threshold = value;}
unsigned long CurrentBufferUsage() const
{return (segment_size * segment_pool.CurrentUsage());}
unsigned long PeakBufferUsage() const
{return (segment_size * segment_pool.PeakUsage());}
unsigned long BufferOverunCount() const
{return segment_pool.OverunCount() + block_pool.OverrunCount();}
bool IsReadReady() const {return read_ready;}
bool DetermineReadReadiness()
bool DetermineReadReadiness() const
{
NormBlock* block = stream_buffer.Find(read_index.block);
return ((NULL != block) && (NULL != block->GetSegment(read_index.segment)));
@ -475,6 +509,8 @@ class NormStreamObject : public NormObject
bool IsReadIndex(NormBlockId blockId, NormSegmentId segmentId) const
{return ((blockId == read_index.block) && (segmentId == read_index.segment));}
bool PassiveReadCheck(NormBlockId blockId, NormSegmentId segmentId);
private:
bool ReadPrivate(char* buffer, unsigned int* buflen, bool findMsgStart = false);
void Terminate();
@ -520,7 +556,7 @@ class NormSimObject : public NormObject
{
public:
NormSimObject(class NormSession& theSession,
class NormServerNode* theServer,
class NormSenderNode* theSender,
const NormObjectId& objectId);
~NormSimObject();

View File

@ -25,7 +25,8 @@ class NormSegmentPool
}
bool IsEmpty() const {return (NULL == seg_list);}
unsigned long CurrentUsage() const {return (seg_total - seg_count);}
unsigned int CurrentUsage() const
{return (seg_total - seg_count);}
unsigned long PeakUsage() const {return peak_usage;}
unsigned long OverunCount() const {return overruns;}
unsigned int GetSegmentSize() {return seg_size;}
@ -94,7 +95,7 @@ class NormBlock
segment_table[sid] = segment;
}
// Server routines
// Sender routines
void TxInit(NormBlockId& blockId, UINT16 ndata, UINT16 autoParity)
{
id = blockId;
@ -106,6 +107,7 @@ class NormBlock
parity_offset = autoParity;
flags = 0;
seg_size_max = 0;
last_nack_time.GetCurrentTime();
}
void TxRecover(NormBlockId& blockId, UINT16 ndata, UINT16 nparity)
{
@ -139,10 +141,12 @@ class NormBlock
bool AppendRepairAdv(NormCmdRepairAdvMsg& cmd,
NormObjectId objectId,
bool repairInfo,
UINT8 fecId,
UINT8 fecM,
UINT16 numData,
UINT16 segmentSize);
// Client routines
// Receiver routines
void RxInit(NormBlockId& blockId, UINT16 ndata, UINT16 nparity)
{
id = blockId;
@ -228,14 +232,25 @@ class NormBlock
UINT16 finalSegmentSize) const;
bool AppendRepairRequest(NormNackMsg& nack,
UINT8 fecId,
UINT8 fecM,
UINT16 numData,
UINT16 numParity,
NormObjectId objectId,
bool pendingInfo,
UINT16 segmentSize);
void SetLastNackTime(const ProtoTime& theTime)
{last_nack_time = theTime;}
const ProtoTime& GetLastNackTime() const
{return last_nack_time;}
double GetNackAge() const
{return ProtoTime::Delta(ProtoTime().GetCurrentTime(), last_nack_time);}
//void DisplayPendingMask(FILE* f) {pending_mask.Display(f);}
bool IsEmpty() const;
//bool IsEmpty() const;
void EmptyToPool(NormSegmentPool& segmentPool);
private:
@ -251,6 +266,7 @@ class NormBlock
ProtoBitmask pending_mask;
ProtoBitmask repair_mask;
ProtoTime last_nack_time; // for stream flow control
NormBlock* next;
}; // end class NormBlock
@ -274,7 +290,7 @@ class NormBlockPool
}
else if (!overrun_flag)
{
DMSG(0, "NormBlockPool::Get() warning: operating with constrained buffering resources\n");
PLOG(PL_DEBUG, "NormBlockPool::Get() warning: operating with constrained buffering resources\n");
overruns++;
overrun_flag = true;
}

View File

@ -8,6 +8,21 @@
#include "protokit.h"
#include "protoCap.h" // for ProtoCap for ECN_SUPPORT
// When this is defined, our experimental tweak to
// limiting suggested cc rate to 2.0* measured recv rate is
// used during steady state similar to "slow start"
// conditions. What this means is that when data transmission
// is idle, the rate will be reduced. This _may_ impact
// certain use cases. Our theory here is that preventing rate
// overshoot will be more helpful and safer than the penalty
// imposed. This uses the non-RFC5740 NORM_CC_FLAG_LIMIT in
// NORM-CC feedback header extensions
#define LIMIT_CC_RATE 1
class NormController
{
public:
@ -19,13 +34,16 @@ class NormController
TX_QUEUE_EMPTY,
TX_FLUSH_COMPLETED,
TX_WATERMARK_COMPLETED,
TX_CMD_SENT,
TX_OBJECT_SENT,
TX_OBJECT_PURGED,
TX_RATE_CHANGED,
LOCAL_SENDER_CLOSED,
REMOTE_SENDER_NEW,
REMOTE_SENDER_ACTIVE,
REMOTE_SENDER_INACTIVE,
REMOTE_SENDER_PURGED,
RX_CMD_NEW,
RX_OBJECT_NEW,
RX_OBJECT_INFO,
RX_OBJECT_UPDATED,
@ -39,7 +57,7 @@ class NormController
virtual void Notify(NormController::Event event,
class NormSessionMgr* sessionMgr,
class NormSession* session,
class NormServerNode* sender,
class NormSenderNode* sender,
class NormObject* object) = 0;
}; // end class NormController
@ -49,7 +67,8 @@ class NormSessionMgr
friend class NormSession;
public:
NormSessionMgr(ProtoTimerMgr& timerMgr,
ProtoSocket::Notifier& socketNotifier);
ProtoSocket::Notifier& socketNotifier,
ProtoChannel::Notifier* channelNotifier = NULL);
~NormSessionMgr();
void SetController(NormController* theController)
{controller = theController;}
@ -62,7 +81,7 @@ class NormSessionMgr
void Notify(NormController::Event event,
class NormSession* session,
class NormServerNode* sender,
class NormSenderNode* sender,
class NormObject* object)
{
if (controller)
@ -72,14 +91,17 @@ class NormSessionMgr
void ActivateTimer(ProtoTimer& timer) {timer_mgr.ActivateTimer(timer);}
ProtoTimerMgr& GetTimerMgr() const {return timer_mgr;}
ProtoSocket::Notifier& GetSocketNotifier() const {return socket_notifier;}
ProtoChannel::Notifier* GetChannelNotifier() const {return channel_notifier;}
void DoSystemTimeout()
{timer_mgr.DoSystemTimeout();}
NormController* GetController() const {return controller;}
private:
ProtoTimerMgr& timer_mgr;
ProtoSocket::Notifier& socket_notifier;
ProtoChannel::Notifier* channel_notifier;
NormController* controller;
class NormSession* top_session; // top of NormSession list
@ -106,8 +128,13 @@ class NormSession
static const UINT16 DEFAULT_NPARITY;
static const UINT16 DEFAULT_TX_CACHE_MIN;
static const UINT16 DEFAULT_TX_CACHE_MAX;
static const UINT32 DEFAULT_TX_CACHE_SIZE;
static const double DEFAULT_FLOW_CONTROL_FACTOR;
static const UINT16 DEFAULT_RX_CACHE_MAX;
static const int DEFAULT_ROBUST_FACTOR;
enum {IFACE_NAME_MAX = 31};
enum ProbingMode {PROBE_NONE, PROBE_PASSIVE, PROBE_ACTIVE};
enum AckingStatus
{
@ -117,9 +144,20 @@ class NormSession
ACK_SUCCESS
};
// This is currently used to determine whether
// and how to "auto populate" the acking node
// list based on received messages
enum TrackingStatus
{
TRACK_NONE = 0x00,
TRACK_RECEIVERS = 0x01,
TRACK_SENDERS = 0x02,
TRACK_ALL = 0x03
};
// General methods
const NormNodeId& LocalNodeId() const {return local_node_id;}
bool Open(const char* interfaceName = NULL);
bool Open();
void Close();
bool IsOpen() {return (rx_socket.IsOpen() || tx_socket->IsOpen());}
const ProtoAddress& Address() {return address;}
@ -145,12 +183,39 @@ class NormSession
loopback = result ? state : loopback;
return result;
}
void SetTxPort(UINT16 txPort) {tx_port = txPort;}
void SetRxPortReuse(bool enable, bool bindToSessionAddress = true)
bool SetFragmentation(bool state)
{
rx_port_reuse = enable; // allow sessionPort reuse when true
rx_addr_bind = bindToSessionAddress; // bind rx_socket to sessionAddr when true
bool result = tx_socket->IsOpen() ? tx_socket->SetFragmentation(state) : true;
fragmentation = result ? state : fragmentation;
return result;
}
// MUST be called _after_ SetAddress()
bool SetTxPort(UINT16 txPort, bool enableReuse = false, const char* srcAddr = NULL);
UINT16 GetTxPort() const;
bool SetRxPortReuse(bool enableReuse,
const char* rxAddress, // bind() to <rxAddress>/<sessionPort>
const char* senderAddress = (const char*)0, // connect() to <senderAddress>/<senderPort>
UINT16 senderPort = 0);
UINT16 GetRxPort() const;
// "SetEcnSupport(true)" sets up raw packet capture (pcap) so that incoming packet
// ECN status may be checked
// NOTE: only effective _before_ sndr/rcvr startup!
void SetEcnSupport(bool ecnEnable, bool ignoreLoss, bool tolerateLoss)
{
ecn_enabled = ecnEnable;
ecn_ignore_loss = ecnEnable ? ignoreLoss : false;
cc_tolerate_loss = ecn_ignore_loss ? false : tolerateLoss;
}
bool GetEcnIgnoreLoss() const
{return ecn_ignore_loss;}
bool GetCCTolerateLoss() const
{return cc_tolerate_loss;}
static double CalculateRate(double size, double rtt, double loss);
NormSessionMgr& GetSessionMgr() {return session_mgr;}
@ -161,38 +226,74 @@ class NormSession
{return rx_socket.SetRxBufferSize(bufferSize);}
// Session parameters
double GetTxRate()
{
return (tx_rate * 8.0); // convert to bits/second
}
double GetTxRate(); // returns bits/sec
// (TBD) watch timer scheduling and min/max bounds
void SetTxRate(double txRate)
{
txRate /= 8.0; // convert to bytes/sec
posted_tx_rate_changed = false;
SetTxRateInternal(txRate);
}
double BackoffFactor() {return backoff_factor;}
void SetBackoffFactor(double value) {backoff_factor = value;}
bool CongestionControl() {return cc_enable;}
void SetCongestionControl(bool state)
void SetTxRateBounds(double rateMin, double rateMax);
double BackoffFactor()
{return backoff_factor;}
void SetBackoffFactor(double value)
{backoff_factor = value;}
bool CongestionControl()
{return cc_enable;}
void SetCongestionControl(bool state, bool adjustRate = true)
{
if (state) SetGrttProbingMode(PROBE_ACTIVE);
cc_enable = state;
cc_adjust = adjustRate;
if (state) probe_proactive = true;
}
// This method enables/disables flow control operation.
void SetFlowControl(double flowControlFactor)
{flow_control_factor = flowControlFactor;}
double GetFlowControl() const
{return flow_control_factor;}
// This method is used by "internal" NormSession and NormObject code
// to activate the timer-based flow control when needed.
void ActivateFlowControl(double delay, NormObjectId objectId, NormController::Event event);
void DeactivateFlowControl()
{flow_control_timer.Deactivate();}
bool FlowControlIsActive() const
{return flow_control_timer.IsActive();}
NormObjectId GetFlowControlObject() const
{return flow_control_object;}
// The value returned here is the time interval used to determine
// whether there has been "recent" NACKing for a given object or block.
// A larger "flow_control_factor" stretches the time interval that
// is considered "recent" and thus imposes stronger flow control.
// A _strong_ "flow_control_factor" would be on the order of
// "tx_robust_factor", but note larger values require more
// tx/rx caching and/or buffering to sustain high throughput
// NOTE "flow_control_factor = 0.0" means _no_ timer-based
// flow control is imposed
double GetFlowControlDelay() const
{
double fdelay = (flow_control_factor * (SenderGrtt() * (backoff_factor + 1)));
return ((fdelay > 0.020) ? fdelay : 0.020); // minimum 20 msec flow control
}
// GRTT measurement management
void SetGrttProbingMode(ProbingMode probingMode);
void SetGrttProbingInterval(double intervalMin, double intervalMax);
void SetGrttMax(double grttMax) {grtt_max = grttMax;}
void SetTxRateBounds(double rateMin, double rateMax);
bool SetTxCacheBounds(NormObjectSize sizeMax,
unsigned long countMin,
unsigned long countMax);
void Notify(NormController::Event event,
class NormServerNode* server,
class NormSenderNode* sender,
class NormObject* object)
{
notify_pending = true;
session_mgr.Notify(event, this, server, object);
session_mgr.Notify(event, this, sender, object);
notify_pending = false;
}
@ -205,20 +306,21 @@ class NormSession
void SetUserData(const void* userData) {user_data = userData;}
const void* GetUserData() {return user_data;}
// Server methods
void ServerSetBaseObjectId(NormObjectId baseId)
// Sender methods
void SenderSetBaseObjectId(NormObjectId baseId)
{
next_tx_object_id = IsServer() ? next_tx_object_id : baseId;
//instance_id = IsServer() ? instance_id : (UINT16)baseId;
next_tx_object_id = IsSender() ? next_tx_object_id : baseId;
//instance_id = IsSender() ? instance_id : (UINT16)baseId;
}
bool IsServer() {return is_server;}
bool StartServer(UINT16 instanceId,
bool IsSender() {return is_sender;}
bool StartSender(UINT16 instanceId,
UINT32 bufferSpace,
UINT16 segmentSize,
UINT16 numData,
UINT16 numParity,
const char* interfaceName = NULL);
void StopServer();
UINT16 numParity);
void StopSender();
void SetTxOnly(bool txOnly, bool connectToSessionAddress = false);
NormStreamObject* QueueTxStream(UINT32 bufferSize,
bool doubleBuffer = false,
const char* infoPtr = NULL,
@ -235,15 +337,29 @@ class NormSession
void DeleteTxObject(NormObject* obj);
// postive ack mgmnt
void ServerSetWatermark(NormObjectId objectId,
NormBlockId blockId,
NormSegmentId segmentId);
void ServerCancelWatermark();
bool ServerAddAckingNode(NormNodeId nodeId);
void ServerRemoveAckingNode(NormNodeId nodeId);
AckingStatus ServerGetAckingStatus(NormNodeId nodeId);
NormObject* SenderFindTxObject(NormObjectId objectId)
{return tx_table.Find(objectId);}
// postive ack mgmnt
void SenderSetWatermark(NormObjectId objectId,
NormBlockId blockId,
NormSegmentId segmentId,
bool overrideFlush = false);
void SenderResetWatermark();
void SenderCancelWatermark();
void SenderSetAutoAckingNodes(TrackingStatus trackingStatus)
{acking_auto_populate = trackingStatus;}
bool SenderAddAckingNode(NormNodeId nodeId);
void SenderRemoveAckingNode(NormNodeId nodeId);
AckingStatus SenderGetAckingStatus(NormNodeId nodeId);
// Set "prevNodeId = NORM_NODE_NONE" to init this iteration (returns "false" when done)
bool SenderGetNextAckingNode(NormNodeId& prevNodeId, AckingStatus* ackingStatus = NULL);
// App-defined command support methods
bool SenderSendCmd(const char* cmdBuffer, unsigned int cmdLength, bool robust);
void SenderCancelCmd();
// robust factor
void SetTxRobustFactor(int value)
@ -255,31 +371,34 @@ class NormSession
int GetRxRobustFactor() const
{return rx_robust_factor;}
UINT16 ServerSegmentSize() const {return segment_size;}
UINT16 ServerBlockSize() const {return ndata;}
UINT16 ServerNumParity() const {return nparity;}
UINT16 ServerAutoParity() const {return auto_parity;}
void ServerSetAutoParity(UINT16 autoParity)
UINT8 GetSenderFecId() const {return fec_id;}
UINT8 GetSenderFecFieldSize() const {return fec_m;}
UINT16 SenderSegmentSize() const {return segment_size;}
UINT16 SenderBlockSize() const {return ndata;}
UINT16 SenderNumParity() const {return nparity;}
UINT16 SenderAutoParity() const {return auto_parity;}
void SenderSetAutoParity(UINT16 autoParity)
{ASSERT(autoParity <= nparity); auto_parity = autoParity;}
UINT16 ServerExtraParity() const {return extra_parity;}
void ServerSetExtraParity(UINT16 extraParity)
UINT16 SenderExtraParity() const {return extra_parity;}
void SenderSetExtraParity(UINT16 extraParity)
{extra_parity = extraParity;}
// EMCON Server (useful when there are silent receivers)
// EMCON Sender (useful when there are silent receivers)
// (NORM_INFO is redundantly sent)
void SndrSetEmcon(bool state)
{sndr_emcon = true;}
bool SndrEmcon() const
{return sndr_emcon;}
bool ServerGetFirstPending(NormObjectId& objectId)
bool SenderGetFirstPending(NormObjectId& objectId)
{
UINT32 index;
bool result = tx_pending_mask.GetFirstSet(index);
objectId = (UINT16)index;
return result;
}
bool ServerGetFirstRepairPending(NormObjectId& objectId)
bool SenderGetFirstRepairPending(NormObjectId& objectId)
{
UINT32 index;
bool result = tx_repair_mask.GetFirstSet(index);
@ -287,10 +406,10 @@ class NormSession
return result;
}
double ServerGrtt() {return grtt_advertised;}
void ServerSetGrtt(double grttValue)
double SenderGrtt() const {return grtt_advertised;}
void SenderSetGrtt(double grttValue)
{
if (IsServer())
if (IsSender())
{
double grttMin = 2.0 * ((double)(44+segment_size))/tx_rate;
grttValue = (grttValue < grttMin) ? grttMin : grttValue;
@ -298,59 +417,67 @@ class NormSession
grtt_quantized = NormQuantizeRtt(grttValue);
grtt_measured = grtt_advertised = NormUnquantizeRtt(grtt_quantized);
}
double ServerGroupSize() {return gsize_measured;}
void ServerSetGroupSize(double gsize)
double SenderGroupSize() {return gsize_measured;}
void SenderSetGroupSize(double gsize)
{
gsize_measured = gsize;
gsize_quantized = NormQuantizeGroupSize(gsize);
gsize_advertised = NormUnquantizeGroupSize(gsize_quantized);
}
void ServerEncode(const char* segment, char** parityVectorList)
{encoder->Encode(segment, parityVectorList);}
void SenderEncode(unsigned int segmentId, const char* segment, char** parityVectorList)
{encoder->Encode(segmentId, segment, parityVectorList);}
NormBlock* ServerGetFreeBlock(NormObjectId objectId, NormBlockId blockId);
void ServerPutFreeBlock(NormBlock* block)
NormBlock* SenderGetFreeBlock(NormObjectId objectId, NormBlockId blockId);
void SenderPutFreeBlock(NormBlock* block)
{
block->EmptyToPool(segment_pool);
block_pool.Put(block);
}
char* ServerGetFreeSegment(NormObjectId objectId, NormBlockId blockId);
void ServerPutFreeSegment(char* segment) {segment_pool.Put(segment);}
char* SenderGetFreeSegment(NormObjectId objectId, NormBlockId blockId);
void SenderPutFreeSegment(char* segment) {segment_pool.Put(segment);}
void PromptServer() {QueueMessage(NULL);}
void PromptSender() {QueueMessage(NULL);}
void TouchServer()
void TouchSender()
{
posted_tx_queue_empty = false;
PromptServer();
PromptSender();
//if (!notify_pending) Serve();
}
// Client methods
bool StartClient(unsigned long bufferSpace,
const char* interfaceName = NULL);
void StopClient();
bool IsClient() const {return is_client;}
unsigned long RemoteServerBufferSize() const
{return remote_server_buffer_size;}
void ClientSetUnicastNacks(bool state) {unicast_nacks = state;}
bool ClientGetUnicastNacks() const {return unicast_nacks;}
bool GetPostedTxQueueEmpty() const
{return posted_tx_queue_empty;}
void ClientSetSilent(bool state)
{client_silent = state;}
bool ClientIsSilent() const {return client_silent;}
// Receiver methods
bool StartReceiver(unsigned long bufferSpace);
void StopReceiver();
bool IsReceiver() const {return is_receiver;}
unsigned long RemoteSenderBufferSize() const
{return remote_sender_buffer_size;}
void DeleteRemoteSender(NormSenderNode& senderNode);
// Call this to do remote sender memory allocations ahead of time
bool PreallocateRemoteSender(UINT16 segmentSize, UINT16 numData, UINT16 numParity);
void ReceiverSetUnicastNacks(bool state) {unicast_nacks = state;}
bool ReceiverGetUnicastNacks() const {return unicast_nacks;}
void ReceiverSetSilent(bool state)
{receiver_silent = state;}
bool ReceiverIsSilent() const {return receiver_silent;}
void RcvrSetIgnoreInfo(bool state)
{rcvr_ignore_info = state;}
bool RcvrIgnoreInfo() const
{return rcvr_ignore_info;}
// "-1" corresponds to typical operation where source data for
// partially received FEC blocks are only provided to the app
// when buffer constraints require it.
// The default "rcvr_max_delay = -1" corresponds to typical
// operation where source data forpartially received FEC blocks
// are only provided to the app when buffer constraints require it.
// Otherwise, the "maxDelay" corresponds to the max number
// of FEC blocks the receiver waits before passing partially
// received blocks to the app.
@ -359,24 +486,47 @@ class NormSession
void RcvrSetMaxDelay(INT32 maxDelay)
{rcvr_max_delay = maxDelay;}
bool RcvrIsLowDelay()
{return (ClientIsSilent() && (rcvr_max_delay >= 0));}
{return (ReceiverIsSilent() && (rcvr_max_delay >= 0));}
INT32 RcvrGetMaxDelay() const
{return rcvr_max_delay;}
NormObject::NackingMode ClientGetDefaultNackingMode() const
// When "rcvr_realtime" is set to "true", the buffer managment scheme of
// favoring newly arriving data over attempting reliable reception of
// buffered data is observed. This is the same buffer management that
// is used for silent receiver operation
// (TBD) allow the above "low delay" option to work with this, too?
void RcvrSetRealtime(bool state)
{rcvr_realtime = state;}
bool RcvrIsRealtime() const
{return rcvr_realtime;}
NormObject::NackingMode ReceiverGetDefaultNackingMode() const
{return default_nacking_mode;}
void ClientSetDefaultNackingMode(NormObject::NackingMode nackingMode)
void ReceiverSetDefaultNackingMode(NormObject::NackingMode nackingMode)
{default_nacking_mode = nackingMode;}
NormServerNode::RepairBoundary ClientGetDefaultRepairBoundary() const
NormSenderNode::RepairBoundary ReceiverGetDefaultRepairBoundary() const
{return default_repair_boundary;}
void ClientSetDefaultRepairBoundary(NormServerNode::RepairBoundary repairBoundary)
void ReceiverSetDefaultRepairBoundary(NormSenderNode::RepairBoundary repairBoundary)
{default_repair_boundary = repairBoundary;}
NormSenderNode::SyncPolicy ReceiverGetDefaultSyncPolicy() const
{return default_sync_policy;}
void ReceiverSetDefaultSyncPolicy(NormSenderNode::SyncPolicy syncPolicy)
{default_sync_policy = syncPolicy;}
// Set default "max_pending_range" of NormObjects for reception
void SetRxCacheMax(UINT16 maxCount)
{rx_cache_count_max = maxCount;}
UINT16 GetRxCacheMax() const
{return rx_cache_count_max;}
// Debug settings
void SetTrace(bool state) {trace = state;}
void SetTxLoss(double percent) {tx_loss_rate = percent;}
void SetRxLoss(double percent) {rx_loss_rate = percent;}
void SetReportTimerInterval(double interval) {report_timer.SetInterval(interval);}
double GetReportTimerInterval() {return report_timer.GetInterval();}
#ifdef SIMULATE
// Simulation specific methods
@ -385,6 +535,8 @@ class NormSession
const ProtoAddress& src, bool unicast);
#endif // SIMULATE
void SetProbeCount(unsigned probeCount) {probe_count = probeCount;}
private:
// Only NormSessionMgr can create/delete sessions
NormSession(NormSessionMgr& sessionMgr, NormNodeId localNodeId);
@ -394,26 +546,34 @@ class NormSession
bool QueueTxObject(NormObject* obj);
double GetProbeInterval();
bool OnTxTimeout(ProtoTimer& theTimer);
bool OnRepairTimeout(ProtoTimer& theTimer);
bool OnFlushTimeout(ProtoTimer& theTimer);
bool OnProbeTimeout(ProtoTimer& theTimer);
bool OnReportTimeout(ProtoTimer& theTimer);
bool OnCmdTimeout(ProtoTimer& theTimer);
bool OnFlowControlTimeout(ProtoTimer& theTimer);
void TxSocketRecvHandler(ProtoSocket& theSocket, ProtoSocket::Event theEvent);
void RxSocketRecvHandler(ProtoSocket& theSocket, ProtoSocket::Event theEve);
void HandleReceiveMessage(NormMsg& msg, bool wasUnicast);
void RxSocketRecvHandler(ProtoSocket& theSocket, ProtoSocket::Event theEvent);
void HandleReceiveMessage(NormMsg& msg, bool wasUnicast, bool ecn = false);
// Server message handling routines
void ServerHandleNackMessage(const struct timeval& currentTime,
// This is used when raw packet capture is enabled
void OnPktCapture(ProtoChannel& theChannel,
ProtoChannel::Notification notifyType);
// Sender message handling routines
void SenderHandleNackMessage(const struct timeval& currentTime,
NormNackMsg& nack);
void ServerHandleAckMessage(const struct timeval& currentTime,
void SenderHandleAckMessage(const struct timeval& currentTime,
const NormAckMsg& ack,
bool wasUnicast);
void ServerUpdateGrttEstimate(double clientRtt);
void SenderUpdateGrttEstimate(double rcvrRtt);
double CalculateRtt(const struct timeval& currentTime,
const struct timeval& grttResponse);
void ServerHandleCCFeedback(struct timeval currentTime,
void SenderHandleCCFeedback(struct timeval currentTime,
NormNodeId nodeId,
UINT8 ccFlags,
double ccRtt,
@ -422,27 +582,39 @@ class NormSession
UINT16 ccSequence);
void AdjustRate(bool onResponse);
void SetTxRateInternal(double txRate); // here, txRate is bytes/sec
bool ServerQueueSquelch(NormObjectId objectId);
void ServerQueueFlush();
bool ServerQueueWatermarkFlush();
bool ServerBuildRepairAdv(NormCmdRepairAdvMsg& cmd);
void ServerUpdateGroupSize();
bool SenderQueueSquelch(NormObjectId objectId);
void SenderQueueFlush();
bool SenderQueueWatermarkFlush();
bool SenderBuildRepairAdv(NormCmdRepairAdvMsg& cmd);
void SenderUpdateGroupSize();
bool SenderQueueAppCmd();
// Client message handling routines
void ClientHandleObjectMessage(const struct timeval& currentTime,
const NormObjectMsg& msg);
void ClientHandleCommand(const struct timeval& currentTime,
const NormCmdMsg& msg);
void ClientHandleNackMessage(const NormNackMsg& nack);
void ClientHandleAckMessage(const NormAckMsg& ack);
// Receiver message handling routines
void ReceiverHandleObjectMessage(const struct timeval& currentTime,
const NormObjectMsg& msg,
bool ecnStatus);
void ReceiverHandleCommand(const struct timeval& currentTime,
const NormCmdMsg& msg,
bool ecnStatus);
void ReceiverHandleNackMessage(const NormNackMsg& nack);
void ReceiverHandleAckMessage(const NormAckMsg& ack);
NormSessionMgr& session_mgr;
bool notify_pending;
ProtoTimer tx_timer;
UINT16 tx_port;
bool tx_port_reuse;
ProtoAddress tx_address; // bind tx_socket to tx_address when valid
ProtoSocket tx_socket_actual;
ProtoSocket* tx_socket;
ProtoSocket rx_socket;
ProtoCap* rx_cap; // raw packet capture alternative to "rx_socket"
bool rx_port_reuse; // enable rx_socket port (sessionPort) reuse when true
ProtoAddress rx_bind_addr;
ProtoAddress rx_connect_addr;
ProtoAddressList dst_addr_list; // list of local addresses
NormMessageQueue message_queue;
NormMessageQueue message_pool;
ProtoTimer report_timer;
@ -450,20 +622,22 @@ class NormSession
// General session parameters
NormNodeId local_node_id;
ProtoAddress address; // session destination address & port
ProtoAddress address; // session destination address/port
UINT8 ttl; // session multicast ttl
UINT8 tos; // session IPv4 TOS (or IPv6 traffic class - TBD)
bool loopback; // to receive own traffic
bool rx_port_reuse; // enable rx_socket port (sessionPort) reuse when true
bool rx_addr_bind; // bind rx_socket to sessionAddr when true
char interface_name[32];
bool loopback; // receive own traffic it true
bool fragmentation; // enable UDP/IP fragmentation (i.e. clear DF bit) if true
bool ecn_enabled; // set true to get raw packets and check for ECN status
char interface_name[IFACE_NAME_MAX+1];
double tx_rate; // bytes per second
double tx_rate_min;
double tx_rate_max;
double backoff_factor;
// Server parameters and state
bool is_server;
// Sender parameters and state
double backoff_factor;
bool is_sender;
int tx_robust_factor;
UINT16 instance_id;
UINT16 segment_size;
@ -472,6 +646,8 @@ class NormSession
UINT16 auto_parity;
UINT16 extra_parity;
bool sndr_emcon;
bool tx_only;
bool tx_connect;
NormObjectTable tx_table;
ProtoSlidingMask tx_pending_mask;
@ -480,6 +656,8 @@ class NormSession
NormBlockPool block_pool;
NormSegmentPool segment_pool;
NormEncoder* encoder;
UINT8 fec_id;
UINT8 fec_m;
NormObjectId next_tx_object_id;
unsigned int tx_cache_count_min;
@ -488,12 +666,15 @@ class NormSession
ProtoTimer flush_timer;
int flush_count;
bool posted_tx_queue_empty;
bool posted_tx_rate_changed;
// For postive acknowledgement collection
NormNodeTree acking_node_tree;
unsigned int acking_node_count;
unsigned int acking_success_count;
TrackingStatus acking_auto_populate; // whether / how to "auto populate" acking node list
bool watermark_pending;
bool watermark_flushes;
bool watermark_active;
NormObjectId watermark_object_id;
NormBlockId watermark_block_id;
@ -533,31 +714,52 @@ class NormSession
UINT8 gsize_quantized;
// Sender congestion control parameters
unsigned int probe_count; // for experimentation (cc probes per rtt)
bool cc_enable;
UINT8 cc_sequence;
bool cc_adjust;
UINT16 cc_sequence;
NormNodeList cc_node_list;
bool cc_slow_start;
bool cc_active;
unsigned long sent_accumulator; // for sentRate measurement
NormNode::Accumulator sent_accumulator; // for sentRate measurement
double nominal_packet_size;
bool data_active; // true when actively sending data
double flow_control_factor;
ProtoTimer flow_control_timer;
NormObjectId flow_control_object;
NormController::Event flow_control_event;
// Sender "app-defined" command state
unsigned int cmd_count;
char* cmd_buffer;
unsigned int cmd_length;
ProtoTimer cmd_timer;
// Receiver parameters
bool is_client;
bool is_receiver;
int rx_robust_factor;
NormNodeTree server_tree;
unsigned long remote_server_buffer_size;
NormSenderNode* preset_sender;
NormNodeTree sender_tree;
unsigned long remote_sender_buffer_size;
bool unicast_nacks;
bool client_silent;
bool receiver_silent;
bool rcvr_ignore_info;
INT32 rcvr_max_delay;
NormServerNode::RepairBoundary default_repair_boundary;
bool rcvr_realtime;
NormSenderNode::RepairBoundary default_repair_boundary;
NormObject::NackingMode default_nacking_mode;
NormSenderNode::SyncPolicy default_sync_policy;
UINT16 rx_cache_count_max;
// State for some experimental congestion control
bool ecn_ignore_loss;
bool cc_tolerate_loss;
// Protocol test/debug parameters
bool trace;
double tx_loss_rate; // for correlated loss
double rx_loss_rate; // for uncorrelated loss
double report_timer_interval;
const void* user_data;
@ -565,5 +767,11 @@ class NormSession
NormSession* next;
}; // end class NormSession
// This function prints out NORM message info
void NormTrace(const struct timeval& currentTime,
NormNodeId localId,
const NormMsg& msg,
bool sent,
UINT8 fecM);
#endif // _NORM_SESSION

View File

@ -15,15 +15,23 @@ class NormSimAgent : public NormController, public ProtoMessageSink
bool ProcessCommand(const char* cmd, const char* val);
// Note: don't allow client _and_ server operation at same time
bool StartServer(); // start sender
bool StartClient(); // start receiver
// Note: don't allow receiver _and_ sender operation at same time
bool StartSender(); // start sender
bool StartReceiver(); // start receiver
bool IsActive() {return (NULL != session);}
void Stop();
bool SendMessage(unsigned int len, const char* txBuffer);
enum NormCC
{
NORM_FIXED, // fixed-rate (no congestion control)
NORM_CC, // "normal" TCP-friendly congestion control
NORM_CCE, // strict ECN-based congestion control
NORM_CCL // "loss-tolerant" congestion control
};
protected:
NormSimAgent(ProtoTimerMgr& timerMgr,
ProtoSocket::Notifier& socketNotifier);
@ -45,7 +53,7 @@ class NormSimAgent : public NormController, public ProtoMessageSink
virtual void Notify(NormController::Event event,
class NormSessionMgr* sessionMgr,
class NormSession* session,
class NormServerNode* server,
class NormSenderNode* sender,
class NormObject* object);
void ActivateTimer(ProtoTimer& theTimer)
@ -53,6 +61,8 @@ class NormSimAgent : public NormController, public ProtoMessageSink
bool OnIntervalTimeout(ProtoTimer& theTimer);
void SetCCMode(NormCC ccMode);
static const char* const cmd_list[];
NormSessionMgr session_mgr;
@ -63,9 +73,12 @@ class NormSimAgent : public NormController, public ProtoMessageSink
UINT16 port; // session port number
UINT8 ttl;
double tx_rate; // bits/sec
unsigned int probe_count;
bool cc_enable;
bool ecn_enable;
NormCC cc_mode;
bool unicast_nacks;
bool silent_client;
bool silent_receiver;
double backoff_factor;
UINT16 segment_size;
UINT8 ndata;
@ -75,7 +88,12 @@ class NormSimAgent : public NormController, public ProtoMessageSink
double group_size;
double grtt_estimate;
unsigned long tx_buffer_size; // bytes
unsigned long tx_cache_min;
unsigned long tx_cache_max;
NormObjectSize tx_cache_size;
unsigned long rx_buffer_size; // bytes
unsigned long rx_cache_max; // rx object max_pending count
// for simulated transmission (streams or files)
unsigned long tx_object_size;
@ -84,6 +102,8 @@ class NormSimAgent : public NormController, public ProtoMessageSink
unsigned long tx_object_size_max;
int tx_repeat_count;
double tx_repeat_interval;
int tx_requeue;
int tx_requeue_count;
NormStreamObject* stream;
bool auto_stream;
@ -100,6 +120,7 @@ class NormSimAgent : public NormController, public ProtoMessageSink
// protocol debug parameters
bool tracing;
FILE* log_file_ptr;
double tx_loss;
double rx_loss;

View File

@ -32,6 +32,6 @@
#ifndef _NORM_VERSION
#define _NORM_VERSION
#define VERSION "1.4b3a"
#define VERSION "1.5b1"
#endif // _NORM_VERSION

View File

@ -50,6 +50,7 @@ SYSTEM = arm-linux
CC = arm-linux-g++
SYSTEM_CFLAGS = -Wall -Wcast-align -pedantic -fPIC
SYSTEM_SOFLAGS = -shared
SYSTEM_SOEXT = so
RANLIB = arm-linux-ranlib
AR = arm-linux-ar

243
makefiles/Makefile.common Normal file
View File

@ -0,0 +1,243 @@
#########################################################################
# COMMON NORM MAKEFILE STUFF
#
SHELL=/bin/sh
.SUFFIXES: .cpp -sim.o $(.SUFFIXES)
PROTOLIB = ../protolib
COMMON = ../src/common
UNIX = ../src/unix
EXAMPLE = ../examples
NS = ../src/sim/ns
INCLUDES = $(SYSTEM_INCLUDES) -I$(UNIX) -I../include -I$(PROTOLIB)/include
CFLAGS = -g -DPROTO_DEBUG -DUNIX -D_FILE_OFFSET_BITS=64 -O $(SYSTEM_CFLAGS) $(SYSTEM_HAVES) $(INCLUDES)
LDFLAGS = $(SYSTEM_LDFLAGS)
# Note: Even command line app needs X11 for Netscape post-processing
LIBS = $(SYSTEM_LIBS) -lm -lpthread
XLIBS = -lXmu -lXt -lX11
TARGETS = norm raft
# Rule for C++ .cpp extension
.cpp.o:
$(CC) -c $(CFLAGS) -o $*.o $*.cpp
# NORM depends upon the NRL Protean Group's development library
LIBPROTO = $(PROTOLIB)/lib/libprotokit.a
NORM_SRC = $(COMMON)/normMessage.cpp $(COMMON)/normSession.cpp \
$(COMMON)/normNode.cpp $(COMMON)/normObject.cpp \
$(COMMON)/normSegment.cpp $(COMMON)/normEncoder.cpp \
$(COMMON)/normEncoderRS8.cpp $(COMMON)/normEncoderRS16.cpp \
$(COMMON)/normEncoderMDP.cpp $(COMMON)/galois.cpp \
$(COMMON)/normFile.cpp $(COMMON)/normApi.cpp $(SYSTEM_SRC)
NORM_OBJ = $(NORM_SRC:.cpp=.o)
LIB_SRC = $(NORM_SRC)
LIB_OBJ = $(LIB_SRC:.cpp=.o)
all: norm raft libnorm.a
$(PROTOLIB)/lib/libprotokit.a:
$(MAKE) -C $(PROTOLIB)/makefiles -f Makefile.$(SYSTEM) libprotokit.a
# NORM as a static library
libnorm.a: $(LIB_OBJ)
rm -f $@
$(AR) rcv $@ $(LIB_OBJ)
$(RANLIB) $@
mkdir -p ../lib
cp $@ ../lib/$@
# NORM as a shared library (i.e. libnorm.so, libnorm.dylib, etc)
# (Note - we are linking "libprotokit" in statically
libnorm.$(SYSTEM_SOEXT): $(LIB_OBJ) $(LIBPROTO)
$(CC) $(SYSTEM_SOFLAGS) $(LIB_OBJ) $(LIBPROTO) $(LIBS) -o $@
mkdir -p ../lib
cp $@ ../lib/$@
SIM_SRC = $(NORM_SRC) $(COMMON)/normSimAgent.cpp
SIM_OBJ = $(SIM_SRC:.cpp=-sim.o)
libnormsim.a: $(SIM_OBJ)
rm -f $@
$(AR) rcv $@ $(SIM_OBJ)
$(RANLIB) $@
# (norm) command-line file broadcaster/receiver
APP_SRC = $(COMMON)/normApp.cpp $(COMMON)/normPostProcess.cpp \
$(UNIX)/unixPostProcess.cpp
APP_OBJ = $(APP_SRC:.cpp=.o)
norm: $(APP_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(APP_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# This section builds some of code "examples" that use the NORM API
# NORM_OBJECT_FILE sender example
FSEND_SRC = $(EXAMPLE)/normFileSend.cpp
FSEND_OBJ = $(FSEND_SRC:.cpp=.o)
normFileSend: $(FSEND_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(FSEND_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# NORM_OBJECT_FILE receiver example
FRECV_SRC = $(EXAMPLE)/normFileRecv.cpp
FRECV_OBJ = $(FRECV_SRC:.cpp=.o)
normFileRecv: $(FRECV_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(FRECV_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# NORM_OBJECT_DATA sender example
DSEND_SRC = $(EXAMPLE)/normDataSend.cpp
DSEND_OBJ = $(DSEND_SRC:.cpp=.o)
normDataSend: $(DSEND_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(DSEND_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# NORM_OBJECT_DATA receiver example
DRECV_SRC = $(EXAMPLE)/normDataRecv.cpp
DRECV_OBJ = $(DRECV_SRC:.cpp=.o)
normDataRecv: $(DRECV_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(DRECV_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# NORM_OBJECT_STREAM sender example
SSEND_SRC = $(EXAMPLE)/normStreamSend.cpp
SSEND_OBJ = $(SSEND_SRC:.cpp=.o)
normStreamSend: $(SSEND_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(SSEND_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# NORM_OBJECT_STREAM receiver example
SRECV_SRC = $(EXAMPLE)/normStreamRecv.cpp
SRECV_OBJ = $(SRECV_SRC:.cpp=.o)
normStreamRecv: $(SRECV_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(SRECV_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (normTest) test of NORM API
TEST_SRC = $(COMMON)/normTest.cpp
TEST_OBJ = $(TEST_SRC:.cpp=.o)
normTest: $(TEST_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(TEST_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (normThreadTest) test of threaded use of NORM API
TTEST_SRC = $(COMMON)/normThreadTest.cpp
TTEST_OBJ = $(TTEST_SRC:.cpp=.o)
normThreadTest: $(TTEST_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(TTEST_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (normThreadTest2) alt test of threaded use of NORM API
TTEST2_SRC = $(UNIX)/normThreadTest2.cpp
TTEST2_OBJ = $(TTEST2_SRC:.cpp=.o)
normThreadTest2: $(TTEST2_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(TTEST2_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (pcap2norm) - parses pcap (e.g. tcpdump) file and prints NORM trace
PCAP_SRC = $(COMMON)/pcap2norm.cpp
PCAP_OBJ = $(PCAP_SRC:.cpp=.o)
pcap2norm: $(PCAP_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(PCAP_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (n2m) - converts NORM "trace" to MGEN log format to enable TRPR (or other) analyses
N2M_SRC = $(COMMON)/n2m.cpp
N2M_OBJ = $(N2M_SRC:.cpp=.o)
n2m: $(N2M_OBJ)
$(CC) $(CFLAGS) -o $@ $(N2M_OBJ) $(LDFLAGS) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (npc) NORM Pre-Coder
PCODE_SRC = $(COMMON)/normPrecode.cpp
PCODE_OBJ = $(PCODE_SRC:.cpp=.o)
npc: $(PCODE_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(PCODE_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (raft) reliable app for tunnel (command-line reliable UDP tunnel)
RAFT_SRC = $(COMMON)/raft.cpp
RAFT_OBJ = $(RAFT_SRC:.cpp=.o)
raft: $(RAFT_OBJ) $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(RAFT_OBJ) $(LDFLAGS) $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (ntun) IP/NORM tunnel app using ProtoVif
NTUN_SRC = $(COMMON)/ntun.cpp $(PROTOLIB)/common/protoVif.cpp $(PROTOLIB)/unix/unixVif.cpp
NTUN_OBJ = $(NTUN_SRC:.cpp=.o)
ntun: $(NTUN_OBJ) $(LIBPROTO) libnorm.a
$(CC) $(CFLAGS) -o $@ $(NTUN_OBJ) $(LDFLAGS) libnorm.a $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (fect) fec tester code
FECT_SRC = $(COMMON)/fecTest.cpp $(COMMON)/normEncoder.cpp $(COMMON)/galois.cpp \
$(COMMON)/normEncoderRS8.cpp $(COMMON)/normEncoderRS16.cpp
FECT_OBJ = $(FECT_SRC:.cpp=.o)
fect: $(FECT_OBJ) libnorm.a $(LIBPROTO)
$(CC) $(CFLAGS) -o $@ $(FECT_OBJ) $(LDFLAGS) $(LIBPROTO) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
# (gtf) generate test file
GTF_SRC = $(COMMON)/gtf.cpp
GTF_OBJ = $(GTF_SRC:.cpp=.o)
gtf: $(GTF_OBJ)
$(CC) $(CFLAGS) -o $@ $(GTF_OBJ) $(LDFLAGS) $(LIBS)
mkdir -p ../bin
cp $@ ../bin/$@
clean:
rm -f $(COMMON)/*.o $(UNIX)/*.o $(NS)/*.o \
libnorm.a libnorm.$(SYSTEM_SOEXT) ../lib/libnorm.a ../lib/libnorm.$(SYSTEM_SOEXT) \
norm raft normTest normTest2 normThreadTest normThreadTest2 ../bin/*;
$(MAKE) -C $(PROTOLIB)/makefiles -f Makefile.$(SYSTEM) clean
distclean: clean
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

View File

@ -40,7 +40,7 @@ SYSTEM_HAVES = -DHAVE_IPV6 -DHAVE_ASSERT -DHAVE_GETLOGIN -DHAVE_FLOCK -DHAVE_DI
SYSTEM_SRC =
SYSTEM = freebsd
CC = gcc
CC = g++
SYSTEM_CFLAGS = -fPIC -Wall -pedantic -Wcast-align
SYSTEM_SOFLAGS = -shared
RANLIB = ranlib

58
makefiles/Makefile.iphone Normal file
View File

@ -0,0 +1,58 @@
#
# Protean MacOS X (Darwin) Makefile definitions
#
SDK = /Developer/Platforms/iPhoneOS.platform/Developer
ARCH = armv6
SYSROOT = $(SDK)/SDKs/iPhoneOS2.2.1.sdk
# 1) System specific additional libraries, include paths, etc
# (Where to find X11 libraries, etc)
#
SYSTEM_INCLUDES =
SYSTEM_LDFLAGS = -L$(SYSROOT)/usr/lib
SYSTEM_LIBS = -lresolv
# 2) System specific capabilities
# Must choose appropriate for the following:
#
# A) -DHAVE_CUSERID (preferred) or -DHAVE_GETLOGIN for cuserid() or getlogin()
# functions to obtain user's login name (We may change this to getpwd()
# if that is better across different platforms and login environments)
#
# B) -DHAVE_LOCKF (preferred) or -D_LOCKF for lockf() or flock() file locking
# functions to attempt exclusive lock on writing to files
#
# C) Specify -DHAVE_DIRFD if you system provides the "dirfd()" function
# (Most don't have it defined ... but some do)
#
# D) Optionally specify -DHAVE_ASSERT if your system has a built-in ASSERT()
# routine.
#
# E) Some systems (SOLARIS/SUNOS) have a few gotchas which require
# some #ifdefs to avoid compiler warnings ... so you might need
# to specify -DSOLARIS or -DSUNOS depending on your OS.
#
# F) Uncomment this if you have the NRL IPv6+IPsec software
#DNETSEC = -DNETSEC -I/usr/inet6/include
#
# (We export these for other Makefiles as needed)
#
SYSTEM_HAVES = -DMACOSX -DECN_SUPPORT -DHAVE_IPV6 -DHAVE_ASSERT -DHAVE_GETLOGIN -DHAVE_FLOCK \
-D_FILE_OFFSET_BITS=64 -DHAVE_DIRFD
SYSTEM_SRC = ../protolib/src/unix/bpfCap.cpp
# The "SYSTEM" keyword can be used for dependent makes
SYSTEM = iphone
CC = $(SDK)/usr/bin/arm-apple-darwin9-g++-4.0.1 -arch $(ARCH) -isysroot $(SYSROOT)
SYSTEM_CFLAGS = -Wall -Wcast-align -pedantic -fPIC -I$(SDK)/usr/include/gcc/darwin/4.0
SYSTEM_SOFLAGS = -dynamiclib
SYSTEM_SOEXT = dylib
RANLIB = $(SDK)/usr/bin/ranlib
AR = $(SDK)/usr/bin/ar
include Makefile.common

View File

@ -35,16 +35,17 @@ SYSTEM_LIBS = -ldl
# (We export these for other Makefiles as needed)
#
SYSTEM_HAVES = -DLINUX -DHAVE_IPV6 -DHAVE_GETLOGIN -D_FILE_OFFSET_BITS=64 -DHAVE_LOCKF \
SYSTEM_HAVES = -DLINUX -DECN_SUPPORT -DHAVE_IPV6 -DHAVE_GETLOGIN -D_FILE_OFFSET_BITS=64 -DHAVE_LOCKF \
-DHAVE_OLD_SIGNALHANDLER -DHAVE_DIRFD -DHAVE_ASSERT
SYSTEM_SRC =
SYSTEM_SRC = ../protolib/src/linux/linuxCap.cpp
SYSTEM = linux
export CC = g++
export SYSTEM_CFLAGS = -fPIC -Wall -Wcast-align
export SYSTEM_SOFLAGS = -shared
export SYSTEM_SOFLAGS = -shared -Wl,-soname,libnorm.so.1
SYSTEM_SOEXT = so
export RANLIB = ranlib
export AR = ar

View File

@ -8,7 +8,7 @@
SYSTEM_INCLUDES =
SYSTEM_LDFLAGS =
SYSTEM_LIBS = -lresolv
SYSTEM_LIBS = -lresolv -lpcap
# 2) System specific capabilities
# Must choose appropriate for the following:
@ -36,17 +36,18 @@ SYSTEM_LIBS = -lresolv
# (We export these for other Makefiles as needed)
#
SYSTEM_HAVES = -DMACOSX -DHAVE_IPV6 -DHAVE_ASSERT -DHAVE_GETLOGIN -DHAVE_FLOCK \
SYSTEM_HAVES = -DMACOSX -DECN_SUPPORT -DHAVE_IPV6 -DHAVE_ASSERT -DHAVE_GETLOGIN -DHAVE_FLOCK \
-D_FILE_OFFSET_BITS=64 -DHAVE_DIRFD
SYSTEM_SRC =
SYSTEM_SRC = ../protolib/src/unix/bpfCap.cpp
# The "SYSTEM" keyword can be used for dependent makes
SYSTEM = macosx
CC = g++
SYSTEM_CFLAGS = -fPIC -Wall -Wcast-align
SYSTEM_CFLAGS = -Wall -Wcast-align -fPIC -arch x86_64 -arch i386
SYSTEM_SOFLAGS = -dynamiclib
SYSTEM_SOEXT = dylib
RANLIB = ranlib
AR = ar

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mil.navy.nrl.norm"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="17"/>
</manifest>

52
makefiles/android/README Normal file
View File

@ -0,0 +1,52 @@
This directory contains an Android NDK import module for NORM, which builds
a shared library, and the JNI bindings.
Using NORM in your pure Java Android Application
------------------------------------------------
1. First, update the library project to point to your Android SDK:
android update lib-project --target <id> --path /path/to/norm/makefiles/android
android update lib-project --target <id> --path /path/to/protolib/makefiles/android
Use "android list targets" to see the ids of the SDK targets you have
installed.
2. Add a "jni/Application.mk" in the root of your project to reference NORM:
* You must at least set "APP_MODULES := norm-jni"
* You should set "APP_BUILD_SCRIPT := /path/to/norm/makefiles/android/jni/Android.mk"
* You should also set "NDK_MODULE_PATH" to point to the base norm directory
so that the NDK can find protolib. See the example.
Example:
LOCAL_PATH := $(call my-dir)
APP_MODULES := mil_navy_nrl_norm
APP_ABI := all
APP_BUILD_SCRIPT := $(LOCAL_PATH)/../library/norm/makefiles/android/jni/Android.mk
NDK_MODULE_PATH := $(LOCAL_PATH)../library/norm/
3. Reference the NORM Android library project in your "project.properties"
file. Add the following:
android.library.reference.1=/path/to/norm/makefiles/android
Now, you should be able to run "ndk-build" in your root project directory to
build the shared libraries, and run "ant debug" to build your APK.
Using NORM in your C/C++/Java Android Application
-------------------------------------------------
1. Add a "jni/Application.mk" with your C/C++ code specified.
2. Reference the NORM Android project as an NDK Import Module. See
"IMPORT-MODULE.html" in the NDK docs.
Put something like the following at the bottom of your "Android.mk"
$(call import-module,norm/makefiles/android/jni)
This is relative to the "NDK_MODULE_PATH" variable that must be defined in
"Application.mk".

View File

@ -0,0 +1,18 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
source.dir=../../src/java/src

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="norm" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"
/>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View File

@ -0,0 +1,55 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := norm
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../protolib/include \
$(LOCAL_PATH)/../../../include
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_STATIC_LIBRARIES := protolib
ifeq ($(APP_OPTIM),debug)
LOCAL_CFLAGS += -DNORM_DEBUG
endif
LOCAL_EXPORT_CFLAGS := $(LOCAL_CFLAGS)
LOCAL_SRC_FILES := \
../../../src/common/galois.cpp \
../../../src/common/normApi.cpp \
../../../src/common/normEncoder.cpp \
../../../src/common/normEncoderMDP.cpp \
../../../src/common/normEncoderRS16.cpp \
../../../src/common/normEncoderRS8.cpp \
../../../src/common/normFile.cpp \
../../../src/common/normMessage.cpp \
../../../src/common/normNode.cpp \
../../../src/common/normObject.cpp \
../../../src/common/normSegment.cpp \
../../../src/common/normSession.cpp
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := mil_navy_nrl_norm
LOCAL_STATIC_LIBRARIES := norm protolib
LOCAL_SRC_FILES := \
../../../src/java/jni/normDataJni.cpp \
../../../src/java/jni/normEventJni.cpp \
../../../src/java/jni/normFileJni.cpp \
../../../src/java/jni/normInstanceJni.cpp \
../../../src/java/jni/normJni.cpp \
../../../src/java/jni/normNodeJni.cpp \
../../../src/java/jni/normObjectJni.cpp \
../../../src/java/jni/normSessionJni.cpp \
../../../src/java/jni/normStreamJni.cpp
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := norm-app
LOCAL_STATIC_LIBRARIES := norm
LOCAL_SRC_FILES := \
../../../src/common/normApp.cpp \
../../../src/common/normPostProcess.cpp \
../../../src/unix/unixPostProcess.cpp
include $(BUILD_EXECUTABLE)
$(call import-module,protolib/makefiles/android/jni)

View File

@ -0,0 +1,2 @@
APP_ABI := all
APP_PLATFORM := android-9

View File

@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@ -0,0 +1,12 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
android.library=true
# Project target.
target=android-16

View File

@ -0,0 +1,65 @@
#########################################################################
# COMMON NORM-JNI MAKEFILE STUFF
#
.SUFFIXES: .cpp -sim.o $(.SUFFIXES)
NORMJNI = ../../src/java/jni
INCLUDES = $(SYSTEM_INCLUDES) -I../../include
CFLAGS = -g -O $(SYSTEM_CFLAGS) $(INCLUDES)
LIBNORM = ../../lib/libnorm.a
PROTOLIB = ../../protolib
LIBPROTO = $(PROTOLIB)/lib/libprotokit.a
LIBS = $(SYSTEM_LIBS) -lm -lpthread
# Rule for C++ .cpp extension
.cpp.o:
$(CC) -c $(CFLAGS) -o $*.o $*.cpp
LIB_SRC = \
$(NORMJNI)/normJni.cpp \
$(NORMJNI)/normInstanceJni.cpp \
$(NORMJNI)/normSessionJni.cpp \
$(NORMJNI)/normObjectJni.cpp \
$(NORMJNI)/normDataJni.cpp \
$(NORMJNI)/normFileJni.cpp \
$(NORMJNI)/normStreamJni.cpp \
$(NORMJNI)/normEventJni.cpp \
$(NORMJNI)/normNodeJni.cpp
LIB_OBJ = $(LIB_SRC:.cpp=.o)
LIB_DEP = $(LIB_SRC:.cpp=.d)
all: libmil_navy_nrl_norm.$(SYSTEM_SOEXT)
# NORM JNI shared library
libmil_navy_nrl_norm.$(SYSTEM_SOEXT): $(LIB_OBJ) $(LIBNORM) $(LIBPROTO)
$(CC) $(SYSTEM_SOFLAGS) $(LIB_OBJ) $(LIBNORM) $(LIBPROTO) $(LIBS) -o $@
mkdir -p ../../lib
cp $@ ../../lib/$@
$(LIBNORM):
$(MAKE) -C ../../makefiles -f Makefile.$(SYSTEM) libnorm.a
$(LIBPROTO):
$(MAKE) -C $(PROTOLIB)/makefiles -f Makefile.$(SYSTEM) libprotokit.a
-include $(LIB_DEP)
%.d: %.cpp
$(CC) -MM -MT $(@:.d=.o) -MF $@ $(CPPFLAGS) $<
clean:
rm -f $(NORMJNI)/*.o \
$(NORMJNI)/*.d \
libmil_navy_nrl_norm.$(SYSTEM_SOEXT) \
../../lib/libmil_navy_nrl_norm.$(SYSTEM_SOEXT)
distclean: clean
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

View File

@ -0,0 +1,17 @@
#
# Linux NORM-JNI Makefile definitions
#
# System specific additional libraries, include paths, etc
SYSTEM_INCLUDES = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
SYSTEM_LIBS =
SYSTEM_SRC =
SYSTEM = linux
export CC = g++
export SYSTEM_CFLAGS = -fPIC -Wall -Wcast-align -D_FILE_OFFSET_BITS=64
export SYSTEM_SOFLAGS = -shared -Wl,--no-undefined
SYSTEM_SOEXT = so
include Makefile.common

62
makefiles/java/build.xml Normal file
View File

@ -0,0 +1,62 @@
<project name="NORM" default="jar" basedir="../../src/java">
<!-- Properties -->
<property name="name" value="norm-1.0.0" />
<property name="optimize" value="false" />
<property name="debug" value="on" />
<property name="src.dir" value="src" />
<property name="class.dir" value="class" />
<property name="jni.dir" value="jni" />
<property name="dist.dir" value="../../lib" />
<!-- Compile Targets -->
<target name="compile" description="Compiles the project">
<mkdir dir="${class.dir}" />
<javac destdir="${class.dir}" debug="${debug}" optimize="${optimize}">
<src path="${src.dir}" />
<include name="mil/navy/nrl/norm/**/*.java" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<!-- JNI tasks -->
<target name="jni" depends="compile" description="Create the jni headers">
<javah outputFile="${jni.dir}/normInstanceJni.h" classpath="${class.dir}">
<class name="mil.navy.nrl.norm.NormInstance"/>
</javah>
<javah outputFile="${jni.dir}/normSessionJni.h" classpath="${class.dir}">
<class name="mil.navy.nrl.norm.NormSession"/>
</javah>
<javah outputFile="${jni.dir}/normObjectJni.h" classpath="${class.dir}">
<class name="mil.navy.nrl.norm.NormObject"/>
</javah>
<javah outputFile="${jni.dir}/normDataJni.h" classpath="${class.dir}">
<class name="mil.navy.nrl.norm.NormData"/>
</javah>
<javah outputFile="${jni.dir}/normFileJni.h" classpath="${class.dir}">
<class name="mil.navy.nrl.norm.NormFile"/>
</javah>
<javah outputFile="${jni.dir}/normStreamJni.h" classpath="${class.dir}">
<class name="mil.navy.nrl.norm.NormStream"/>
</javah>
<javah outputFile="${jni.dir}/normNodeJni.h" classpath="${class.dir}">
<class name="mil.navy.nrl.norm.NormNode"/>
</javah>
<javah outputFile="${jni.dir}/normEventJni.h" classpath="${class.dir}">
<class name="mil.navy.nrl.norm.NormEvent"/>
</javah>
</target>
<!-- Jar tasks -->
<target name="jar" depends="compile" description="Creates the jar file">
<mkdir dir="${dist.dir}" />
<jar jarfile="${dist.dir}/${name}.jar">
<fileset dir="${class.dir}" includes="mil/navy/nrl/norm/**/*.*" />
</jar>
</target>
<!-- Clean tasks -->
<target name="clean" description="Cleans the project">
<delete dir="${class.dir}" />
<delete file="${dist.dir}/${name}.jar" />
</target>
</project>

63
makefiles/win32/Norm.sln Normal file
View File

@ -0,0 +1,63 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NormLib", "NormLib.vcproj", "{D7B0023C-8798-4918-8DA0-05C9054D70B9}"
ProjectSection(ProjectDependencies) = postProject
{DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9} = {DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "norm", "norm\norm.vcproj", "{6E1308A6-D40F-489E-A4F1-40D859380D64}"
ProjectSection(ProjectDependencies) = postProject
{D7B0023C-8798-4918-8DA0-05C9054D70B9} = {D7B0023C-8798-4918-8DA0-05C9054D70B9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "normTest", "normTest.vcproj", "{32CF83E0-D2E0-4E43-8F7B-72BD0AB64647}"
ProjectSection(ProjectDependencies) = postProject
{DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9} = {DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9}
{182006F3-188F-466E-89FE-8421C0478691} = {182006F3-188F-466E-89FE-8421C0478691}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NormDll", "NormDll.vcproj", "{182006F3-188F-466E-89FE-8421C0478691}"
ProjectSection(ProjectDependencies) = postProject
{DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9} = {DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "npc", "npc.vcproj", "{7BF4525B-9185-4296-A2BF-FFE77BB66EAF}"
ProjectSection(ProjectDependencies) = postProject
{D7B0023C-8798-4918-8DA0-05C9054D70B9} = {D7B0023C-8798-4918-8DA0-05C9054D70B9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Protokit", "..\..\protolib\makefiles\win32\Protokit.vcproj", "{DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D7B0023C-8798-4918-8DA0-05C9054D70B9}.Debug|Win32.ActiveCfg = Debug|Win32
{D7B0023C-8798-4918-8DA0-05C9054D70B9}.Debug|Win32.Build.0 = Debug|Win32
{D7B0023C-8798-4918-8DA0-05C9054D70B9}.Release|Win32.ActiveCfg = Release|Win32
{D7B0023C-8798-4918-8DA0-05C9054D70B9}.Release|Win32.Build.0 = Release|Win32
{6E1308A6-D40F-489E-A4F1-40D859380D64}.Debug|Win32.ActiveCfg = Debug|Win32
{6E1308A6-D40F-489E-A4F1-40D859380D64}.Debug|Win32.Build.0 = Debug|Win32
{6E1308A6-D40F-489E-A4F1-40D859380D64}.Release|Win32.ActiveCfg = Release|Win32
{6E1308A6-D40F-489E-A4F1-40D859380D64}.Release|Win32.Build.0 = Release|Win32
{32CF83E0-D2E0-4E43-8F7B-72BD0AB64647}.Debug|Win32.ActiveCfg = Debug|Win32
{32CF83E0-D2E0-4E43-8F7B-72BD0AB64647}.Debug|Win32.Build.0 = Debug|Win32
{32CF83E0-D2E0-4E43-8F7B-72BD0AB64647}.Release|Win32.ActiveCfg = Release|Win32
{32CF83E0-D2E0-4E43-8F7B-72BD0AB64647}.Release|Win32.Build.0 = Release|Win32
{182006F3-188F-466E-89FE-8421C0478691}.Debug|Win32.ActiveCfg = Debug|Win32
{182006F3-188F-466E-89FE-8421C0478691}.Debug|Win32.Build.0 = Debug|Win32
{182006F3-188F-466E-89FE-8421C0478691}.Release|Win32.ActiveCfg = Release|Win32
{182006F3-188F-466E-89FE-8421C0478691}.Release|Win32.Build.0 = Release|Win32
{7BF4525B-9185-4296-A2BF-FFE77BB66EAF}.Debug|Win32.ActiveCfg = Debug|Win32
{7BF4525B-9185-4296-A2BF-FFE77BB66EAF}.Release|Win32.ActiveCfg = Release|Win32
{DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9}.Debug|Win32.ActiveCfg = Debug|Win32
{DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9}.Debug|Win32.Build.0 = Debug|Win32
{DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9}.Release|Win32.ActiveCfg = Release|Win32
{DE94F096-A09B-44B6-8EFE-C7BF1F65C4C9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

BIN
makefiles/win32/Norm.suo Normal file

Binary file not shown.

View File

@ -0,0 +1,251 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="NormDll"
ProjectGUID="{182006F3-188F-466E-89FE-8421C0478691}"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\protolib\include"
PreprocessorDefinitions="NORM_USE_DLL;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib iphlpapi.lib"
OutputFile="$(OutDir)/Norm.dll"
LinkIncremental="2"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/NormDll.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(OutDir)/Norm.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\include;..\..\protolib\include"
PreprocessorDefinitions="NORM_USE_DLL;NDEBUG;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="ws2_32.lib iphlpapi.lib"
OutputFile="$(OutDir)/Norm.dll"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(OutDir)/Norm.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\common\galois.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normApi.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normEncoder.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normEncoderMDP.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normEncoderRS16.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normEncoderRS8.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normFile.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normMessage.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normNode.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normObject.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normSegment.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normSession.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="NormLib"
ProjectGUID="{D7B0023C-8798-4918-8DA0-05C9054D70B9}"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\protolib\include"
PreprocessorDefinitions="PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/NormLib.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Debug\NormLib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include;..\..\protolib\include"
PreprocessorDefinitions="NDEBUG;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_LIB;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/NormLib.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Release\NormLib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\src\common\galois.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normApi.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normEncoder.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normEncoderMDP.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normEncoderRS16.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normEncoderRS8.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normFile.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normMessage.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normNode.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normObject.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normSegment.cpp"
>
</File>
<File
RelativePath="..\..\src\common\normSession.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,942 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="NormLib"
ProjectGUID="{FDF1CD37-A1E7-435A-9C3D-61DA5A0E0E68}"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="Windows Mobile 6 Professional SDK (ARMV4I)"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include,..\..\..\protolib\include,..\protolib\win32,..\..\protolib\common,..\..\protolib\win32"
PreprocessorDefinitions="_DEBUG;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_LIB;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/NormLib.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Debug\NormLib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="1"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
AdditionalIncludeDirectories="..\..\include,..\..\..\protolib\include,..\protolib\win32,..\..\protolib\common,..\..\protolib\win32"
PreprocessorDefinitions="_DEBUG;PROTO_DEBUG;HAVE_ASSERT;WIN32;_LIB;UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_ARM_;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER)"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/NormLib.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Debug\NormLib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include,..\..\..\protolib\include,..\protolib\win32,..\..\protolib\common,..\..\protolib\win32"
PreprocessorDefinitions="NDEBUG;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_LIB;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/NormLib.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Release\NormLib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
IntermediateDirectory="Windows Mobile 6 Professional SDK (ARMV4I)\$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="1"
/>
<Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include,..\..\..\protolib\include,..\protolib\win32,..\..\protolib\common,..\..\protolib\win32"
PreprocessorDefinitions="NDEBUG;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_LIB;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/NormLib.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\Release\NormLib.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCCodeSignTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
<DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<DebuggerTool
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\src\common\galois.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normApi.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normEncoder.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normEncoderRS16.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normEncoderRS8.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normEncoderMDP.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normFile.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normMessage.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normNode.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normObject.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normSegment.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\src\common\normSession.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
AdditionalIncludeDirectories="..\..\include"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="norm"
ProjectGUID="{6E1308A6-D40F-489E-A4F1-40D859380D64}"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/norm.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\include;..\..\..\protolib\include"
PreprocessorDefinitions="_DEBUG;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_CRT_SECURE_NO_WARNINGS;_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/norm.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/norm.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/norm.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/norm.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/vmg"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\include;..\..\..\protolib\include"
PreprocessorDefinitions="NDEBUG;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/norm.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/norm.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/norm.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\..\src\common\normApp.cpp"
>
</File>
<File
RelativePath="..\..\..\src\common\normPostProcess.cpp"
>
</File>
<File
RelativePath="..\win32PostProcess.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,229 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="normTest"
ProjectGUID="{32CF83E0-D2E0-4E43-8F7B-72BD0AB64647}"
RootNamespace="normTest"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/normTest.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\protolib\include"
PreprocessorDefinitions="NORM_USE_DLL;PROTO_DEBUG;HAVE_ASSERT;WIN32;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/normTest.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/normTest.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="./"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/normTest.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/normTest.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include;..\..\protolib\include"
PreprocessorDefinitions="NORM_USE_DLL;PROTO_DEBUG;WIN32;HAVE_ASSERT;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/normTest.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="false"
AdditionalDependencies="iphlpapi.lib ws2_32.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/normTest.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
ProgramDatabaseFile=".\Release/normTest.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\src\common\normTest.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

225
makefiles/win32/npc.vcproj Normal file
View File

@ -0,0 +1,225 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="npc"
ProjectGUID="{7BF4525B-9185-4296-A2BF-FFE77BB66EAF}"
RootNamespace="normTest"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/normTest.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\protolib\include"
PreprocessorDefinitions="PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/normTest.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib ws2_32.lib odbc32.lib odbccp32.lib"
LinkIncremental="0"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="./"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/normTest.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\include;..\..\protolib\include"
PreprocessorDefinitions="NDEBUG;PROTO_DEBUG;HAVE_IPV6;HAVE_ASSERT;WIN32;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/normTest.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="false"
AdditionalDependencies="iphlpapi.lib ws2_32.lib odbc32.lib odbccp32.lib"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=""
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<File
RelativePath="..\..\src\common\normPrecode.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,432 +0,0 @@
# Copyright (c) 1994, 1995, 1996
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that: (1) source code distributions
# retain the above copyright notice and this paragraph in its entirety, (2)
# distributions including binary code include the above copyright notice and
# this paragraph in its entirety in the documentation or other materials
# provided with the distribution, and (3) all advertising materials mentioning
# features or use of this software display the following acknowledgement:
# ``This product includes software developed by the University of California,
# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
# the University nor the names of its contributors may be used to endorse
# or promote products derived from this software without specific prior
# written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#) $Header: /cvsroot/norm/norm/ns/ns-2.1b7a-Makefile.in,v 1.1 2002/07/11 15:25:11 adamson Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
#
# Top level hierarchy
prefix = @prefix@
# Pathname of directory to install the binary
BINDEST = @prefix@/bin
# Pathname of directory to install the man page
MANDEST = @prefix@/man
BLANK = # make a blank space. DO NOT add anything to this line
# The following will be redefined under Windows (see WIN32 lable below)
CC = @CC@
CPP = @CXX@
LINK = $(CPP)
MKDEP = ./conf/mkdep
TCLSH = @V_TCLSH@
TCL2C = @V_TCL2CPP@
AR = ar rc $(BLANK)
RANLIB = @V_RANLIB@
INSTALL = @INSTALL@
LN = ln
TEST = test
RM = rm -f
PERL = @PERL@
CCOPT = @V_CCOPT@
STATIC = @V_STATIC@
LDFLAGS = $(STATIC)
LDOUT = -o $(BLANK)
DEFINE = -DTCP_DELAY_BIND_ALL -DNO_TK @V_DEFINE@ @V_DEFINES@ @DEFS@
PROTOLIB_INCLUDES = -Iprotolib/common -Iprotolib/ns
MDP_INCLUDES = -Imdp/common -Imdp/ns -Imdp/unix
NORM_INCLUDES = -Inorm/common -Inorm/ns
INCLUDES = \
-I. @V_INCLUDE_X11@ \
@V_INCLUDES@ \
$(PROTOLIB_INCLUDES) $(MDP_INCLUDES) $(NORM_INCLUDES)
LIB = \
@V_LIBS@ \
@V_LIB_X11@ \
@V_LIB@ \
-lm @LIBS@
# -L@libdir@ \
# These flags work on Linux
PROTOLIB_CFLAGS = -DUNIX -DNS2 -DPROTO_DEBUG -DSIMULATE -DHAVE_ASSERT -DHAVE_DIRFD
CFLAGS = $(CCOPT) $(DEFINE) -g $(PROTOLIB_CFLAGS)
# Explicitly define compilation rules since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
# PROTOLIB/MDP/NORM code uses .cpp files so we added a suffix and rule
.SUFFIXES: .cc .cpp # $(.SUFFIXES)
.cpp.o:
@rm -f $@
$(CPP) -c $(CFLAGS) $(INCLUDES) -o $@ $*.cpp
.cc.o:
@rm -f $@
$(CPP) -c $(CFLAGS) $(INCLUDES) -o $@ $*.cc
.c.o:
@rm -f $@
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $*.c
GEN_DIR = gen/
LIB_DIR = lib/
NS = ns
NSX = nsx
NSE = nse
# To allow conf/makefile.win overwrite this macro
OBJ_STL = @V_STLOBJ@
# WIN32: uncomment the following line to include specific make for VC++
# !include <conf/makefile.win>
OBJ_CC = \
random.o rng.o ranvar.o misc.o timer-handler.o \
scheduler.o object.o \
packet.o ip.o route.o connector.o ttl.o \
trace.o trace-ip.o \
classifier.o classifier-addr.o classifier-hash.o classifier-virtual.o \
classifier-mcast.o classifier-bst.o classifier-mpath.o replicator.o \
classifier-mac.o classifier-port.o ump.o \
app.o telnet.o tcplib-telnet.o \
trafgen.o traffictrace.o pareto.o expoo.o cbr_traffic.o \
tbf.o resv.o sa.o saack.o \
measuremod.o estimator.o adc.o ms-adc.o timewindow-est.o acto-adc.o \
pointsample-est.o salink.o actp-adc.o hb-adc.o expavg-est.o\
param-adc.o null-estimator.o \
adaptive-receiver.o vatrcvr.o consrcvr.o \
agent.o message.o udp.o session-rtp.o rtp.o rtcp.o ivs.o \
tcp.o tcp-sink.o tcp-reno.o tcp-newreno.o \
tcp-vegas.o tcp-rbp.o tcp-full.o \
scoreboard.o tcp-sack1.o tcp-fack.o \
tcp-asym.o tcp-asym-sink.o tcp-fs.o tcp-asym-fs.o \
tcp-int.o chost.o tcp-session.o nilist.o \
integrator.o queue-monitor.o flowmon.o loss-monitor.o \
queue.o drop-tail.o simple-intserv-sched.o red.o \
semantic-packetqueue.o semantic-red.o ack-recons.o \
sfq.o fq.o drr.o cbq.o \
hackloss.o errmodel.o \
delay.o snoop.o \
dynalink.o rtProtoDV.o net-interface.o \
ctrMcast.o mcast_ctrl.o srm.o \
sessionhelper.o delaymodel.o srm-ssm.o \
srm-topo.o \
mftp.o mftp_snd.o mftp_rcv.o codeword.o \
alloc-address.o address.o \
$(LIB_DIR)int.Vec.o $(LIB_DIR)int.RVec.o \
$(LIB_DIR)dmalloc_support.o \
webcache/http.o webcache/tcp-simple.o webcache/pagepool.o \
webcache/inval-agent.o webcache/tcpapp.o webcache/http-aux.o \
webcache/mcache.o webcache/webtraf.o \
realaudio/realaudio.o \
lanRouter.o filter.o pkt-counter.o \
Decapsulator.o Encapsulator.o encap.o \
channel.o mac.o ll.o mac-802_11.o mac-802_3.o mac-tdma.o \
mip.o mip-reg.o gridkeeper.o \
propagation.o tworayground.o antenna.o omni-antenna.o \
shadowing.o bi-connector.o node.o mobilenode.o \
arp.o god.o dem.o topography.o modulation.o priqueue.o \
phy.o wired-phy.o wireless-phy.o \
mac-timers.o cmu-trace.o varp.o \
dsdv/dsdv.o dsdv/rtable.o rtqueue.o rttable.o \
imep/imep.o imep/dest_queue.o imep/imep_api.o \
imep/imep_rt.o imep/rxmit_queue.o imep/imep_timers.o \
imep/imep_util.o imep/imep_io.o \
tora/tora.o tora/tora_api.o tora/tora_dest.o tora/tora_io.o \
tora/tora_logs.o tora/tora_neighbor.o \
dsr/dsragent.o dsr/hdr_sr.o dsr/mobicache.o dsr/path.o \
dsr/requesttable.o dsr/routecache.o \
aodv/aodv_logs.o aodv/aodv.o \
ns-process.o \
satgeometry.o sathandoff.o satlink.o satnode.o \
satposition.o satroute.o sattrace.o \
rap/raplist.o rap/rap.o rap/media-app.o rap/utilities.o \
fsm.o tcp-abs.o \
diffusion/diffusion.o diffusion/diff_rate.o diffusion/diff_prob.o \
diffusion/diff_sink.o diffusion/flooding.o diffusion/omni_mcast.o \
diffusion/hash_table.o diffusion/routing_table.o diffusion/iflist.o \
tfrc.o tfrc-sink.o energy-model.o ping.o tcp-rfc793edu.o \
rio.o semantic-rio.o tcp-sack-rh.o scoreboard-rh.o \
plm/loss-monitor-plm.o plm/cbr-traffic-PP.o \
linkstate/hdr-ls.o \
mpls/classifier-addr-mpls.o mpls/ldp.o mpls/mpls-module.o \
rtmodule.o classifier-hier.o addr-params.o \
$(OBJ_STL)
# don't allow comments to follow continuation lines
# mac-csma.o mac-multihop.o\
# sensor-nets/landmark.o mac-simple-wireless.o \
# sensor-nets/tags.o sensor-nets/sensor-query.o \
# sensor-nets/flood-agent.o \
# what was here before is now in emulate/
OBJ_C =
OBJ_COMPAT = $(OBJ_GETOPT) win32.o
#XXX compat/win32x.o compat/tkConsole.o
OBJ_EMULATE_CC = \
emulate/net-ip.o \
emulate/net.o \
emulate/tap.o \
emulate/ether.o \
emulate/internet.o \
emulate/ping_responder.o \
emulate/arp.o \
emulate/icmp.o \
emulate/net-pcap.o \
emulate/nat.o
OBJ_EMULATE_C = \
emulate/inet.o
OBJ_PROTOLIB_CPP = \
protolib/ns/nsProtoAgent.o protolib/common/protoSim.o \
protolib/common/networkAddress.o protolib/common/protocolTimer.o \
protolib/common/debug.o
OBJ_MDP_CPP = \
mdp/ns/nsMdpAgent.o mdp/common/mdpSimAgent.o \
mdp/common/mdpBitMask.o mdp/common/mdpMessage.o \
mdp/common/mdpEncoder.o mdp/common/galois.o \
mdp/common/mdpSession.o mdp/common/mdpMsgHandler.o \
mdp/common/mdpNode.o mdp/common/mdpObject.o \
mdp/unix/mdpFile.o
OBJ_NORM_CPP = \
norm/ns/nsNormAgent.o norm/common/normSimAgent.o \
norm/common/normMessage.o norm/common/normSession.o \
norm/common/normNode.o norm/common/normObject.o \
norm/common/normSegment.o norm/common/normBitmask.o \
norm/common/normEncoder.o norm/common/galois.o \
norm/common/normFile.o
OBJ_GEN = $(GEN_DIR)version.o $(GEN_DIR)ns_tcl.o $(GEN_DIR)ptypes.o
SRC = $(OBJ_C:.o=.c) $(OBJ_CC:.o=.cc) \
$(OBJ_EMULATE_C:.o=.c) $(OBJ_EMULATE_CC:.o=.cc) \
tclAppInit.cc tkAppInit.cc \
$(OBJ_PROTOLIB_CPP:.o=.cpp) $(OBJ_MDP_CPP:.o=.cpp) \
$(OBJ_NORM_CPP:.o=.cpp)
OBJ = $(OBJ_C) $(OBJ_CC) $(OBJ_GEN) $(OBJ_COMPAT) \
$(OBJ_PROTOLIB_CPP) $(OBJ_MDP_CPP) $(OBJ_NORM_CPP)
CLEANFILES = ns nsx ns.dyn $(OBJ) $(OBJ_EMULATE_CC) \
$(OBJ_EMULATE_C) tclAppInit.o \
$(GEN_DIR)* $(NS).core core core.$(NS) core.$(NSX) core.$(NSE) \
ptypes2tcl ptypes2tcl.o
SUBDIRS=\
indep-utils/cmu-scen-gen/setdest \
indep-utils/webtrace-conv/dec \
indep-utils/webtrace-conv/epa \
indep-utils/webtrace-conv/nlanr \
indep-utils/webtrace-conv/ucb
all: $(NS) all-recursive
all-recursive:
for i in $(SUBDIRS); do ( cd $$i; $(MAKE) all; ) done
$(NS): $(OBJ) tclAppInit.o Makefile
$(LINK) $(LDFLAGS) $(LDOUT)$@ \
tclAppInit.o $(OBJ) $(LIB)
Makefile: Makefile.in
@echo "Makefile.in is newer than Makefile."
@echo "You need to re-run configure."
false
$(NSE): $(OBJ) tclAppInit.o $(OBJ_EMULATE_CC) $(OBJ_EMULATE_C)
$(LINK) $(LDFLAGS) $(LDOUT)$@ \
tclAppInit.o $(OBJ) \
$(OBJ_EMULATE_CC) $(OBJ_EMULATE_C) $(LIB) -lpcap
ns.dyn: $(OBJ) tclAppInit.o
$(LINK) $(LDFLAGS) -o $@ \
tclAppInit.o $(OBJ) $(LIB)
PURIFY = purify -cache-dir=/tmp
ns-pure: $(OBJ) tclAppInit.o
$(PURIFY) $(LINK) $(LDFLAGS) -o $@ \
tclAppInit.o $(OBJ) $(LIB)
NS_TCL_LIB = \
tcl/lib/ns-compat.tcl \
tcl/lib/ns-default.tcl \
tcl/lib/ns-errmodel.tcl \
tcl/lib/ns-lib.tcl \
tcl/lib/ns-link.tcl \
tcl/lib/ns-mobilenode.tcl \
tcl/lib/ns-sat.tcl \
tcl/lib/ns-cmutrace.tcl \
tcl/lib/ns-node.tcl \
tcl/lib/ns-rtmodule.tcl \
tcl/lib/ns-hiernode.tcl \
tcl/lib/ns-packet.tcl \
tcl/lib/ns-queue.tcl \
tcl/lib/ns-source.tcl \
tcl/lib/ns-nam.tcl \
tcl/lib/ns-trace.tcl \
tcl/lib/ns-agent.tcl \
tcl/lib/ns-random.tcl \
tcl/lib/ns-namsupp.tcl \
tcl/lib/ns-address.tcl \
tcl/lib/ns-intserv.tcl \
tcl/lib/ns-autoconf.tcl \
tcl/rtp/session-rtp.tcl \
tcl/lib/ns-mip.tcl \
tcl/rtglib/dynamics.tcl \
tcl/rtglib/route-proto.tcl \
tcl/rtglib/algo-route-proto.tcl \
tcl/rtglib/ns-rtProtoLS.tcl \
tcl/interface/ns-iface.tcl \
tcl/mcast/BST.tcl \
tcl/mcast/ns-mcast.tcl \
tcl/mcast/McastProto.tcl \
tcl/mcast/DM.tcl \
tcl/mcast/srm.tcl \
tcl/mcast/srm-adaptive.tcl \
tcl/mcast/srm-ssm.tcl \
tcl/mcast/timer.tcl \
tcl/mcast/McastMonitor.tcl \
tcl/mcast/mftp_snd.tcl \
tcl/mcast/mftp_rcv.tcl \
tcl/mcast/mftp_rcv_stat.tcl \
tcl/mobility/dsdv.tcl \
tcl/mobility/dsr.tcl \
tcl/ctr-mcast/CtrMcast.tcl \
tcl/ctr-mcast/CtrMcastComp.tcl \
tcl/ctr-mcast/CtrRPComp.tcl \
tcl/rlm/rlm.tcl \
tcl/rlm/rlm-ns.tcl \
tcl/session/session.tcl \
tcl/lib/ns-route.tcl \
tcl/emulate/ns-emulate.tcl \
tcl/lan/vlan.tcl \
tcl/lan/ns-ll.tcl \
tcl/lan/ns-mac.tcl \
tcl/webcache/http-agent.tcl \
tcl/webcache/http-server.tcl \
tcl/webcache/http-cache.tcl \
tcl/webcache/http-mcache.tcl \
tcl/webcache/webtraf.tcl \
tcl/plm/plm.tcl \
tcl/plm/plm-ns.tcl \
tcl/plm/plm-topo.tcl \
tcl/mpls/ns-mpls-classifier.tcl \
tcl/mpls/ns-mpls-ldpagent.tcl \
tcl/mpls/ns-mpls-node.tcl \
tcl/mpls/ns-mpls-simulator.tcl
$(GEN_DIR)ns_tcl.cc: $(NS_TCL_LIB)
$(TCLSH) bin/tcl-expand.tcl tcl/lib/ns-lib.tcl tcl/lib/ns-stl.tcl | $(TCL2C) et_ns_lib > $@
$(GEN_DIR)version.c: VERSION
$(RM) $@
$(TCLSH) bin/string2c.tcl version_string < VERSION > $@
$(GEN_DIR)ptypes.cc: ptypes2tcl packet.h
./ptypes2tcl > $@
ptypes2tcl: ptypes2tcl.o
$(LINK) $(LDFLAGS) $(LDOUT)$@ ptypes2tcl.o
ptypes2tcl.o: ptypes2tcl.cc packet.h
install: force install-ns install-man install-recursive
install-ns: force
$(INSTALL) -m 555 -o bin -g bin ns $(DESTDIR)$(BINDEST)
install-man: force
$(INSTALL) -m 444 -o bin -g bin ns.1 $(DESTDIR)$(MANDEST)/man1
install-recursive: force
for i in $(SUBDIRS); do cd $$i; $(MAKE) install; done
clean:
$(RM) $(CLEANFILES)
AUTOCONF_GEN = tcl/lib/ns-autoconf.tcl tcl/lib/ns-stl.tcl
distclean:
$(RM) $(CLEANFILES) Makefile config.cache config.log config.status \
gnuc.h os-proto.h $(AUTOCONF_GEN)
tags: force
ctags -wtd *.cc *.h webcache/*.cc webcache/*.h dsdv/*.cc dsdv/*.h \
dsr/*.cc dsr/*.h webcache/*.cc webcache/*.h lib/*.cc lib/*.h \
../Tcl/*.cc ../Tcl/*.h
TAGS: force
etags *.cc *.h webcache/*.cc webcache/*.h dsdv/*.cc dsdv/*.h \
dsr/*.cc dsr/*.h webcache/*.cc webcache/*.h lib/*.cc lib/*.h \
../Tcl/*.cc ../Tcl/*.h
tcl/lib/TAGS: force
( \
cd tcl/lib; \
$(TCLSH) ../../bin/tcl-expand.tcl ns-lib.tcl | grep '^### tcl-expand.tcl: begin' | awk '{print $$5}' >.tcl_files; \
etags --lang=none -r '/^[ \t]*proc[ \t]+\([^ \t]+\)/\1/' `cat .tcl_files`; \
etags --append --lang=none -r '/^\([A-Z][^ \t]+\)[ \t]+\(instproc\|proc\)[ \t]+\([^ \t]+\)[ \t]+/\1::\3/' `cat .tcl_files`; \
)
depend: $(SRC)
$(MKDEP) $(CFLAGS) $(INCLUDES) $(SRC)
srctar:
@cwd=`pwd` ; dir=`basename $$cwd` ; \
name=ns-`cat VERSION | tr A-Z a-z` ; \
tar=ns-src-`cat VERSION`.tar.gz ; \
list="" ; \
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
echo \
"(rm -f $$tar; cd .. ; ln -s $$dir $$name)" ; \
(rm -f $$tar; cd .. ; ln -s $$dir $$name) ; \
echo \
"(cd .. ; tar cfh $$tar [lots of files])" ; \
(cd .. ; tar cfh - $$list) | gzip -c > $$tar ; \
echo \
"rm ../$$name; chmod 444 $$tar" ; \
rm ../$$name; chmod 444 $$tar
force:
test: force
./validate
# Create makefile.vc for Win32 development by replacing:
# "# !include ..." -> "!include ..."
makefile.vc: Makefile.in
$(PERL) bin/gen-vcmake.pl < Makefile.in > makefile.vc
# $(PERL) -pe 's/^# (\!include)/\!include/o' < Makefile.in > makefile.vc

View File

@ -1,536 +0,0 @@
# Copyright (c) 1994, 1995, 1996
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that: (1) source code distributions
# retain the above copyright notice and this paragraph in its entirety, (2)
# distributions including binary code include the above copyright notice and
# this paragraph in its entirety in the documentation or other materials
# provided with the distribution, and (3) all advertising materials mentioning
# features or use of this software display the following acknowledgement:
# ``This product includes software developed by the University of California,
# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
# the University nor the names of its contributors may be used to endorse
# or promote products derived from this software without specific prior
# written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# @(#) $Header: /cvsroot/norm/norm/ns/ns-2.1b9-Makefile.in,v 1.1 2002/11/18 16:14:07 adamson Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
#
# Top level hierarchy
prefix = @prefix@
# Pathname of directory to install the binary
BINDEST = @prefix@/bin
# Pathname of directory to install the man page
MANDEST = @prefix@/man
BLANK = # make a blank space. DO NOT add anything to this line
# The following will be redefined under Windows (see WIN32 lable below)
CC = @CC@
CPP = @CXX@
LINK = $(CPP)
MKDEP = ./conf/mkdep
TCLSH = @V_TCLSH@
TCL2C = @V_TCL2CPP@
AR = ar rc $(BLANK)
RANLIB = @V_RANLIB@
INSTALL = @INSTALL@
LN = ln
TEST = test
RM = rm -f
MV = mv
PERL = @PERL@
# for diffusion
#DIFF_INCLUDES = "./diffusion3/main ./diffusion3/lib ./diffusion3/nr ./diffusion3/ns"
CCOPT = @V_CCOPT@
STATIC = @V_STATIC@
LDFLAGS = $(STATIC)
LDOUT = -o $(BLANK)
DEFINE = -DTCP_DELAY_BIND_ALL -DNO_TK -DNIXVECTOR @V_DEFINE@ @V_DEFINES@ @DEFS@ -DPGM -DPGM_DEBUG -DNS_DIFFUSION
PROTOLIB_INCLUDES = -Iprotolib/common -Iprotolib/ns
MDP_INCLUDES = -Imdp/common -Imdp/ns -Imdp/unix
NORM_INCLUDES = -Inorm/common -Inorm/ns
INCLUDES = \
-I. @V_INCLUDE_X11@ \
@V_INCLUDES@ \
-I./tcp -I./common -I./link -I./queue \
-I./adc -I./apps -I./mac -I./mobile -I./trace \
-I./routing -I./tools -I./classifier -I./mcast \
-I./diffusion3/main -I./diffusion3/lib \
-I./diffusion3/nr -I./diffusion3/ns -I./asim/ \
$(PROTOLIB_INCLUDES) $(MDP_INCLUDES) $(NORM_INCLUDES)
LIB = \
@V_LIBS@ \
@V_LIB_X11@ \
@V_LIB@ \
-lm @LIBS@
# -L@libdir@ \
# These flags work on Linux
PROTOLIB_CFLAGS = -g -DUNIX -DNS2 -DPROTO_DEBUG -DSIMULATE -DHAVE_ASSERT -DHAVE_DIRFD
CFLAGS = $(CCOPT) $(DEFINE) $(PROTOLIB_CFLAGS)
# Explicitly define compilation rules since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
# PROTOLIB/MDP/NORM code uses .cpp files so we added a suffix and rule
.SUFFIXES: .cc .cpp # $(.SUFFIXES)
.cc.o:
@rm -f $@
$(CPP) -c $(CFLAGS) $(INCLUDES) -o $@ $*.cc
.c.o:
@rm -f $@
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $*.c
.cpp.o:
@rm -f $@
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $*.cpp
GEN_DIR = gen/
LIB_DIR = lib/
NS = ns
NSX = nsx
NSE = nse
# To allow conf/makefile.win overwrite this macro
# We will set these two macros to empty in conf/makefile.win since VC6.0
# does not seem to support the STL in gcc 2.8 and up.
OBJ_STL = linkstate/ls.o linkstate/rtProtoLS.o \
pgm/classifier-pgm.o pgm/pgm-agent.o pgm/pgm-sender.o \
pgm/pgm-receiver.o pgm/rcvbuf.o \
diffusion3/nr/nr.o diffusion3/lib/dr.o \
diffusion3/ns/diffagent.o diffusion3/ns/diffrtg.o \
diffusion3/ns/difftimer.o diffusion3/main/diffusion.o \
diffusion3/main/attrs.o diffusion3/main/iodev.o \
diffusion3/main/events.o diffusion3/main/message.o \
diffusion3/main/hashutils.o diffusion3/main/stats.o \
diffusion3/main/tools.o diffusion3/main/drivers/rpc_stats.o \
diffusion3/apps/sysapps/gradient.o \
diffusion3/apps/sysapps/log.o \
diffusion3/lib/diffapp.o \
diffusion3/apps/agents/ping_sender.o \
diffusion3/apps/agents/ping_receiver.o \
diffusion3/apps/agents/ping_common.o \
diffusion3/apps/gear/geo-attr.o \
diffusion3/apps/gear/geo-routing.o \
diffusion3/apps/gear/geo-tools.o
NS_TCL_LIB_STL = tcl/rtglib/ns-rtProtoLS.tcl \
tcl/lib/ns-diffusion.tcl
# WIN32: uncomment the following line to include specific make for VC++
# !include <conf/makefile.win>
OBJ_CC = \
tools/random.o tools/rng.o tools/ranvar.o common/misc.o common/timer-handler.o \
common/scheduler.o common/object.o common/packet.o \
common/ip.o routing/route.o common/connector.o common/ttl.o \
trace/trace.o trace/trace-ip.o \
classifier/classifier.o classifier/classifier-addr.o \
classifier/classifier-hash.o \
classifier/classifier-virtual.o \
classifier/classifier-mcast.o \
classifier/classifier-bst.o \
classifier/classifier-mpath.o mcast/replicator.o \
classifier/classifier-mac.o \
classifier/classifier-port.o src_rtg/classifier-sr.o \
src_rtg/sragent.o src_rtg/hdr_src.o adc/ump.o \
apps/app.o apps/telnet.o tcp/tcplib-telnet.o \
tools/trafgen.o trace/traffictrace.o tools/pareto.o \
tools/expoo.o tools/cbr_traffic.o \
adc/tbf.o adc/resv.o adc/sa.o tcp/saack.o \
tools/measuremod.o adc/estimator.o adc/adc.o adc/ms-adc.o \
adc/timewindow-est.o adc/acto-adc.o \
adc/pointsample-est.o adc/salink.o adc/actp-adc.o \
adc/hb-adc.o adc/expavg-est.o\
adc/param-adc.o adc/null-estimator.o \
adc/adaptive-receiver.o apps/vatrcvr.o adc/consrcvr.o \
common/agent.o common/message.o apps/udp.o \
common/session-rtp.o apps/rtp.o tcp/rtcp.o \
common/ivs.o \
tcp/tcp.o tcp/tcp-sink.o tcp/tcp-reno.o \
tcp/tcp-newreno.o \
tcp/tcp-vegas.o tcp/tcp-rbp.o tcp/tcp-full.o tcp/rq.o \
baytcp/tcp-full-bay.o baytcp/ftpc.o baytcp/ftps.o \
tcp/scoreboard.o tcp/tcp-sack1.o tcp/tcp-fack.o \
tcp/tcp-asym.o tcp/tcp-asym-sink.o tcp/tcp-fs.o \
tcp/tcp-asym-fs.o \
tcp/tcp-int.o tcp/chost.o tcp/tcp-session.o \
tcp/nilist.o \
tools/integrator.o tools/queue-monitor.o \
tools/flowmon.o tools/loss-monitor.o \
queue/queue.o queue/drop-tail.o \
adc/simple-intserv-sched.o queue/red.o \
queue/semantic-packetqueue.o queue/semantic-red.o \
tcp/ack-recons.o \
queue/sfq.o queue/fq.o queue/drr.o queue/srr.o queue/cbq.o \
link/hackloss.o queue/errmodel.o queue/fec.o\
link/delay.o tcp/snoop.o \
gaf/gaf.o \
link/dynalink.o routing/rtProtoDV.o common/net-interface.o \
mcast/ctrMcast.o mcast/mcast_ctrl.o mcast/srm.o \
common/sessionhelper.o queue/delaymodel.o \
mcast/srm-ssm.o mcast/srm-topo.o \
apps/mftp.o apps/mftp_snd.o apps/mftp_rcv.o \
apps/codeword.o \
routing/alloc-address.o routing/address.o \
$(LIB_DIR)int.Vec.o $(LIB_DIR)int.RVec.o \
$(LIB_DIR)dmalloc_support.o \
webcache/http.o webcache/tcp-simple.o webcache/pagepool.o \
webcache/inval-agent.o webcache/tcpapp.o webcache/http-aux.o \
webcache/mcache.o webcache/webtraf.o \
empweb/empweb.o \
empweb/empftp.o \
realaudio/realaudio.o \
mac/lanRouter.o classifier/filter.o \
common/pkt-counter.o \
common/Decapsulator.o common/Encapsulator.o \
common/encap.o \
mac/channel.o mac/mac.o mac/ll.o mac/mac-802_11.o \
mac/mac-802_3.o mac/mac-tdma.o \
mobile/mip.o mobile/mip-reg.o mobile/gridkeeper.o \
mobile/propagation.o mobile/tworayground.o \
mobile/antenna.o mobile/omni-antenna.o \
mobile/shadowing.o mobile/shadowing-vis.o \
common/bi-connector.o common/node.o \
common/mobilenode.o \
mac/arp.o mobile/god.o mobile/dem.o \
mobile/topography.o mobile/modulation.o \
queue/priqueue.o \
mac/phy.o mac/wired-phy.o mac/wireless-phy.o \
mac/mac-timers.o trace/cmu-trace.o mac/varp.o \
dsdv/dsdv.o dsdv/rtable.o queue/rtqueue.o \
routing/rttable.o \
imep/imep.o imep/dest_queue.o imep/imep_api.o \
imep/imep_rt.o imep/rxmit_queue.o imep/imep_timers.o \
imep/imep_util.o imep/imep_io.o \
tora/tora.o tora/tora_api.o tora/tora_dest.o \
tora/tora_io.o tora/tora_logs.o tora/tora_neighbor.o \
dsr/dsragent.o dsr/hdr_sr.o dsr/mobicache.o dsr/path.o \
dsr/requesttable.o dsr/routecache.o dsr/add_sr.o \
dsr/dsr_proto.o dsr/flowstruct.o dsr/linkcache.o \
dsr/simplecache.o dsr/sr_forwarder.o \
aodv/aodv_logs.o aodv/aodv.o \
aodv/aodv_rtable.o aodv/aodv_rqueue.o \
common/ns-process.o \
satellite/satgeometry.o satellite/sathandoff.o \
satellite/satlink.o satellite/satnode.o \
satellite/satposition.o satellite/satroute.o \
satellite/sattrace.o \
rap/raplist.o rap/rap.o rap/media-app.o rap/utilities.o \
common/fsm.o tcp/tcp-abs.o \
diffusion/diffusion.o diffusion/diff_rate.o diffusion/diff_prob.o \
diffusion/diff_sink.o diffusion/flooding.o diffusion/omni_mcast.o \
diffusion/hash_table.o diffusion/routing_table.o diffusion/iflist.o \
tcp/tfrc.o tcp/tfrc-sink.o mobile/energy-model.o apps/ping.o tcp/tcp-rfc793edu.o \
queue/rio.o queue/semantic-rio.o tcp/tcp-sack-rh.o tcp/scoreboard-rh.o \
plm/loss-monitor-plm.o plm/cbr-traffic-PP.o \
linkstate/hdr-ls.o \
mpls/classifier-addr-mpls.o mpls/ldp.o mpls/mpls-module.o \
routing/rtmodule.o classifier/classifier-hier.o \
routing/addr-params.o \
nix/hdr_nv.o nix/classifier-nix.o \
nix/nixnode.o \
routealgo/rnode.o \
routealgo/bfs.o \
routealgo/rbitmap.o \
routealgo/rlookup.o \
routealgo/routealgo.o \
nix/nixvec.o \
nix/nixroute.o \
diffserv/dsred.o diffserv/dsredq.o \
diffserv/dsEdge.o diffserv/dsCore.o \
diffserv/dsPolicy.o diffserv/ew.o\
queue/red-pd.o queue/pi.o queue/vq.o queue/rem.o \
queue/gk.o \
pushback/rate-limit.o pushback/rate-limit-strategy.o \
pushback/ident-tree.o pushback/agg-spec.o \
pushback/logging-data-struct.o \
pushback/rate-estimator.o \
pushback/pushback-queue.o pushback/pushback.o \
common/parentnode.o trace/basetrace.o \
common/simulator.o asim/asim.o \
@V_STLOBJ@
# don't allow comments to follow continuation lines
# mac-csma.o mac-multihop.o\
# sensor-nets/landmark.o mac-simple-wireless.o \
# sensor-nets/tags.o sensor-nets/sensor-query.o \
# sensor-nets/flood-agent.o \
# what was here before is now in emulate/
OBJ_C =
OBJ_COMPAT = $(OBJ_GETOPT) common/win32.o
#XXX compat/win32x.o compat/tkConsole.o
OBJ_EMULATE_CC = \
emulate/net-ip.o \
emulate/net.o \
emulate/tap.o \
emulate/ether.o \
emulate/internet.o \
emulate/ping_responder.o \
emulate/arp.o \
emulate/icmp.o \
emulate/net-pcap.o \
emulate/nat.o \
emulate/iptap.o \
emulate/tcptap.o
OBJ_EMULATE_C = \
emulate/inet.o
OBJ_GEN = $(GEN_DIR)version.o $(GEN_DIR)ns_tcl.o $(GEN_DIR)ptypes.o
OBJ_PROTOLIB_CPP = \
protolib/ns/nsProtoAgent.o protolib/common/protoSim.o \
protolib/common/networkAddress.o protolib/common/protocolTimer.o \
protolib/common/debug.o
OBJ_MDP_CPP = \
mdp/ns/nsMdpAgent.o mdp/common/mdpSimAgent.o \
mdp/common/mdpBitMask.o mdp/common/mdpMessage.o \
mdp/common/mdpEncoder.o mdp/common/galois.o \
mdp/common/mdpSession.o mdp/common/mdpMsgHandler.o \
mdp/common/mdpNode.o mdp/common/mdpObject.o \
mdp/unix/mdpFile.o
OBJ_NORM_CPP = \
norm/ns/nsNormAgent.o norm/common/normSimAgent.o \
norm/common/normMessage.o norm/common/normSession.o \
norm/common/normNode.o norm/common/normObject.o \
norm/common/normSegment.o norm/common/normBitmask.o \
norm/common/normEncoder.o norm/common/galois.o \
norm/common/normFile.o
OBJ_CPP = $(OBJ_PROTOLIB_CPP) $(OBJ_MDP_CPP) $(OBJ_NORM_CPP)
SRC = $(OBJ_C:.o=.c) $(OBJ_CC:.o=.cc) $(OBJ_CPP:.o=.cpp) \
$(OBJ_EMULATE_C:.o=.c) $(OBJ_EMULATE_CC:.o=.cc) \
common/tclAppInit.cc common/tkAppInit.cc
OBJ = $(OBJ_C) $(OBJ_CC) $(OBJ_GEN) $(OBJ_COMPAT) $(OBJ_CPP)
CLEANFILES = ns nse nsx ns.dyn $(OBJ) $(OBJ_EMULATE_CC) \
$(OBJ_EMULATE_C) common/tclAppInit.o \
$(GEN_DIR)* $(NS).core core core.$(NS) core.$(NSX) core.$(NSE) \
common/ptypes2tcl common/ptypes2tcl.o
SUBDIRS=\
indep-utils/cmu-scen-gen/setdest \
indep-utils/webtrace-conv/dec \
indep-utils/webtrace-conv/epa \
indep-utils/webtrace-conv/nlanr \
indep-utils/webtrace-conv/ucb
BUILD_NSE = @build_nse@
all: $(NS) $(BUILD_NSE) all-recursive
all-recursive:
for i in $(SUBDIRS); do ( cd $$i; $(MAKE) all; ) done
$(NS): $(OBJ) common/tclAppInit.o Makefile
$(LINK) $(LDFLAGS) $(LDOUT)$@ \
common/tclAppInit.o $(OBJ) $(LIB)
Makefile: Makefile.in
@echo "Makefile.in is newer than Makefile."
@echo "You need to re-run configure."
false
$(NSE): $(OBJ) common/tclAppInit.o $(OBJ_EMULATE_CC) $(OBJ_EMULATE_C)
$(LINK) $(LDFLAGS) $(LDOUT)$@ \
common/tclAppInit.o $(OBJ) \
$(OBJ_EMULATE_CC) $(OBJ_EMULATE_C) $(LIB)
ns.dyn: $(OBJ) common/tclAppInit.o
$(LINK) $(LDFLAGS) -o $@ \
common/tclAppInit.o $(OBJ) $(LIB)
PURIFY = purify -cache-dir=/tmp
ns-pure: $(OBJ) common/tclAppInit.o
$(PURIFY) $(LINK) $(LDFLAGS) -o $@ \
common/tclAppInit.o $(OBJ) $(LIB)
NS_TCL_LIB = \
tcl/lib/ns-compat.tcl \
tcl/lib/ns-default.tcl \
tcl/lib/ns-errmodel.tcl \
tcl/lib/ns-lib.tcl \
tcl/lib/ns-link.tcl \
tcl/lib/ns-mobilenode.tcl \
tcl/lib/ns-sat.tcl \
tcl/lib/ns-cmutrace.tcl \
tcl/lib/ns-node.tcl \
tcl/lib/ns-rtmodule.tcl \
tcl/lib/ns-hiernode.tcl \
tcl/lib/ns-packet.tcl \
tcl/lib/ns-queue.tcl \
tcl/lib/ns-source.tcl \
tcl/lib/ns-nam.tcl \
tcl/lib/ns-trace.tcl \
tcl/lib/ns-agent.tcl \
tcl/lib/ns-random.tcl \
tcl/lib/ns-namsupp.tcl \
tcl/lib/ns-address.tcl \
tcl/lib/ns-intserv.tcl \
tcl/lib/ns-autoconf.tcl \
tcl/rtp/session-rtp.tcl \
tcl/lib/ns-mip.tcl \
tcl/rtglib/dynamics.tcl \
tcl/rtglib/route-proto.tcl \
tcl/rtglib/algo-route-proto.tcl \
tcl/rtglib/ns-rtProtoLS.tcl \
tcl/interface/ns-iface.tcl \
tcl/mcast/BST.tcl \
tcl/mcast/ns-mcast.tcl \
tcl/mcast/McastProto.tcl \
tcl/mcast/DM.tcl \
tcl/mcast/srm.tcl \
tcl/mcast/srm-adaptive.tcl \
tcl/mcast/srm-ssm.tcl \
tcl/mcast/timer.tcl \
tcl/mcast/McastMonitor.tcl \
tcl/mcast/mftp_snd.tcl \
tcl/mcast/mftp_rcv.tcl \
tcl/mcast/mftp_rcv_stat.tcl \
tcl/mobility/dsdv.tcl \
tcl/mobility/dsr.tcl \
tcl/ctr-mcast/CtrMcast.tcl \
tcl/ctr-mcast/CtrMcastComp.tcl \
tcl/ctr-mcast/CtrRPComp.tcl \
tcl/rlm/rlm.tcl \
tcl/rlm/rlm-ns.tcl \
tcl/session/session.tcl \
tcl/lib/ns-route.tcl \
tcl/emulate/ns-emulate.tcl \
tcl/lan/vlan.tcl \
tcl/lan/abslan.tcl \
tcl/lan/ns-ll.tcl \
tcl/lan/ns-mac.tcl \
tcl/webcache/http-agent.tcl \
tcl/webcache/http-server.tcl \
tcl/webcache/http-cache.tcl \
tcl/webcache/http-mcache.tcl \
tcl/webcache/webtraf.tcl \
tcl/webcache/empweb.tcl \
tcl/webcache/empftp.tcl \
tcl/plm/plm.tcl \
tcl/plm/plm-ns.tcl \
tcl/plm/plm-topo.tcl \
tcl/mpls/ns-mpls-classifier.tcl \
tcl/mpls/ns-mpls-ldpagent.tcl \
tcl/mpls/ns-mpls-node.tcl \
tcl/mpls/ns-mpls-simulator.tcl \
tcl/lib/ns-pushback.tcl \
tcl/lib/ns-srcrt.tcl \
@V_NS_TCL_LIB_STL@
$(GEN_DIR)ns_tcl.cc: $(NS_TCL_LIB)
$(TCLSH) bin/tcl-expand.tcl tcl/lib/ns-lib.tcl @V_NS_TCL_LIB_STL@ | $(TCL2C) et_ns_lib > $@
$(GEN_DIR)version.c: VERSION
$(RM) $@
$(TCLSH) bin/string2c.tcl version_string < VERSION > $@
$(GEN_DIR)ptypes.cc: common/ptypes2tcl common/packet.h
./common/ptypes2tcl > $@
common/ptypes2tcl: common/ptypes2tcl.o
$(LINK) $(LDFLAGS) $(LDOUT)$@ common/ptypes2tcl.o
common/ptypes2tcl.o: common/ptypes2tcl.cc common/packet.h
install: force install-ns install-man install-recursive
install-ns: force
$(INSTALL) -m 555 -o bin -g bin ns $(DESTDIR)$(BINDEST)
install-man: force
$(INSTALL) -m 444 -o bin -g bin ns.1 $(DESTDIR)$(MANDEST)/man1
install-recursive: force
for i in $(SUBDIRS); do ( cd $$i; $(MAKE) install; ) done
clean:
$(RM) $(CLEANFILES)
AUTOCONF_GEN = tcl/lib/ns-autoconf.tcl
distclean:
$(RM) $(CLEANFILES) Makefile config.cache config.log config.status \
gnuc.h os-proto.h $(AUTOCONF_GEN); \
$(MV) .configure .configure- ;\
echo "Moved .configure to .configure-"
tags: force
ctags -wtd *.cc *.h webcache/*.cc webcache/*.h dsdv/*.cc dsdv/*.h \
dsr/*.cc dsr/*.h webcache/*.cc webcache/*.h lib/*.cc lib/*.h \
../Tcl/*.cc ../Tcl/*.h
TAGS: force
etags *.cc *.h webcache/*.cc webcache/*.h dsdv/*.cc dsdv/*.h \
dsr/*.cc dsr/*.h webcache/*.cc webcache/*.h lib/*.cc lib/*.h \
../Tcl/*.cc ../Tcl/*.h
tcl/lib/TAGS: force
( \
cd tcl/lib; \
$(TCLSH) ../../bin/tcl-expand.tcl ns-lib.tcl | grep '^### tcl-expand.tcl: begin' | awk '{print $$5}' >.tcl_files; \
etags --lang=none -r '/^[ \t]*proc[ \t]+\([^ \t]+\)/\1/' `cat .tcl_files`; \
etags --append --lang=none -r '/^\([A-Z][^ \t]+\)[ \t]+\(instproc\|proc\)[ \t]+\([^ \t]+\)[ \t]+/\1::\3/' `cat .tcl_files`; \
)
depend: $(SRC)
$(MKDEP) $(CFLAGS) $(INCLUDES) $(SRC)
srctar:
@cwd=`pwd` ; dir=`basename $$cwd` ; \
name=ns-`cat VERSION | tr A-Z a-z` ; \
tar=ns-src-`cat VERSION`.tar.gz ; \
list="" ; \
for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
echo \
"(rm -f $$tar; cd .. ; ln -s $$dir $$name)" ; \
(rm -f $$tar; cd .. ; ln -s $$dir $$name) ; \
echo \
"(cd .. ; tar cfh $$tar [lots of files])" ; \
(cd .. ; tar cfh - $$list) | gzip -c > $$tar ; \
echo \
"rm ../$$name; chmod 444 $$tar" ; \
rm ../$$name; chmod 444 $$tar
force:
test: force
./validate
# Create makefile.vc for Win32 development by replacing:
# "# !include ..." -> "!include ..."
makefile.vc: Makefile.in
$(PERL) bin/gen-vcmake.pl < Makefile.in > makefile.vc
# $(PERL) -pe 's/^# (\!include)/\!include/o' < Makefile.in > makefile.vc

135
src/common/fecTest.cpp Normal file
View File

@ -0,0 +1,135 @@
// This code tests our NORM FEC encoder/decoder implementations
#include "protoTime.h" // for ProtoTime
#include "normEncoderRS8.h"
#include "normEncoderRS16.h"
#include <string.h> // for memcpy(), etc
#include <stdlib.h> // for rand()
#include <stdio.h>
const unsigned int NUM_PARITY = 100;
const unsigned int NUM_DATA = 400;
const unsigned int SHORT_DATA = 400;
const unsigned int SEG_SIZE = 64;
const unsigned int B_SIZE = (SHORT_DATA + NUM_PARITY);
#define NORM_ENCODER NormEncoderRS16
#define NORM_DECODER NormDecoderRS16
int main(int argc, char* argv[])
{
// Uncomment to seed random generator
ProtoTime currentTime;
currentTime.GetCurrentTime();
int seed = (unsigned int)currentTime.usec();
fprintf(stderr, "fect: seed = %u\n", seed);
srand(seed);
NORM_ENCODER encoder;
encoder.Init(NUM_DATA, NUM_PARITY, SEG_SIZE);
NORM_DECODER decoder;
decoder.Init(NUM_DATA, NUM_PARITY, SEG_SIZE);
for (int trial = 0; trial < 2; trial++)
{
// 1) Create some "printable" source data
char txData[B_SIZE][SEG_SIZE];
char* txDataPtr[B_SIZE];
for (unsigned int i = 0 ; i < SHORT_DATA; i++)
{
txDataPtr[i] = txData[i];
memset(txDataPtr[i], 'a' + (i%26), SEG_SIZE - 1);
txDataPtr[i][SEG_SIZE - 1] = '\0';
}
// 2) Zero-init the parity vectors of our txData
for (unsigned int i = SHORT_DATA; i < B_SIZE; i++)
{
txDataPtr[i] = txData[i];
memset(txDataPtr[i], 0, SEG_SIZE);
}
// 3) Run our encoder (and record CPU time)
ProtoTime startTime, stopTime;
startTime.GetCurrentTime();
for (unsigned int i = 0; i < SHORT_DATA; i++)
{
encoder.Encode(txDataPtr[i], txDataPtr + SHORT_DATA);
}
stopTime.GetCurrentTime();
double encodeTime = ProtoTime::Delta(stopTime, startTime);
// 4) Copy "txData" to our "rxData"
char rxData[B_SIZE][SEG_SIZE];
char* rxDataPtr[B_SIZE];
for (unsigned int i = 0; i < B_SIZE; i++)
{
rxDataPtr[i] = rxData[i];
memcpy(rxDataPtr[i], txDataPtr[i], SEG_SIZE);
}
// 5) Randomly pick some number of erasures and their locations
unsigned int erasureCount = 2;//rand() % NUM_PARITY;
unsigned int erasureLocs[B_SIZE];
for (unsigned int i = 0; i < B_SIZE; i++)
erasureLocs[i] = i;
for (unsigned int i = 0; i < erasureCount; i++)
{
// We do a little random shuffle here to generate
// "erasureCount" unique erasure locations
unsigned int loc = i + (rand() % (B_SIZE - i));
unsigned int tmp = erasureLocs[i];
erasureLocs[i] = erasureLocs[loc];
erasureLocs[loc] = tmp;
}
// Sort the "erasureLocs" into order (important!)
for (unsigned int i = 0; i < erasureCount; i++)
{
for (unsigned int j = i+1; j < erasureCount; j++)
{
if (erasureLocs[j] < erasureLocs[i])
{
unsigned int tmp = erasureLocs[i];
erasureLocs[i] = erasureLocs[j];
erasureLocs[j] = tmp;
}
}
}
fprintf(stderr, "erasureCount: %u erasureLocs: ", erasureCount);
for (unsigned int i = 0; i < erasureCount; i++)
fprintf(stderr, "%u ", erasureLocs[i]);
fprintf(stderr, "\n");
// 6) Clear our erasure locs
for (unsigned int i = 0; i < erasureCount; i++)
memset(rxDataPtr[erasureLocs[i]], 0, SEG_SIZE);
// 7) Decode the rxData
startTime.GetCurrentTime();
decoder.Decode(rxDataPtr, SHORT_DATA, erasureCount, erasureLocs);
stopTime.GetCurrentTime();
double decodeTime = ProtoTime::Delta(stopTime, startTime);
// 8) check decoding
for (unsigned int i = 0; i < SHORT_DATA; i++)
{
if (0 != memcmp(rxDataPtr[i], txDataPtr[i], SEG_SIZE))
{
fprintf(stderr, "fect: segment:%d rxData decode error!\n", i);
fprintf(stderr, " txData: %.32s ...\n", txDataPtr[i]);
fprintf(stderr, " rxData: %.32s ...\n", rxDataPtr[i]);
}
}
// 9) Print results
fprintf(stderr, "fect: encodeTime:%lf usec decodeTime:%lf usec\n", 1.0e+06*encodeTime, 1.0e+06*decodeTime);
}
} // end main()

Some files were not shown because too many files have changed in this diff Show More