diff --git a/src/common/packet.h b/src/common/packet.h index d7ebe6f50..5404c3bd0 100644 --- a/src/common/packet.h +++ b/src/common/packet.h @@ -46,11 +46,19 @@ namespace ns3 { * 16 bytes big. Trying to attach bigger data structures will trigger * crashes at runtime. * + * Implementing a new type of Chunk for a new protocol is pretty easy + * and is a matter of creating a subclass of the ns3::Chunk base class, + * and implementing the 4 pure virtual methods defined in ns3::Chunk. + * Sample code which shows how to create such a new Chunk, how to use + * it, and how to manipulate tags is shown below: + * \include samples/main-packet.cc + * * The current implementation of the byte buffers and tag list is based - * on COW (Copy On Write). An introduction to COW can be found in Scott - * Meyer's "More Effective C++", items 17 and 29. What this means is that + * on COW (Copy On Write. An introduction to COW can be found in Scott + * Meyer's "More Effective C++", items 17 and 29). What this means is that * copying packets without modifying them is very cheap (in terms of cpu - * and memory usage). What is key for proper COW implementations is being + * and memory usage) and modifying them can be also very cheap. What is + * key for proper COW implementations is being * able to detect when a given modification of the state of a packet triggers * a full copy of the data prior to the modification: COW systems need * to detect when an operation is "dirty". @@ -59,6 +67,7 @@ namespace ns3 { * - ns3::Packet::removeTag * - ns3::Packet::add * - both versions of ns3::Packet::addAtEnd + * * Non-dirty operations: * - ns3::Packet::addTag * - ns3::Packet::removeAllTags diff --git a/src/simulator/simulator.h b/src/simulator/simulator.h index 7c02acaae..d65011c63 100644 --- a/src/simulator/simulator.h +++ b/src/simulator/simulator.h @@ -42,6 +42,10 @@ class SchedulerFactory; * than microsecond accuracy. Events whose expiration time is * the same are scheduled in FIFO order: the first event inserted in the * Scheduling queue is scheduled to expire first. + * + * A simple example of how to use the Simulator class to schedule events + * is shown below: + * \include samples/main-simulator.cc */ class Simulator { public: