void FibHelper::AddRoute(Ptr<Node> node, const Name& prefix, Ptr<Node> otherNode, int32_t metric) { for (uint32_t deviceId = 0; deviceId < node->GetNDevices(); deviceId++) { Ptr<PointToPointNetDevice> netDevice = DynamicCast<PointToPointNetDevice>(node->GetDevice(deviceId)); if (netDevice == 0) continue; Ptr<Channel> channel = netDevice->GetChannel(); if (channel == 0) continue; if (channel->GetDevice(0)->GetNode() == otherNode || channel->GetDevice(1)->GetNode() == otherNode) { Ptr<L3Protocol> ndn = node->GetObject<L3Protocol>(); NS_ASSERT_MSG(ndn != 0, "Ndn stack should be installed on the node"); shared_ptr<Face> face = ndn->getFaceByNetDevice(netDevice); NS_ASSERT_MSG(face != 0, "There is no face associated with the p2p link"); AddRoute(node, prefix, face, metric); return; } } NS_FATAL_ERROR("Cannot add route: Node# " << node->GetId() << " and Node# " << otherNode->GetId() << " are not connected"); }
void FibHelper::AddRoute(Ptr<Node> node, const Name& prefix, uint32_t faceId, int32_t metric) { Ptr<L3Protocol> ndn = node->GetObject<L3Protocol>(); NS_ASSERT_MSG(ndn != 0, "Ndn stack should be installed on the node"); shared_ptr<Face> face = ndn->getFaceById(faceId); NS_ASSERT_MSG(face != 0, "Face with ID [" << faceId << "] does not exist on node [" << node->GetId() << "]"); AddRoute(node, prefix, face, metric); }
void FibHelper::AddRoute(const std::string& nodeName, const Name& prefix, const std::string& otherNodeName, int32_t metric) { Ptr<Node> node = Names::Find<Node>(nodeName); NS_ASSERT_MSG(node != 0, "Node [" << nodeName << "] does not exist"); Ptr<Node> otherNode = Names::Find<Node>(otherNodeName); NS_ASSERT_MSG(otherNode != 0, "Node [" << otherNodeName << "] does not exist"); AddRoute(node, prefix, otherNode, metric); }
bool TPinocchio::Initialize() { crow::logger::setHandler(&log_handler_); AddRoute(); AddRouteRegist(); AddRouteSend(); AddRouteRecv(); AddRoutePublishApiKey(); return true; }
// copy constructor instead of clone ECode CLinkProperties::constructor( /* [in] */ ILinkProperties* source) { if (source != NULL) { source->GetInterfaceName(&mIfaceName); AutoPtr<IObjectContainer> addr; source->GetLinkAddresses((IObjectContainer**)&addr); AutoPtr<IObjectEnumerator> emu; FAIL_RETURN(addr->GetObjectEnumerator((IObjectEnumerator**)&emu)); Boolean hasNext; while (emu->MoveNext(&hasNext), hasNext) { AutoPtr<ILinkAddress> linkaddr; emu->Current((IInterface**)&linkaddr); AddLinkAddress(linkaddr); } AutoPtr<IObjectContainer> dns; source->GetLinkAddresses((IObjectContainer**)&dns); AutoPtr<IObjectEnumerator> emu2; FAIL_RETURN(dns->GetObjectEnumerator((IObjectEnumerator**)&emu2)); Boolean hasNext2; while (emu->MoveNext(&hasNext2), hasNext2) { AutoPtr<IInetAddress> inetaddr; emu2->Current((IInterface**)&inetaddr); AddDns(inetaddr); } AutoPtr<IObjectContainer> route; source->GetLinkAddresses((IObjectContainer**)&route); AutoPtr<IObjectEnumerator> emu3; FAIL_RETURN(route->GetObjectEnumerator((IObjectEnumerator**)&emu3)); Boolean hasNext3; while (emu->MoveNext(&hasNext3), hasNext3) { AutoPtr<IRouteInfo> routeinfo; emu3->Current((IInterface**)&routeinfo); AddRoute(routeinfo); } AutoPtr<IProxyProperties> proxy; source->GetHttpProxy((IProxyProperties**)&proxy); if (proxy == NULL) mHttpProxy = NULL; else { CProxyProperties::New(proxy, (IProxyProperties**)&mHttpProxy); } } return NOERROR; }
GpxRootElement::GpxRootElement(const wxString &creator, GpxMetadataElement *metadata, ListOfGpxWpts *waypoints, ListOfGpxRoutes *routes, ListOfGpxTracks *tracks, GpxExtensionsElement *extensions) : TiXmlElement("gpx") { my_extensions = NULL; my_metadata = NULL; first_waypoint = NULL; last_waypoint = NULL; first_route = NULL; last_route = NULL; first_track = NULL; last_track = NULL; SetAttribute ( "version", "1.1" ); SetAttribute ( "creator", creator.ToUTF8() ); SetAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" ); SetAttribute( "xmlns", "http://www.topografix.com/GPX/1/1" ); SetAttribute( "xmlns:gpxx", "http://www.garmin.com/xmlschemas/GpxExtensions/v3" ); SetAttribute( "xsi:schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" ); SetMetadata(metadata); if (waypoints) { wxListOfGpxWptsNode *waypoint = waypoints->GetFirst(); while (waypoint) { AddWaypoint(waypoint->GetData()); waypoint = waypoint->GetNext(); } } if (routes) { wxListOfGpxRoutesNode *route = routes->GetFirst(); while (route) { AddRoute(route->GetData()); route = route->GetNext(); } } if (tracks) { wxListOfGpxTracksNode *track = tracks->GetFirst(); while (track) { AddTrack(track->GetData()); track = track->GetNext(); } } SetExtensions(extensions); }
ECode CLinkProperties::ReadFromParcel( /* [in] */ IParcel* source) { source->ReadString(&mIfaceName); Int32 addressCount; source->ReadInt32(&addressCount); for (Int32 i = 0; i < addressCount; i++) { AutoPtr<ILinkAddress> linkaddr; source->ReadInterfacePtr((Handle32*)&linkaddr); AddLinkAddress(linkaddr); } AutoPtr<IInetAddressHelper> helper; CInetAddressHelper::AcquireSingleton((IInetAddressHelper**)&helper); source->ReadInt32(&addressCount); for (Int32 i = 0; i < addressCount; i++) { AutoPtr<ArrayOf<Byte> > address; source->ReadArrayOf((Handle32*)&address); AutoPtr<IInetAddress> inetaddr; helper->GetByAddress(address, (IInetAddress**)&inetaddr); AddDns(inetaddr); } source->ReadInt32(&addressCount); for (Int32 i = 0; i < addressCount; i++) { AutoPtr<IRouteInfo> routeinfo; source->ReadInterfacePtr((Handle32*)&routeinfo); AddRoute(routeinfo); } Byte by = 0; source->ReadByte(&by); if (by == 1) { source->ReadInterfacePtr((Handle32*)&mHttpProxy); } return NOERROR; }
void DXMNodeDagAdapter::Initialize(DXMNode* node) { DXMNodeAdapter::Initialize(node); if( g_DebugBasic ) { MFnDependencyNode depNode(node->GetSite()); MString name= depNode.name(); DXCC_DPFA_REPORT("%s", name.asChar()); } MDagPathArray dagPathArray; MFnDagNode dagNode(node->GetSite()); dagNode.getAllPaths(dagPathArray); for(UINT index= 0; index < dagPathArray.length(); index++) { AddRoute(dagPathArray[index]); } SyncFlags= DAGSYNC_TRANSFORM | DAGSYNC_VISIBILITY_OF_NODE | DAGSYNC_VISIBILITY_OF_ROUTES; GetOwnerGraphAdapter()->AddSyncRequest(this); }
RestServer::RestServer() { AddRoute("HEAD", REGEX_DBNAME_GROUP "/{0,}$", &RestServer::HeadDatabase); AddRoute("HEAD", REGEX_DBNAME_GROUP REGEX_DOCID_GROUP, &RestServer::HeadDocument); AddRoute("HEAD", REGEX_DBNAME_GROUP "/+_design" REGEX_DESIGNID_GROUP, &RestServer::HeadDesignDocument); AddRoute("HEAD", REGEX_DBNAME_GROUP REGEX_DOCID_GROUP REGEX_ATTACHMENT_NAME_GROUP, &RestServer::HeadDocumentAttachment); AddRoute("HEAD", "/+", &RestServer::HeadServer); AddRoute("DELETE", REGEX_DBNAME_GROUP "/+_local" REGEX_DOCID_GROUP, &RestServer::DeleteLocalDocument); AddRoute("DELETE", REGEX_DBNAME_GROUP "/{0,}$", &RestServer::DeleteDatabase); AddRoute("DELETE", REGEX_DBNAME_GROUP "/+_design" REGEX_DESIGNID_GROUP, &RestServer::DeleteDesignDocument); AddRoute("DELETE", REGEX_DBNAME_GROUP REGEX_DOCID_GROUP REGEX_ATTACHMENT_NAME_GROUP, &RestServer::DeleteDocumentAttachment); AddRoute("DELETE", REGEX_DBNAME_GROUP REGEX_DOCID_GROUP, &RestServer::DeleteDocument); AddRoute("PUT", REGEX_DBNAME_GROUP "/+_local" REGEX_DOCID_GROUP, &RestServer::PutLocalDocument); AddRoute("PUT", REGEX_DBNAME_GROUP "/+_design" REGEX_DESIGNID_GROUP, &RestServer::PutDesignDocument); AddRoute("PUT", REGEX_DBNAME_GROUP REGEX_DOCID_GROUP REGEX_ATTACHMENT_NAME_GROUP, &RestServer::PutDocumentAttachment); AddRoute("PUT", REGEX_DBNAME_GROUP REGEX_DOCID_GROUP, &RestServer::PutDocument); AddRoute("PUT", REGEX_DBNAME_GROUP "/{0,}$", &RestServer::PutDatabase); AddRoute("POST", REGEX_DBNAME_GROUP "/+_all_docs", &RestServer::PostDatabaseAllDocs); AddRoute("POST", REGEX_DBNAME_GROUP "/+_bulk_docs", &RestServer::PostDatabaseBulkDocs); AddRoute("POST", REGEX_DBNAME_GROUP "/+_revs_diff", &RestServer::PostDatabaseRevsDiff); AddRoute("POST", REGEX_DBNAME_GROUP "/+_ensure_full_commit", &RestServer::PostEnsureFullCommit); AddRoute("POST", REGEX_DBNAME_GROUP "/+_temp_view", &RestServer::PostTempView); AddRoute("POST", REGEX_DBNAME_GROUP "/{0,}$", &RestServer::PostDatabase); AddRoute("GET", "/+_active_tasks/{0,}$", &RestServer::GetActiveTasks); AddRoute("GET", "/+_uuids/{0,}$", &RestServer::GetUuids); AddRoute("GET", "/+_session/{0,}$", &RestServer::GetSession); AddRoute("GET", "/+_all_dbs/{0,}$", &RestServer::GetAllDbs); AddRoute("GET", "/+_config/query_servers/{0,}$", &RestServer::GetConfigQueryServers); AddRoute("GET", "/+_config/native_query_servers/{0,}$", &RestServer::GetConfigNativeQueryServers); AddRoute("GET", "/+_config/{0,}$", &RestServer::GetConfig); AddRoute("GET", REGEX_DBNAME_GROUP "/+_local" REGEX_DOCID_GROUP, &RestServer::GetLocalDocument); AddRoute("GET", REGEX_DBNAME_GROUP "/+_design" REGEX_DESIGNID_GROUP "/_view" REGEX_VIEWID_GROUP, &RestServer::GetDesignDocumentView); AddRoute("GET", REGEX_DBNAME_GROUP "/+_design" REGEX_DESIGNID_GROUP, &RestServer::GetDesignDocument); AddRoute("GET", REGEX_DBNAME_GROUP REGEX_DOCID_GROUP REGEX_ATTACHMENT_NAME_GROUP, &RestServer::GetDocumentAttachment); AddRoute("GET", REGEX_DBNAME_GROUP REGEX_DOCID_GROUP, &RestServer::GetDocument); AddRoute("GET", REGEX_DBNAME_GROUP "/+_all_docs/{0,}$", &RestServer::GetDatabaseAllDocs); AddRoute("GET", REGEX_DBNAME_GROUP "/{0,}$", &RestServer::GetDatabase); AddRoute("GET", "/{0,}$", &RestServer::GetSignature); databases_.AddDatabase("_replicator"); databases_.AddDatabase("_users"); }