blob: 20cf496e76f181a112dec881fb0b2c2da8facf1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/bin/sh
. /usr/share/libubox/jshn.sh
. /lib/functions.sh
SERVICESFILE="-1"
find_service_config() {
local cfg="$1"
config_get library "$cfg" library
if [ "$library" != "olsrd_nameservice" ]; then
return 1
fi
config_get services_file "$cfg" services_file
SERVICESFILE=$services_file
}
load_services() {
local olsrd="$1"
config_load $olsrd
config_foreach find_service_config LoadPlugin
local services_configured=0
if [ "$SERVICESFILE" != "-1" ]; then
services_configured=1
fi
local services=$(cat $SERVICESFILE|grep -ve "^###"|grep -ve "^$")
json_init
json_add_boolean configured $services_configured
json_add_string source "$olsrd"
json_add_string services "$services"
json_dump
}
case "$1" in
list)
# List method must return the list of methods and parameters that the daemon will accept. Only methods listed here will available to call.
echo '{ "services4": { }, "services6": { } }'
;;
call)
case "$2" in
services4)
load_services "olsrd"
;;
services6)
load_services "olsrd6"
;;
esac
;;
esac
|