
--------------------------------------------------------------------------
                            ATM SIMULATION MODULE
                                    by
                             Sowmya Manjanatha
                    CNRG, University of New Hampshire, Durham
--------------------------------------------------------------------------

     This file contains the information about the changes made into 
NS 2.1b6 to enable ATM simulation.  The ATM simulator was added on to
NS in order to aid our research on Mapping IP DiffServ to ATM QoS.  
Therefore, only those features of ATM that were required for our research
was added.  

     These were the features that were necessary for our research:

1. An interface to add and delete an ATM PVC on a Node.

2. A PVC database on the Node configured as an ATM switch.

3. In order to configure a Node as a switch, 
	
	 - an atmconditioner was added on to the node (basically in between
                                       an incoming link and the node).

         - an atmscheduler was added on to the outgoing link of the atm switch.

4. AAL5 capability on every node acting as an edge. (this is not required on 
   the switch since segmentation and reassembly does not happen on the switch).


     Please note that this section only explains the changes made to the C++
code under the main NS directory.  All the OTcl additions were added on a
different file  ns-atm.tcl under tcl/lib subdirectory.  Please see ns-atm.tcl
for all the OTcl changes.

     The "atm" subdirectory under NS contains all the new files that were added
for adding the ATM simulation facility.

CHANGES MADE TO THE EXISTING NS CODE:
------------------------------------

classifier.cc/h    : Classifier is the place where the outgoing packet from a Node
                     is converted to ATM PDU's. The "recv" method forwards packet
                     if the next target is IP-based or cell if the next target is
                     ATM based.  Therefore, I added a C++ method "aal5_processing"
                     into the Classifier so that a packet can be segmented before
                     being sent to the destination.  Note that, if the Node on
                     to which the Classifier is attached is the destination node
		     or ATM Switch itself, then a "recv" method that accepts Cells
	             is required on the Classifier.  If the Node turns out to be
		     the destination, then Cells are sent to yet another ATM method
		     i.e the "re_assembly" function.  

	             So, Classifier needs three different functions:

		     1) aal5_segmentation    
		     2) aal5_reassembly   
                     3) recv method that accepts Cells.
               

object.cc/h        : The "recv" method that accepts Cells was added onto NsObject.
                     The "handle" method was changed to handle cells as well.

connector.cc/h     : The "recv", "send" and "drop" methods that accept
                      Cells were added onto Connector.

bi-connector.cc/h  : added "recv",sendUp, sendDown methods with a Cell * parameter.

trace.cc           : I added a new i) recv and ii) format function to trace Cells.
                     This code needs re-attention.  I would say it should basically
                     be re-written.  First, of all, I just put it right now so that
                     when I have trace-all enabled, atleast other paths except for 
                     the ATM path will go through.  The code was anyways very messy
                     before because the "format" function is too long.  It's hard
                     to re-use it.  Most of the instructions inside can be 
                     functionized/methodized so that new trace functions can be 
                     easily built using only those smaller functions for e.g.
                     (let us say, we have one for flags, one for source/dest addresses etc.)
                     that they require.

                     Re: ATM, I should figure out the trace data required by most ATM 
                     simulations and then dump them.  Right now, the only specific ATM
                     stuff are VPI, VCI and type="atm". Probably, the ECN bit sent during
                     congestion by ATM can be specified in place of the existing FLAGS.
		     Also, a new flag for BRM and FRM cells can be generated.

	             Note : I have also incorporated the DequeTrace recv method.  This
                     needs modification as well.

queue.cc           : New recv, enque and deque functions for the main queue.

red.cc             : New enque and deque functions

droptail.cc        : New enque and deque functions

cellqueue.cc       : This is a new queue created in place of the existing PacketQueue class.
		     On NS, all the different queueing schemes such as RED, DropTail use
	             the PacketQueue methods.  Basically, the enquing and dequing policies
                     are based on packets (NOT bytes) in these queues.  









