Agents represent endpoints where network-layer packets are constructed or consumed, and are used in the implementation of protocols at various layers. The Agent../ns-2/agent.h has an implementation partly in OTcl and partly in C++. The C++ implementation is contained in agent.cc and agent.h, and the OTcl support is in tcl/lib/ns-agent.tcl.