@node Organization @chapter Organization This manual is organized into several parts with several chapters per part. This chapter describes the overall software organization and the corresponding organization of this manual. ns-3 is a discrete-event network simulator in which the simulation core and models are implemented in C++. ns-3 is built as a library which may be statically or dynamically linked to a C++ main program that defines the simulation topology and starts the simulator. ns-3 also exports nearly all of its API to Python, allowing Python programs to import an "ns3" module in much the same way as in C++. @float Figure,fig:organization @caption{Software organization of ns-3} @center @image{figures/software-organization, 5in} @end float The source code for ns-3 is mostly organized in the @code{src/} directory and can be described by the diagram in @ref{fig:organization}. We will work our way from the bottom up; in general, modules only have dependencies on modules beneath them in the figure. We first describe Part 1 of the manual. The simulation core is implemented in @code{src/core}, and the core is used to build the simulation engine @code{src/simulator}. Packets are fundamental objects in a network simulator and are implemented in @code{src/packet}. These three simulation modules by themselves are intended to comprise a generic simulation core that can be used by different kinds of networks, not just Internet-based networks. The above modules of ns-3 are independent of specific network and device models, which are covered in later parts of this manual. In addition to the above ns-3 core, we describe also in Part 1 two other modules that supplement the core C++-based API. ns-3 programs may access all of the API directly or may make use of a so-called ``helper API'' that provides convenient wrappers or encapsulation of low-level API calls. The fact that ns-3 programs can be written to two APIs (or a combination thereof) is a fundamental aspect of the simulator and is also covered in Part 1. We also describe how Python is supported in ns-3 as the last chapter of Part 1. The remainder of the manual is focused on documenting the models and supporting capabilities. Part 2 focuses on two fundamental objects in ns-3: the @code{Node} and @code{NetDevice}. Two special NetDevice types are designed to support network emulation use cases, and emulation is described in Part 3. Part 4 is devoted to Internet-related models, including the sockets API used by Internet applications. Part 5 covers applications, and Part 6 describes additional support for simulation, such as animators. The project maintains a separate manual devoted to testing and validation of ns-3 code (see the @uref{http://www.nsnam.org/tutorials.html,, ns-3 Testing and Validation manual}).