src: Updating code style to conform (more or less) to ndn-cxx style

Also, adding .clang-format that describes the applied style. Note that
this style requires a slightly customized version of clang-format.
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index 5ab8cba..d7505e7 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -43,7 +43,7 @@
 
 #include <boost/foreach.hpp>
 
-NS_LOG_COMPONENT_DEFINE ("ndn.L3Protocol");
+NS_LOG_COMPONENT_DEFINE("ndn.L3Protocol");
 
 namespace ns3 {
 namespace ndn {
@@ -51,32 +51,31 @@
 const uint16_t L3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
 const uint16_t L3Protocol::IP_STACK_PORT = 9695;
 
-NS_OBJECT_ENSURE_REGISTERED (L3Protocol);
+NS_OBJECT_ENSURE_REGISTERED(L3Protocol);
 
 TypeId
-L3Protocol::GetTypeId (void)
+L3Protocol::GetTypeId(void)
 {
-  static TypeId tid = TypeId ("ns3::ndn::L3Protocol")
-    .SetGroupName ("ndn")
-    .SetParent<Object> ()
-    .AddConstructor<L3Protocol> ()
-    .AddAttribute ("FaceList", "List of faces associated with ndn stack",
-                   ObjectVectorValue (),
-                   MakeObjectVectorAccessor (&L3Protocol::m_faces),
-                   MakeObjectVectorChecker<Face> ())
-  ;
+  static TypeId tid =
+    TypeId("ns3::ndn::L3Protocol")
+      .SetGroupName("ndn")
+      .SetParent<Object>()
+      .AddConstructor<L3Protocol>()
+      .AddAttribute("FaceList", "List of faces associated with ndn stack", ObjectVectorValue(),
+                    MakeObjectVectorAccessor(&L3Protocol::m_faces),
+                    MakeObjectVectorChecker<Face>());
   return tid;
 }
 
-L3Protocol::L3Protocol ()
-: m_faceCounter (0)
+L3Protocol::L3Protocol()
+  : m_faceCounter(0)
 {
-  NS_LOG_FUNCTION (this);
+  NS_LOG_FUNCTION(this);
 }
 
-L3Protocol::~L3Protocol ()
+L3Protocol::~L3Protocol()
 {
-  NS_LOG_FUNCTION (this);
+  NS_LOG_FUNCTION(this);
 }
 
 /*
@@ -84,137 +83,135 @@
  * by setting the node in the ndn stack
  */
 void
-L3Protocol::NotifyNewAggregate ()
+L3Protocol::NotifyNewAggregate()
 {
   // not really efficient, but this will work only once
-  if (m_node == 0)
-    {
-      m_node = GetObject<Node> ();
-      if (m_node != 0)
-        {
-          NS_ASSERT_MSG (m_forwardingStrategy != 0,
-                         "Forwarding strategy should be aggregated before L3Protocol");
-        }
+  if (m_node == 0) {
+    m_node = GetObject<Node>();
+    if (m_node != 0) {
+      NS_ASSERT_MSG(m_forwardingStrategy != 0,
+                    "Forwarding strategy should be aggregated before L3Protocol");
     }
-  if (m_forwardingStrategy == 0)
-    {
-      m_forwardingStrategy = GetObject<ForwardingStrategy> ();
-    }
+  }
+  if (m_forwardingStrategy == 0) {
+    m_forwardingStrategy = GetObject<ForwardingStrategy>();
+  }
 
-  Object::NotifyNewAggregate ();
+  Object::NotifyNewAggregate();
 }
 
 void
-L3Protocol::DoDispose (void)
+L3Protocol::DoDispose(void)
 {
-  NS_LOG_FUNCTION (this);
+  NS_LOG_FUNCTION(this);
 
   // for (FaceList::iterator i = m_faces.begin (); i != m_faces.end (); ++i)
   //   {
   //     *i = 0;
   //   }
-  m_faces.clear ();
+  m_faces.clear();
   m_node = 0;
 
   // Force delete on objects
   m_forwardingStrategy = 0; // there is a reference to PIT stored in here
 
-  Object::DoDispose ();
+  Object::DoDispose();
 }
 
 uint32_t
-L3Protocol::AddFace (const Ptr<Face> &face)
+L3Protocol::AddFace(const Ptr<Face>& face)
 {
-  NS_LOG_FUNCTION (this << &face);
+  NS_LOG_FUNCTION(this << &face);
 
-  face->SetId (m_faceCounter); // sets a unique ID of the face. This ID serves only informational purposes
+  face->SetId(
+    m_faceCounter); // sets a unique ID of the face. This ID serves only informational purposes
 
   // ask face to register in lower-layer stack
-  face->RegisterProtocolHandlers (MakeCallback (&ForwardingStrategy::OnInterest, m_forwardingStrategy),
-                                  MakeCallback (&ForwardingStrategy::OnData, m_forwardingStrategy));
+  face->RegisterProtocolHandlers(MakeCallback(&ForwardingStrategy::OnInterest,
+                                              m_forwardingStrategy),
+                                 MakeCallback(&ForwardingStrategy::OnData, m_forwardingStrategy));
 
-  m_faces.push_back (face);
+  m_faces.push_back(face);
   m_faceCounter++;
 
-  m_forwardingStrategy->AddFace (face); // notify that face is added
-  return face->GetId ();
+  m_forwardingStrategy->AddFace(face); // notify that face is added
+  return face->GetId();
 }
 
 void
-L3Protocol::RemoveFace (Ptr<Face> face)
+L3Protocol::RemoveFace(Ptr<Face> face)
 {
-  NS_LOG_FUNCTION (this << boost::cref (*face));
+  NS_LOG_FUNCTION(this << boost::cref(*face));
   // ask face to register in lower-layer stack
-  face->UnRegisterProtocolHandlers ();
-  Ptr<Pit> pit = GetObject<Pit> ();
+  face->UnRegisterProtocolHandlers();
+  Ptr<Pit> pit = GetObject<Pit>();
 
   // just to be on a safe side. Do the process in two steps
-  std::list< Ptr<pit::Entry> > entriesToRemoves;
-  for (Ptr<pit::Entry> pitEntry = pit->Begin (); pitEntry != 0; pitEntry = pit->Next (pitEntry))
-    {
-      pitEntry->RemoveAllReferencesToFace (face);
+  std::list<Ptr<pit::Entry>> entriesToRemoves;
+  for (Ptr<pit::Entry> pitEntry = pit->Begin(); pitEntry != 0; pitEntry = pit->Next(pitEntry)) {
+    pitEntry->RemoveAllReferencesToFace(face);
 
-      // If this face is the only for the associated FIB entry, then FIB entry will be removed soon.
-      // Thus, we have to remove the whole PIT entry
-      if (pitEntry->GetFibEntry ()->m_faces.size () == 1 &&
-          pitEntry->GetFibEntry ()->m_faces.begin ()->GetFace () == face)
-        {
-          entriesToRemoves.push_back (pitEntry);
-        }
+    // If this face is the only for the associated FIB entry, then FIB entry will be removed soon.
+    // Thus, we have to remove the whole PIT entry
+    if (pitEntry->GetFibEntry()->m_faces.size() == 1
+        && pitEntry->GetFibEntry()->m_faces.begin()->GetFace() == face) {
+      entriesToRemoves.push_back(pitEntry);
     }
-  BOOST_FOREACH (Ptr<pit::Entry> removedEntry, entriesToRemoves)
-    {
-      pit->MarkErased (removedEntry);
-    }
+  }
+  BOOST_FOREACH (Ptr<pit::Entry> removedEntry, entriesToRemoves) {
+    pit->MarkErased(removedEntry);
+  }
 
-  FaceList::iterator face_it = find (m_faces.begin(), m_faces.end(), face);
-  if (face_it == m_faces.end ())
-    {
-      return;
-    }
-  m_faces.erase (face_it);
+  FaceList::iterator face_it = find(m_faces.begin(), m_faces.end(), face);
+  if (face_it == m_faces.end()) {
+    return;
+  }
+  m_faces.erase(face_it);
 
-  GetObject<Fib> ()->RemoveFromAll (face);
-  m_forwardingStrategy->RemoveFace (face); // notify that face is removed
+  GetObject<Fib>()->RemoveFromAll(face);
+  m_forwardingStrategy->RemoveFace(face); // notify that face is removed
 }
 
 Ptr<Face>
-L3Protocol::GetFace (uint32_t index) const
+L3Protocol::GetFace(uint32_t index) const
 {
-  NS_ASSERT (0 <= index && index < m_faces.size ());
+  NS_ASSERT(0 <= index && index < m_faces.size());
   return m_faces[index];
 }
 
 Ptr<Face>
-L3Protocol::GetFaceById (uint32_t index) const
+L3Protocol::GetFaceById(uint32_t index) const
 {
-  BOOST_FOREACH (const Ptr<Face> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
-    {
-      if (face->GetId () == index)
-        return face;
-    }
+  BOOST_FOREACH (const Ptr<Face>& face, m_faces) // this function is not supposed to be called
+                                                 // often, so linear search is fine
+  {
+    if (face->GetId() == index)
+      return face;
+  }
   return 0;
 }
 
 Ptr<Face>
-L3Protocol::GetFaceByNetDevice (Ptr<NetDevice> netDevice) const
+L3Protocol::GetFaceByNetDevice(Ptr<NetDevice> netDevice) const
 {
-  BOOST_FOREACH (const Ptr<Face> &face, m_faces) // this function is not supposed to be called often, so linear search is fine
-    {
-      Ptr<NetDeviceFace> netDeviceFace = DynamicCast<NetDeviceFace> (face);
-      if (netDeviceFace == 0) continue;
+  BOOST_FOREACH (const Ptr<Face>& face, m_faces) // this function is not supposed to be called
+                                                 // often, so linear search is fine
+  {
+    Ptr<NetDeviceFace> netDeviceFace = DynamicCast<NetDeviceFace>(face);
+    if (netDeviceFace == 0)
+      continue;
 
-      if (netDeviceFace->GetNetDevice () == netDevice)
-        return face;
-    }
+    if (netDeviceFace->GetNetDevice() == netDevice)
+      return face;
+  }
   return 0;
 }
 
 uint32_t
-L3Protocol::GetNFaces (void) const
+L3Protocol::GetNFaces(void) const
 {
-  return m_faces.size ();
+  return m_faces.size();
 }
 
-} //namespace ndn
-} //namespace ns3
+} // namespace ndn
+} // namespace ns3