Access routing table in storing mode of RPL (Contiki / Cooja) - contiki

I am able to successfully run sample code (../examples/6tisch/simple-node) where rpl-lite is implemented and after every 60 seconds root of the network print its routing table. As it uses rpl-lite, only root node stores a routing table.
I am looking for a sample code for implementing (storing mode) in this program and print the routing table of each node every 60 seconds.
I have added "MAKE_ROUTING = MAKE_ROUTING_RPL_CLASSIC" in the Make File to enable RPL-Classic
#include "contiki.h"
#include "sys/node-id.h"
#include "sys/log.h"
#include "net/ipv6/uip-ds6-route.h"
#include "net/ipv6/uip-sr.h"
#include "net/mac/tsch/tsch.h"
#include "net/routing/routing.h"
#define DEBUG DEBUG_PRINT
#include "net/ipv6/uip-debug.h"
/*---------------------------------------------------------------------------*/
PROCESS(node_process, "RPL Node");
AUTOSTART_PROCESSES(&node_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(node_process, ev, data)
{
int is_coordinator;
PROCESS_BEGIN();
is_coordinator = 0;
#if CONTIKI_TARGET_COOJA || CONTIKI_TARGET_Z1
is_coordinator = (node_id == 1);
#endif
if(is_coordinator) {
NETSTACK_ROUTING.root_start();
}
NETSTACK_MAC.on();
{
static struct etimer et;
/* Print out routing tables every minute */
etimer_set(&et, CLOCK_SECOND * 60);
while(1) {
PRINTF("Routing entries: %u\n", uip_ds6_route_num_routes());
PROCESS_YIELD_UNTIL(etimer_expired(&et));
etimer_reset(&et);
}
}
PROCESS_END();
}

These steps worked for me:
Add MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC to the Makefile to ensure RPL Classic is used; storing mode is on by default.
For convenience, add includes and defined that allow to use the Contiki-NG logging module:
/* Log configuration */
#include "sys/log.h"
#define LOG_MODULE "App"
#define LOG_LEVEL LOG_LEVEL_DBG
Add this code to the while(1) loop:
LOG_INFO("Routing entries: %u\n", uip_ds6_route_num_routes());
uip_ds6_route_t *route = uip_ds6_route_head();
while(route) {
LOG_INFO("Route ");
LOG_INFO_6ADDR(&route->ipaddr);
LOG_INFO_("/128 via ");
LOG_INFO_6ADDR(uip_ds6_route_nexthop(route));
LOG_INFO_("\n");
route = uip_ds6_route_next(route);
}
Output on the root node:
01:00.382 ID:1 [INFO: App ] Routing entries: 7
01:00.382 ID:1 [INFO: App ] Route fd00::205:5:5:5/128 via fe80::205:5:5:5
01:00.382 ID:1 [INFO: App ] Route fd00::204:4:4:4/128 via fe80::204:4:4:4
01:00.382 ID:1 [INFO: App ] Route fd00::208:8:8:8/128 via fe80::203:3:3:3
01:00.382 ID:1 [INFO: App ] Route fd00::203:3:3:3/128 via fe80::203:3:3:3
01:00.382 ID:1 [INFO: App ] Route fd00::207:7:7:7/128 via fe80::203:3:3:3
01:00.382 ID:1 [INFO: App ] Route fd00::206:6:6:6/128 via fe80::203:3:3:3
01:00.382 ID:1 [INFO: App ] Route fd00::202:2:2:2/128 via fe80::203:3:3:3
Output on a forwarder node:
01:00.899 ID:3 [INFO: App ] Routing entries: 4
01:00.899 ID:3 [INFO: App ] Route fd00::208:8:8:8/128 via fe80::206:6:6:6
01:00.899 ID:3 [INFO: App ] Route fd00::207:7:7:7/128 via fe80::206:6:6:6
01:00.899 ID:3 [INFO: App ] Route fd00::206:6:6:6/128 via fe80::206:6:6:6
01:00.899 ID:3 [INFO: App ] Route fd00::202:2:2:2/128 via fe80::202:2:2:2

Related

Vert.x: can I mix a wildcard route with an explicit route?

I want to host Swagger UI as static content using Vert.x. The swagger-initializer.js needs the spec somewhere on the server and I want it to be in /api/swagger-ui as well, so I can define the spec in swagger-initializer.js as
window.onload = function() {
window.ui = SwaggerUIBundle({
url: "petstore.yaml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
};
It works perfectly like this
Router.router(vertx).route("/api/swagger-ui/petstore.json").handler(StaticHandler.create("path/to/petstore.json"));
Router.router(vertx).route("/api/swagger-ui/*").handler(StaticHandler.create("path/to/swagger-ui"));
serving Swagger UI together with the provided spec.
But I wonder if there are any side effects by mixing a wildcard with an explicit route?
Are there any resources if this is good practice and it doesn't just work by coincidence?
It's fine, because by default routes are matched in the order they are added to the router.
When a request arrives, the router will step through each route and check if it matches, if it matches then the handler for that route will be called.

Django channels public and private routers

My ASGI app contains 2 URL pattern series. Some of them require authentication and the rest are available without authentication.
How can I tell them apart when defining ProtocolTypeRouter?
private_urls = [
path("ws/url/one/", FirstConsumer.as_asgi()),
]
public_urls = [
path("ws/url/two/", SecondConsumer.as_asgi()),
path("ws/url/three/", ThirdConsumer.as_asgi()),
]
application = ProtocolTypeRouter(
"http": asgi_app,
# I don't know how to separate them here:
"websocket": URLRouter(public_urls) + JWTAuthMiddlewareStack(URLRouter(private_urls)),
)

iOS Universal link not working in react-native iOS

Hi I know this question being asked before still I cannot figure out what am doing wrong.
Added apple-app-site-association file in our server under https://ourserver.com/.well-known/apple-app-site-association
The file content is as follows
`
{
"applinks":{
"apps":[],
"details":[
{
"appID":"<teamId>.<bundleId>",
"paths":[ "*", "/" ]
}
]
}
}
`
3. Associated Domain is added as capability with
applinks:servername.com
applinks:dev.servername.com
Added code in AppDeletegate.m
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}
EDIT 1
Noticed something i tried universal linking in iOS versions 12.4.2 iPhone and it redirected correctly. Where as in iOS version 14 it redirected to our web page. So I updated my apple-app-site-association file as follows
{
"applinks": {
"details": [
{
"appIDs": [
"teamid.bundleid"
],
"components": [
{
"/": "/*",
"comment": "Matches any URL whose path starts with URL_PATH and instructs the system not to open it as a universal link"
},
{
"/": "*",
"comment": "Matches any URL whose path starts with URL_PATH and instructs the system not to open it as a universal link"
}
],
"paths": [
"*",
"/"
]
}
]
}
}
oru web url is validated in this link
All the testing is done in real devices.
EDIT 2
All below is tested in Simulator - iPhone 11 Pro iOS 14.4
Tested the same in a simulator with developer mode
applinks:servername.com?mode=developer
applinks:dev.servername.com?mode=developer
it opened correctly in SIMUALTOR
then i misspelled our server name and clicked from iMessages it redirected to Safari in SIMULATOR -
I tried again with correct server name after clearing Safari history and cache - STILL IT REDIRECTES TO BROWSER NOT APP
EDIT 3
On Simulator
Went through this link and saw about Smart App banner since i couldn't find anything like that. After searching found this SO Post and tried Settings - Safari - Advanced - Website Data - In the page showed my domain name - Clear Website Data.
Tried again on Simulator and app opened correctly
On iPhone with release adhoc build
On Real Device did the same Settings - Safari - Advanced - Website Data - In the page showed my domain name - Clear Website Data but it didn't work. Still it opens the browser in app
EDIT 4
the AASA file in EDIT 2 make the redirection fail in iOS version 12.4.2. Hence updated it like this
{
"applinks":{
"apps":[
],
"details":[
{
"appID":"teamid.bundleid",
"paths":[
"*",
"/"
],
"appIDs":[
"teamed.bundleid"
],
"components":[
{
"/":"/*"
},
{
"/":"*"
}
]
}
]
}
}
After updating to this redirects to app in version 12.4.2 but fails in 14 and above versions. Modified AASA file after going through this link
Any Help is Appreciated
Thanks in advance
I was having the same issue and saw above #suja haven't resolved it yet so I thought to post the answer here.
First we need to double-check our <teamID>.<bundleID> pattern. Because if our association file doesn't recognize this if it's wrong (even though if we got all other steps correctly).
I found this useful official link and saw this video carefully. Also, the video slides can be seen here in PDF
Actually, they've updated the contents regarding association file, like
appID: string_value key now turns into appIDs: array_of_strings
the paths key has now been replaced by components
If you want to test in Simulator during development, then you should use a query parameter mode=developer at the end of the matching URL in the Association Domains capability in XCode.
You cannot use http:// (like if you are launching your website locally using localhost:PORT then you should use some external service to make your localhost available as a public link). In my case, I did use ngrok to mock my localhost as https://, also don't forget to allow that ngrok URL in CORS policy, if web services (APIs) are being called from your web pages.
apple-app-site-association must be in a public folder of your website under subdirectory .well-known
Now combine all steps. I was having the same issue since yesterday then I found the above links from the official Apple site to get this done and to understand how exactly Universal link works.
Most importantly, if you are testing on Simulator, then please make sure that from your Apple developer Account that your development appID.bundleID should be exact in the association file.
below is my association file as an example
{
"applinks": {
"details": [
{
"appIDs": [
"YOUR_PRODUCTION_TEAM_ID.com.yourapp_bundleID",
"YOUR_DEV_TEAM_ID.com.yourapp_bundleID.dev"
],
"components": [
{
"/": "*",
"comment": "Matches any URLs"
}
]
}
]
}
}
And for production, don't forget to add the production URLs in association domains capability, as well as PROD_appID.PROD_bundleID in apple-app-site-association file. Remember this file should be accessible by apple at
https://your-web.com/.well-known/apple-app-site-association
That's it, and further to play around with query parameters as well as dynamic paths, I would suggest seeing the above PDF link and especially the video on the official Apple site!
Try replacing "appID":".bundleid" with "appID":".bundleid" in your aasa file.

Universal link does not work. Link validator tool displays error:Error no apps associated with url

I followed all the steps for adding universal link support for an app. But the option to open the app is never displayed.
The server hosts apple-app-site-association file with the following contents:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "teamID.bundleID'",
"paths": [ "/ios/meetings"]
}
]
}
}
Device logs for when app is installed:
swcd(CoreUtils)[216] : Completing request for 'https://example.com/.well-known/apple-app-site-association', status 0/0x0 noErr
swcd(CoreUtils)[216] : Updated app ID 'teamID.bundleID', domain '*.example.com', flags 0x0 < > -> 0x2 < SiteApproved > on check
Hitting URL: https://example.com/ through apps like mail, messages, notes, and safari always opens the link in the browser.
Link validator tool displays status passed but the section "Link to Application" displays an error: Error no apps associated with URL.
Can anyone tell me if I am missing anything?
Thanks in advance.
Try this.
1 set paths to ["*", "/"]
and
2 goto Project-->Targets-->Capabilities-->Associated Domain "ON"

apache camel: Dynamic router is calling the same end point for multiple times in a single request

I have configured the dynamic router in the receiver router like below,
dynamicRouter(method("com.eg.DynamicIncomingRoute"), "getIncomingRoute"))
But it is redirecting the request for multiple times to the same bean and the same method.
In the logs it shows like this,
Message History
RouteId ProcessorId Processor Elapsed (ms)
[route3 ] [route3 ] [mina2://tcp://localhost:8888?codec=%23hl7codec&sync=true ] [ 29642]
[route3 ] [dynamicRouter1 ] [dynamicRouter[bean{com.eg.service.handlerService, ] [ 29632]
[route1 ] [to1 ] [bean:handlerService?method=handleMessage ] [ 11835]
[route1 ] [to1 ] [bean:handlerService?method=handleMessage ] [ 12776]
[route1 ] [to1 ] [bean:handlerService?method=handleMessage ] [ 4700]
You can observe the route1 is repeated for multiple times. means it is redirecting to the same method for multiple times. Instead i want to send response back to the user. So how can i do that ?
Read the documentation!
http://camel.apache.org/dynamic-router
See that beware box on that page
Also related is this SO with some details: Dynamic routing in camel en-queues messages infinitely

Resources