add dangerous realtime scheduling methods in an intentionally harder to find and use way
authorCraig Dowell <craigdo@ee.washington.edu>
Fri, 10 Oct 2008 16:22:13 -0700
changeset 3798 898d8a14b88f
parent 3797 9f03fc6f7296
child 3799 ceea04d07e60
add dangerous realtime scheduling methods in an intentionally harder to find and use way
src/simulator/realtime-simulator-impl.cc
src/simulator/realtime-simulator-impl.h
src/simulator/realtime-simulator.cc
src/simulator/realtime-simulator.h
src/simulator/simulator.h
src/simulator/wscript
--- a/src/simulator/realtime-simulator-impl.cc	Fri Oct 10 15:26:32 2008 -0700
+++ b/src/simulator/realtime-simulator-impl.cc	Fri Oct 10 16:22:13 2008 -0700
@@ -618,6 +618,41 @@
   return id;
 }
 
+Time
+RealtimeSimulatorImpl::Now (void) const
+{
+  return TimeStep (m_currentTs);
+}
+
+//
+// Schedule an event for a _relative_ time in the future.
+//
+EventId
+RealtimeSimulatorImpl::ScheduleReal (Time const &time, const Ptr<EventImpl> &event)
+{
+  NS_LOG_FUNCTION (time << event);
+  NS_ASSERT (false);
+  EventId id;
+  return id;
+}
+
+EventId
+RealtimeSimulatorImpl::ScheduleRealNow (const Ptr<EventImpl> &event)
+{
+  NS_LOG_FUNCTION (event);
+  NS_ASSERT (false);
+  EventId id;
+  return id;
+}
+
+Time
+RealtimeSimulatorImpl::RealNow (void) const
+{
+  NS_ASSERT (false);
+  return TimeStep (m_currentTs);
+}
+
+
 EventId
 RealtimeSimulatorImpl::ScheduleDestroy (const Ptr<EventImpl> &event)
 {
@@ -640,12 +675,6 @@
   return id;
 }
 
