/**
   * "When new links are added or opened, and if we're configured to add nexthop routes, try to add
   * a new route for the given link." [DTN2]
   */
  public void add_nexthop_route(final Link link) {

    // "If we're configured to do so, create a route entry for the eid
    // specified by the link when it connected, using the
    // scheme-specific code to transform the URI to wildcard
    // the service part" [DTN2]
    EndpointID eid = link.remote_eid();
    if (config_.add_nexthop_routes() && !eid.equals(EndpointID.NULL_EID())) {
      EndpointIDPattern eid_pattern = new EndpointIDPattern(link.remote_eid());

      // "attempt to build a route pattern from link's remote_eid" [DTN2]
      if (!eid_pattern.append_service_wildcard())
        // "else assign remote_eid as-is" [DTN2]
        eid_pattern.assign(link.remote_eid());

      RouteEntryVec ignored = new RouteEntryVec();
      if (route_table_.get_matching(eid_pattern, link, ignored) == 0) {
        RouteEntry entry = new RouteEntry(eid_pattern, link);
        entry.set_action(ForwardingInfo.action_t.FORWARD_ACTION);
        add_route(entry);
      }
    }
  }