face: give ProtocolFactory access to NetworkMonitor

Subclasses of ProtocolFactory can access NetworkMonitor and
addFace callback anytime via member fields. They are supplied
to ProtocolFactory::create from FaceSystem.

This is in preparation for letting ProtocolFactory subclasses
react to fine-grained signals from NetworkMonitor.

refs #4021

Change-Id: I8da116bffc83d1bdeed7fd3b2e12c8872f19177b
diff --git a/daemon/face/protocol-factory.cpp b/daemon/face/protocol-factory.cpp
index daa0214..010190d 100644
--- a/daemon/face/protocol-factory.cpp
+++ b/daemon/face/protocol-factory.cpp
@@ -1,5 +1,5 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
  * Copyright (c) 2014-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
@@ -38,11 +38,19 @@
 }
 
 unique_ptr<ProtocolFactory>
-ProtocolFactory::create(const std::string& id)
+ProtocolFactory::create(const std::string& id, shared_ptr<ndn::net::NetworkMonitor> netmon,
+                        const FaceCreatedCallback& addFace)
 {
   Registry& registry = getRegistry();
   auto found = registry.find(id);
-  return found == registry.end() ? nullptr : found->second();
+  if (found == registry.end()) {
+    return nullptr;
+  }
+
+  auto factory = found->second();
+  factory->netmon = std::move(netmon);
+  factory->addFace = addFace;
+  return factory;
 }
 
 std::set<std::string>