-Time
-RealtimeSimulatorImpl::Now (void) const
-{
-  return TimeStep (m_currentTs);
-}
-
 Time 
 RealtimeSimulatorImpl::GetDelayLeft (const EventId &id) const
 {
--- a/src/simulator/realtime-simulator-impl.h	Fri Oct 10 15:26:32 2008 -0700
+++ b/src/simulator/realtime-simulator-impl.h	Fri Oct 10 16:22:13 2008 -0700
@@ -69,13 +69,16 @@
   void Stop (Time const &time);
   EventId Schedule (Time const &time, const Ptr<EventImpl> &event);
   EventId ScheduleNow (const Ptr<EventImpl> &event);
+  EventId ScheduleReal (Time const &time, const Ptr<EventImpl> &event);
+  EventId ScheduleRealNow (const Ptr<EventImpl> &event);
   EventId ScheduleDestroy (const Ptr<EventImpl> &event);
+  Time Now (void) const;
+  Time RealNow (void) const;
   void Remove (const EventId &ev);
   void Cancel (const EventId &ev);
   bool IsExpired (const EventId &ev) const;
   virtual void RunOneEvent (void);
   void Run (void);
-  Time Now (void) const;
   Time GetDelayLeft (const EventId &id) const;
   Time GetMaximumSimulationTime (void) const;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/simulator/realtime-simulator.cc	Fri Oct 10 16:22:13 2008 -0700
@@ -0,0 +1,74 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 University of Washington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "simulator.h"
+#include "realtime-simulator.h"
+#include "realtime-simulator-impl.h"
+#include "event-impl.h"
+
+#include "ns3/assert.h"
+#include "ns3/log.h"
+
+NS_LOG_COMPONENT_DEFINE ("RealtimeSimulatorExtension");
+
+namespace ns3 {
+
+RealtimeSimulatorImpl *
+RealtimeSimulatorExtension::GetRealtimeImpl (void)
+{
+  RealtimeSimulatorImpl *impl = dynamic_cast<RealtimeSimulatorImpl *>(Simulator::GetImpl ());
+  NS_ASSERT_MSG (impl, 
+                 "RealtimeSimulatorExtension::GetImpl (): Underlying simulator implementation not realtime");
+  return impl;
+}
+
+Time
+RealtimeSimulatorExtension::RealNow (void)
+{
+  return GetRealtimeImpl ()->RealNow ();
+}
+
+EventId
+RealtimeSimulatorExtension::ScheduleReal (Time const &time, const Ptr<EventImpl> &ev)
+{
+  NS_LOG_FUNCTION (time << ev);
+  return GetRealtimeImpl ()->ScheduleReal (time, ev);
+}
+
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (const Ptr<EventImpl> &ev)
+{
+  NS_LOG_FUNCTION (ev);
+  return GetRealtimeImpl ()->ScheduleRealNow (ev);
+}
+
+EventId
+RealtimeSimulatorExtension::ScheduleReal (Time const &time, void (*f) (void))
+{
+  NS_LOG_FUNCTION (time << f);
+  return ScheduleReal (time, Simulator::MakeEvent (f));
+}
+
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (void (*f) (void))
+{
+  NS_LOG_FUNCTION (f);
+  return ScheduleRealNow (Simulator::MakeEvent (f));
+}
+
+} // namespace ns3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/simulator/realtime-simulator.h	Fri Oct 10 16:22:13 2008 -0700
@@ -0,0 +1,498 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 University of Washington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef REALTIME_SIMULATOR_H
+#define REALTIME_SIMULATOR_H
+
+#include "simulator.h"
+#include "realtime-simulator-impl.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup simulator
+ *
+ * \brief Extension class to control the scheduling of real-time simulation 
+ * events.  Intended to be used by threads driven by "external" system
+ * events and will schedule events using the current real-time instead of 
+ * the current simulation time.
+ */
+class RealtimeSimulatorExtension 
+{
+public:
+  /**
+   * Schedule an event to expire at the relative real-time "time"
+   * is reached.  This can be thought of as scheduling an event
+   * for the current real-time plus the Time passed as a parameter
+   *
+   * When the event expires (when it becomes due to be run), the 
+   * input method will be invoked on the input object.  
+   *
+   * @param time the relative expiration time of the event.
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @returns an id for the scheduled event.
+   */
+  template <typename MEM, typename OBJ>
+  static EventId ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @returns an id for the scheduled event.
+   */
+  template <typename MEM, typename OBJ, typename T1>
+  static EventId ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, T1 a1);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @param a2 the second argument to pass to the invoked method
+   * @returns an id for the scheduled event.
+   */
+  template <typename MEM, typename OBJ, typename T1, typename T2>
+  static EventId ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @param a2 the second argument to pass to the invoked method
+   * @param a3 the third argument to pass to the invoked method
+   * @returns an id for the scheduled event.
+   */
+  template <typename MEM, typename OBJ, 
+            typename T1, typename T2, typename T3>
+  static EventId ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @param a2 the second argument to pass to the invoked method
+   * @param a3 the third argument to pass to the invoked method
+   * @param a4 the fourth argument to pass to the invoked method
+   * @returns an id for the scheduled event.
+   */
+  template <typename MEM, typename OBJ, 
+            typename T1, typename T2, typename T3, typename T4>
+  static EventId ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @param a2 the second argument to pass to the invoked method
+   * @param a3 the third argument to pass to the invoked method
+   * @param a4 the fourth argument to pass to the invoked method
+   * @param a5 the fifth argument to pass to the invoked method
+   * @returns an id for the scheduled event.
+   */
+  template <typename MEM, typename OBJ, 
+            typename T1, typename T2, typename T3, typename T4, typename T5>
+  static EventId ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, 
+                           T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+  /**
+   * @param time the relative expiration time of the event.
+   * @param f the function to invoke
+   * @returns an id for the scheduled event.
+   */
+  static EventId ScheduleReal (Time const &time, void (*f) (void));
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @returns an id for the scheduled event.
+   */
+  template <typename U1, typename T1>
+  static EventId ScheduleReal (Time const &time, void (*f) (U1), T1 a1);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @param a2 the second argument to pass to the function to invoke
+   * @returns an id for the scheduled event.
+   */
+  template <typename U1, typename U2, typename T1, typename T2>
+  static EventId ScheduleReal (Time const &time, void (*f) (U1,U2), T1 a1, T2 a2);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @param a2 the second argument to pass to the function to invoke
+   * @param a3 the third argument to pass to the function to invoke
+   * @returns an id for the scheduled event.
+   */
+  template <typename U1, typename U2, typename U3, typename T1, typename T2, typename T3>
+  static EventId ScheduleReal (Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @param a2 the second argument to pass to the function to invoke
+   * @param a3 the third argument to pass to the function to invoke
+   * @param a4 the fourth argument to pass to the function to invoke
+   * @returns an id for the scheduled event.
+   */
+  template <typename U1, typename U2, typename U3, typename U4, 
+            typename T1, typename T2, typename T3, typename T4>
+  static EventId ScheduleReal (Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
+
+  /**
+   * @param time the relative expiration time of the event.
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @param a2 the second argument to pass to the function to invoke
+   * @param a3 the third argument to pass to the function to invoke
+   * @param a4 the fourth argument to pass to the function to invoke
+   * @param a5 the fifth argument to pass to the function to invoke
+   * @returns an id for the scheduled event.
+   */
+  template <typename U1, typename U2, typename U3, typename U4, typename U5,
+            typename T1, typename T2, typename T3, typename T4, typename T5>
+  static EventId ScheduleReal (Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+  /**
+   * Schedule an event to expire Now. All events scheduled to
+   * to expire "Now" are scheduled FIFO, after all normal events
+   * have expired. 
+   *
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   */
+  template <typename MEM, typename OBJ>
+  static EventId ScheduleRealNow (MEM mem_ptr, OBJ obj);
+
+  /**
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   */
+  template <typename MEM, typename OBJ, 
+            typename T1>
+  static EventId ScheduleRealNow (MEM mem_ptr, OBJ obj, T1 a1);
+
+  /**
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @param a2 the second argument to pass to the invoked method
+   */
+  template <typename MEM, typename OBJ, 
+            typename T1, typename T2>
+  static EventId ScheduleRealNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2);
+
+  /**
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @param a2 the second argument to pass to the invoked method
+   * @param a3 the third argument to pass to the invoked method
+   */
+  template <typename MEM, typename OBJ, 
+            typename T1, typename T2, typename T3>
+  static EventId ScheduleRealNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3);
+
+  /**
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @param a2 the second argument to pass to the invoked method
+   * @param a3 the third argument to pass to the invoked method
+   * @param a4 the fourth argument to pass to the invoked method
+   */
+  template <typename MEM, typename OBJ, 
+            typename T1, typename T2, typename T3, typename T4>
+  static EventId ScheduleRealNow (MEM mem_ptr, OBJ obj, 
+                              T1 a1, T2 a2, T3 a3, T4 a4);
+  /**
+   * @param mem_ptr member method pointer to invoke
+   * @param obj the object on which to invoke the member method
+   * @param a1 the first argument to pass to the invoked method
+   * @param a2 the second argument to pass to the invoked method
+   * @param a3 the third argument to pass to the invoked method
+   * @param a4 the fourth argument to pass to the invoked method
+   * @param a5 the fifth argument to pass to the invoked method
+   */
+  template <typename MEM, typename OBJ, 
+            typename T1, typename T2, typename T3, typename T4, typename T5>
+  static EventId ScheduleRealNow (MEM mem_ptr, OBJ obj, 
+                              T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+  /**
+   * @param f the function to invoke
+   */
+  static EventId ScheduleRealNow (void (*f) (void));
+
+  /**
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   */
+  template <typename U1,
+            typename T1>
+  static EventId ScheduleRealNow (void (*f) (U1), T1 a1);
+
+  /**
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @param a2 the second argument to pass to the function to invoke
+   */
+  template <typename U1, typename U2,
+            typename T1, typename T2>
+  static EventId ScheduleRealNow (void (*f) (U1,U2), T1 a1, T2 a2);
+
+  /**
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @param a2 the second argument to pass to the function to invoke
+   * @param a3 the third argument to pass to the function to invoke
+   */
+  template <typename U1, typename U2, typename U3,
+            typename T1, typename T2, typename T3>
+  static EventId ScheduleRealNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3);
+
+  /**
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @param a2 the second argument to pass to the function to invoke
+   * @param a3 the third argument to pass to the function to invoke
+   * @param a4 the fourth argument to pass to the function to invoke
+   */
+  template <typename U1, typename U2, typename U3, typename U4,
+            typename T1, typename T2, typename T3, typename T4>
+  static EventId ScheduleRealNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4);
+
+  /**
+   * @param f the function to invoke
+   * @param a1 the first argument to pass to the function to invoke
+   * @param a2 the second argument to pass to the function to invoke
+   * @param a3 the third argument to pass to the function to invoke
+   * @param a4 the fourth argument to pass to the function to invoke
+   * @param a5 the fifth argument to pass to the function to invoke
+   */
+  template <typename U1, typename U2, typename U3, typename U4, typename U5,
+            typename T1, typename T2, typename T3, typename T4, typename T5>
+  static EventId ScheduleRealNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
+
+  /**
+   * Return the "current normalized real-time".
+   */
+  static Time RealNow (void);
+
+  /**
+   * \param time delay until the event expires
+   * \param event the event to schedule
+   * \returns a unique identifier for the newly-scheduled event.
+   *
+   * This method will be typically used by language bindings
+   * to delegate events to their own subclass of the EventImpl base class.
+   */
+  static EventId ScheduleReal (Time const &time, const Ptr<EventImpl> &event);  
+
+  /**
+   * \param event the event to schedule
+   * \returns a unique identifier for the newly-scheduled event.
+   *
+   * This method will be typically used by language bindings
+   * to delegate events to their own subclass of the EventImpl base class.
+   */
+  static EventId ScheduleRealNow (const Ptr<EventImpl> &event);
+private:
+  RealtimeSimulatorExtension ();
+  ~RealtimeSimulatorExtension ();
+
+  static RealtimeSimulatorImpl *GetRealtimeImpl (void);
+};
+
+template <typename MEM, typename OBJ>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (mem_ptr, obj));
+}
+
+template <typename MEM, typename OBJ,
+          typename T1>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, T1 a1) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (mem_ptr, obj, a1));
+}
+
+template <typename MEM, typename OBJ, 
+          typename T1, typename T2>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2)
+{
+  return ScheduleReal (time, Simulator::MakeEvent (mem_ptr, obj, a1, a2));
+}
+
+template <typename MEM, typename OBJ,
+          typename T1, typename T2, typename T3>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (mem_ptr, obj, a1, a2, a3));
+}
+
+template <typename MEM, typename OBJ, 
+          typename T1, typename T2, typename T3, typename T4>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
+}
+
+template <typename MEM, typename OBJ, 
+          typename T1, typename T2, typename T3, typename T4, typename T5>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, MEM mem_ptr, OBJ obj, 
+                             T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
+}
+
+template <typename U1, typename T1>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, void (*f) (U1), T1 a1) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (f, a1));
+}
+
+template <typename U1, typename U2, 
+          typename T1, typename T2>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, void (*f) (U1,U2), T1 a1, T2 a2) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (f, a1, a2));
+}
+
+template <typename U1, typename U2, typename U3,
+          typename T1, typename T2, typename T3>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3)
+{
+  return ScheduleReal (time, Simulator::MakeEvent (f, a1, a2, a3));
+}
+
+template <typename U1, typename U2, typename U3, typename U4,
+          typename T1, typename T2, typename T3, typename T4>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (f, a1, a2, a3, a4));
+}
+
+template <typename U1, typename U2, typename U3, typename U4, typename U5,
+          typename T1, typename T2, typename T3, typename T4, typename T5>
+EventId RealtimeSimulatorExtension::ScheduleReal (Time const &time, void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
+{
+  return ScheduleReal (time, Simulator::MakeEvent (f, a1, a2, a3, a4, a5));
+}
+
+template <typename MEM, typename OBJ>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (MEM mem_ptr, OBJ obj) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (mem_ptr, obj));
+}
+
+template <typename MEM, typename OBJ, 
+          typename T1>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (MEM mem_ptr, OBJ obj, T1 a1) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (mem_ptr, obj, a1));
+}
+
+template <typename MEM, typename OBJ, 
+          typename T1, typename T2>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (mem_ptr, obj, a1, a2));
+}
+
+template <typename MEM, typename OBJ, 
+          typename T1, typename T2, typename T3>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (mem_ptr, obj, a1, a2, a3));
+}
+
+template <typename MEM, typename OBJ, 
+          typename T1, typename T2, typename T3, typename T4>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (MEM mem_ptr, OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (mem_ptr, obj, a1, a2, a3, a4));
+}
+
+template <typename MEM, typename OBJ, 
+          typename T1, typename T2, typename T3, typename T4, typename T5>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (MEM mem_ptr, OBJ obj, 
+                        T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5));
+}
+
+template <typename U1,
+          typename T1>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (void (*f) (U1), T1 a1) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (f, a1));
+}
+
+template <typename U1, typename U2,
+          typename T1, typename T2>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (void (*f) (U1,U2), T1 a1, T2 a2) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (f, a1, a2));
+}
+
+template <typename U1, typename U2, typename U3,
+          typename T1, typename T2, typename T3>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3)
+{
+  return ScheduleRealNow (Simulator::MakeEvent (f, a1, a2, a3));
+}
+
+template <typename U1, typename U2, typename U3, typename U4,
+          typename T1, typename T2, typename T3, typename T4>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (f, a1, a2, a3, a4));
+}
+
+template <typename U1, typename U2, typename U3, typename U4, typename U5,
+          typename T1, typename T2, typename T3, typename T4, typename T5>
+EventId
+RealtimeSimulatorExtension::ScheduleRealNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) 
+{
+  return ScheduleRealNow (Simulator::MakeEvent (f, a1, a2, a3, a4, a5));
+}
+
+}; // namespace ns3
+
+#endif /* REALTIME_SIMULATOR_H */
--- a/src/simulator/simulator.h	Fri Oct 10 15:26:32 2008 -0700
+++ b/src/simulator/simulator.h	Fri Oct 10 16:22:13 2008 -0700
@@ -56,6 +56,8 @@
  */
 class Simulator 
 {
+  friend class RealtimeSimulatorExtension;
+
 public:
   /**
    * \param impl a new simulator implementation
--- a/src/simulator/wscript	Fri Oct 10 15:26:32 2008 -0700
+++ b/src/simulator/wscript	Fri Oct 10 16:22:13 2008 -0700
@@ -61,6 +61,7 @@
         'heap-scheduler.cc',
         'event-impl.cc',
         'simulator.cc',
+        'realtime-simulator.cc',
         'default-simulator-impl.cc',
         'timer.cc',
         'watchdog.cc',
@@ -75,6 +76,7 @@
         'event-id.h',
         'event-impl.h',
         'simulator.h',
+        'realtime-simulator.h',
         'simulator-impl.h',
         'default-simulator-impl.h',
         'scheduler.h',