mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-25 19:44:30 +08:00
Compare commits
215 Commits
kernel-cc
...
ps/old/ast
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
479f5ace1c | ||
|
|
e2458f9094 | ||
|
|
cc81f24afe | ||
|
|
b4311b9506 | ||
|
|
d709112cec | ||
|
|
30fcbbe797 | ||
|
|
01e874d94b | ||
|
|
27f11d321d | ||
|
|
a377af2ccd | ||
|
|
93cd4c477d | ||
|
|
c208c12ef3 | ||
|
|
7bfdea5ff3 | ||
|
|
ab88b8e133 | ||
|
|
2d7baa91e2 | ||
|
|
66ad2e3158 | ||
|
|
0981bc9ccd | ||
|
|
c9601eb4aa | ||
|
|
2f6fed6d92 | ||
|
|
6fbf823167 | ||
|
|
7833470f7a | ||
|
|
0ff160345d | ||
|
|
a63d88c100 | ||
|
|
169ebea761 | ||
|
|
069de32121 | ||
|
|
6eecfcd238 | ||
|
|
e49d908f94 | ||
|
|
24b6106ddd | ||
|
|
8cd62ff81f | ||
|
|
0d3466445c | ||
|
|
cde3056c2f | ||
|
|
5ffec072d5 | ||
|
|
6e9f0fafa3 | ||
|
|
0feb577f1a | ||
|
|
d4d189bd1e | ||
|
|
8143b29d38 | ||
|
|
78863e3174 | ||
|
|
3324bd6c94 | ||
|
|
a1a8e179d8 | ||
|
|
3e6ce7dd21 | ||
|
|
74e087814d | ||
|
|
3069b113f2 | ||
|
|
ae4bd347d0 | ||
|
|
b534f1f164 | ||
|
|
b0a857c7c9 | ||
|
|
106982c69a | ||
|
|
b24cb6f4d4 | ||
|
|
ed2f0381a0 | ||
|
|
bbede82173 | ||
|
|
256948792c | ||
|
|
b173df6ff5 | ||
|
|
31361b2bfb | ||
|
|
fb2181f279 | ||
|
|
2ef80243bf | ||
|
|
5811d46d56 | ||
|
|
e0d7cb9caa | ||
|
|
5b22a2dce6 | ||
|
|
dd481c8bfe | ||
|
|
fa760967a1 | ||
|
|
ce8bf2872c | ||
|
|
faa17d8679 | ||
|
|
ceca1c1a53 | ||
|
|
7862c07454 | ||
|
|
22129691d0 | ||
|
|
9625c3b81c | ||
|
|
a1d6b02a20 | ||
|
|
d6ab9d1a12 | ||
|
|
97ad605a1c | ||
|
|
3e66393c7b | ||
|
|
9b02ee98d2 | ||
|
|
8a2939ddde | ||
|
|
a17530309f | ||
|
|
d6f0f38524 | ||
|
|
4c99a2fb98 | ||
|
|
701cc69a03 | ||
|
|
da5615d50a | ||
|
|
6ea1aa0a2b | ||
|
|
09e49e54eb | ||
|
|
e92bc0ea7d | ||
|
|
a1e4de11f0 | ||
|
|
750d5ff091 | ||
|
|
1f5c527959 | ||
|
|
4dba945466 | ||
|
|
ce942da01f | ||
|
|
a6139059a3 | ||
|
|
a58ac037fd | ||
|
|
5ec0992e1d | ||
|
|
71c459b27d | ||
|
|
4021526a61 | ||
|
|
009d2b613c | ||
|
|
cee25ad753 | ||
|
|
221020162e | ||
|
|
6e7e03544a | ||
|
|
65dd02c8ad | ||
|
|
4b193200ed | ||
|
|
64c89e3778 | ||
|
|
46bbd6e198 | ||
|
|
351814d4eb | ||
|
|
bc7260e31f | ||
|
|
a88e8ca92a | ||
|
|
fac97aafc4 | ||
|
|
67bf9c7cc6 | ||
|
|
416807ec6d | ||
|
|
bf68e19da1 | ||
|
|
f668805565 | ||
|
|
09595f0343 | ||
|
|
0a221ad2a2 | ||
|
|
47a918ff4d | ||
|
|
4ae7bdd609 | ||
|
|
cae2808318 | ||
|
|
6f600d6f37 | ||
|
|
fdb3f55a35 | ||
|
|
486b1a854c | ||
|
|
5fb7c59fb3 | ||
|
|
86bca8523b | ||
|
|
af1516bf6c | ||
|
|
b167e072ac | ||
|
|
e11fef0a1d | ||
|
|
70597bb8de | ||
|
|
fa4e426d33 | ||
|
|
ca2d6ac266 | ||
|
|
201d3e9b69 | ||
|
|
27173c0d40 | ||
|
|
a0749cd0cf | ||
|
|
02e15998da | ||
|
|
178b836aff | ||
|
|
b2184b2b45 | ||
|
|
bba5a9e3d6 | ||
|
|
a350812bfd | ||
|
|
5eccb99fce | ||
|
|
ae92433819 | ||
|
|
dd91c8823b | ||
|
|
ab0294c188 | ||
|
|
c0fe19f4d7 | ||
|
|
803bfdd345 | ||
|
|
7a31cda783 | ||
|
|
361f3404d1 | ||
|
|
35427c3ad2 | ||
|
|
2d569ff935 | ||
|
|
b76d2ee06a | ||
|
|
207c769970 | ||
|
|
4940ba3428 | ||
|
|
4c377f65b5 | ||
|
|
9a0dcfd895 | ||
|
|
fbcf382a64 | ||
|
|
09413abb61 | ||
|
|
f29c51e68c | ||
|
|
8cce20ecb6 | ||
|
|
3f77b219b9 | ||
|
|
8bae398da7 | ||
|
|
1576532e0e | ||
|
|
8f4fdc0f7d | ||
|
|
7f34e8b807 | ||
|
|
cb0d37c698 | ||
|
|
5aee44ba2c | ||
|
|
17c2361a90 | ||
|
|
00555a7a2e | ||
|
|
de7cf6298c | ||
|
|
f9ac50cf4f | ||
|
|
be791726a4 | ||
|
|
0879221d1a | ||
|
|
ab80d8a243 | ||
|
|
8e5d63d7d3 | ||
|
|
5e7bfbd977 | ||
|
|
75e6c3f089 | ||
|
|
4b1dbd91cd | ||
|
|
52321de1ca | ||
|
|
97d6f8604e | ||
|
|
7b9db30978 | ||
|
|
eb6dc4b927 | ||
|
|
e628a79588 | ||
|
|
c5d25fdfad | ||
|
|
b207009cb4 | ||
|
|
1b94f625ea | ||
|
|
5c5c9d53a4 | ||
|
|
6403153076 | ||
|
|
17b0fcba98 | ||
|
|
4339dcddbe | ||
|
|
1f6143cdeb | ||
|
|
4cf9d8a93d | ||
|
|
10bdb7a8dc | ||
|
|
659ec81047 | ||
|
|
0513a124dc | ||
|
|
330f79b31f | ||
|
|
43be9fd282 | ||
|
|
1e3195e1ee | ||
|
|
9dea956039 | ||
|
|
7e60791000 | ||
|
|
e8bdb6bc24 | ||
|
|
3400265f13 | ||
|
|
5e797bf457 | ||
|
|
58f1084714 | ||
|
|
69a79e6b3e | ||
|
|
8f48ff9e83 | ||
|
|
794223e29e | ||
|
|
7ed295b977 | ||
|
|
9599e9fad5 | ||
|
|
96c9277e1a | ||
|
|
a1b0964e0a | ||
|
|
807f7c520f | ||
|
|
94b3e0b975 | ||
|
|
5345917eaa | ||
|
|
1f5d3f2eed | ||
|
|
be1d548163 | ||
|
|
05489b127a | ||
|
|
c525acc002 | ||
|
|
65f799faa0 | ||
|
|
8cabb87357 | ||
|
|
c19546bbdd | ||
|
|
6699e1a741 | ||
|
|
d20174daed | ||
|
|
b08557465f | ||
|
|
e46fa1b3ae | ||
|
|
e4258501a9 | ||
|
|
3dc434eb24 | ||
|
|
aa9d058747 |
@@ -1,24 +1,19 @@
|
||||
#
|
||||
# Copyright (C) 2013 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mcpd
|
||||
PKG_NAME:=4g-support
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mcpd
|
||||
define Package/4g-support
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IPTV
|
||||
TITLE:=Multicast Daemon
|
||||
TITLE:=4G Network Setup Tools
|
||||
endef
|
||||
|
||||
define Package/mcpd/description
|
||||
Multicast Daemon
|
||||
define Package/4g-support/description
|
||||
4g-support contains necessary tools to setup 4G WAN connection
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
@@ -29,8 +24,8 @@ endef
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/mcpd/install
|
||||
define Package/4g-support/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mcpd))
|
||||
$(eval $(call BuildPackage,4g-support))
|
||||
62
4g-support/files/etc/gcom/ncmconnection.gcom
Normal file
62
4g-support/files/etc/gcom/ncmconnection.gcom
Normal file
@@ -0,0 +1,62 @@
|
||||
opengt
|
||||
set com 115200n81
|
||||
set comecho off
|
||||
set senddelay 0.05
|
||||
waitquiet 1 0.2
|
||||
|
||||
:start
|
||||
if $env("USE_DISCONNECT")="1" goto disconnect
|
||||
send "AT^^NDISDUP=1,1,\""
|
||||
send $env("USE_APN")
|
||||
|
||||
if $env("USE_AUTHTYPE")="-1" goto noauth
|
||||
else goto auth
|
||||
|
||||
:noauth
|
||||
send "\"^m"
|
||||
goto result
|
||||
|
||||
:auth
|
||||
send "\",\""
|
||||
send $env("USE_USERID")
|
||||
send "\",\""
|
||||
send $env("USE_PASSWORD")
|
||||
send "\","
|
||||
send $env("USE_AUTHTYPE")
|
||||
send "^m"
|
||||
goto result
|
||||
|
||||
:result
|
||||
waitfor 5 "OK","ERR","ERROR"
|
||||
if % = 0 goto connok
|
||||
if % = 1 goto connerr
|
||||
if % = 2 goto connerr
|
||||
|
||||
:connok
|
||||
print "WWAN connection established.\r\n"
|
||||
goto done
|
||||
|
||||
:connerr
|
||||
print "WWAN error. Connection failed.\r\n"
|
||||
exit 1
|
||||
|
||||
:disconnect
|
||||
send "AT^^NDISDUP=1,0,\""
|
||||
send $env("USE_APN")
|
||||
send "\"^m"
|
||||
|
||||
waitfor 5 "OK","ERR","ERROR"
|
||||
if % = 0 goto disconnok
|
||||
if % = 1 goto disconnerr
|
||||
if % = 2 goto disconnerr
|
||||
|
||||
:disconnok
|
||||
print "WWAN connection disconnected.\r\n"
|
||||
goto done
|
||||
|
||||
:disconnerr
|
||||
print "WWAN disconnection error.\r\n"
|
||||
exit 1
|
||||
|
||||
:done
|
||||
exit 0
|
||||
35
4g-support/files/etc/hotplug.d/net/05-mobile
Normal file
35
4g-support/files/etc/hotplug.d/net/05-mobile
Normal file
@@ -0,0 +1,35 @@
|
||||
. /lib/network/config.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
iface_status() {
|
||||
local iface=$1
|
||||
local up
|
||||
json_load "$(ifstatus $iface)"
|
||||
json_get_var up up
|
||||
json_close_object
|
||||
return $up
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
add|register)
|
||||
if [ "${INTERFACE:0:4}" == "wwan" ]; then
|
||||
netname=$(get_network_of "$INTERFACE")
|
||||
for net in $netname; do
|
||||
local service=$(uci -q get network.$net.service)
|
||||
local cnt=0
|
||||
while $(iface_status $net); do
|
||||
ifup $net
|
||||
if [ "$service" == "qmi" ]; then
|
||||
cnt=$(($cnt+1))
|
||||
# quit trying if still not online after three times
|
||||
[ $cnt -eq 3 ] && break
|
||||
sleep 5
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
66
4g-support/files/etc/hotplug.d/usb/30-usbnet
Normal file
66
4g-support/files/etc/hotplug.d/usb/30-usbnet
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
local usb_dir uVid uPid uMa uPr uSe bConf bNumConfs vendor product mdmtyp netdev comdev cdcdev ttydev usbno usbbr
|
||||
|
||||
sanitize() {
|
||||
sed -e 's/[[:space:]]\+$//; s/[[:space:]]\+/_/g' "$@"
|
||||
}
|
||||
|
||||
find_usb_attrs() {
|
||||
usb_dir="/sys/$DEVPATH"
|
||||
[ -f "$usb_dir/idVendor" ] || usb_dir="${usb_dir%/*}"
|
||||
|
||||
uVid=$(cat "$usb_dir/idVendor")
|
||||
uPid=$(cat "$usb_dir/idProduct")
|
||||
uMa=$(sanitize "$usb_dir/manufacturer")
|
||||
uPr=$(sanitize "$usb_dir/product")
|
||||
uSe=$(sanitize "$usb_dir/serial")
|
||||
bNumConfs=$(cat "$usb_dir/bNumConfigurations")
|
||||
bConf=$(cat "$usb_dir/bConfigurationValue")
|
||||
netdev=$(find $usb_dir -name wwan* | awk -F'/' '{print$NF}' | head -2 | tail -1)
|
||||
cdcdev=$(find $usb_dir -name cdc-wdm* | awk -F'/' '{print$NF}' | head -2 | tail -1)
|
||||
ttydev=$(ls $(find $usb_dir -name tty | head -2 | tail -1) | tail -1)
|
||||
if [ -n "$cdcdev" ]; then
|
||||
comdev=$cdcdev
|
||||
mdmtyp=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$2}' | head -1)
|
||||
vendor=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$3}' | head -1)
|
||||
product=$(grep $uVid:$uPid /etc/modemdb | grep 'qmi\|mbim' | awk '{print$4}' | head -1)
|
||||
else
|
||||
comdev=$ttydev
|
||||
mdmtyp=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$2}' | head -1)
|
||||
vendor=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$3}' | head -1)
|
||||
product=$(grep $uVid:$uPid /etc/modemdb | grep 'ncm' | awk '{print$4}' | head -1)
|
||||
fi
|
||||
[ -n "$mdmtyp" ] || mdmtyp=$(grep $uVid:$uPid /etc/modemdb | awk '{print$2}' | head -1)
|
||||
[ -n "$vendor" ] || vendor=$(grep $uVid:$uPid /etc/modemdb | awk '{print$3}' | head -1)
|
||||
[ -n "$product" ] || product=$(grep $uVid:$uPid /etc/modemdb | awk '{print$4}' | head -1)
|
||||
}
|
||||
|
||||
convert_to_mbim() {
|
||||
if [ "$mdmtyp" == "mbim" ] && [ "$bNumConfs" == "2" ]; then
|
||||
[ "$bConf" == "2" ] || echo 2 > $usb_dir/bConfigurationValue
|
||||
fi
|
||||
}
|
||||
|
||||
usbno=$(echo $DEVPATH | cut -d'/' -f5)
|
||||
usbbr=$(echo $DEVPATH | cut -d'/' -f7)
|
||||
case "$usbbr" in
|
||||
*:*) usbbr=$(echo $DEVPATH | cut -d'/' -f6) ;;
|
||||
esac
|
||||
|
||||
find_usb_attrs
|
||||
if [ "$ACTION" = add ]; then
|
||||
convert_to_mbim "$uVid:$uPid"
|
||||
if [ -n "$uVid" ] && [ -n "$uPid" ] && [ -n "$mdmtyp" ] && [ -n "$netdev" ] && [ -n "$comdev" ]; then
|
||||
if [ -n "$usbno" ] && [ -n "$usbbr" ]; then
|
||||
sed -i "/$usbno:$usbbr/ d" /var/usbnets
|
||||
echo $usbno:$usbbr $uVid:$uPid $uMa $uPr $netdev $comdev $mdmtyp $vendor $product >> /var/usbnets
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ACTION" = remove ]; then
|
||||
if [ -n "$usbno" ] && [ -n "$usbbr" ]; then
|
||||
sed -i "/$usbno:$usbbr/ d" /var/usbnets
|
||||
fi
|
||||
fi
|
||||
100
4g-support/files/etc/modemdb
Normal file
100
4g-support/files/etc/modemdb
Normal file
@@ -0,0 +1,100 @@
|
||||
1bbb:011e qmi
|
||||
1a8d:1001 ecm
|
||||
1a8d:100c ecm
|
||||
1a8d:100d ecm
|
||||
16d8:6280 qmi
|
||||
16d8:6803 qmi
|
||||
16d8:6804 qmi
|
||||
16d8:7003 qmi
|
||||
16d8:700a qmi
|
||||
2001:7d01 mbim
|
||||
2001:7d02 mbim
|
||||
2001:7d03 mbim
|
||||
12d1:14ac qmi
|
||||
12d1:140c qmi
|
||||
12d1:1506 qmi Huawei E367/392/398
|
||||
12d1:1506 ncm Huawei E3276
|
||||
12d1:14d2 qmi
|
||||
12d1:1c07 ncm
|
||||
12d1:1436 ecm
|
||||
12d1:14c9 qmi
|
||||
12d1:14db ecm
|
||||
12d1:151d mbim
|
||||
12d1:151e qmi Huawei E353
|
||||
12d1:1c1e ncm
|
||||
12d1:150c qmi
|
||||
12d1:150f qmi
|
||||
12d1:151b qmi
|
||||
12d1:142d ecm
|
||||
12d1:1432 ecm
|
||||
12d1:1c1f ncm
|
||||
12d1:1433 qmi
|
||||
12d1:1465 ecm
|
||||
12d1:14ca qmi
|
||||
12d1:14cf ncm
|
||||
12d1:14bc ecm
|
||||
12d1:14ae ecm
|
||||
12d1:1576 mbim
|
||||
12d1:1577 mbim
|
||||
12d1:1400 mbim
|
||||
12d1:14f7 mbim
|
||||
12d1:1464 qmi
|
||||
12d1:14cb qmi
|
||||
12d1:14cc qmi
|
||||
12d1:14c6 qmi
|
||||
12d1:14fa mbim
|
||||
12d1:1578 mbim
|
||||
12d1:14c8 qmi
|
||||
12d1:14f8 mbim
|
||||
12d1:1575 mbim
|
||||
12d1:1579 mbim
|
||||
12d1:157a mbim
|
||||
12d1:157b mbim
|
||||
12d1:157f mbim
|
||||
12d1:1f16 mbim Vodafone K5150
|
||||
12d1:1404 qmi
|
||||
19f2:1700 ecm
|
||||
1410:b001 qmi
|
||||
1527:1000 ecm
|
||||
0b3c:c005 qmi
|
||||
0f3d:68a2 qmi
|
||||
1199:68a2 qmi SierraWireless M7710
|
||||
1199:68c0 qmi SierraWireless M7304
|
||||
1349:1100 qmi
|
||||
1349:1200 qmi
|
||||
1199:683c qmi
|
||||
2360:2100 qmi
|
||||
2360:2200 qmi
|
||||
2360:2300 qmi
|
||||
2507:0000 qmi
|
||||
19d2:0055 qmi
|
||||
19d2:0052 qmi
|
||||
19d2:0063 qmi
|
||||
19d2:1008 qmi
|
||||
19d2:1010 qmi
|
||||
19d2:2002 qmi
|
||||
19d2:1176 qmi
|
||||
19d2:1023 mbim
|
||||
19d2:0104 qmi
|
||||
19d2:1018 qmi
|
||||
19d2:1032 mbim
|
||||
19d2:1402 qmi
|
||||
19d2:1405 ecm
|
||||
19d2:1426 qmi
|
||||
19d2:0031 qmi
|
||||
19d2:0124 qmi
|
||||
19d2:1254 qmi
|
||||
19d2:0017 qmi
|
||||
19d2:0002 qmi
|
||||
19d2:0121 qmi
|
||||
19d2:1252 qmi
|
||||
19d2:0157 qmi
|
||||
19d2:0167 qmi
|
||||
19d2:0199 qmi
|
||||
19d2:0257 qmi
|
||||
19d2:0326 qmi
|
||||
19d2:0349 ecm
|
||||
19d2:1408 ecm
|
||||
19d2:0284 qmi
|
||||
19d2:0019 qmi
|
||||
19d2:0265 qmi
|
||||
159
4g-support/files/lib/netifd/proto/4g.sh
Executable file
159
4g-support/files/lib/netifd/proto/4g.sh
Executable file
@@ -0,0 +1,159 @@
|
||||
#!/bin/sh
|
||||
INCLUDE_ONLY=1
|
||||
|
||||
. /lib/functions.sh
|
||||
. ../netifd-proto.sh
|
||||
init_proto "$@"
|
||||
|
||||
proto_4g_init_config() {
|
||||
proto_config_add_string "modem"
|
||||
proto_config_add_string "service"
|
||||
proto_config_add_string "comdev"
|
||||
proto_config_add_string "ipaddr"
|
||||
proto_config_add_string "netmask"
|
||||
proto_config_add_string "hostname"
|
||||
proto_config_add_string "clientid"
|
||||
proto_config_add_string "vendorid"
|
||||
proto_config_add_boolean "broadcast"
|
||||
proto_config_add_string "reqopts"
|
||||
proto_config_add_string "apn"
|
||||
proto_config_add_string "username"
|
||||
proto_config_add_string "password"
|
||||
proto_config_add_boolean "lte_apn_use"
|
||||
proto_config_add_string "lte_apn"
|
||||
proto_config_add_string "lte_username"
|
||||
proto_config_add_string "lte_password"
|
||||
proto_config_add_string "pincode"
|
||||
proto_config_add_string "technology"
|
||||
proto_config_add_string "auto"
|
||||
}
|
||||
|
||||
proto_4g_setup() {
|
||||
local config="$1"
|
||||
local iface="$2"
|
||||
|
||||
local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
|
||||
json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
|
||||
|
||||
local opt dhcpopts
|
||||
for opt in $reqopts; do
|
||||
append dhcpopts "-O $opt"
|
||||
done
|
||||
|
||||
for opt in $sendopts; do
|
||||
append dhcpopts "-x $opt"
|
||||
done
|
||||
|
||||
[ "$broadcast" = 1 ] && broadcast="-B" || broadcast=
|
||||
[ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C"
|
||||
[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
|
||||
[ "$iface6rd" != 0 -a -f /lib/netifd/proto/6rd.sh ] && append dhcpopts "-O 212"
|
||||
[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
|
||||
[ -n "$zone" ] && proto_export "ZONE=$zone"
|
||||
[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
|
||||
|
||||
json_get_var comdev comdev
|
||||
json_get_var apn apn
|
||||
json_get_var service service
|
||||
json_get_var pincode pincode
|
||||
|
||||
|
||||
# if [ -n "$modem" ]; then
|
||||
# service=$(echo $modem | cut -d':' -f1)
|
||||
# comdev=$(echo $modem | cut -d':' -f2)
|
||||
# iface=$(echo $modem | cut -d':' -f3)
|
||||
# fi
|
||||
|
||||
case "$service" in
|
||||
ecm)
|
||||
;;
|
||||
eem)
|
||||
;;
|
||||
mbim)
|
||||
local mbimdev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
|
||||
local comdev="${comdev:-$mbimdev}"
|
||||
[ -n "$pincode" ] && {
|
||||
if ! mbimcli -d $comdev --query-pin-state 2>&1 | grep -q "unlocked"; then
|
||||
set -o pipefail
|
||||
if ! mbimcli -d $comdev --enter-pin="${pincode}" 2>&1; then
|
||||
mbimcli -d $comdev --query-pin-state
|
||||
proto_notify_error "$config" PIN_FAILED
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
APN="$apn" mbim-network $comdev start
|
||||
;;
|
||||
ncm)
|
||||
[ -n "$pincode" ] && echo $pincode | gcom -d $comdev
|
||||
USE_APN="$apn" gcom -d $comdev -s /etc/gcom/ncmconnection.gcom
|
||||
;;
|
||||
qmi)
|
||||
local qmidev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
|
||||
local comdev="${comdev:-$qmidev}"
|
||||
[ -n "$pincode" ] && {
|
||||
if ! qmicli -d $comdev --dms-uim-get-pin-status 2>&1 | grep -q "enabled-verified\|disabled" >/dev/null; then
|
||||
set -o pipefail
|
||||
if ! qmicli -d $comdev --dms-uim-verify-pin="PIN,${pincode}" 2>&1; then
|
||||
qmicli -d $comdev --dms-uim-get-pin-status
|
||||
proto_notify_error "$config" PIN_FAILED
|
||||
proto_block_restart "$interface"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
APN="$apn" qmi-network $comdev start
|
||||
;;
|
||||
esac
|
||||
|
||||
proto_export "INTERFACE=$config"
|
||||
proto_run_command "$config" udhcpc -R \
|
||||
-p /var/run/udhcpc-$iface.pid \
|
||||
-s /lib/netifd/dhcp.script \
|
||||
-f -t 0 -i "$iface" \
|
||||
${ipaddr:+-r $ipaddr} \
|
||||
${hostname:+-H $hostname} \
|
||||
${vendorid:+-V $vendorid} \
|
||||
$clientid $broadcast $dhcpopts
|
||||
}
|
||||
|
||||
proto_4g_teardown() {
|
||||
local interface="$1"
|
||||
local iface="$2"
|
||||
local modem service comdev
|
||||
|
||||
config_load network
|
||||
config_get service $interface service
|
||||
config_get comdev $interface comdev
|
||||
|
||||
# config_get modem $interface modem
|
||||
# if [ -n "$modem" ]; then
|
||||
# service=$(echo $modem | cut -d':' -f1)
|
||||
# comdev=$(echo $modem | cut -d':' -f2)
|
||||
# iface=$(echo $modem | cut -d':' -f3)
|
||||
# fi
|
||||
|
||||
case "$service" in
|
||||
ecm)
|
||||
;;
|
||||
eem)
|
||||
;;
|
||||
mbim)
|
||||
local mbimdev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
|
||||
local comdev="${comdev:-$mbimdev}"
|
||||
mbim-network $comdev stop
|
||||
;;
|
||||
ncm)
|
||||
USE_DISCONNECT=1 gcom -d $comdev -s /etc/gcom/ncmconnection.gcom
|
||||
;;
|
||||
qmi)
|
||||
local qmidev=/dev/$(basename $(ls /sys/class/net/${iface}/device/usb/cdc-wdm* -d))
|
||||
local comdev="${comdev:-$qmidev}"
|
||||
qmi-network $comdev stop
|
||||
;;
|
||||
esac
|
||||
proto_kill_command "$interface"
|
||||
}
|
||||
|
||||
add_protocol 4g
|
||||
@@ -1,188 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=alleato-base
|
||||
|
||||
PKG_VERSION:=14.49.2
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:alleato_base.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=8314aed451255410a2cd4fa43ac3235504e8f018
|
||||
|
||||
PKG_MAINTAINER:=Martin Assarsson, ALLEATO
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
######################################################
|
||||
|
||||
define Package/alleato3
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+python
|
||||
TITLE:=Alleato python libraries
|
||||
endef
|
||||
|
||||
define Package/zwaved
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+jansson
|
||||
TITLE:=Alleato zwave daemon
|
||||
endef
|
||||
|
||||
define Package/zwave-mgr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato zwave manager
|
||||
endef
|
||||
|
||||
define Package/zwave-profiler
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato zwave profiler
|
||||
endef
|
||||
|
||||
define Package/alleato-scheduler
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato scheduler
|
||||
endef
|
||||
|
||||
define Package/alleato-boxconfig
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3
|
||||
TITLE:=Alleato boxconfig
|
||||
endef
|
||||
|
||||
define Package/all-omc
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=+alleato3 +screen
|
||||
TITLE:=Alleato remote tunnel
|
||||
endef
|
||||
|
||||
define Package/ubus-kicker
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato ubus-kicker
|
||||
endef
|
||||
|
||||
define Package/mqttnagios
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato mqttnagios
|
||||
endef
|
||||
|
||||
define Package/all4-alleato-tools
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Alleato
|
||||
DEPENDS:=
|
||||
TITLE:=Alleato tools
|
||||
endef
|
||||
|
||||
######################################################
|
||||
|
||||
define Package/alleato3/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/python2.7/
|
||||
$(CP) -r $(PKG_BUILD_DIR)/python-2.7/* $(1)/usr/lib/python2.7/
|
||||
endef
|
||||
|
||||
define Package/zwaved/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwaved $(1)/etc/init.d/zwaved
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwaved $(1)/usr/sbin/zwaved
|
||||
endef
|
||||
|
||||
define Package/zwave-mgr/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d $(1)/etc/alleato/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwave-mgr $(1)/etc/init.d/zwave-mgr
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwave_mgr $(1)/usr/mqttrules/zwave_mgr
|
||||
endef
|
||||
|
||||
define Package/zwave-profiler/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/zwave-profiler $(1)/etc/init.d/zwave-profiler
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/zwave-profiler $(1)/usr/mqttrules/zwave-profiler
|
||||
endef
|
||||
|
||||
define Package/alleato-scheduler/install
|
||||
$(INSTALL_DIR) $(1)/usr/mqttrules $(1)/etc/init.d $(1)/etc/crontabs/sched
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/scheduler $(1)/etc/init.d/scheduler
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/scheduler $(1)/usr/mqttrules/scheduler
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/schedule $(1)/etc/crontabs/sched/schedule
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/schedule $(1)/etc/crontabs/schedule
|
||||
endef
|
||||
|
||||
define Package/alleato-boxconfig/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/bin $(1)/etc/init.d $(1)/etc/alleato $(1)/home/mosquitto
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/boxconfig $(1)/etc/init.d/boxconfig
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/boxconfig $(1)/usr/bin/boxconfig
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/genmosquittoconf $(1)/usr/bin/genmosquittoconf
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/check_client_id $(1)/usr/sbin/check_client_id
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/boxconfig.conf $(1)/etc/boxconfig.conf
|
||||
endef
|
||||
|
||||
define Package/all-omc/install
|
||||
$(INSTALL_DIR) $(1)/root $(1)/etc/init.d $(1)/etc/config $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/omc $(1)/etc/init.d/omc
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/root/ssh_key $(1)/root/ssh_key
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/alleato.config $(1)/etc/config/alleato
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/omc $(1)/usr/bin/omc
|
||||
endef
|
||||
|
||||
define Package/ubus-kicker/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/ubus-kicker $(1)/etc/init.d/ubus-kicker
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/ubus-kicker $(1)/usr/sbin/ubus-kicker
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/akick $(1)/usr/sbin/akick
|
||||
endef
|
||||
|
||||
define Package/mqttnagios/install
|
||||
$(INSTALL_DIR) $(1)/etc/nagios.d $(1)/usr/bin $(1)/etc/crontabs $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/mqttnagios $(1)/etc/init.d/mqttnagios
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/send_mqtt_nag $(1)/usr/bin/send_mqtt_nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/dropbear $(1)/etc/nagios.d/dropbear.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/mosquitto $(1)/etc/nagios.d/mosquitto.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/ssh $(1)/etc/nagios.d/ssh.nag
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nagios.d/zwaved $(1)/etc/nagios.d/zwaved.nag
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/data/mqttnagios $(1)/etc/crontabs/mqttnagios
|
||||
echo '/5 * * * * /usr/sbin/check_client_id' >> $(1)/etc/crontabs/root
|
||||
endef
|
||||
|
||||
define Package/all4-alleato-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d $(1)/opt/alleato
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/house $(1)/etc/init.d/house
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init.d/rulesd $(1)/etc/init.d/rulesd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/binaries/alleato_tools $(1)/usr/bin/alleato_tools
|
||||
endef
|
||||
|
||||
######################################################
|
||||
|
||||
$(eval $(call BuildPackage,alleato3))
|
||||
$(eval $(call BuildPackage,zwaved))
|
||||
$(eval $(call BuildPackage,zwave-mgr))
|
||||
$(eval $(call BuildPackage,zwave-profiler))
|
||||
$(eval $(call BuildPackage,alleato-scheduler))
|
||||
$(eval $(call BuildPackage,alleato-boxconfig))
|
||||
$(eval $(call BuildPackage,all-omc))
|
||||
$(eval $(call BuildPackage,ubus-kicker))
|
||||
$(eval $(call BuildPackage,mqttnagios))
|
||||
$(eval $(call BuildPackage,all4-alleato-tools))
|
||||
@@ -1,7 +0,0 @@
|
||||
config ANYFI_CONTROLLER
|
||||
string "Controller IP or FQDN"
|
||||
depends on PACKAGE_anyfi
|
||||
help
|
||||
The default IP address or fully qualified domain name (FQDN)
|
||||
of the Controller that should manage the Anyfi.net software.
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
ANYFI_TARGET := $(ARCH)-linux-$(subst C,c,$(LIBC))-$(LIBCV)
|
||||
|
||||
PKG_NAME := anyfi
|
||||
PKG_VERSION := 1.3.9
|
||||
PKG_RELEASE := 1
|
||||
|
||||
PKG_SOURCE := anyfimac-$(PKG_VERSION)-$(ANYFI_TARGET).tar.bz2
|
||||
PKG_SOURCE_URL := http://anyfi.net/download
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/anyfimac-$(PKG_VERSION)-$(ANYFI_TARGET)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION := net
|
||||
CATEGORY := Network
|
||||
TITLE := Anyfi.net - Free SDWN Data Plane for IEEE 802.11
|
||||
URL := http://anyfi.net
|
||||
DEPENDS := +kmod-tun +librt +wl-anyfi
|
||||
MAINTAINER := Anyfi Networks <eng@anyfinetworks.com>
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Anyfi.net is a free Software-Defined Wirless Networking (SDWN)
|
||||
forwarding data plane implementation for IEEE 802.11.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
echo "config anyfi controller" > $(PKG_BUILD_DIR)/anyfi.conf
|
||||
echo " option 'hostname' $(CONFIG_ANYFI_CONTROLLER)" >> \
|
||||
$(PKG_BUILD_DIR)/anyfi.conf
|
||||
echo "config anyfi optimizer" >> $(PKG_BUILD_DIR)/anyfi.conf
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
@echo "Nothing to do - Anyfi.net software comes pre-built."
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/anyfi
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/anyfi.conf $(1)/etc/config/anyfi
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/anyfimac $(1)/sbin
|
||||
$(LN) anyfimac $(1)/sbin/anyfid
|
||||
$(LN) anyfimac $(1)/sbin/myfid
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(LN) ../sbin/anyfimac $(1)/bin/anyfidctl
|
||||
$(LN) ../sbin/anyfimac $(1)/bin/myfidctl
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -1,558 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2014 Anyfi Networks AB.
|
||||
#
|
||||
# Overview of the Integration
|
||||
# ===========================
|
||||
#
|
||||
# Anyfi.net software consists of two user space daemons; the radio daemon
|
||||
# anyfid and the tunnel termination daemon myfid. They communicate with each
|
||||
# other and with a Controller [1] over UDP/IP.
|
||||
#
|
||||
# The radio daemon anyfid provides guests with access to remote Wi-Fi networks.
|
||||
# It needs a Wi-Fi monitor interface to detect when guest devices come within
|
||||
# range and a pool of virtual access points to serve them. The integration is
|
||||
# responsible for creating the monitor interface and the pool of virtual access
|
||||
# points; anyfid handles the rest.
|
||||
#
|
||||
# The tunnel termination daemon myfid provides remote access to the local Wi-Fi
|
||||
# network. It is up to the integration to configure myfid to authenticate remote
|
||||
# devices in the same way that devices are authenticated when connecting
|
||||
# locally.
|
||||
#
|
||||
# Myfid is also responsible for telling the controller the MAC address of
|
||||
# devices that connect locally, so that they can later be offered seamless
|
||||
# remote access whenever they come close to another access point running anyfid.
|
||||
# However, when the user changes the WPA passphrase all such associations
|
||||
# between previously connected devices and the local Wi-Fi network should be
|
||||
# removed. The integration does so by passing myfid the --reset flag.
|
||||
#
|
||||
# Below is the integration logic in pseudo code. If you need to integrate
|
||||
# Anyfi.net software in your own firmware build environment you can find step
|
||||
# by step instructions at http://anyfi.net/integration.
|
||||
#
|
||||
# 1. A Community Edition of the Controller is available for download at
|
||||
# http://www.anyfinetworks.com/download. You can also use the public
|
||||
# demonstration controller at "demo.anyfi.net".
|
||||
#
|
||||
#
|
||||
# Integration Logic in Pseudo Code
|
||||
# ================================
|
||||
#
|
||||
# After enabling a Wi-Fi device:
|
||||
# IF a controller is configured AND Anyfi.net is not disabled
|
||||
# ALLOCATE monitor interface and virtual access point pool for anyfid
|
||||
# START anyfid
|
||||
#
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
# IF a controller is configured AND Anyfi.net is not disabled
|
||||
# GENERATE a config file for myfid
|
||||
#
|
||||
# IF the WPA passphrase has changed
|
||||
# ADD the --reset flag to myfid arguments
|
||||
#
|
||||
# START myfid on the Wi-Fi interface
|
||||
#
|
||||
# After disabling a Wi-Fi device:
|
||||
# STOP anyfid
|
||||
#
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
# STOP myfid on the Wi-Fi interface
|
||||
#
|
||||
# NOTE 1: The integration provides remote access to all Wi-Fi interfaces on the
|
||||
# system that have anyfi_disabled set to 0. Each interface will have
|
||||
# its own myfid daemon. There should however only be one anyfid daemon
|
||||
# per radio.
|
||||
#
|
||||
# NOTE 2: On concurrent dual band routers each radio should have its own anyfid
|
||||
# daemon.
|
||||
#
|
||||
#
|
||||
# Anyfi.net UCI data model
|
||||
# ========================
|
||||
#
|
||||
# Anyfi.net global parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# controller
|
||||
# .hostname IP or FQDN demo.anyfi.net Controller IP or FQDN
|
||||
# .key path - Controller public key PEM file
|
||||
# optimizer
|
||||
# .key path - Optimizer public key PEM file
|
||||
#
|
||||
# Wi-Fi device parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# anyfi_disabled boolean 0 Enable/disable guest access on this radio
|
||||
# anyfi_iface port - Bind anyfid to a WAN interface IP address
|
||||
# anyfi_port number - Bind anyfid to a SDWN UDP port
|
||||
# anyfi_floor percent 5 Min backhaul and spectrum allocation
|
||||
# anyfi_ceiling percent 75 Max backhaul and spectrum allocation
|
||||
# anyfi_uplink integer - WAN uplink capacity in bits per second
|
||||
# anyfi_downlink integer - WAN downlink capacity in bits per second
|
||||
# anyfi_bssids integer - Max number of virtual interfaces to use
|
||||
# anyfi_clients integer - Max number of concurrent guest users
|
||||
#
|
||||
# Wi-Fi interface parameters:
|
||||
#
|
||||
# Name Type Default Description
|
||||
# anyfi_disabled boolean 0 Enable remote access on this network
|
||||
# anyfi_iface string - Bind myfid to a WAN interface IP
|
||||
# address
|
||||
# anyfi_port port - Bind myfid to a SDWN UDP port
|
||||
# anyfi_autz_server IP - RADIUS authorization server IP
|
||||
# anyfi_autz_port port 1812 RADIUS authorization server UDP port
|
||||
# anyfi_autz_secret string - RADIUS authorization server shared
|
||||
# secret
|
||||
# anyfi_acct_server IP - RADIUS extra accounting server IP
|
||||
# anyfi_acct_port port 1813 RADIUS extra accounting server UDP port
|
||||
# anyfi_acct_secret string - RADIUS extra accounting server shared
|
||||
# secret
|
||||
|
||||
append ENABLE_HOOKS anyfi_enable
|
||||
append DISABLE_HOOKS anyfi_disable
|
||||
|
||||
# Daemon run dir for temporary files.
|
||||
RUNDIR=/var/run
|
||||
|
||||
# Config file dir for persistent configuration files.
|
||||
CONFDIR=/etc
|
||||
|
||||
##### Wi-Fi device handling ##################################################
|
||||
|
||||
# Get the channel for Wi-Fi device.
|
||||
# anyfi_dev_get_channel <device>
|
||||
anyfi_dev_get_channel() {
|
||||
local device="$1"
|
||||
local hwmode channel
|
||||
|
||||
config_get hwmode "$device" hwmode
|
||||
config_get channel "$device" channel
|
||||
|
||||
if [ "$channel" = auto -o "$channel" = 0 ]; then
|
||||
case "$hwmode" in
|
||||
auto)
|
||||
channel=auto
|
||||
;;
|
||||
|
||||
*b*|*g*)
|
||||
channel=auto2
|
||||
;;
|
||||
|
||||
*a*)
|
||||
channel=auto5
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
echo "$channel"
|
||||
}
|
||||
|
||||
# Get the WLAN interface list for a WLAN device.
|
||||
# anyfi_get_vifs <device>
|
||||
anyfi_get_vifs() {
|
||||
local device=$1
|
||||
local vifs=""
|
||||
local cfg
|
||||
|
||||
for cfg in $CONFIG_SECTIONS; do
|
||||
local type dev
|
||||
config_get type "$cfg" TYPE
|
||||
config_get dev "$cfg" device
|
||||
|
||||
if [ "$type" = wifi-iface ] && [ "$dev" = "$device" ]; then
|
||||
append vifs "$cfg"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$vifs"
|
||||
}
|
||||
|
||||
# Start the Anyfi.net radio head daemon anyfid on a device.
|
||||
# anyfi_dev_start <device> <type> <controller> <controller_key>
|
||||
anyfi_dev_start()
|
||||
{
|
||||
local device="$1"
|
||||
local type="$2"
|
||||
local controller="$3"
|
||||
local controller_key="$4"
|
||||
local nvifs bssids monitor iflist
|
||||
|
||||
# Determine how many virtual interfaces we should use
|
||||
config_get bssids "$device" anyfi_bssids
|
||||
nvifs=$(anyfi_get_vifs "$device" | wc -w)
|
||||
|
||||
if [ -n "$bssids" ]; then
|
||||
# Limit the number of virtual interfaces to 32
|
||||
[ "$bssids" -lt 32 ] || bssids=32
|
||||
elif [ $nvifs -lt 4 ]; then
|
||||
# Don't use more that 8 interfaces in total if possible...
|
||||
bssids=$((8 - $nvifs))
|
||||
else
|
||||
# ...but try to allocate at least 4 interfaces for anyfid.
|
||||
bssids=4
|
||||
fi
|
||||
|
||||
# ALLOCATE monitor and pool of virtual access points
|
||||
if monitor=$(anyfi_${type}_alloc_monitor "$device") && \
|
||||
iflist=$(anyfi_${type}_alloc_iflist "$device" $bssids)
|
||||
then
|
||||
local args=""
|
||||
local wanif port floor ceiling uplink downlink clients
|
||||
|
||||
config_get wanif "$device" anyfi_iface
|
||||
config_get port "$device" anyfi_port
|
||||
config_get floor "$device" anyfi_floor
|
||||
config_get ceiling "$device" anyfi_ceiling
|
||||
config_get uplink "$device" anyfi_uplink
|
||||
config_get downlink "$device" anyfi_downlink
|
||||
config_get clients "$device" anyfi_clients
|
||||
|
||||
# If there are no interfaces on this device then
|
||||
# anyfid controls channel
|
||||
if [ "$nvifs" -eq 0 ]; then
|
||||
args="$args --channel=$(anyfi_dev_get_channel $device)"
|
||||
fi
|
||||
|
||||
[ -n "$wanif" ] && args="$args --bind-if=$wanif"
|
||||
[ -n "$port" ] && args="$args --bind-port=$port"
|
||||
[ -n "$floor" ] && args="$args --floor=$floor"
|
||||
[ -n "$ceiling" ] && args="$args --ceiling=$ceiling"
|
||||
[ -n "$uplink" ] && args="$args --uplink=$uplink"
|
||||
[ -n "$downlink" ] && args="$args --downlink=$downlink"
|
||||
[ -n "$clients" ] && args="$args --max-clients=$clients"
|
||||
[ -n "$controller_key" ] && \
|
||||
args="$args --controller-key=$controller_key"
|
||||
|
||||
# START anyfid
|
||||
echo "$device: starting anyfid"
|
||||
/sbin/anyfid --accept-license -C "$controller" -B \
|
||||
-P $RUNDIR/anyfid_$device.pid $args \
|
||||
$monitor $iflist
|
||||
else
|
||||
echo "$device: failed to allocate anyfid interfaces" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
##### Wi-Fi interface handling ###############################################
|
||||
|
||||
# Get the printable name of an interface.
|
||||
anyfi_vif_get_name() {
|
||||
local ifname
|
||||
config_get ifname "$1" ifname
|
||||
echo "${ifname:-$1}"
|
||||
}
|
||||
|
||||
# Generate the config file for myfid from UCI variables.
|
||||
# anyfi_vif_gen_config <vif>
|
||||
anyfi_vif_gen_config() {
|
||||
local vif="$1"
|
||||
local name="$(anyfi_vif_get_name $1)"
|
||||
local device net ssid enc key isolate ifname
|
||||
|
||||
config_get device "$vif" device
|
||||
config_get net "$vif" network
|
||||
config_get ssid "$vif" ssid
|
||||
config_get enc "$vif" encryption
|
||||
config_get key "$vif" key
|
||||
config_get isolate "$vif" isolate
|
||||
config_get ifname "$vif" ifname
|
||||
|
||||
# Check basic settings before proceeding
|
||||
[ -n "$net" ] || [ -n "$ssid" ] || return 1
|
||||
|
||||
local auth_proto auth_mode auth_cache group_rekey
|
||||
local ciphers wpa_ciphers rsn_ciphers passphrase
|
||||
local auth_server auth_port auth_secret
|
||||
local autz_server autz_port autz_secret
|
||||
local acct_server acct_port acct_secret
|
||||
local acct2_server acct2_port acct2_secret
|
||||
local radius_nasid
|
||||
|
||||
# Resolve explicit cipher overrides (tkip, ccmp or tkip+ccmp)
|
||||
case "$enc" in
|
||||
*+tkip+ccmp|*+tkip+aes)
|
||||
ciphers=tkip+ccmp
|
||||
;;
|
||||
|
||||
*+ccmp|*+aes)
|
||||
ciphers=ccmp
|
||||
;;
|
||||
|
||||
*+tkip)
|
||||
ciphers=tkip
|
||||
;;
|
||||
esac
|
||||
|
||||
# Resolve authentication protocol (WPA or WPA2)
|
||||
case "$enc" in
|
||||
psk-mixed*|wpa-mixed*|mixed-psk*|mixed-wpa*)
|
||||
auth_proto=wpa+rsn
|
||||
wpa_ciphers=$ciphers
|
||||
rsn_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
psk2*|wpa2*)
|
||||
auth_proto=rsn
|
||||
rsn_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
psk*|wpa*)
|
||||
auth_proto=wpa
|
||||
wpa_ciphers=$ciphers
|
||||
;;
|
||||
|
||||
none)
|
||||
echo "$name: no remote access for security reasons (open network)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
|
||||
wep*)
|
||||
echo "$name: no remote access for security reasons (wep is insecure)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "$name: unrecognized encryption type $enc" 1>&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Resolve authenticator mode (PSK or 802.1X)
|
||||
case "$enc" in
|
||||
psk*)
|
||||
auth_mode=psk
|
||||
passphrase=$key
|
||||
[ -n "$passphrase" ] || return 1
|
||||
;;
|
||||
|
||||
wpa*)
|
||||
auth_mode=eap
|
||||
|
||||
config_get auth_server "$vif" radius_server
|
||||
config_get auth_port "$vif" radius_port
|
||||
config_get auth_secret "$vif" radius_secret
|
||||
|
||||
config_get acct_server "$vif" acct_server
|
||||
config_get acct_port "$vif" acct_port
|
||||
config_get acct_secret "$vif" acct_secret
|
||||
|
||||
config_get auth_cache "$vif" auth_cache
|
||||
config_get group_rekey "$vif" wpa_group_rekey
|
||||
|
||||
[ -n "$auth_server" ] || return 1
|
||||
[ -n "$auth_secret" ] || auth_secret="$key"
|
||||
[ -n "$acct_server" -a -z "$acct_secret" ] && acct_secret="$key"
|
||||
;;
|
||||
|
||||
none)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "$name: no remote access ('encryption' not configured)" 1>&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Optional RADIUS authorization and accounting for Anyfi.net
|
||||
config_get autz_server "$vif" anyfi_autz_server
|
||||
config_get autz_port "$vif" anyfi_autz_port
|
||||
config_get autz_secret "$vif" anyfi_autz_secret
|
||||
|
||||
config_get acct2_server "$vif" anyfi_acct_server
|
||||
config_get acct2_port "$vif" anyfi_acct_port
|
||||
config_get acct2_secret "$vif" anyfi_acct_secret
|
||||
|
||||
config_get radius_nasid "$vif" radius_nasid
|
||||
|
||||
# Generate common config file options
|
||||
cat <<EOF
|
||||
ssid = '$ssid'
|
||||
bridge = br-$net
|
||||
auth_proto = $auth_proto
|
||||
EOF
|
||||
|
||||
# Generate dependent config file options
|
||||
[ "$isolate" = 1 ] && echo "isolation = 1"
|
||||
[ -n "$ifname" ] && echo "local_ap = $ifname"
|
||||
[ -n "$auth_mode" ] && echo "auth_mode = $auth_mode"
|
||||
[ -n "$auth_cache" ] && echo "auth_cache = $auth_cache"
|
||||
[ -n "$rsn_ciphers" ] && echo "rsn_ciphers = $rsn_ciphers"
|
||||
[ -n "$wpa_ciphers" ] && echo "wpa_ciphers = $wpa_ciphers"
|
||||
[ -n "$group_rekey" ] && echo "group_rekey = $group_rekey"
|
||||
[ -n "$passphrase" ] && echo "passphrase = '$passphrase'"
|
||||
[ -n "$radius_nasid" ] && echo "radius_nas_id = $radius_nas_id"
|
||||
if [ -n "$auth_server" ] && [ -n "$auth_secret" ]; then
|
||||
echo "radius_auth_server = $auth_server"
|
||||
echo "radius_auth_port = ${auth_port:-1812}"
|
||||
echo "radius_auth_secret = $auth_secret"
|
||||
fi
|
||||
if [ -n "$acct_server" ] && [ -n "$acct_secret" ]; then
|
||||
echo "radius_acct_server = $acct_server"
|
||||
echo "radius_acct_port = ${acct_port:-1813}"
|
||||
echo "radius_acct_secret = $acct_secret"
|
||||
fi
|
||||
if [ -n "$autz_server" ] && [ -n "$autz_secret" ]; then
|
||||
echo "radius_autz_server = $autz_server"
|
||||
echo "radius_autz_port = ${autz_port:-1812}"
|
||||
echo "radius_autz_secret = $autz_secret"
|
||||
fi
|
||||
if [ -n "$acct2_server" ] && [ -n "$acct2_secret" ]; then
|
||||
echo "radius_acct2_server = $acct2_server"
|
||||
echo "radius_acct2_port = ${acct2_port:-1813}"
|
||||
echo "radius_acct2_secret = $acct2_secret"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Get the current value from a myfid configuration file.
|
||||
# anyfi_vif_get_config <file> <config>
|
||||
anyfi_vif_get_config() {
|
||||
local file="$1"
|
||||
local key="$2"
|
||||
|
||||
[ -e "$file" ] || return 1
|
||||
|
||||
# Assume the format is exactly "key = value",
|
||||
# where value may or may not be in ''
|
||||
grep "$key = " $file | cut -d '=' -f2- | cut -b2- | \
|
||||
sed -e "/^'.*'$/s/^'\\(.*\\)'$/\\1/"
|
||||
}
|
||||
|
||||
# Start the Anyfi.net tunnel-termination daemon myfid on an interface.
|
||||
# anyfi_vif_start <vif> <controller> <controller_key> <optimizer_key>
|
||||
anyfi_vif_start()
|
||||
{
|
||||
local vif="$1"
|
||||
local controller="$2"
|
||||
local controller_key="$3"
|
||||
local optimizer_key="$4"
|
||||
|
||||
local name="$(anyfi_vif_get_name $vif)"
|
||||
local pid_file="$RUNDIR/myfid_$name.pid"
|
||||
local conf_file="$CONFDIR/myfid_$name.conf"
|
||||
local new_conf_file="$RUNDIR/myfid_$name.conf"
|
||||
|
||||
# GENERATE a config file for myfid
|
||||
if (anyfi_vif_gen_config $vif) > $new_conf_file; then
|
||||
local controller_key optimizer_key
|
||||
local key old_key wanif port
|
||||
local args=""
|
||||
|
||||
config_get key "$vif" key
|
||||
config_get wanif "$vif" anyfi_iface
|
||||
config_get port "$vif" anyfi_port
|
||||
|
||||
# ADD optional arguments
|
||||
[ -n "$wanif" ] && args="$args --bind-if=$wanif"
|
||||
[ -n "$port" ] && args="$args --bind-port=$port"
|
||||
[ -n "$controller_key" ] && \
|
||||
args="$args --controller-key=$controller_key"
|
||||
[ -n "$optimizer_key" ] && \
|
||||
args="$args --optimizer-key=$optimizer_key"
|
||||
|
||||
# ADD the --reset flag to myfid arguments if the passphrase
|
||||
# has changed or myfid is started for the first time
|
||||
old_key="$(anyfi_vif_get_config $conf_file passphrase)"
|
||||
[ "$key" == "$old_key" ] || args="$args --reset"
|
||||
|
||||
# Update the myfid config file in flash only if needed
|
||||
if ! cmp -s $new_conf_file $conf_file; then
|
||||
mv $new_conf_file $conf_file
|
||||
else
|
||||
rm -f $new_conf_file
|
||||
fi
|
||||
|
||||
# START myfid
|
||||
echo "$name: starting myfid"
|
||||
/sbin/myfid --accept-license -C "$controller" -B -P $pid_file \
|
||||
$args $conf_file
|
||||
fi
|
||||
}
|
||||
|
||||
# Stop an Anyfi.net daemon gracefully
|
||||
# anyfi_stop_daemon <pidfile>
|
||||
anyfi_stop_daemon() {
|
||||
local pidfile="$1"
|
||||
|
||||
kill -TERM $(cat $pidfile)
|
||||
for t in $(seq 0 5); do
|
||||
[ -e $pidfile ] || return 0
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Timeout waiting for daemon assocated with $pidfile to exit" 1>&2
|
||||
kill -KILL $(cat $pidfile)
|
||||
rm -f $pidfile
|
||||
return 1
|
||||
}
|
||||
|
||||
# Enable Anyfi.net for a Wi-Fi device.
|
||||
# Run from ENABLE_HOOKS
|
||||
anyfi_enable()
|
||||
{
|
||||
local device="$1"
|
||||
local controller
|
||||
local type vif vifs
|
||||
|
||||
# A controller IP or FQDN is required
|
||||
controller="$(uci get anyfi.controller.hostname 2>/dev/null)"
|
||||
[ -n "$controller" ] || return 0
|
||||
|
||||
# Optional controller and optimizer public keys
|
||||
controller_key="$(uci get anyfi.controller.key 2>/dev/null)"
|
||||
optimizer_key="$(uci get anyfi.optimizer.key 2>/dev/null)"
|
||||
|
||||
# Reload the wireless config to get the assigned ifnames right
|
||||
config_load wireless
|
||||
config_get type "$device" type
|
||||
vifs=$(anyfi_get_vifs "$device")
|
||||
|
||||
# START anyfid on this device
|
||||
if [ "$(config_get $device anyfi_disabled)" != 1 ] && \
|
||||
/sbin/anyfi-probe "$type"
|
||||
then
|
||||
anyfi_dev_start $device $type "$controller" "$controller_key"
|
||||
fi
|
||||
|
||||
# FOREACH Wi-Fi interface of this device
|
||||
for vif in $vifs; do
|
||||
if [ "$(config_get $vif disabled)" != 1 ] && \
|
||||
[ "$(config_get $vif anyfi_disabled)" != 1 ]
|
||||
then
|
||||
anyfi_vif_start $vif "$controller" \
|
||||
"$controller_key" "$optimizer_key"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Disable Anyfi.net for a Wi-Fi device.
|
||||
# Run from DISABLE_HOOKS
|
||||
anyfi_disable()
|
||||
{
|
||||
local device="$1"
|
||||
local type vif vifs
|
||||
|
||||
# Reload the wireless config to get the assigned ifnames right
|
||||
config_load wireless
|
||||
config_get type "$device" type
|
||||
vifs=$(anyfi_get_vifs "$device")
|
||||
|
||||
# STOP anyfid on this device (if anyfid is running)
|
||||
if [ -e $RUNDIR/anyfid_$device.pid ]; then
|
||||
echo "$device: stopping anyfid"
|
||||
anyfi_stop_daemon $RUNDIR/anyfid_$device.pid
|
||||
anyfi_${type}_release_iflist $device
|
||||
anyfi_${type}_release_monitor $device
|
||||
fi
|
||||
|
||||
# FOREACH Wi-Fi interface of this device (with myfid running)
|
||||
for vif in $vifs; do
|
||||
local name="$(anyfi_vif_get_name $vif)"
|
||||
local pidfile="$RUNDIR/myfid_$name.pid"
|
||||
|
||||
if [ -e $pidfile ]; then
|
||||
echo "$name: stopping myfid"
|
||||
anyfi_stop_daemon $pidfile
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2014 Anyfi Networks AB.
|
||||
# Anyfi.net setup functions for Broadcom wl driver.
|
||||
|
||||
# Get monitor name interface based for a device.
|
||||
# anyfi_dev_monitor_name <device>
|
||||
anyfi_broadcom_name_monitor() {
|
||||
local device="$1"
|
||||
|
||||
# Map wlX => radiotapX
|
||||
echo "$device" | sed 's/^.*\([0-9]\)$/radiotap\1/'
|
||||
}
|
||||
|
||||
# Get BSS index of the last wl interface that is used (=up)
|
||||
# wl0.2 => 2
|
||||
# wl0 => (empty)
|
||||
anyfi_broadcom_get_wlindex() {
|
||||
ifconfig | grep -o "^$1\..." | cut -d'.' -f2 | sort -n | tail -n 1
|
||||
}
|
||||
|
||||
# Allocate virtual Wi-Fi interfaces for anyfid.
|
||||
# anyfi_broadcom_alloc_iflist <device> <bssids>
|
||||
anyfi_broadcom_alloc_iflist() {
|
||||
local device="$1"
|
||||
local bssids="$2"
|
||||
local count=0
|
||||
local wlindex num
|
||||
|
||||
# Enable MBSS mode if not already enabled
|
||||
if [ "$(wlctl -i $device mbss)" = 0 ]; then
|
||||
wlctl -i $device down
|
||||
wlctl -i $device mbss 1
|
||||
wlctl -i $device up
|
||||
fi
|
||||
|
||||
wlindex=$(anyfi_broadcom_get_wlindex $device)
|
||||
|
||||
# Create WLAN interfaces and let the driver assign the BSSIDs
|
||||
for num in $(seq $bssids); do
|
||||
local idx=$(($wlindex + $num))
|
||||
local wlif=$device.$idx
|
||||
|
||||
# Do the 'wlctl' dance to make the driver assign proper BSSIDs
|
||||
wlctl -i $device bss -C $idx up > /dev/null || break
|
||||
wlctl -i $device ssid -C $idx "dummy" > /dev/null
|
||||
wlctl -i $device bss -C $idx up > /dev/null
|
||||
wlctl -i $device bss -C $idx down > /dev/null
|
||||
wlctl -i $device ssid -C $idx "" > /dev/null
|
||||
|
||||
local bssid=$(wlctl -i $wlif cur_etheraddr | cut -d' ' -f2)
|
||||
ifconfig $wlif hw ether $bssid > /dev/null
|
||||
count=$(($count + 1))
|
||||
done
|
||||
|
||||
[ "$count" -gt 0 ] && echo $device.$(($wlindex + 1))/$count
|
||||
}
|
||||
|
||||
# Release virtual Wi-Fi interfaces allocated for anyfid.
|
||||
# anyfi_broadcom_release_iflist <device>
|
||||
anyfi_broadcom_release_iflist() {
|
||||
true
|
||||
}
|
||||
|
||||
# Allocate a monitor interface for anyfid.
|
||||
# anyfi_broadcom_alloc_monitor <device>
|
||||
anyfi_broadcom_alloc_monitor() {
|
||||
local device="$1"
|
||||
local monitor=$(anyfi_broadcom_name_monitor $device)
|
||||
|
||||
wlctl -i $device monitor 0 || return 1
|
||||
wlctl -i $device monitor 3 || return 1
|
||||
ifconfig $monitor down || return 1
|
||||
ifconfig $monitor up || return 1
|
||||
echo $monitor
|
||||
}
|
||||
|
||||
# Release the monitor interface for anyfid.
|
||||
# anyfi_broadcom_release_monitor <device>
|
||||
anyfi_broadcom_release_monitor() {
|
||||
local device="$1"
|
||||
local monitor=$(anyfi_broadcom_name_monitor $device)
|
||||
|
||||
ifconfig $monitor down 2> /dev/null
|
||||
wlctl -i $device monitor 0 2> /dev/null
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Check if a WLAN driver type is supported by Anyfi.net radio software."
|
||||
echo "Usage: $0 {mac80211|...}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
number() {
|
||||
echo $2 | sed -e 's/[^0-9]/ /g' | cut -d' ' -f $1
|
||||
}
|
||||
|
||||
major() {
|
||||
number 1 $1
|
||||
}
|
||||
|
||||
minor() {
|
||||
number 2 $1
|
||||
}
|
||||
|
||||
case $1 in
|
||||
mac80211)
|
||||
COMPAT_VER=$(opkg list-installed kmod-mac80211 | cut -d'+' -f2)
|
||||
KERNEL_VER=$(uname -r)
|
||||
|
||||
# Future kernels > 3.x are OK
|
||||
[ "$(major $KERNEL_VER)" -gt 3 ] && return 0
|
||||
|
||||
# The required commit 86c228a7627f3f2776893da47592234140fbfba8
|
||||
# for mac80211 support was introduced in kernel 3.12.
|
||||
[ "$(major $KERNEL_VER)" -eq 3 ] && \
|
||||
[ "$(minor $KERNEL_VER)" -ge 12 ] && return 0
|
||||
|
||||
[ "$(major $COMPAT_VER)" -gt 2013 ] && return 0
|
||||
[ "$(major $COMPAT_VER)" -eq 2013 ] && \
|
||||
[ "$(minor $COMPAT_VER)" -ge 11 ] && return 0
|
||||
|
||||
cat <<EOF
|
||||
Support for mac80211 requires Linux kernel >= 3.12 or
|
||||
compat-wireless >= 2013-11-05. Please update your system.
|
||||
EOF
|
||||
;;
|
||||
|
||||
broadcom)
|
||||
return 0
|
||||
;;
|
||||
|
||||
*)
|
||||
cat<<EOF
|
||||
WLAN driver \"$1\" is not supported by the Anyfi.net radio software.
|
||||
Improved drivers with Anyfi.net support are available for Broadcom,
|
||||
Qualcomm Atheros, Ralink and Realtek chipsets. Please contact
|
||||
support@anyfi.net for updated drivers, reference integrations and
|
||||
commercial integration services.
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
847
asterisk-1.8.x-mod/Makefile
Normal file
847
asterisk-1.8.x-mod/Makefile
Normal file
@@ -0,0 +1,847 @@
|
||||
#
|
||||
# Copyright (C) 2008-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=asterisk18-mod
|
||||
PKG_VERSION:=1.8.10.1
|
||||
|
||||
PKG_SOURCE_VERSION:=ffa46ba1d5abf22fa83d0bd06ea56fe8e638dd43
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/asterisk-1.8.x
|
||||
|
||||
PKG_RELEASE:=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)-$(PKG_RELEASE).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/ltqtapi.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/asterisk18-mod/Default
|
||||
SUBMENU:=Telephony
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=http://www.asterisk.org/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod/Default/description
|
||||
Asterisk is a complete PBX in software. It provides all of the features
|
||||
you would expect from a PBX and more. Asterisk does voice over IP in three
|
||||
protocols, and can interoperate with almost all standards-based telephony
|
||||
equipment using relatively inexpensive hardware.
|
||||
endef
|
||||
|
||||
|
||||
define Package/asterisk18-mod
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Complete open source PBX, v1.8x
|
||||
MENU:=1
|
||||
DEPENDS:= +natalie-dect-h +PACKAGE_bcmkernel:bcmkernel +PACKAGE_bcmopen:bcmopen +libopenssl +libncurses +libpopt +libpthread +uci +ubus +zlib @!TARGET_avr32
|
||||
ifeq ($(CONFIG_PACKAGE_voice-client),y)
|
||||
DEPENDS+= +voice-client
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-sounds
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Sound files
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-sounds/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package contains sound files for Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-voicemail
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Voicemail support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-voicemail/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package contains voicemail related modules for Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-transfer
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Call transfer support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-transfer/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package contains the call transfer support module for Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-softhangup
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=SoftHangup application
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-softhangup/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package contains the SoftHangup support module for Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-meetme
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=conferencing support
|
||||
DEPENDS:= asterisk18-mod +dahdi-tools-libtonezone +dahdi
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-meetme/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides the MeetMe application driver Conferencing support to
|
||||
Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-iax2
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=IAX support
|
||||
DEPENDS:= asterisk18-mod +asterisk18-res-crypto
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-iax2/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides IAX support to
|
||||
Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-cdr
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=CDR support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-cdr/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides Call Detail Record support to
|
||||
Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-musiconhold
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=MOH support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-musiconhold/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides Music On Hold support to
|
||||
Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-voice
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Voice client/pbx support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-voice/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides Voice Client/pbx support to
|
||||
Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-srtp
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=SRTP support
|
||||
DEPENDS:= asterisk18-mod libsrtp +asterisk18-mod-res-crypto
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-srtp/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides SRTP support to
|
||||
Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-stun
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=STUN support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-queue
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Queue support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-gtalk
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=GTalk support
|
||||
DEPENDS:= asterisk18-mod +libiksemel
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-gtalk/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides the channel chan_gtalk and res_jabber for GTalk
|
||||
support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mobile
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Mobile channel support
|
||||
DEPENDS:= asterisk18-mod +bluez-libs
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mobile/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides the channel chan_mobile support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-timing-timerfd
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:= Timerfd Timing Interface
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-timing-pthread
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:= pthread Timing Interface
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-fax
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Generic FAX Resource for FAX technology resource modules
|
||||
DEPENDS:= asterisk18-mod +asterisk18-mod-res-timing-pthread
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-fax-spandsp
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Spandsp T.38 and G.711 FAX Resource
|
||||
DEPENDS:= asterisk18-mod +asterisk18-mod-res-fax +libspandsp
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mgcp
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=MGCP channel support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mgcp/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides the channel chan_mgcp support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-skinny
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Skinny channel support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-skinny/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides the channel chan_skinny support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-brcm
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Broadcom channel support
|
||||
DEPENDS:= asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-brcm/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides the channel chan_brcm support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-curl
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=CURL support
|
||||
DEPENDS:= asterisk18-mod +libcurl
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-curl/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides CURL
|
||||
support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-mysql
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=MySQL support
|
||||
DEPENDS:= asterisk18-mod +PACKAGE_asterisk18-mysql:libmysqlclient
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-mysql/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides MySQL
|
||||
support to Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-lantiq
|
||||
$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=Lantiq TAPI support
|
||||
DEPENDS:= asterisk18-mod $(LTQ_TAPI_DEPENDS)
|
||||
URL:=http://git.nanl.de/?p=asterisk_channel_lantiq.git
|
||||
MAINTAINER:=Mirko Vogt <mirko@openwrt.org>
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-lantiq/description
|
||||
$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides the channel chan_lantiq support to Asterisk.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-inotify
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-app-meetme),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-dahdi="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-dahdi
|
||||
endif
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-chan-gtalk),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-gnutls="$(STAGING_DIR)/usr" \
|
||||
--with-iksemel="$(STAGING_DIR)/usr"
|
||||
SITE_VARS+= \
|
||||
ac_cv_lib_iksemel_iks_start_sasl=yes \
|
||||
ac_cv_lib_gnutls_gnutls_bye=yes
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-gnutls \
|
||||
--without-iksemel
|
||||
endif
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-curl),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-curl="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-curl
|
||||
endif
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-mysql),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-mysqlclient="$(STAGING_DIR)/usr/bin"
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-mysqlclient
|
||||
endif
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-res-fax-spandsp),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-spandsp="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-spandsp
|
||||
endif
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-chan-mobile),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-bluetooth="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-bluetooth
|
||||
endif
|
||||
|
||||
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk18-mod-res-srtp),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-srtp="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-srtp
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_IBOARDID),"D301")
|
||||
EXTRA_CFLAGS += -DNTR_SUPPORT
|
||||
endif
|
||||
|
||||
CONFIGURE_ARGS+= \
|
||||
--without-curses \
|
||||
--with-gsm=internal \
|
||||
--without-cap \
|
||||
--without-gtk \
|
||||
--without-gtk2 \
|
||||
--without-isdnnet \
|
||||
--without-kde \
|
||||
--without-misdn \
|
||||
--without-nbs \
|
||||
--with-ncurses="$(STAGING_DIR)/usr" \
|
||||
--without-netsnmp \
|
||||
--without-newt \
|
||||
--without-odbc \
|
||||
--without-ogg \
|
||||
--without-osptk \
|
||||
--with-popt="$(STAGING_DIR)/usr" \
|
||||
--without-pri \
|
||||
--without-qt \
|
||||
--without-radius \
|
||||
--without-sdl \
|
||||
--without-suppserv \
|
||||
--without-tds \
|
||||
--without-termcap \
|
||||
--without-tinfo \
|
||||
--without-vorbis \
|
||||
--without-vpb \
|
||||
--with-z="$(STAGING_DIR)/usr" \
|
||||
--with-sounds-cache="$(DL_DIR)" \
|
||||
--disable-xmldoc
|
||||
|
||||
EXTRA_CFLAGS+= $(TARGET_CPPFLAGS)
|
||||
EXTRA_LDFLAGS+= $(TARGET_LDFLAGS)
|
||||
|
||||
ifeq ($(CONFIG_DEBUG),y)
|
||||
CONFIGURE_ARGS+= \
|
||||
--enable-dev-mode
|
||||
MENUSELECT_ARGS+= \
|
||||
--enable BETTER_BACKTRACES
|
||||
MENUSELECT_ARGS+= \
|
||||
--enable DEBUG_THREADS
|
||||
MENUSELECT_ARGS+= \
|
||||
--enable DONT_OPTIMIZE
|
||||
MENUSELECT_ARGS+= \
|
||||
--enable MALLOC_DEBUG
|
||||
#MENUSELECT_ARGS+= \
|
||||
# --disable LOADABLE_MODULES
|
||||
#MENUSELECT_ARGS+= \
|
||||
# --enable LOW_MEMORY
|
||||
#MENUSELECT_ARGS+= \
|
||||
# --enable STATIC_BUILD
|
||||
|
||||
DEBUG:=
|
||||
OPTIMIZE:=
|
||||
|
||||
#CONFIGURE_ARGS+= \
|
||||
# --enable-coverage
|
||||
else
|
||||
MENUSELECT_ARGS+= \
|
||||
--enable LOW_MEMORY
|
||||
DEBUG:=
|
||||
OPTIMIZE:=
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
ifneq ($(CONFIG_TARGET_lantiq),)
|
||||
$(CP) ./src-lantiq/* $(PKG_BUILD_DIR)/
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
-rm $(PKG_BUILD_DIR)/menuselect.makeopts
|
||||
$(call Build/Configure/Default,,$(SITE_VARS))
|
||||
if test -n "$(MENUSELECT_ARGS)" ; then \
|
||||
$(MAKE) -C "$(PKG_BUILD_DIR)" menuselect.makeopts ; \
|
||||
(cd $(PKG_BUILD_DIR) && ./menuselect/menuselect $(MENUSELECT_ARGS)) ; \
|
||||
fi
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C "$(PKG_BUILD_DIR)" \
|
||||
include/asterisk/version.h \
|
||||
include/asterisk/buildopts.h defaults.h \
|
||||
makeopts.embed_rules
|
||||
ASTCFLAGS="$(EXTRA_CFLAGS)" \
|
||||
ASTLDFLAGS="$(EXTRA_LDFLAGS)" \
|
||||
$(MAKE) -C "$(PKG_BUILD_DIR)" \
|
||||
ASTVARLIBDIR="/usr/lib/asterisk" \
|
||||
ASTDATADIR="/usr/lib/asterisk" \
|
||||
ASTKEYDIR="/usr/lib/asterisk" \
|
||||
ASTDBDIR="/usr/lib/asterisk" \
|
||||
NOISY_BUILD="1" \
|
||||
DEBUG="$(DEBUG)" \
|
||||
OPTIMIZE="$(OPTIMIZE)" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
all install samples
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/asterisk-1.8/include/asterisk/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk/*.h $(1)/usr/include/asterisk-1.8/include/asterisk/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk.h $(1)/usr/include/asterisk-1.8/include/
|
||||
endef
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_voice-client),y)
|
||||
define Package/asterisk18-mod/conffiles
|
||||
/etc/asterisk/asterisk.conf
|
||||
/etc/asterisk/modules.conf
|
||||
/etc/asterisk/extensions.conf
|
||||
/etc/asterisk/sip.conf
|
||||
/etc/asterisk/sip_notify.conf
|
||||
/etc/asterisk/features.conf
|
||||
/etc/asterisk/indications.conf
|
||||
/etc/asterisk/logger.conf
|
||||
/etc/asterisk/manager.conf
|
||||
/etc/asterisk/rtp.conf
|
||||
/etc/default/asterisk
|
||||
/etc/init.d/asterisk
|
||||
endef
|
||||
else
|
||||
define Package/asterisk18-mod/conffiles
|
||||
/etc/default/asterisk
|
||||
/etc/init.d/asterisk
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/asterisk18-mod/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk/ssl
|
||||
ifneq ($(CONFIG_PACKAGE_voice-client),y)
|
||||
for f in asterisk extensions features \
|
||||
indications logger manager modules \
|
||||
sip sip_notify rtp; do \
|
||||
$(CP) $(PKG_INSTALL_DIR)/etc/asterisk/$$$$f.conf $(1)/etc/asterisk/ ; \
|
||||
done
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
for f in app_dial app_echo app_playback app_macro \
|
||||
chan_sip res_rtp_asterisk res_rtp_multicast \
|
||||
codec_ulaw codec_gsm \
|
||||
format_gsm format_pcm format_wav format_wav_gsm \
|
||||
pbx_config \
|
||||
func_strings func_timeout func_callerid func_logic; do \
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$$$$f.so $(1)/usr/lib/asterisk/modules/ ; \
|
||||
done
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/asterisk $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/default
|
||||
$(INSTALL_DATA) ./files/asterisk.default $(1)/etc/default/asterisk
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/asterisk.init $(1)/etc/init.d/asterisk
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-sounds/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/* $(1)/usr/lib/asterisk/sounds/
|
||||
rm -f $(1)/usr/lib/asterisk/sounds/vm-*
|
||||
rm -f $(1)/usr/lib/asterisk/sounds/conf-*
|
||||
endef
|
||||
|
||||
|
||||
define Package/asterisk18-mod-voicemail/conffiles
|
||||
/etc/asterisk/voicemail.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-voicemail/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/voicemail.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/*voicemail.so $(1)/usr/lib/asterisk/modules/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_adsi.so $(1)/usr/lib/asterisk/modules/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_smdi.so $(1)/usr/lib/asterisk/modules/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/vm-*.gsm $(1)/usr/lib/asterisk/sounds/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-meetme/conffiles
|
||||
/etc/asterisk/meetme.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-meetme/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/meetme.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_meetme.so $(1)/usr/lib/asterisk/modules/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/conf-*.gsm $(1)/usr/lib/asterisk/sounds/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-iax2/conffiles
|
||||
/etc/asterisk/iax.conf
|
||||
/etc/asterisk/iaxprov.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-cdr/conffiles
|
||||
/etc/asterisk/cdr.conf
|
||||
/etc/asterisk/cdr_custom.conf
|
||||
/etc/asterisk/cdr_manager.conf
|
||||
/etc/asterisk/cdr_odbc.conf
|
||||
/etc/asterisk/cdr_pgsql.conf
|
||||
/etc/asterisk/cdr_tds.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-musiconhold/conffiles
|
||||
/etc/asterisk/musiconhold.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-iax2/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/iax.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/iaxprov.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_iax2.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-cdr/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/cdr*.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/*cdr*.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-musiconhold/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_musiconhold.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-voice/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_voice.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-gtalk/conffiles
|
||||
/etc/asterisk/gtalk.conf
|
||||
/etc/asterisk/jabber.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-gtalk/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/gtalk.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/jabber.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_gtalk.so $(1)/usr/lib/asterisk/modules/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_jabber.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mobile/conffiles
|
||||
/etc/asterisk/chan_mobile.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mobile/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/chan_mobile.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_mobile.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-timing-timerfd/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_timing_timerfd.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-timing-pthread/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_timing_pthread.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-fax/conffiles
|
||||
/etc/asterisk/res_fax.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-fax/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/res_fax.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_fax.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-fax-spandsp/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_fax_spandsp.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mgcp/conffiles
|
||||
/etc/asterisk/mgcp.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-mgcp/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/mgcp.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_mgcp.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-skinny/conffiles
|
||||
/etc/asterisk/skinny.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-skinny/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/skinny.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_skinny.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_voice-client),y)
|
||||
define Package/asterisk18-mod-chan-brcm/conffiles
|
||||
/etc/asterisk/brcm.conf
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/asterisk18-mod-chan-brcm/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
ifneq ($(CONFIG_PACKAGE_voice-client),y)
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/brcm.conf $(1)/etc/asterisk/
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_brcm.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-curl/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/func_curl.so $(1)/usr/lib/asterisk/modules/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_curl.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-transfer/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_transfer.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-softhangup/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_softhangup.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-mysql/conffiles
|
||||
/etc/asterisk/app_mysql.conf
|
||||
/etc/asterisk/res_config_mysql.conf
|
||||
/etc/asterisk/cdr_mysql.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-mysql/install
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/app_mysql.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/res_config_mysql.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/cdr_mysql.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_mysql.so $(1)/usr/lib/asterisk/modules/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/cdr_mysql.so $(1)/usr/lib/asterisk/modules/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_config_mysql.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-lantiq/conffiles
|
||||
/etc/asterisk/lantiq.conf
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-chan-lantiq/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_DIR) $(1)/etc/asterisk
|
||||
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/lantiq.conf $(1)/etc/asterisk/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_lantiq.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-srtp/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_srtp.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-res-stun/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_stun_monitor.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-app-queue/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_queue.so $(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
define Buildasterisk18-modModuleTemplate
|
||||
|
||||
define Package/asterisk18-mod-$(subst _,-,$(1))
|
||||
$$(call Package/asterisk18-mod/Default)
|
||||
TITLE:=$(2) support
|
||||
DEPENDS:= asterisk18-mod $(4)
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-$(subst _,-,$(1))/description
|
||||
$$(call Package/asterisk18-mod/Default/description)
|
||||
This package provides support $(3) in Asterisk.
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-$(subst _,-,$(1))/install
|
||||
$(INSTALL_DIR) $$(1)/usr/lib/asterisk/modules
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$(1).so $$(1)/usr/lib/asterisk/modules/
|
||||
endef
|
||||
|
||||
$$(eval $$(call BuildPackage,asterisk18-mod-$(subst _,-,$(1))))
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,asterisk18-mod))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-voicemail))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-sounds))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-app-meetme))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-app-transfer))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-app-softhangup))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-iax2))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-cdr))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-musiconhold))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-voice))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-gtalk))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-mobile))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-fax))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-fax-spandsp))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-timing-timerfd))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-timing-pthread))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-mgcp))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-skinny))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-brcm))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-curl))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-mysql))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-chan-lantiq))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-srtp))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-res-stun))
|
||||
$(eval $(call BuildPackage,asterisk18-mod-app-queue))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_authenticate,Authenticate,support for executing arbitrary authenticate commands))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_chanisavail,Channel availability check,support for checking if a channel is available))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_chanspy,Channel listen in,support for listening in on any channel))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_directed_pickup,Directed call pickup,support for directed call pickup))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_exec,Exec application,support for application execution))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_minivm,Minimal voicemail system,a voicemail system in small building blocks working together based on the Comedian Mail voicemail system))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_readexten,Extension to variable,a trivial application to read an extension into a variable))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_read,Variable read,a trivial application to read a variable))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_sayunixtime,Say Unix time,an application to say Unix time))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_sms,SMS,SMS support (ETSI ES 201 912 protocol 1)))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_stack,Stack applications, stack applications Gosub Return etc., +asterisk18-res-agi))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_system,System exec,support for executing system commands))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_talkdetect,File playback with audio detect,for file playback with audio detect))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_waituntil,Sleep,support sleeping until the given epoch))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_while,While loop,a while loop implementation))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,chan_agent,Agents proxy channel, an implementation of agents proxy channel))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,chan_local,Local proxy channel, an implementation of local proxy channel))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_alaw,Signed linear to alaw translation,translation between signed linear and alaw codecs))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_ulaw,Signed linear to ulaw translation,translation between signed linear and ulaw codecs))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_a_mu,Alaw to ulaw translation,translation between alaw and ulaw codecs))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_g722,G.722,a high bit rate 48/56/64Kbps ITU standard codec))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_g726,Signed linear to G.726 translation,translation between signed linear and ITU G.726-32kbps codecs))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_ilbc,iLBC,internet Low Bitrate Codec))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,codec_gsm,GSM,GSM codec))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,format_g726,G.726,support for headerless G.726 16/24/32/40kbps data format))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,format_g729,G.729,support for raw headerless G729 data))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,format_sln,Raw slinear format,support for raw slinear format))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,format_sln16,Raw slinear 16 format,support for Raw slinear 16 format))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_db,Database interaction,functions for interaction with the database))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_devstate,Blinky lights control,functions for manually controlled blinky lights))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_vmcount,vmcount dialplan,a vmcount dialplan function))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_extstate,Hinted extension state,retrieving the state of a hinted extension for dialplan control))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_global,Global variable,global variable dialplan functions))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_shell,Shell,support for shell execution))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,pbx_ael,Asterisk Extension Logic,support for symbolic Asterisk Extension Logic))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,res_ael_share,Shareable AEL code,support for shareable AEL code mainly between internal and external modules))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,pbx_spool,Call Spool,outgoing call spool support))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,res_agi,Asterisk Gateway Interface,support for the Asterisk Gateway Interface extension))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,res_crypto,Provide Crypto,Cryptographic Signature capability))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_alarmreceiver,Alarm receiver,Central Station Alarm receiver for Ademco Contact ID))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_setcallerid,Set callerid,support for setting callerid))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_verbose,Verbose logging,Verbose logging application))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_channel,Channel info,Channel info dialplan function))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_blacklist,Blacklist on callerid,looking up the callerid number and see if it is blacklisted))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_originate,Originate a call,originating an outbound call and connecting it to a specified extension or application))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_uri,URI encoding and decoding,Encodes and decodes URI-safe strings))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_disa,Direct Inward System Access,Direct Inward System Access))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_senddtmf,Send DTMF digits,Sends arbitrary DTMF digits))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,func_cut,CUT function,CUT function))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,res_clioriginate,Calls via CLI,Originate calls via the CLI))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_mixmonitor,Record a call and mix the audio,record a call and mix the audio during the recording))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_playtones,Playtones application,play a tone list))
|
||||
$(eval $(call Buildasterisk18-modModuleTemplate,app_record,Record sound file,to record a sound file))
|
||||
4
asterisk-1.8.x-mod/files/asterisk.default
Normal file
4
asterisk-1.8.x-mod/files/asterisk.default
Normal file
@@ -0,0 +1,4 @@
|
||||
## startup options for /etc/init.d/asterisk
|
||||
|
||||
ENABLE_ASTERISK="yes"
|
||||
OPTIONS=""
|
||||
57
asterisk-1.8.x-mod/files/asterisk.init
Normal file
57
asterisk-1.8.x-mod/files/asterisk.init
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=98
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=asterisk
|
||||
PROG=/usr/sbin/asterisk
|
||||
DEFAULT=/etc/default/asterisk
|
||||
|
||||
init_asterisk() {
|
||||
# do not start asterisk until the
|
||||
# router receives a default route
|
||||
while ! ip r | grep -q default; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
[ -f $DEFAULT ] && . $DEFAULT
|
||||
[ -d /var/run/asterisk ] || mkdir -p /var/run/asterisk
|
||||
[ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk
|
||||
[ -d /var/spool/asterisk ] || mkdir -p /var/spool/asterisk
|
||||
|
||||
# does the board have a fxs relay?
|
||||
local fxsRelayGpio=$(db -q get hw.board.fxsRelayGpio)
|
||||
if [ "$fxsRelayGpio" != "" ]; then
|
||||
/sbin/brcm_fw_tool set -x $fxsRelayGpio -p 1
|
||||
fi
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger voice_client
|
||||
}
|
||||
|
||||
start_service() {
|
||||
init_asterisk
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" -f
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
# service_start /usr/sbin/asterisk
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
asterisk -rx "core reload"
|
||||
asterisk -rx "dialplan reload"
|
||||
asterisk -rx "brcm reload"
|
||||
}
|
||||
|
||||
restart() {
|
||||
reload
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
service_stop /usr/sbin/asterisk
|
||||
}
|
||||
|
||||
81
bluez/Makefile
Normal file
81
bluez/Makefile
Normal file
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# Copyright (C) 2006-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bluez
|
||||
PKG_VERSION:=5.28
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=http://www.kernel.org/pub/linux/bluetooth
|
||||
PKG_MD5SUM:=bc20a8285530758c68f6a60e4ca62a15
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/bluez
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libpthread +libusb-compat +glib2 +dbus +libreadline $(INTL_DEPENDS) $(ICONV_DEPENDS)
|
||||
TITLE:=Bluetooth stack new version
|
||||
URL:=http://www.bluez.org/
|
||||
endef
|
||||
|
||||
define Package/bluez/conffiles
|
||||
/etc/config/bluetooth
|
||||
endef
|
||||
|
||||
TARGET_LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib/libiconv-full/lib \
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-shared \
|
||||
--disable-cups \
|
||||
--enable-debug \
|
||||
--disable-test \
|
||||
--disable-obex \
|
||||
--disable-systemd \
|
||||
--disable-udev \
|
||||
--enable-tools \
|
||||
--enable-experimental \
|
||||
--enable-library \
|
||||
--disable-static \
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) \
|
||||
-L$(ICONV_PREFIX)/lib \
|
||||
-L$(INTL_PREFIX)/lib -lm -lncurses" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
all install
|
||||
endef
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/bluetooth
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/bluetooth/*.h $(1)/usr/include/bluetooth
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libbluetooth.* $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/bluez.pc $(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
define Package/bluez/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/bluetooth
|
||||
$(INSTALL_DIR) $(1)/etc/dbus-1/system.d
|
||||
$(CP) $(PKG_INSTALL_DIR)/etc/dbus-1/system.d/bluetooth.conf $(1)/etc/dbus-1/system.d/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bluetooth
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/bluetooth/* $(1)/usr/lib/bluetooth
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libblue* $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bluez))
|
||||
47
btle_alarm/Makefile
Normal file
47
btle_alarm/Makefile
Normal file
@@ -0,0 +1,47 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=btle_alarm
|
||||
PKG_VERSION:=1.0.6
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=b505d7ae1524a213ca3de7f8ee15a7d51c6bbbd5
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/btle_alarm
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/btle_alarm
|
||||
SECTION:=base
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Ethernet bridging configuration utility
|
||||
#DESCRIPTION:=This variable is obsolete. use the Package/name/description define instead!
|
||||
URL:=http://btle_alarm.sourceforge.net/
|
||||
DEPENDS:=+bluez +libncurses
|
||||
endef
|
||||
|
||||
define Package/btle_alarm/description
|
||||
Ethernet bridging configuration utility
|
||||
Manage ethernet bridging; a way to connect networks together to
|
||||
form a larger network.
|
||||
endef
|
||||
|
||||
define Package/btle_alarm/install
|
||||
|
||||
$(CP) ./files/* $(1)/
|
||||
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/btle_alarm $(1)/sbin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config/
|
||||
$(INSTALL_DATA) ./files/btle_alarm.conf $(1)/etc/config/btle_alarm
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/* $(1)/etc/init.d/
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,btle_alarm))
|
||||
2
btle_alarm/files/btle_alarm.conf
Normal file
2
btle_alarm/files/btle_alarm.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
config info 'Device'
|
||||
option mac 'D0:39:72:B6:23:D6'
|
||||
29
btle_alarm/files/etc/init.d/btle_alarm
Executable file
29
btle_alarm/files/etc/init.d/btle_alarm
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (C) 2009 OpenWrt.org
|
||||
#
|
||||
|
||||
START=99
|
||||
|
||||
start() {
|
||||
for i in down reset up;do
|
||||
hciconfig hci0 $i
|
||||
done
|
||||
mac=`uci get btle_alarm.Device.mac`
|
||||
if [ $? -eq 0 ];then
|
||||
hcitool lewladd $mac
|
||||
else
|
||||
hcitool lewladd D0:39:72:B6:43:8A
|
||||
hcitool lewladd D0:39:72:B6:18:AA
|
||||
fi
|
||||
sleep 1
|
||||
/sbin/btle_alarm &> /dev/null &
|
||||
echo $! > /tmp/btle_alarm.pid
|
||||
}
|
||||
|
||||
stop() {
|
||||
hciconfig hci0 down
|
||||
kill -9 `cat /tmp/btle_alarm.pid`
|
||||
rm /tmp/btle_alarm.pid
|
||||
sleep 1
|
||||
}
|
||||
30
catv/Makefile
Normal file
30
catv/Makefile
Normal file
@@ -0,0 +1,30 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=catv
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/catv
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=CATV
|
||||
endef
|
||||
|
||||
define Package/catv/description
|
||||
CATV configuration utility
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/catv/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,catv))
|
||||
4
catv/files/etc/config/catv
Normal file
4
catv/files/etc/config/catv
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
config service 'catv'
|
||||
option enable 'no'
|
||||
option filter '3'
|
||||
BIN
catv/files/etc/init.d/.catv.kate-swp
Normal file
BIN
catv/files/etc/init.d/.catv.kate-swp
Normal file
Binary file not shown.
26
catv/files/etc/init.d/catv
Executable file
26
catv/files/etc/init.d/catv
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (C) 2015 inteno.org
|
||||
#
|
||||
|
||||
START=71
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
start_service() {
|
||||
local enable=0
|
||||
local filter=0
|
||||
|
||||
config_load catv
|
||||
config_get enable catv enable
|
||||
config_get filter catv filter
|
||||
ubus call catv set-enable "{\"enable\":\"$enable\"}"
|
||||
ubus call catv set-filter "{\"filter\":\"$filter\"}"
|
||||
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger catv
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=crashlog
|
||||
|
||||
66
dectmngr/Makefile
Normal file
66
dectmngr/Makefile
Normal file
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0.24
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/dectmngr
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=6ba403663bc9cfdb8f89fb34de367f0796d68552
|
||||
PKG_NAME:=dectmngr
|
||||
|
||||
|
||||
LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
|
||||
RSTRIP:=true
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dectmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Broadcom endpoint test application
|
||||
URL:=
|
||||
DEPENDS:= +libevent2 +libjson +natalie-dect-h bcmkernel
|
||||
endef
|
||||
|
||||
define Package/dectmngr/description
|
||||
Dect proxy, manager and tools
|
||||
endef
|
||||
|
||||
|
||||
define Package/dectmngr/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/dect
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_DIR) $(1)/etc/dect/
|
||||
$(INSTALL_DIR) $(1)/etc/config/
|
||||
|
||||
cp $(PKG_BUILD_DIR)/dectmngr $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/atohx $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/dectproxy $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/dectdbgd $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/dect $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/dectcalib $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/dect_testmode $(1)/usr/bin/
|
||||
cp files/etc/init.d/* $(1)/etc/init.d/
|
||||
cp files/etc/hotplug.d/dect/* $(1)/etc/hotplug.d/dect/
|
||||
cp files/etc/dect/* $(1)/etc/dect/
|
||||
cp files/etc/config/* $(1)/etc/config/
|
||||
cp files/sbin/dectreg $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dectmngr))
|
||||
3
dectmngr/files/etc/config/dect
Executable file
3
dectmngr/files/etc/config/dect
Executable file
@@ -0,0 +1,3 @@
|
||||
config dect 'dect'
|
||||
option 'radio' 'auto'
|
||||
|
||||
BIN
dectmngr/files/etc/dect/dect_testmode.dat
Normal file
BIN
dectmngr/files/etc/dect/dect_testmode.dat
Normal file
Binary file not shown.
BIN
dectmngr/files/etc/dect/nvs_default
Normal file
BIN
dectmngr/files/etc/dect/nvs_default
Normal file
Binary file not shown.
15
dectmngr/files/etc/hotplug.d/dect/00-dectstate
Normal file
15
dectmngr/files/etc/hotplug.d/dect/00-dectstate
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$ACTION" == "led_blink" ]; then
|
||||
ubus call led.dect set '{"state":"notice"}'
|
||||
fi
|
||||
|
||||
if [ "$ACTION" == "led_on" ]; then
|
||||
ubus call led.dect set '{"state":"ok"}'
|
||||
fi
|
||||
|
||||
if [ "$ACTION" == "led_off" ]; then
|
||||
ubus call led.dect set '{"state":"off"}'
|
||||
fi
|
||||
|
||||
|
||||
60
dectmngr/files/etc/init.d/dect
Executable file
60
dectmngr/files/etc/init.d/dect
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=97
|
||||
STOP=10
|
||||
USE_PROCD=1
|
||||
|
||||
DEST=
|
||||
DEFAULT=
|
||||
OPTIONS=""
|
||||
|
||||
|
||||
start_service() {
|
||||
# avoid fp timing problem
|
||||
echo 1 > /proc/sys/kernel/printk_with_interrupt_enabled
|
||||
|
||||
# setup board specific dect parameters
|
||||
cat /proc/nvram/rfpi | tr -d ' ' | atohx > /tmp/rfpi
|
||||
cat /proc/nvram/fixed_emc | tr -d ' ' | atohx > /tmp/fixed_emc
|
||||
cat /proc/nvram/bcm_def_freq | tr -d ' ' | atohx > /tmp/bcm_def_freq
|
||||
DECTANTDIV=`db get hw.board.DectAntennaDiversity`
|
||||
case "$DECTANTDIV" in
|
||||
1|off) echo -ne "\x01" > /tmp/dect_antenna_diversity ;;
|
||||
2) echo -ne "\x02" > /tmp/dect_antenna_diversity ;;
|
||||
*) echo -ne "\x00" > /tmp/dect_antenna_diversity ;;
|
||||
esac
|
||||
|
||||
if [ ! -f /etc/dect/nvs ]; then
|
||||
cp /etc/dect/nvs_default /etc/dect/nvs
|
||||
dd of=/etc/dect/nvs if=/tmp/rfpi conv=notrunc bs=1 seek=0
|
||||
dd of=/etc/dect/nvs if=/tmp/fixed_emc conv=notrunc bs=1 seek=10
|
||||
dd of=/etc/dect/nvs if=/tmp/bcm_def_freq conv=notrunc bs=1 seek=6
|
||||
dd of=/etc/dect/nvs if=/tmp/dect_antenna_diversity conv=notrunc bs=1 seek=32
|
||||
fsync /etc/dect/nvs
|
||||
fi
|
||||
|
||||
# init dectproxy
|
||||
dectproxy > /dev/null 2>&1 &
|
||||
dectmngr > /tmp/dectmngr 2>&1 &
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
killall -9 dectproxy
|
||||
killall -9 dectmngr
|
||||
}
|
||||
|
||||
restart_service() {
|
||||
echo "restarting dect"
|
||||
killall dectmngr
|
||||
dectmngr > /tmp/dectmngr 2>&1 &
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
# reload config
|
||||
dect -c
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger dect
|
||||
}
|
||||
|
||||
17
dectmngr/files/sbin/dectreg
Executable file
17
dectmngr/files/sbin/dectreg
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script is likely not used. Just exit with
|
||||
# an error and see if someone screems... If not,
|
||||
# we can delete this file.
|
||||
exit 1
|
||||
|
||||
|
||||
[ -f /var/dectisregistering ] || {
|
||||
touch /var/dectisregistering 2>/dev/null
|
||||
/usr/bin/dectmngr -r
|
||||
ubus call led.dect set '{"state" : "notice"}'
|
||||
sleep 20
|
||||
rm /var/dectisregistering 2>/dev/null
|
||||
/usr/bin/dectmngr -s
|
||||
ubus call led.dect set '{"state" : "ok"}'
|
||||
}
|
||||
51
dectmngr2/Makefile
Normal file
51
dectmngr2/Makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.0
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/dectmngr2
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=a51f8ed1b9178262777f73f7c275d3962f829c8a
|
||||
PKG_NAME:=dectmngr2
|
||||
|
||||
|
||||
LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
|
||||
RSTRIP:=true
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/dectmngr2
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Dectmngr2
|
||||
URL:=
|
||||
DEPENDS:= +natalie-dect-h bcmkernel +libubox +ubus
|
||||
endef
|
||||
|
||||
define Package/dectmngr2/description
|
||||
Dectmngr2
|
||||
endef
|
||||
|
||||
|
||||
define Package/dectmngr2/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/dect/
|
||||
|
||||
cp $(PKG_BUILD_DIR)/src/dectmngr2 $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/files/target.bin $(1)/etc/dect/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,dectmngr2))
|
||||
@@ -1,46 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=endptcfg-open
|
||||
PKG_VERSION:=15-06-24
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://ihgsp.inteno.se/ihgsp/consumer/
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
|
||||
define Package/endptcfg-open
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Broadcom endpoint driver configuration application pre compiled for open SDK
|
||||
URL:=
|
||||
endef
|
||||
|
||||
define Package/endptcfg-open/description
|
||||
Broadcom endpoint driver configuration application pre compiled for open SDK
|
||||
endef
|
||||
|
||||
|
||||
|
||||
define Package/endptcfg-open/install
|
||||
mkdir -p $(1)/usr/bin/
|
||||
ifeq ($(CONFIG_BCM_CHIP_ID),"63138")
|
||||
$(CP) $(PKG_BUILD_DIR)/endptcfg_arm $(1)/usr/bin/endptcfg
|
||||
|
||||
else
|
||||
$(CP) $(PKG_BUILD_DIR)/endptcfg_mips $(1)/usr/bin/endptcfg
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,endptcfg-open))
|
||||
90
endptcfg/Makefile
Normal file
90
endptcfg/Makefile
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=endptcfg
|
||||
PKG_VERSION:=0.2
|
||||
|
||||
PKG_SOURCE_VERSION:=1194b05278bd0945ca5c76436e56617b86871a65
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_KERNEL_PROFILE)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
|
||||
PKG_NAME:=endptcfg-open
|
||||
else
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:endptcfg
|
||||
PKG_SOURCE_PROTO:=git
|
||||
endif
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
|
||||
BCMKERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
|
||||
export BCMKERNEL_DIR
|
||||
|
||||
TARGET_LDFLAGS += $(BCMKERNEL_DIR)/userspace/private/apps/vodsl/telephonyProfiles/telephonyProfiles.o \
|
||||
$(BCMKERNEL_DIR)/userspace/private/apps/vodsl/voip/util/log/vodslLog.o \
|
||||
$(BCMKERNEL_DIR)/userspace/private/apps/vodsl/endpoint/endpoint_user.o \
|
||||
$(BCMKERNEL_DIR)/userspace/private/apps/vodsl/bos/bos.o \
|
||||
-lpthread
|
||||
|
||||
ifeq ($(CONFIG_BRCM_SDK_VER_416040),y)
|
||||
TARGET_CFLAGS += -DFAKE_SSP
|
||||
endif
|
||||
|
||||
RSTRIP:=true
|
||||
export BUILD_DIR
|
||||
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/endptcfg
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Broadcom endpoint driver configuration application
|
||||
URL:=
|
||||
DEPENDS:=+libpthread bcmkernel
|
||||
endef
|
||||
|
||||
define Package/endptcfg/description
|
||||
Broadcom endpoint driver configuration application
|
||||
endef
|
||||
|
||||
ifneq ($(CONFIG_BCM_OPEN),y)
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) LINUX_DIR=$(LINUX_DIR) LDFLAGS="$(TARGET_LDFLAGS)" CFLAGS="$(TARGET_CFLAGS) \
|
||||
-I$(LINUX_DIR)/include \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-DRS_ENDIAN_TYPE=RS_BIG_ENDIAN \
|
||||
-DBOS_OS_LINUXUSER -DBOS_CFG_TIME \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/broadcom/include/bcm963xx \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/endpt/inc \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/inc \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/codec \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/publicInc \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/voice_res_gw/casCtl/inc \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_drivers/inc \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/private/apps/vodsl/voip/inc \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/xChange/dslx_common/xchg_common/bos/LinuxUser"
|
||||
endef
|
||||
else
|
||||
define Build/Compile
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/endptcfg/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
cp $(PKG_BUILD_DIR)/endptcfg $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,endptcfg))
|
||||
@@ -15,19 +15,28 @@ export PLATFORM_INCLUDE:=platforms/iopsys/build.mk
|
||||
|
||||
export DATE:=$(shell date +%Y-%m-%d-%H-%M-%S)
|
||||
export LOGIN:=$(shell whoami)
|
||||
BASE_PKG_VERSION:=3.4.0
|
||||
PKG_RELEASE:=RC6
|
||||
BASE_PKG_VERSION:=3.4.1
|
||||
PKG_RELEASE:=RC8
|
||||
PKG_VERSION:=$(BASE_PKG_VERSION)-$(PKG_RELEASE)_$(DATE)_$(LOGIN)
|
||||
export PKG_VERSION
|
||||
|
||||
###########################--RELEASE--################################
|
||||
|
||||
PKG_SOURCE_URL:=ssh://git@iopsys.inteno.se/ice-client.git
|
||||
PKG_SOURCE_VERSION:=e860a7697ac8d6029cd1f75e1df9885e1d4131f5
|
||||
PKG_SOURCE_URL:=ssh://git@private.inteno.se/ice-client.git
|
||||
PKG_SOURCE_VERSION:=ecad8b60183b43ecf86543c0c29db46cda8aae29
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_KERNEL_PROFILE)-$(BASE_PKG_VERSION)$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
#PKG_NAME:=ice-client-open
|
||||
else
|
||||
PKG_SOURCE_URL:=ssh://git@private.inteno.se/ice-client.git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BASE_PKG_VERSION)-$(PKG_RELEASE).tar.gz
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
endif
|
||||
|
||||
|
||||
###########################--RELEASE--################################
|
||||
@@ -44,7 +53,8 @@ define Package/ice-client
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=ice-client
|
||||
MENU:=1
|
||||
DEPENDS:=+libopenssl +libstdcpp +libubus +ubus +ubusd +jshn +libubox +libpthread +libjson-c
|
||||
DEPENDS:=+libopenssl +libstdcpp +libubus +ubus +ubusd +jshn +libubox
|
||||
DEFAULT:=y
|
||||
endef
|
||||
|
||||
###########################--DEVELOPMENT--################################
|
||||
@@ -52,7 +62,7 @@ endef
|
||||
# Uncomment stuff Build/Prepare
|
||||
#
|
||||
# Plus make sure to comment and provide the following lines above
|
||||
# #PKG_SOURCE_URL:=ssh://git@iopsys.inteno.se/ice-client.git
|
||||
# #PKG_SOURCE_URL:=ssh://git@private.inteno.se/ice-client.git
|
||||
# #PKG_SOURCE_VERSION:=a11bf64e6b1054803b52750aabd71bf440ff6e16
|
||||
# #PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
# #PKG_SOURCE:=$(PKG_NAME)-$(BASE_PKG_VERSION)-$(PKG_RELEASE).tar.gz
|
||||
@@ -84,6 +94,10 @@ endef
|
||||
# command to copy the binary file from its current location (in our case the build
|
||||
# directory) to the install directory.
|
||||
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
define Build/Compile
|
||||
endef
|
||||
else
|
||||
define Build/Configure
|
||||
echo $(BASE_PKG_VERSION)-$(PKG_RELEASE) > $(PKG_BUILD_DIR)/core/version.txt
|
||||
echo $(DATE) > $(PKG_BUILD_DIR)/core/date.txt
|
||||
@@ -94,21 +108,37 @@ endef
|
||||
define Build/Clean
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) clean
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/ice-client/preinst
|
||||
#!/bin/sh
|
||||
echo "backup current config"
|
||||
cp /etc/iopsys/server.ini /tmp/iopsysserver.ini
|
||||
cp /etc/config/ice /tmp/ice.back
|
||||
if [ -f "/etc/iopsys/server.ini" ]; then
|
||||
cp /etc/iopsys/server.ini /tmp/iopsysserver.ini
|
||||
fi
|
||||
if [ -f "/etc/config/ice" ]; then
|
||||
cp /etc/config/ice /tmp/ice.back
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
define Package/ice-client/install
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DIR) $(1)/usr
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/* $(1)/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/etc/* $(1)/etc/
|
||||
$(CP) $(PKG_BUILD_DIR)/usr/* $(1)/usr/
|
||||
endef
|
||||
else
|
||||
define Package/ice-client/install
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/core/ice $(1)/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/modules/system/ubusevent/obj/iopsys/ubusevent $(1)/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/{systemService.so.1.0.1,libconfStore.so.1,networkService.so.1.0.1,packageService.so.1.0.1,monitorService.so.1.0.1,iperfService.so.1.0.1,logService.so.1.0.1} $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/wsice/obj/iopsys/libwsice.so $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/execute
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/progress
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/result
|
||||
@@ -124,6 +154,7 @@ define Package/ice-client/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/ice-client $(1)/etc/init.d/ice-client
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/ice-client/postinst
|
||||
#!/bin/sh
|
||||
@@ -139,7 +170,7 @@ exit 0
|
||||
endef
|
||||
|
||||
# Additional modules
|
||||
|
||||
ifneq ($(CONFIG_BCM_OPEN),y)
|
||||
# Camerawatch
|
||||
define Package/ice-client-camerawatch
|
||||
$(call Package/ice-client/Default)
|
||||
@@ -853,11 +884,30 @@ fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# bmspeedtest
|
||||
define Package/ice-client-bcmspeedmgr
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=bcmspeedmgr
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-bcmspeedmgr/description
|
||||
bcmspeedmgr module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-bcmspeedmgr/install
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/daemons/bcmspeedmgr/obj/iopsys/bcmspeedmgr $(1)/bin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(CP) $(PKG_BUILD_DIR)/platforms/iopsys/bcmspeedtestservice $(1)/etc/init.d/bcmspeedtestservice
|
||||
endef
|
||||
endif
|
||||
# This line executes the necessary commands to compile our program.
|
||||
# The above define directives specify all the information needed, but this
|
||||
# line calls BuildPackage which in turn actually uses this information to
|
||||
# build a package.
|
||||
$(eval $(call BuildPackage,ice-client))
|
||||
ifneq ($(CONFIG_BCM_OPEN),y)
|
||||
$(eval $(call BuildPackage,ice-client-guest))
|
||||
$(eval $(call BuildPackage,ice-client-camerawatch))
|
||||
$(eval $(call BuildPackage,ice-client-openvpn))
|
||||
@@ -872,3 +922,5 @@ $(eval $(call BuildPackage,ice-client-rework))
|
||||
$(eval $(call BuildPackage,ice-client-sip))
|
||||
$(eval $(call BuildPackage,ice-client-monitor))
|
||||
$(eval $(call BuildPackage,ice-client-gigaset))
|
||||
$(eval $(call BuildPackage,ice-client-bcmspeedmgr))
|
||||
endif
|
||||
|
||||
@@ -8,15 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=3.0-2015-11-10
|
||||
PKG_VERSION:=3.0-2016-02-24
|
||||
PKG_FIXUP:=autoreconf
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
PKG_SOURCE_URL:=http://ihgsp.inteno.se/git/freecwmp.git
|
||||
else
|
||||
PKG_SOURCE_URL:=ssh://git@iopsys.inteno.se/freecwmp.git
|
||||
endif
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/icwmp.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=8d34c241548a21b6462df5d16906824685fe916c
|
||||
PKG_SOURCE_VERSION:=476392f44397a10769efdd96005378732b9e915a
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
@@ -140,7 +136,6 @@ ifeq ($(CONFIG_CWMP_SCRIPTS_FULL),y)
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/icwmp.sh $(1)/usr/sbin/icwmp
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/iwepkeygen $(1)/usr/sbin/iwepkeygen
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/watchicwmpd.sh $(1)/usr/sbin/watchicwmpd
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
57
inotify-tools/Makefile
Normal file
57
inotify-tools/Makefile
Normal file
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=inotify-tools
|
||||
PKG_VERSION:=3.14
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=1df9af4d6cd0f4af4b1b19254bcf056aed4ae395
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/rvoicilas/inotify-tools.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
# support parallel build
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/inotify-tools
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Tools to trace filesystem events.
|
||||
URL:=
|
||||
endef
|
||||
|
||||
define Package/inotify-tools/description
|
||||
Tools to trace filesystem events.
|
||||
endef
|
||||
|
||||
define Package/inotify-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib/
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so.0.4.1 $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so.0 $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libinotifytools.so $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywait $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inotifywatch $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,inotify-tools))
|
||||
13
inotify-tools/files/usr/bin/iop_write_monitor
Executable file
13
inotify-tools/files/usr/bin/iop_write_monitor
Executable file
@@ -0,0 +1,13 @@
|
||||
#! /bin/sh
|
||||
|
||||
# is the real root mounted ?
|
||||
if [ ! -f /tmp/inotify_real_root/etc/preinit ]
|
||||
then
|
||||
ubivol=$( cat /proc/cmdline | sed -e "s/.*root=\(ubi:rootfs_.\).*/\1/" )
|
||||
mkdir /tmp/inotify_real_root
|
||||
mount -t ubifs $ubivol /tmp/inotify_real_root
|
||||
fi
|
||||
|
||||
inotifywait -r -m -e modify -e create -e attrib -e delete -e move /tmp/inotify_real_root
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=inteno-configs
|
||||
|
||||
PKG_VERSION:=1.0
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:inteno-configs.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=e6836dbc3dde40eba661b3c37d5f5d0cc6f2e5d0
|
||||
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
######################################
|
||||
|
||||
define NewConfig
|
||||
define Package/$(1)/install
|
||||
$(INSTALL_DIR) $$(1)/etc/config
|
||||
$(INSTALL_DIR) $$(1)/etc/uci-defaults
|
||||
$(CP) $(PKG_BUILD_DIR)/$(1)/etc/config/* $$(1)/etc/config/ | true
|
||||
$(CP) $(PKG_BUILD_DIR)/$(1)/etc/uci-defaults/* $$(1)/etc/uci-defaults | true
|
||||
endef
|
||||
|
||||
define Package/$(1)
|
||||
SECTION:=configs
|
||||
CATEGORY:=Configurations
|
||||
TITLE:=$(1)
|
||||
endef
|
||||
|
||||
endef
|
||||
|
||||
|
||||
define AddConfig
|
||||
$(eval $(call NewConfig,$(1)))
|
||||
$(eval $(call BuildPackage,$(1)))
|
||||
endef
|
||||
|
||||
######################################
|
||||
|
||||
$(eval $(call AddConfig,conf-common-inteno))
|
||||
$(eval $(call AddConfig,conf-caiman-inteno))
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# iup at boot
|
||||
# Copyright (C) 2007 OpenWrt.org
|
||||
|
||||
START=98
|
||||
STOP=15
|
||||
USE_PROCD=1
|
||||
@@ -28,6 +29,38 @@ init_iup() {
|
||||
config_load provisioning
|
||||
config_get interval polling interval
|
||||
config_get starttime polling starttime
|
||||
|
||||
### Ask for IUP related DHCP options only if IUP is enabled ###
|
||||
local enabled
|
||||
local newreqopts=
|
||||
local baseopts=
|
||||
local reqopts="$(uci -q get network.wan.reqopts)"
|
||||
local proto="$(uci -q get network.wan.proto)"
|
||||
local iupopts="66 67 128 224"
|
||||
local ropt iopt
|
||||
config_get enabled iup enabled "on"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
66|67|128|224) ;;
|
||||
*) baseopts="$baseopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
ropt=""
|
||||
reqopts="$baseopts $iupopts"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
66|67|128|224) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
|
||||
*) newreqopts="$newreqopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
if [ "$proto" == "dhcp" ]; then
|
||||
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
uci -q set network.wan.reqopts="$newreqopts"
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
fi
|
||||
#################################################################
|
||||
|
||||
if [ $interval == "weekly" ]; then
|
||||
interval="0"
|
||||
elif [ $interval == "hourly" ]; then
|
||||
@@ -43,21 +76,35 @@ init_iup() {
|
||||
if grep -q "iup" "$CRONPATH" ; then
|
||||
sed -i "/iup/d" $CRONPATH
|
||||
fi
|
||||
echo "$number $starttime * * $interval /sbin/iup > /dev/null 2>&1" >> $CRONPATH
|
||||
echo "$number $starttime * * $interval /sbin/iup -v > /dev/null 2>&1" >> $CRONPATH
|
||||
fsync $CRONPATH
|
||||
/etc/init.d/cron restart
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
boot() {
|
||||
init_iup
|
||||
}
|
||||
|
||||
start_service() {
|
||||
init_iup
|
||||
|
||||
test_default_route
|
||||
if [ "$?" -eq 0 ]; then
|
||||
/sbin/iup &
|
||||
/sbin/iup -v &
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
killall -9 /sbin/iup
|
||||
if [ -f "/tmp/run/iup.pid" ]; then
|
||||
kill -9 $(cat /tmp/run/iup.pid)
|
||||
rm -rf /tmp/run/iup.pid
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo $$ > /var/run/iup.pid
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
@@ -24,7 +24,7 @@ MAC=${MAC// /}
|
||||
MAC=$(echo $MAC | tr '[a-z]' '[A-Z]')
|
||||
|
||||
v() {
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
[ "$VERBOSE" -ge 1 ] && logger -t iup "$@"
|
||||
}
|
||||
|
||||
if [ -f $IUPMD5 ]; then
|
||||
@@ -112,7 +112,12 @@ handle_provisioning() {
|
||||
config_get_bool defaultreset "$config" defaultreset
|
||||
config_get deckey "$config" deckey
|
||||
if [ "$enabled" -eq 1 ]; then
|
||||
config_get url "$config" urliup
|
||||
if [ "$config" == "iup" ]; then
|
||||
v "using url from dhcp options"
|
||||
config_get url "$config" urliup
|
||||
else
|
||||
config_get url "$config" url
|
||||
fi
|
||||
url=${url//\$MAC/$MAC}
|
||||
v "Download from $url"
|
||||
|
||||
@@ -153,7 +158,15 @@ handle_Downloaded_file()
|
||||
local KEY
|
||||
[ -n "$1" ] && DECKEY=$(echo $1 | hexdump -e '16/1 "%02x"')
|
||||
KEY=${DECKEY:-$DESKEY}
|
||||
if [ "$(brcm_fw_tool -i check "$IUPCONFFILES")" == "UNKNOWN" ] ; then
|
||||
local img_type
|
||||
case "$(get_image_type "$IUPCONFFILES")" in
|
||||
"INTENO") img_type=2 ;;
|
||||
"CFE+FS") img_type=1 ;;
|
||||
"FS") img_type=0 ;;
|
||||
*) img_type="UNKNOWN";;
|
||||
esac
|
||||
|
||||
if [ "$img_type" == "UNKNOWN" ] ; then
|
||||
case "$(hexdump -v -n 2 -e '1/1 "%02x"' $IUPCONFFILES)" in
|
||||
1f8b)
|
||||
v "Found Config"
|
||||
@@ -246,7 +259,7 @@ if [ $configurl ]; then
|
||||
elif [ $iupurl ]; then
|
||||
handle_provisioning iup
|
||||
else
|
||||
echo "No Provisioning Server Found"
|
||||
v "No Provisioning Server Found"
|
||||
exit
|
||||
fi
|
||||
config_load provisioning
|
||||
@@ -259,6 +272,12 @@ if [ $software ]; then
|
||||
local sysinfo=$(ubus call router quest "{ \"info\": \"system\" }")
|
||||
json_load "$sysinfo"
|
||||
json_get_var firmware firmware
|
||||
json_get_var filesystem filesystem
|
||||
if [ "$filesystem" == "JFFS2" ] ; then
|
||||
firmware=$firmware.w
|
||||
else
|
||||
firmware=$firmware.y
|
||||
fi
|
||||
if [ "$sofwareminuspath" == "${sofwareminuspath/$firmware/}" ] ; then
|
||||
echo $software
|
||||
handle_provisioning uppgradeserver
|
||||
@@ -275,3 +294,4 @@ if [ "$reboot" == "on" ]; then
|
||||
v "Reboot Signaled"
|
||||
/sbin/reboot
|
||||
fi
|
||||
rm -rf /var/run/iup.pid
|
||||
|
||||
75
iup/files/sbin/iup224
Normal file
75
iup/files/sbin/iup224
Normal file
@@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
if [ -z $1 ] ; then
|
||||
echo "No argument"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $(echo $1|grep -o "," | wc -l) -eq 0 ] ; then
|
||||
url=$1
|
||||
else
|
||||
url=$(echo $1|cut -d',' -f1)
|
||||
a=$(echo $1|cut -d',' -f2)
|
||||
b=$(echo $1|cut -d',' -f3)
|
||||
c=$(echo $1|cut -d',' -f4)
|
||||
fi
|
||||
|
||||
echo "url" $url
|
||||
echo "a" $a
|
||||
echo "b" $b
|
||||
echo "c" $c
|
||||
|
||||
currdate=$(date +"%Y-%m-%d")
|
||||
|
||||
active=0
|
||||
if [ -z $a ] ; then
|
||||
active=1
|
||||
elif [ $a ] && [ $b ] && [ $a -lt 25 ] ; then
|
||||
#Time
|
||||
begin=$(date +%s -d"$currdate $a")
|
||||
now=$(date +%s)
|
||||
end=$((begin+3600*$b))
|
||||
if [ $now -gt $begin ] && [ $now -lt $end ] ; then
|
||||
active=1
|
||||
fi
|
||||
elif [ $a ] && [ $b ] && [ $c ] && [ $a -gt 25 ] ; then
|
||||
#Date
|
||||
y=$(echo $a| cut -c1-4)
|
||||
m=$(echo $a| cut -c5-6)
|
||||
d=$(echo $a| cut -c7-8)
|
||||
begin=$(date +%s -d"$y-$m-$d $b")
|
||||
now=$(date +%s)
|
||||
end=$((begin+3600*$c))
|
||||
if [ $now -gt $begin ] && [ $now -lt $end ] ; then
|
||||
active=1
|
||||
fi
|
||||
else
|
||||
echo "Bad format"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sofwareminuspath=${url##*/}
|
||||
|
||||
if [ $url ] && [ $active -eq 1 ]; then
|
||||
echo "Software version to download $sofwareminuspath"
|
||||
local sysinfo=$(ubus call router quest "{ \"info\": \"system\" }")
|
||||
json_load "$sysinfo"
|
||||
json_get_var firmware firmware
|
||||
json_get_var filesystem filesystem
|
||||
if [ "$filesystem" == "JFFS2" ] ; then
|
||||
firmware=$firmware.w
|
||||
else
|
||||
firmware=$firmware.y
|
||||
fi
|
||||
if [ "$sofwareminuspath" == "${sofwareminuspath/$firmware/}" ] ; then
|
||||
echo "Image found $url will start flashing"
|
||||
/sbin/sysupgrade -v $url
|
||||
else
|
||||
echo "Will not update software, already up to date"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -99,8 +99,9 @@ atm_inf_conf() {
|
||||
|
||||
checkxtmlist $atmtype $pcr $scr $mbs
|
||||
ret="$?"
|
||||
xtmctl operate conn --add 1.$vpi.$vci aal5 $encaps 1 $ret $ret
|
||||
xtmctl operate conn --add 1.$vpi.$vci aal5 $encaps 0 $ret $ret
|
||||
xtmctl operate conn --addq 1.$vpi.$vci 0 wrr 1
|
||||
xtmctl operate conn --addq 1.$vpi.$vci 7 wrr 1 # fixes pppoe disconnect issue
|
||||
xtmctl operate conn --createnetdev 1.$vpi.$vci ${ifname%%.*}
|
||||
xtmctl operate intf --state 1 enable
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ boot() {
|
||||
echo "ERROR: porttminit $interf failed!" > /dev/kmsg
|
||||
done
|
||||
fi
|
||||
|
||||
echo '1' > /proc/sys/net/ipv6/conf/$baseifname/disable_ipv6
|
||||
ifconfig $baseifname up
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ ptm_inf_conf() {
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
xtmctl operate conn --add $dslat.$ptmprio 0 1
|
||||
xtmctl operate conn --addq $dslat.$ptmprio 0 wrr 1 -1 -1 3000
|
||||
xtmctl operate conn --addq $dslat.$ptmprio 7 wrr 1 -1 -1 3000 # fixes pppoe disconnect issue
|
||||
xtmctl operate conn --createnetdev $dslat.$ptmprio ${ifname%%.*}
|
||||
xtmctl operate intf --state 1 enable
|
||||
xtmctl start
|
||||
|
||||
@@ -78,8 +78,37 @@ addbrcmvlan ()
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
ifconfig $baseifname up
|
||||
echo "vlanctl --if-create $ifname" > /dev/console
|
||||
|
||||
local unmanaged=0
|
||||
local nets net typ proto
|
||||
nets=$(get_network_of "$ifname")
|
||||
for net in $nets; do
|
||||
typ=$(uci -q get network."$net".type)
|
||||
proto=$(uci -q get network."$net".proto)
|
||||
proto="${proto:-none}"
|
||||
if [ "$typ" == "bridge" -a "$proto" == "none" ]; then
|
||||
unmanaged=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo '1' > /proc/sys/net/ipv6/conf/$baseifname/disable_ipv6
|
||||
ifconfig $baseifname up
|
||||
if [ "x$bridge" = "x" ]; then
|
||||
bridge=0
|
||||
fi
|
||||
|
||||
if [ "$bridge" -eq 1 ]; then
|
||||
if [ "$unmanaged" == "1" ]; then
|
||||
vlanctl --if-create $baseifname $vlan8021q
|
||||
else
|
||||
vlanctl --dhcp-bridged --if-create $baseifname $vlan8021q
|
||||
fi
|
||||
else
|
||||
vlanctl --routed --if-create $baseifname $vlan8021q
|
||||
fi
|
||||
|
||||
if [ "$bridge" -eq 1 ]; then
|
||||
vlanctl --if-create $baseifname $vlan8021q
|
||||
vlanctl --if $baseifname --set-if-mode-rg
|
||||
vlanctl --if $baseifname --tx --tags 0 --default-miss-drop
|
||||
vlanctl --if $baseifname --tx --tags 1 --default-miss-drop
|
||||
@@ -95,7 +124,6 @@ addbrcmvlan ()
|
||||
# tags 2 rx
|
||||
vlanctl --if $baseifname --rx --tags 2 --filter-vid $vlan8021q 0 --pop-tag --set-rxif $ifname --rule-insert-before -1
|
||||
else
|
||||
vlanctl --routed --if-create $baseifname $vlan8021q
|
||||
vlanctl --if $baseifname --set-if-mode-rg
|
||||
vlanctl --if $baseifname --tx --tags 0 --default-miss-drop
|
||||
vlanctl --if $baseifname --tx --tags 1 --default-miss-drop
|
||||
@@ -125,19 +153,38 @@ brcm_virtual_interface_rules ()
|
||||
local baseifname=$1
|
||||
local ifname=$2
|
||||
local bridge=$3
|
||||
|
||||
|
||||
local unmanaged=0
|
||||
local nets net typ proto
|
||||
nets=$(get_network_of "$ifname")
|
||||
for net in $nets; do
|
||||
typ=$(uci -q get network."$net".type)
|
||||
proto=$(uci -q get network."$net".proto)
|
||||
proto="${proto:-none}"
|
||||
if [ "$typ" == "bridge" -a "$proto" == "none" ]; then
|
||||
unmanaged=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo '1' > /proc/sys/net/ipv6/conf/$baseifname/disable_ipv6
|
||||
ifconfig $baseifname up
|
||||
if [ "x$bridge" = "x" ]; then
|
||||
bridge=0
|
||||
fi
|
||||
bridge=0
|
||||
fi
|
||||
|
||||
if [ "$bridge" -eq 1 ]; then
|
||||
vlanctl --if-create-name $baseifname $ifname
|
||||
create_ebtables_bridge_rules
|
||||
if [ "$unmanaged" == "1" ]; then
|
||||
vlanctl --if-create-name $baseifname $ifname
|
||||
else
|
||||
vlanctl --dhcp-bridged --if-create-name $baseifname $ifname
|
||||
fi
|
||||
else
|
||||
vlanctl --routed --if-create-name $baseifname $ifname
|
||||
vlanctl --routed --if-create-name $baseifname $ifname
|
||||
fi
|
||||
|
||||
[ "$bridge" -eq 1 ] && create_ebtables_bridge_rules
|
||||
|
||||
#set default RG mode
|
||||
vlanctl --if $baseifname --set-if-mode-rg
|
||||
#Set Default Droprules
|
||||
@@ -145,9 +192,8 @@ brcm_virtual_interface_rules ()
|
||||
vlanctl --if $baseifname --tx --tags 1 --default-miss-drop
|
||||
vlanctl --if $baseifname --tx --tags 2 --default-miss-drop
|
||||
vlanctl --if $baseifname --tx --tags 0 --filter-txif $ifname --rule-insert-before -1
|
||||
|
||||
|
||||
if [ "$bridge" -eq 1 ]; then
|
||||
|
||||
# tags 1 tx
|
||||
vlanctl --if $baseifname --tx --tags 1 --filter-txif $ifname --rule-insert-before -1
|
||||
# tags 2 tx
|
||||
@@ -159,7 +205,6 @@ brcm_virtual_interface_rules ()
|
||||
# tags 2 rx
|
||||
vlanctl --if $baseifname --rx --tags 2 --set-rxif $ifname --rule-insert-last
|
||||
else
|
||||
|
||||
# tags 1 rx
|
||||
vlanctl --if $baseifname --rx --tags 1 --set-rxif $ifname --filter-vlan-dev-mac-addr 0 --drop-frame --rule-insert-before -1
|
||||
# tags 2 rx
|
||||
@@ -167,9 +212,8 @@ brcm_virtual_interface_rules ()
|
||||
# tags 0 rx
|
||||
vlanctl --if $baseifname --rx --tags 0 --set-rxif $ifname --filter-vlan-dev-mac-addr 1 --rule-insert-before -1
|
||||
fi
|
||||
|
||||
|
||||
ifconfig $ifname up
|
||||
ifconfig $ifname multicast
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2013 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libucix
|
||||
PKG_VERSION:=0.0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
target=$(firstword $(subst -, ,$(BOARD)))
|
||||
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib -luci
|
||||
|
||||
TARGET_LDFLAGS += -shared -luci -Wl,-soname
|
||||
TARGET_CFLAGS += $(FPIC) -Dtarget_$(target)=1 -Wall
|
||||
MAKE_FLAGS += TARGET="$(target)"
|
||||
|
||||
define Package/libucix
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=UCI library
|
||||
DEPENDS:=+libuci
|
||||
endef
|
||||
|
||||
define Package/libucix/description
|
||||
UCI helper library
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/libucix/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/
|
||||
( cd $(PKG_BUILD_DIR) ; rm -f libucix.so && ln -s libucix.so.$(PKG_VERSION) libucix.so )
|
||||
$(CP) $(PKG_BUILD_DIR)/libucix.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libucix.so* $(STAGING_DIR)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/*.h $(STAGING_DIR)/usr/include/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libucix))
|
||||
@@ -1,15 +0,0 @@
|
||||
# Makefile for libucix
|
||||
|
||||
OBJS = libucix.o
|
||||
SRCS = libucix.c
|
||||
|
||||
all: libucix
|
||||
|
||||
libucix: ${OBJS}
|
||||
${CC} ${LDFLAGS} -o libucix.so.${PKG_VERSION} ${OBJS} ${LIBDIR} ${LIBS}
|
||||
|
||||
clean:
|
||||
rm -f libucix.so.* libucix.a ${OBJS}
|
||||
|
||||
depend:
|
||||
${MAKEDEPEND} ${INCL} ${SRCS} ${LIBSRCS}
|
||||
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (C) 2008 John Crispin <blogic@openwrt.org>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <uci_config.h>
|
||||
#include <uci.h>
|
||||
#include "ucix.h"
|
||||
|
||||
static struct uci_ptr ptr;
|
||||
|
||||
static inline int ucix_get_ptr(struct uci_context *ctx, const char *p, const char *s, const char *o, const char *t)
|
||||
{
|
||||
memset(&ptr, 0, sizeof(ptr));
|
||||
ptr.package = p;
|
||||
ptr.section = s;
|
||||
ptr.option = o;
|
||||
ptr.value = t;
|
||||
return uci_lookup_ptr(ctx, &ptr, NULL, true);
|
||||
}
|
||||
|
||||
struct uci_context* ucix_init(const char *config_file)
|
||||
{
|
||||
struct uci_context *ctx = uci_alloc_context();
|
||||
uci_add_delta_path(ctx, "/var/state");
|
||||
if(uci_load(ctx, config_file, NULL) != UCI_OK)
|
||||
{
|
||||
printf("%s/%s is missing or corrupt\n", ctx->savedir, config_file);
|
||||
return NULL;
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
struct uci_context* ucix_init_path(const char *path, const char *config_file)
|
||||
{
|
||||
struct uci_context *ctx = uci_alloc_context();
|
||||
if(path)
|
||||
uci_set_confdir(ctx, path);
|
||||
if(uci_load(ctx, config_file, NULL) != UCI_OK)
|
||||
{
|
||||
printf("%s/%s is missing or corrupt\n", ctx->savedir, config_file);
|
||||
return NULL;
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void ucix_cleanup(struct uci_context *ctx)
|
||||
{
|
||||
uci_free_context(ctx);
|
||||
}
|
||||
|
||||
void ucix_save(struct uci_context *ctx)
|
||||
{
|
||||
uci_set_savedir(ctx, "/tmp/.uci/");
|
||||
uci_save(ctx, NULL);
|
||||
}
|
||||
|
||||
void ucix_save_state(struct uci_context *ctx)
|
||||
{
|
||||
uci_set_savedir(ctx, "/var/state/");
|
||||
uci_save(ctx, NULL);
|
||||
}
|
||||
|
||||
const char* ucix_get_option(struct uci_context *ctx, const char *p, const char *s, const char *o)
|
||||
{
|
||||
struct uci_element *e = NULL;
|
||||
const char *value = NULL;
|
||||
if(ucix_get_ptr(ctx, p, s, o, NULL))
|
||||
return NULL;
|
||||
if (!(ptr.flags & UCI_LOOKUP_COMPLETE))
|
||||
return NULL;
|
||||
e = ptr.last;
|
||||
switch (e->type)
|
||||
{
|
||||
case UCI_TYPE_SECTION:
|
||||
value = uci_to_section(e)->type;
|
||||
break;
|
||||
case UCI_TYPE_OPTION:
|
||||
switch(ptr.o->type) {
|
||||
case UCI_TYPE_STRING:
|
||||
value = ptr.o->v.string;
|
||||
break;
|
||||
default:
|
||||
value = NULL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
int ucix_get_option_int(struct uci_context *ctx, const char *p, const char *s, const char *o, int def)
|
||||
{
|
||||
const char *tmp = ucix_get_option(ctx, p, s, o);
|
||||
int ret = def;
|
||||
|
||||
if (tmp)
|
||||
ret = atoi(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ucix_add_section(struct uci_context *ctx, const char *p, const char *s, const char *t)
|
||||
{
|
||||
if(ucix_get_ptr(ctx, p, s, NULL, t))
|
||||
return;
|
||||
uci_set(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_add_option(struct uci_context *ctx, const char *p, const char *s, const char *o, const char *t)
|
||||
{
|
||||
if(ucix_get_ptr(ctx, p, s, o, (t)?(t):("")))
|
||||
return;
|
||||
uci_set(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_add_option_int(struct uci_context *ctx, const char *p, const char *s, const char *o, int t)
|
||||
{
|
||||
char tmp[64];
|
||||
snprintf(tmp, 64, "%d", t);
|
||||
ucix_add_option(ctx, p, s, o, tmp);
|
||||
}
|
||||
|
||||
void ucix_del(struct uci_context *ctx, const char *p, const char *s, const char *o)
|
||||
{
|
||||
if(!ucix_get_ptr(ctx, p, s, o, NULL))
|
||||
uci_delete(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_revert(struct uci_context *ctx, const char *p, const char *s, const char *o)
|
||||
{
|
||||
if(!ucix_get_ptr(ctx, p, s, o, NULL))
|
||||
uci_revert(ctx, &ptr);
|
||||
}
|
||||
|
||||
void ucix_for_each_section_type(struct uci_context *ctx,
|
||||
const char *p, const char *t,
|
||||
void (*cb)(const char*, void*), void *priv)
|
||||
{
|
||||
struct uci_element *e;
|
||||
if(ucix_get_ptr(ctx, p, NULL, NULL, NULL))
|
||||
return;
|
||||
uci_foreach_element(&ptr.p->sections, e)
|
||||
if (!strcmp(t, uci_to_section(e)->type))
|
||||
cb(e->name, priv);
|
||||
}
|
||||
|
||||
int ucix_commit(struct uci_context *ctx, const char *p)
|
||||
{
|
||||
if(ucix_get_ptr(ctx, p, NULL, NULL, NULL))
|
||||
return 1;
|
||||
return uci_commit(ctx, &ptr.p, false);
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Copyright (C) 2008 John Crispin <blogic@openwrt.org>
|
||||
*/
|
||||
|
||||
#ifndef _UCI_H__
|
||||
#define _UCI_H__
|
||||
struct uci_context* ucix_init(const char *config_file);
|
||||
struct uci_context* ucix_init_path(const char *path, const char *config_file);
|
||||
void ucix_cleanup(struct uci_context *ctx);
|
||||
void ucix_save(struct uci_context *ctx);
|
||||
void ucix_save_state(struct uci_context *ctx);
|
||||
const char* ucix_get_option(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o);
|
||||
int ucix_get_option_int(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o, int def);
|
||||
void ucix_add_section(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *t);
|
||||
void ucix_add_option(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o, const char *t);
|
||||
void ucix_add_option_int(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o, int t);
|
||||
int ucix_commit(struct uci_context *ctx, const char *p);
|
||||
void ucix_revert(struct uci_context *ctx,
|
||||
const char *p, const char *s, const char *o);
|
||||
void ucix_del(struct uci_context *ctx, const char *p,
|
||||
const char *s, const char *o);
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
config mcpd 'mcpd'
|
||||
option igmp_proxy_interfaces 'wan'
|
||||
option igmp_default_version '2'
|
||||
option igmp_query_interval '125'
|
||||
option igmp_query_response_interval '100'
|
||||
option igmp_last_member_query_interval '10'
|
||||
option igmp_robustness_value '2'
|
||||
option igmp_max_groups '25'
|
||||
option igmp_max_sources '10'
|
||||
option igmp_max_members '25'
|
||||
option igmp_fast_leave '1'
|
||||
option igmp_proxy_enable '1'
|
||||
option igmp_snooping_enable '2'
|
||||
option igmp_snooping_interfaces 'br-lan'
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
|
||||
pidof mcpd >/dev/null || exit 0
|
||||
/etc/init.d/mcpd enabled && /etc/init.d/mcpd reload
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
include /lib/network
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=mcpd
|
||||
PROG=/usr/sbin/mcpd
|
||||
|
||||
|
||||
dscp_mark() {
|
||||
local mark=$1
|
||||
local dm=0
|
||||
while [[ $dm -le 56 ]]; do
|
||||
iptables -t mangle -D POSTROUTING -p igmp -j DSCP --set-dscp $dm 2>/dev/null
|
||||
dm=$((dm+2))
|
||||
done
|
||||
[ -n "$mark" ] && iptables -t mangle -A POSTROUTING -p igmp -j DSCP --set-dscp-class $mark
|
||||
}
|
||||
|
||||
mcpd_configure() {
|
||||
local igmp_snooping_enable
|
||||
local igmp_snooping_interfaces
|
||||
local igmp_proxy_interfaces
|
||||
local igmp_proxy_enable
|
||||
local device
|
||||
local proxdevs=""
|
||||
local proxbridge=""
|
||||
local bridged=0
|
||||
local routed=0
|
||||
local _i
|
||||
|
||||
config_load mcpd
|
||||
config_get igmp_snooping_enable mcpd igmp_snooping_enable
|
||||
config_get igmp_snooping_interfaces mcpd igmp_snooping_interfaces
|
||||
config_get igmp_proxy_interfaces mcpd igmp_proxy_interfaces
|
||||
config_get igmp_proxy_enable mcpd igmp_proxy_enable
|
||||
# disable port snooping on all bridges
|
||||
for br in $(brctl show | grep 'br-' | awk '{print$1}' | tr '\n' ' '); do
|
||||
brctl enableportsnooping $br 0
|
||||
done
|
||||
|
||||
grep igmp /etc/config/mcpd | awk '{print $2 $3}' | sed -e "s/[\'\"]/ /g" | tr "_" "-" > /var/mcpd.conf
|
||||
|
||||
for proxif in $igmp_proxy_interfaces; do
|
||||
json_load "$(ifstatus $proxif)"
|
||||
json_get_var device device
|
||||
case "$device" in
|
||||
br-*)
|
||||
bridged=1
|
||||
proxbridge="$device"
|
||||
json_load "$(devstatus $device)"
|
||||
_i=1
|
||||
json_select bridge-members
|
||||
while json_get_var dev $_i; do
|
||||
case "$dev" in
|
||||
*.*)
|
||||
ifconfig $dev | grep RUNNING >/dev/null && proxdevs="$proxdevs $dev" && break
|
||||
;;
|
||||
esac
|
||||
_i=$(($_i + 1))
|
||||
done
|
||||
json_select ..
|
||||
;;
|
||||
*)
|
||||
proxdevs="$proxdevs $device"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ $igmp_proxy_enable -eq 1 ]; then
|
||||
sed -i "s/igmp-proxy-interfaces.*/igmp-proxy-interfaces $proxdevs/" /tmp/mcpd.conf
|
||||
else
|
||||
sed -i "s/igmp-proxy-interfaces.*/igmp-proxy-interfaces /" /tmp/mcpd.conf
|
||||
fi
|
||||
echo "igmp-mcast-interfaces $proxdevs" >> /tmp/mcpd.conf
|
||||
|
||||
sed -i "s/igmp-snooping-interfaces.*/igmp-snooping-interfaces $igmp_snooping_interfaces/" /tmp/mcpd.conf
|
||||
for snpif in $igmp_snooping_interfaces; do
|
||||
case "$snpif" in
|
||||
br-*)
|
||||
# enable port snooping on the bridge
|
||||
/usr/sbin/brctl enableportsnooping $snpif "$igmp_snooping_enable"
|
||||
|
||||
if [ "$snpif" != "$proxbridge" ]; then
|
||||
routed=1
|
||||
json_load "$(devstatus $snpif)"
|
||||
_i=1
|
||||
json_select bridge-members
|
||||
while json_get_var dev $_i; do
|
||||
case "$dev" in
|
||||
*.*)
|
||||
routed=0
|
||||
;;
|
||||
esac
|
||||
_i=$(($_i + 1))
|
||||
done
|
||||
json_select ..
|
||||
fi
|
||||
;;
|
||||
eth%d|wl%d*)
|
||||
routed=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$((bridged+routed))" == "2" ]; then
|
||||
# enable bridged+routed igmp snooping mode
|
||||
echo "igmp-bridged-routed 1" >> /tmp/mcpd.conf
|
||||
fi
|
||||
|
||||
config_get igmp_dscp_mark mcpd igmp_dscp_mark
|
||||
dscp_mark $igmp_dscp_mark
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger network mcpd
|
||||
}
|
||||
|
||||
start_service() {
|
||||
mcpd_configure
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
service_stop $PROG
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
@@ -1,69 +1,123 @@
|
||||
#
|
||||
# Copyright (C) 2006-2012 OpenWrt.org
|
||||
#
|
||||
# Copyright (C) 2009-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=mtd-utils
|
||||
PKG_VERSION:=1.4.5
|
||||
PKG_RELEASE:=1
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
PKG_SOURCE_URL:=http://ihgsp.inteno.se/git/mtd-utils
|
||||
else
|
||||
PKG_SOURCE_URL:=git@ihgsp.inteno.se:mtd-utils
|
||||
endif
|
||||
PKG_VERSION:=1.5.1
|
||||
PKG_RELEASE:=3
|
||||
PKG_INSTALL:=1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=3a0d8a01d91e0e80bc59d6320e91c07383f0ede2
|
||||
PKG_SOURCE_VERSION:=dd9f464eced6af7d5e6a4a920b727421229310f4
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/mtd-utils
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_CAT:=zcat
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
FILES:= \
|
||||
docfdisk \
|
||||
doc_loadbios \
|
||||
flashcp \
|
||||
flash_erase \
|
||||
flash_lock \
|
||||
flash_otp_dump \
|
||||
flash_otp_info \
|
||||
flash_otp_lock \
|
||||
flash_otp_write \
|
||||
flash_unlock \
|
||||
ftl_check \
|
||||
ftl_format \
|
||||
imagewrite \
|
||||
jffs2dump \
|
||||
jffs2reader \
|
||||
mkfs.jffs2 \
|
||||
mtd_debug \
|
||||
nanddump \
|
||||
nandtest \
|
||||
nandwrite \
|
||||
nftldump \
|
||||
nftl_format \
|
||||
recv_image \
|
||||
rfddump \
|
||||
rfdformat \
|
||||
serve_image \
|
||||
sumtool
|
||||
|
||||
HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs
|
||||
CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) -L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT
|
||||
ifneq ($(HOST_OS),Linux)
|
||||
CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include getline.h -include endian.h -I$(CURDIR)/include -include fls.h
|
||||
ifneq ($(CONFIG_LINUX_2_4),y)
|
||||
FILES += \
|
||||
mkfs.ubifs \
|
||||
mtdinfo \
|
||||
ubiattach \
|
||||
ubiblock \
|
||||
ubicrc32 \
|
||||
ubidetach \
|
||||
ubiformat \
|
||||
ubimkvol \
|
||||
ubinfo \
|
||||
ubinize \
|
||||
deubinize \
|
||||
ubirename \
|
||||
ubirmvol \
|
||||
ubirsvol \
|
||||
ubiupdatevol
|
||||
endif
|
||||
|
||||
MTD_MAKEOPTS = \
|
||||
CFLAGS="$(CFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS) $(HOST_STATIC_LINKING)" \
|
||||
WITHOUT_LZO=1 WITHOUT_XATTR=1 \
|
||||
LZMA_STATIC_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a" \
|
||||
SUBDIRS="" \
|
||||
BUILDDIR="$(HOST_BUILD_DIR)"
|
||||
|
||||
define Host/Compile
|
||||
$(MAKE) -C $(HOST_BUILD_DIR)/lib \
|
||||
$(MTD_MAKEOPTS) \
|
||||
TARGETS="libmtd.a libcrc32.a" \
|
||||
LIBS="libmtd libcrc32"
|
||||
$(MAKE) -C $(HOST_BUILD_DIR) \
|
||||
$(MTD_MAKEOPTS) \
|
||||
TARGETS=mkfs.jffs2
|
||||
$(MAKE) -C $(HOST_BUILD_DIR)/ubi-utils \
|
||||
$(MTD_MAKEOPTS) \
|
||||
TARGETS=ubinize
|
||||
$(MAKE) -C $(HOST_BUILD_DIR)/mkfs.ubifs \
|
||||
$(MTD_MAKEOPTS) \
|
||||
BUILDDIR="$(HOST_BUILD_DIR)/mkfs.ubifs"
|
||||
define PartGen
|
||||
define Package/mtd-utils-$(subst _,-,$(1))
|
||||
TITLE:=MTD $(1)
|
||||
URL:=http://www.linux-mtd.infradead.org/
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=mtd-utils +zlib +liblzo +libuuid
|
||||
endef
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(CP) \
|
||||
$(HOST_BUILD_DIR)/mkfs.jffs2 \
|
||||
$(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \
|
||||
$(HOST_BUILD_DIR)/ubinize \
|
||||
$(STAGING_DIR_HOST)/bin/
|
||||
define Package/mtd-utils
|
||||
TITLE:=Utilities for flash info/debug
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/{mkfs.jffs2,mkfs.ubifs,ubinize}
|
||||
define Package/mtd-utils/description
|
||||
Utilities for manipulating memory technology devices.
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
define Package/mtd-utils/install
|
||||
true
|
||||
endef
|
||||
|
||||
$(foreach file,$(FILES),$(eval $(call PartGen,$(file))))
|
||||
|
||||
MAKE_FLAGS += \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
BUILDDIR="$(PKG_BUILD_DIR)" \
|
||||
LDLIBS+="$(LIBGCC_S)" \
|
||||
WITHOUT_XATTR=1
|
||||
|
||||
ifeq ($(CONFIG_LINUX_2_4),y)
|
||||
MAKE_FLAGS += \
|
||||
SUBDIRS=""
|
||||
endif
|
||||
|
||||
define PartInstall
|
||||
define Package/mtd-utils-$(subst _,-,$(1))/install
|
||||
$(INSTALL_DIR) \
|
||||
$$(1)/usr/sbin
|
||||
|
||||
$(INSTALL_BIN) \
|
||||
$(PKG_INSTALL_DIR)/usr/sbin/$(1) \
|
||||
$$(1)/usr/sbin/
|
||||
endef
|
||||
endef
|
||||
|
||||
$(foreach file,$(FILES),$(eval $(call PartInstall,$(file))))
|
||||
|
||||
$(eval $(call BuildPackage,mtd-utils))
|
||||
$(foreach file,$(FILES),$(eval $(call BuildPackage,mtd-utils-$(subst _,-,$(file)))))
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#include <string.h>
|
||||
#define fls local_fls
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef _LINUX_TYPES_H
|
||||
#define _LINUX_TYPES_H
|
||||
|
||||
#include <mtd/ubi-media.h>
|
||||
|
||||
typedef uint16_t __u16;
|
||||
typedef uint32_t __u32;
|
||||
typedef uint64_t __u64;
|
||||
|
||||
typedef __u16 __le16;
|
||||
typedef __u32 __le32;
|
||||
typedef __u64 __le64;
|
||||
typedef __u64 off64_t;
|
||||
|
||||
typedef __u16 __sum16;
|
||||
typedef __u32 __wsum;
|
||||
|
||||
#endif /* _LINUX_TYPES_H */
|
||||
40
natalie-dect-h/Makefile
Normal file
40
natalie-dect-h/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=natalie-dect-h
|
||||
PKG_VERSION:=11.19
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/natalie-dect-h
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=c2139d05e3d082f1dcf58ce3f19306cb76fd0873
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
define Package/natalie-dect-h
|
||||
SECTION:=net
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Dect stack headers
|
||||
URL:=
|
||||
endef
|
||||
|
||||
define Package/natalie-dect-h/description
|
||||
Kernel dect driver headers
|
||||
endef
|
||||
|
||||
|
||||
define Package/natalie-dect-h/install
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/natalie-dect
|
||||
$(CP) -r $(PKG_BUILD_DIR)/SrcHeaders/* $(STAGING_DIR)/usr/include/natalie-dect/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,natalie-dect-h))
|
||||
63
natalie-dect/Makefile
Normal file
63
natalie-dect/Makefile
Normal file
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright (C) 2006-2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=natalie-dect
|
||||
PKG_VERSION:=11.19
|
||||
|
||||
PKG_SOURCE_VERSION:=2015e8106c7d541dd038381c2845bd8462d74a30
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_KERNEL_PROFILE)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
|
||||
PKG_NAME:=natalie-dect-open
|
||||
else
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:natalie-dect-11.19
|
||||
PKG_SOURCE_PROTO:=git
|
||||
endif
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
|
||||
BCM_KERNEL_VERSION=`cat $(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-*/include/config/kernel.release`
|
||||
|
||||
export BUILD_DIR
|
||||
export BCM_KERNEL_VERSION
|
||||
|
||||
define Package/natalie-dect
|
||||
SECTION:=net
|
||||
CATEGORY:=Base system
|
||||
TITLE:=Dect stack
|
||||
URL:=
|
||||
DEPENDS:=bcmkernel
|
||||
endef
|
||||
|
||||
define Package/natalie-dect/description
|
||||
Kernel dect driver
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
define Build/Compile
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/natalie-dect/install
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/
|
||||
ifeq ($(CONFIG_BCM_OPEN),y)
|
||||
$(CP) $(PKG_BUILD_DIR)/dect.ko $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/dect.ko
|
||||
else
|
||||
$(CP) $(PKG_BUILD_DIR)/NatalieFpCvm6362/Src/Projects/NatalieV3/FpCvm/Linux6362/dects.ko $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/dect.ko
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,natalie-dect))
|
||||
60
peripheral_manager/Makefile
Normal file
60
peripheral_manager/Makefile
Normal file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# Copyright (C) 2006-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=peripheral_manager
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=6a89f70edec94286a790cbb7c76debec6bb1c873
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se/peripheral_manager
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
# support parallel build
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/peripheral_manager
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Application deamon for handling of peripheral
|
||||
URL:=
|
||||
DEPENDS:=+libuci +libubus +libblobmsg-json bcmkernel
|
||||
endef
|
||||
|
||||
define Package/peripheral_manager/description
|
||||
Application handling peripheral
|
||||
endef
|
||||
|
||||
TARGET_CPPFLAGS := \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
|
||||
$(TARGET_CPPFLAGS)
|
||||
|
||||
define Package/peripheral_manager/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/peripheral_manager $(1)/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gpio_test $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,peripheral_manager))
|
||||
25
peripheral_manager/files/etc/init.d/peripheral_manager
Executable file
25
peripheral_manager/files/etc/init.d/peripheral_manager
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=19
|
||||
STOP=91
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=peripheral_manager
|
||||
PROG=/sbin/peripheral_manager
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" -f
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_running() {
|
||||
ubus -t 2 wait_for leds
|
||||
ubus call led.status set '{"state":"ok"}'
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/peripheral_manager
|
||||
}
|
||||
|
||||
83
picolisp/Makefile
Normal file
83
picolisp/Makefile
Normal file
@@ -0,0 +1,83 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=picolisp
|
||||
PKG_VERSION=3.1.10
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/picoLisp
|
||||
PKG_SOURCE:=picoLisp-$(PKG_VERSION).tgz
|
||||
PKG_SOURCE_URL:=http://software-lab.de/
|
||||
PKG_MD5SUM:=ac19fd6ff4d05dd2b15ea00d1ed591e7
|
||||
|
||||
PKG_BUILD_DEPENDS+= +libopenssl +@OPENSSL_WITH_EC2M
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/picolisp
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=PicoLisp interpreter
|
||||
DEPENDS:= +libopenssl +@OPENSSL_WITH_EC2M
|
||||
URL:=http://www.picolisp.org/
|
||||
MAINTAINER:=Jeronimo Pellegrini <j_p@aleph0.info>
|
||||
endef
|
||||
|
||||
define Package/picolisp/description
|
||||
Picolisp is yet another dialect of the Lisp language, specially written to be radically practical and simple.
|
||||
endef
|
||||
|
||||
TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
|
||||
# A hack to make picoLisp's Makefile see the include path:
|
||||
MAKE_FLAGS += C_INCLUDE_PATH+=$(STAGING_DIR)/usr/include/
|
||||
|
||||
define Package/picolisp/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib/picolisp/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/picolisp/lib
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/pil $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/psh $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/watchdog $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/picolisp $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/*.l $(1)/usr/lib/picolisp/
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/ht \
|
||||
$(PKG_BUILD_DIR)/lib/ext \
|
||||
$(PKG_BUILD_DIR)/lib/adm.l \
|
||||
$(PKG_BUILD_DIR)/lib/app.l \
|
||||
$(PKG_BUILD_DIR)/lib/boss.l \
|
||||
$(PKG_BUILD_DIR)/lib/btree.l \
|
||||
$(PKG_BUILD_DIR)/lib/conDbgc.l \
|
||||
$(PKG_BUILD_DIR)/lib/db.l \
|
||||
$(PKG_BUILD_DIR)/lib/debug.l \
|
||||
$(PKG_BUILD_DIR)/lib/edit.l \
|
||||
$(PKG_BUILD_DIR)/lib/ed.l \
|
||||
$(PKG_BUILD_DIR)/lib/form.l \
|
||||
$(PKG_BUILD_DIR)/lib/frac.l \
|
||||
$(PKG_BUILD_DIR)/lib/heartbeat.l \
|
||||
$(PKG_BUILD_DIR)/lib/http.l \
|
||||
$(PKG_BUILD_DIR)/lib/import.l \
|
||||
$(PKG_BUILD_DIR)/lib/led.l \
|
||||
$(PKG_BUILD_DIR)/lib/lint.l \
|
||||
$(PKG_BUILD_DIR)/lib/math32.l \
|
||||
$(PKG_BUILD_DIR)/lib/math64.l \
|
||||
$(PKG_BUILD_DIR)/lib/math.l \
|
||||
$(PKG_BUILD_DIR)/lib/misc.l \
|
||||
$(PKG_BUILD_DIR)/lib/pilog.l \
|
||||
$(PKG_BUILD_DIR)/lib/prof.l \
|
||||
$(PKG_BUILD_DIR)/lib/ps.l \
|
||||
$(PKG_BUILD_DIR)/lib/rsa.l \
|
||||
$(PKG_BUILD_DIR)/lib/scrape.l \
|
||||
$(PKG_BUILD_DIR)/lib/simul.l \
|
||||
$(PKG_BUILD_DIR)/lib/sq.l \
|
||||
$(PKG_BUILD_DIR)/lib/too.l \
|
||||
$(PKG_BUILD_DIR)/lib/xhtml.l \
|
||||
$(PKG_BUILD_DIR)/lib/xm.l \
|
||||
$(PKG_BUILD_DIR)/lib/xml.l \
|
||||
$(PKG_BUILD_DIR)/lib/xmlrpc.l $(1)/usr/lib/picolisp/lib/
|
||||
touch $(1)/usr/lib/picolisp/lib/tags
|
||||
$(STRIP) $(1)/usr/bin/picolisp
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,picolisp))
|
||||
43
picolisp/patches/001-mips.diff
Normal file
43
picolisp/patches/001-mips.diff
Normal file
@@ -0,0 +1,43 @@
|
||||
diff -Nur picoLisp/Makefile picoLisp-new/Makefile
|
||||
--- picoLisp/Makefile 1969-12-31 21:00:00.000000000 -0300
|
||||
+++ picoLisp-new/Makefile 2015-06-02 15:38:07.469726899 -0300
|
||||
@@ -0,0 +1,6 @@
|
||||
+all:
|
||||
+ (cd src; make)
|
||||
+
|
||||
+clean:
|
||||
+ (cd src; make clean)
|
||||
+
|
||||
diff -Nur picoLisp/src/Makefile picoLisp-new/src/Makefile
|
||||
--- picoLisp/src/Makefile 2015-03-31 15:48:22.000000000 -0300
|
||||
+++ picoLisp-new/src/Makefile 2015-06-02 15:40:43.541491599 -0300
|
||||
@@ -6,9 +6,13 @@
|
||||
|
||||
picoFiles = main.c gc.c apply.c flow.c sym.c subr.c big.c io.c net.c tab.c
|
||||
|
||||
-CC = gcc
|
||||
+#CC = gcc
|
||||
# CCLD is the cc (compiler frontend) to use for the link step.
|
||||
-CCLD = gcc
|
||||
+#CCLD = gcc
|
||||
+
|
||||
+# Honor the $(CC) variable, inherited form the environment (it's essential
|
||||
+# when cross-compiling)
|
||||
+CCLD = $(CC)
|
||||
|
||||
CFLAGS = -c -O2 -pipe \
|
||||
-falign-functions=32 -fomit-frame-pointer -fno-strict-aliasing \
|
||||
@@ -19,10 +23,10 @@
|
||||
|
||||
ifeq ($(shell uname), Linux)
|
||||
OS = Linux
|
||||
- CFLAGS += -m32
|
||||
- PICOLISP-FLAGS = -m32 -rdynamic
|
||||
+ CFLAGS += -mabi=32 -fPIC
|
||||
+ PICOLISP-FLAGS = -rdynamic
|
||||
LIB-FLAGS = -lm -ldl
|
||||
- DYNAMIC-LIB-FLAGS = -m32 -shared -export-dynamic
|
||||
+ DYNAMIC-LIB-FLAGS = -shared -export-dynamic -fPIC
|
||||
LCRYPT = -lcrypt
|
||||
STRIP = strip
|
||||
else
|
||||
@@ -8,13 +8,12 @@ PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/port-management
|
||||
CATEGORY:=Base system
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Port management tool
|
||||
endef
|
||||
|
||||
define Package/port-management/description
|
||||
port-management contains necessary tools to create
|
||||
layer2 interfaces
|
||||
Port configuration utility
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
|
||||
30
power-management/Makefile
Normal file
30
power-management/Makefile
Normal file
@@ -0,0 +1,30 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=power-management
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/power-management
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Power management tool
|
||||
endef
|
||||
|
||||
define Package/power-management/description
|
||||
Control Broadcom power options
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/power-management/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,power-management))
|
||||
6
power-management/files/etc/config/power_mgmt
Normal file
6
power-management/files/etc/config/power_mgmt
Normal file
@@ -0,0 +1,6 @@
|
||||
config power_mgmt 'power_mgmt'
|
||||
option avs 'stopped'
|
||||
option cpuspeed '0'
|
||||
option cpur4kwait '0'
|
||||
option ethapd '0'
|
||||
option eee '0'
|
||||
43
power-management/files/etc/init.d/power_mgmt
Executable file
43
power-management/files/etc/init.d/power_mgmt
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=13
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
parsebool() {
|
||||
[ "$1" = "1" ] && echo "on" || echo "off"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load power_mgmt
|
||||
|
||||
local speed
|
||||
config_get speed power_mgmt cpuspeed
|
||||
pwrctl config --cpuspeed $speed
|
||||
|
||||
local cpur4kwait
|
||||
config_get cpur4kwait power_mgmt cpur4kwait
|
||||
pwrctl config --wait $(parsebool $cpur4kwait)
|
||||
|
||||
local sr
|
||||
config_get sr power_mgmt sr
|
||||
pwrctl config --sr $(parsebool $sr)
|
||||
|
||||
local ethapd
|
||||
config_get ethapd power_mgmt ethapd
|
||||
pwrctl config --ethapd $(parsebool $ethapd)
|
||||
|
||||
local eee
|
||||
config_get eee power_mgmt eee
|
||||
pwrctl config --eee $(parsebool $eee)
|
||||
|
||||
local avs
|
||||
config_get avs power_mgmt avs
|
||||
pwrctl config --avs $avs
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger power_mgmt
|
||||
}
|
||||
|
||||
53
qrencode/Makefile
Normal file
53
qrencode/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2009 ePoint Systems Ltd.
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=qrencode
|
||||
PKG_VERSION:=3.0.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=2f575b43703c801f4f7bfac65e8845ce967c3d9e
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/qrencode
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib -lpng
|
||||
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
|
||||
define Package/qrencode
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libpng
|
||||
TITLE:=QRcode encoder library
|
||||
URL:=http://megaui.net/fukuchi/works/qrencode/index.en.html
|
||||
endef
|
||||
|
||||
define Package/qrencode/description
|
||||
Libqrencode is a C library for encodingdata in a QR Code symbol, a
|
||||
kind of 2D symbology that can be scanned by handy terminals such as
|
||||
a mobile phone with CCD. The capacity of QR Code is up to 7000
|
||||
digits or 4000 characters, and is highly robust.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) LINUX_DIR=$(LINUX_DIR) LDFLAGS="$(TARGET_LDFLAGS)" CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include -I$(STAGING_DIR)/usr/include"
|
||||
endef
|
||||
|
||||
define Package/qrencode/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/qrencode $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,qrencode))
|
||||
51
questd/Makefile
Normal file
51
questd/Makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Copyright (C) 2013 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=questd
|
||||
PKG_VERSION:=2.0.6
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE_VERSION:=fcb6e59c6a77893982bb99d7d74e001b8d4173dc
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/questd
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_bcmkernel),y)
|
||||
BCMKERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
|
||||
else
|
||||
BCMKERNEL_DIR:=$(BUILD_DIR)/bcmopen-consumer/bcm963xx
|
||||
endif
|
||||
export BCMKERNEL_DIR
|
||||
|
||||
define Package/questd
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread
|
||||
TITLE:=router info daemon
|
||||
endef
|
||||
|
||||
define Package/questd/description
|
||||
questd collects system and network information and presents
|
||||
this information via ubus
|
||||
endef
|
||||
|
||||
define Package/questd/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_DIR) $(1)/tmp
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/questd $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,questd))
|
||||
29
questd/files/etc/init.d/quest
Executable file
29
questd/files/etc/init.d/quest
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=14
|
||||
STOP=96
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=questd
|
||||
PROG=/sbin/questd
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/questd
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger network wireless
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
ubus call router reload
|
||||
}
|
||||
|
||||
5
questd/files/tmp/igmp_snooping
Normal file
5
questd/files/tmp/igmp_snooping
Normal file
@@ -0,0 +1,5 @@
|
||||
igmp snooping 2 proxy 1 lan2lan-snooping 0/0, rate-limit 0pps, priority -1
|
||||
bridge device src-dev #tags lan-tci wan-tci group mode RxGroup source reporter timeout Index ExcludPt
|
||||
br-lan eth5 eth2.1 00 0x0000 0xffffffff 0xe0027ffe EX 0xe0027ffe 0x00000000 0xc0a801f1 258 0x401e0001 -1
|
||||
br-lan eth5 eth2.1 00 0x0000 0xffffffff 0xefc3ffff EX 0xefc3ffff 0x00000000 0xc0a801f1 258 0x400e0001 -1
|
||||
br-lan eth5 eth2.1 00 0x0000 0xffffffff 0xefffffff EX 0xefffffff 0x00000000 0xc0a801f1 258 0x40070001 -1
|
||||
53
sipcalc/Makefile
Normal file
53
sipcalc/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2006-2009 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sipcalc
|
||||
PKG_VERSION:=1.1.5
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.routemeister.net/projects/sipcalc/files \
|
||||
http://download.google.com/mirror
|
||||
PKG_MD5SUM:=8d59e70d21d8f0568e310d342e3e2306
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sipcalc
|
||||
SECTION:=ipv6
|
||||
CATEGORY:=Network
|
||||
TITLE:=IPv6 IPv4 Calculation Program
|
||||
URL:=http://www.routemeister.net/projects/sipcalc/
|
||||
DEPENDS:=+kmod-ipv6
|
||||
endef
|
||||
|
||||
define Package/sipcalc/description
|
||||
IPv6 IPv4 Calculation Program.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/Default,\
|
||||
--with-pidfile=/var/run/sipcalc.pid \
|
||||
)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
sipcalc_LDADD=""
|
||||
endef
|
||||
|
||||
#define Package/sipcalc/conffiles
|
||||
#/etc/config/sipcalc
|
||||
#endef
|
||||
|
||||
define Package/sipcalc/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sipcalc $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sipcalc))
|
||||
@@ -1,45 +1,50 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=tptest
|
||||
PKG_RELEASE:=0
|
||||
PKG_VERSION:=1.3
|
||||
PKG_RELEASE:=0
|
||||
|
||||
PKG_SOURCE_VERSION:=4dfab45a92328226c8182347df50e86a5d72ca5f
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/tptest
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
|
||||
TARGET_CFLAGS+= \
|
||||
-DUNIX -DLINUX
|
||||
-DUNIX -DLINUX
|
||||
|
||||
MAKE_OPTS:= \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
ARCH="$(LINUX_KARCH)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
SUBDIRS="$(PKG_BUILD_DIR)" \
|
||||
|
||||
define Package/tptest
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TPTEST speed test utility
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=TPTEST speed test utility
|
||||
endef
|
||||
|
||||
define Package/tptest/description
|
||||
TPTEST speed test utility
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) LINUX_DIR=$(LINUX_DIR) MAKE_OPTS=$(MAKE_OPTS) LDFLAGS="$(TARGET_LDFLAGS)" CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include -I$(STAGING_DIR)/usr/include"
|
||||
endef
|
||||
|
||||
define Package/tptest/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tptest $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,tptest))
|
||||
|
||||
16
tptest/files/etc/config/speedtest
Normal file
16
tptest/files/etc/config/speedtest
Normal file
@@ -0,0 +1,16 @@
|
||||
config testserver '1'
|
||||
option server 'tptest.bredband.net'
|
||||
option port '1640'
|
||||
|
||||
config testserver '2'
|
||||
option server 'tptest.dataphone.se'
|
||||
option port '1640'
|
||||
|
||||
config testserver '3'
|
||||
option server 'referens.sth.ip-performance.se'
|
||||
option port '1642'
|
||||
|
||||
config testserver '4'
|
||||
option server 'tptest.songnetworks.se'
|
||||
option port '1640'
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
TPTEST engine changelog
|
||||
-----------------------
|
||||
|
||||
|
||||
Version 3.15:
|
||||
|
||||
- Modified TPEngine struct to include "UINT32 start_tcpsend_bytes" and
|
||||
"UINT32 start_tcprecv_bytes", which are used by tpclient.c:AdvanceTest()
|
||||
as start values for tcpBytes when doing TCP send and receive tests.
|
||||
Previously, the values were a #define (START_TCP_BYTES).
|
||||
|
||||
This modification allows a (TPTEST/Statistik) client program to perform
|
||||
auto-TCP tests more effectively.
|
||||
|
||||
- Added "char email[101]" and "char pwd[101]" to TPEngine struct.
|
||||
(more TPTEST/Statistik support).
|
||||
|
||||
- Stat reports now include "email=x;pwd=y" also, no matter if email or
|
||||
pwd exists/is used or not.
|
||||
|
||||
- New test modes supported by AdvanceTest():
|
||||
M_TCP_AUTO, M_TCP_AUTO_SEND, M_TCP_AUTO_RECV
|
||||
|
||||
|
||||
Version 3.16:
|
||||
|
||||
- Added "int socket_sndbuf, socket_rcvbuf, cur_socket_sndbuf, cur_socket_rcvbuf"
|
||||
to TPEngine struct. socket_sndbuf/socket_rcvbuf are used by the application
|
||||
to tell the IO module that it would like certain SO_SNDBUF/SO_RCVBUF values
|
||||
set for data sockets (only. The control socket will use default values for
|
||||
SO_SNDBUF/SO_RCVBUF). If the IO module sees that these variables are non-zero
|
||||
it should try to set the send- and receive buffers for new data sockets
|
||||
accordingly. The IO module should also do a getsockopt() or similar, asking
|
||||
for the actual SO_SNDBUF/SO_RCVBUF values used (after trying to set them) and
|
||||
store the results in cur_socket_rcvbuf/cur_socket_sndbuf. The application may
|
||||
then determine what buffer settings were actually used for the test.
|
||||
|
||||
Note that data sockets aren't created by the engine until a test has been
|
||||
initiated and test parameters have been negotiated between client and server.
|
||||
This means that an application has to e.g. wait until the engine state is
|
||||
"engp->state == CLSM_TESTLOOP" before checking what actual values for
|
||||
SO_SNDBUF/SO_RCVBUF are used.
|
||||
|
||||
Also worth knowing is that SO_SNDBUF and SO_RCVBUF are used by most Unix-like
|
||||
OS's to determine TCP window size. Setting both values to e.g. 65536 on both
|
||||
the client and server side will cause the machines to negotiate that value
|
||||
for the TCP window size when the data connection is set up in a TCP test.
|
||||
|
||||
|
||||
@@ -1,459 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
CC = gcc
|
||||
MAKEDEPEND = makedepend
|
||||
CDEBUG = -g
|
||||
EXTRADEFINES = -DUNIX -DLINUX
|
||||
CFLAGS = ${CDEBUG} ${EXTRADEFINES} ${INCL} -Wall
|
||||
LDFLAGS = ${CDEBUG}
|
||||
LIBDIR =
|
||||
LOCLIBS =
|
||||
LIBS = ${LOCLIBS} ${SYSLIBS}
|
||||
OBJS = tpio_unix.o tpengine.o tpcommon.o client.o tpclient.o getopt.o
|
||||
SRCS = tpio_unix.c tpengine.c tpcommon.c client.c tpclient.c getopt.c
|
||||
LIBSRCS =
|
||||
ISRCS = tpengine.h tpio.h tpio_unix.h server.h tpclient.h
|
||||
ALLSRCS = ${SRCS} ${ISRCS} ${LIBSRCS}
|
||||
|
||||
all: tptest
|
||||
|
||||
tptest: ${OBJS}
|
||||
${CC} ${LDFLAGS} -o tptest ${OBJS} ${LIBDIR} ${LIBS}
|
||||
|
||||
clean:
|
||||
rm -f tptest core *.o *.BAK *.bak *.CKP a.out
|
||||
|
||||
depend:
|
||||
${MAKEDEPEND} ${INCL} ${SRCS} ${LIBSRCS}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
$Id: README,v 1.1 2002/09/12 19:28:38 rlonn Exp $
|
||||
$Source: /cvsroot/tptest/os-dep/unix/README,v $
|
||||
|
||||
tpio_unix is the platform-dependent communications module for Unix.
|
||||
It has been compiled and tested on Solaris 2.8, Redhat Linux 7.0,
|
||||
OpenBSD 2.7 and NetBSD 1.5.
|
||||
|
||||
To build tpio_unix.o
|
||||
|
||||
Do:
|
||||
|
||||
On Solaris: gcc -c tpio_unix.c -DUNIX -DSOLARIS
|
||||
On *BSD: gcc -c tpio_unix.c -DUNIX -DOPENBSD
|
||||
On Linux: gcc -c tpio_unix.c -DUNIX -DLINUX
|
||||
|
||||
The resulting tpio_unix.o is used together with the test engine files
|
||||
(tpengine.o, tpcommon.o, tpclient.o) to create clients and servers.
|
||||
|
||||
|
||||
@@ -1,578 +0,0 @@
|
||||
/*
|
||||
* $Id: client.c,v 1.6 2004/05/17 15:11:55 rlonn Exp $
|
||||
* $Source: /cvsroot/tptest/apps/unix/client/client.c,v $
|
||||
*
|
||||
* TPTEST 3.0 (C) Copyright II-Stiftelsen 2002
|
||||
*
|
||||
* client.c - TPTEST 3.0 client
|
||||
*
|
||||
* Written by
|
||||
* Ragnar L<>nn <prl@gatorhole.com>
|
||||
*
|
||||
* This file is part of the TPTEST system.
|
||||
* See the file LICENSE for copyright notice.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef UNIX
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <time.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include "tpengine.h"
|
||||
#include "tpcommon.h"
|
||||
#include "tpclient.h"
|
||||
#include "tpio.h"
|
||||
|
||||
/* globals */
|
||||
int verbosity = 0;
|
||||
int syslog_verbosity = 0;
|
||||
int no_output = 0;
|
||||
int is_v4 = 0;
|
||||
int use_delay = 0;
|
||||
int repeat = 1;
|
||||
char output_text[400];
|
||||
|
||||
/* prototypes */
|
||||
void usage(char *);
|
||||
void log_error(char *);
|
||||
void log_text(int);
|
||||
LONG_LONG timediff(struct timeval *, struct timeval *);
|
||||
void ReportResults(int, TPEngine *, time_t *, time_t *);
|
||||
|
||||
void usage(char *s) {
|
||||
printf("Usage: tptestclient [options] <-m mode> <parameters> <address> <port>\n");
|
||||
printf("\n");
|
||||
printf("options: <> = required argument, [] = optional argument\n");
|
||||
printf(" -b <local address> Bind to local address/interface\n");
|
||||
printf(" -n <repetitions> Repeat test n number of times (0 = infinite)\n");
|
||||
printf(" -v <verbosity> Set verbosity level\n");
|
||||
printf(" -s <verbosity> Set syslog verbosity level\n");
|
||||
printf(" -e <email> Set email for TPTEST/Statistik\n");
|
||||
printf(" -p <password> Set password for TPTEST/Statistik\n");
|
||||
printf(" -d <delaytime> Set delaytime between repeated tests\n");
|
||||
printf(" -S <sendbuf size> Set size of socket send buffer\n");
|
||||
printf(" -R <recvbuf size> Set size of socket receive buffer\n");
|
||||
printf(" -t No text output\n");
|
||||
printf("\n");
|
||||
printf("test modes & parameters:\n");
|
||||
printf(" udp-send | us UDP send to server\n");
|
||||
printf(" parameters: <testtime> <bitrate>\n");
|
||||
printf(" parameters: <testtime> <packetsize> <packets/sec>\n");
|
||||
printf(" udp-receive | ur UDP receive from server\n");
|
||||
printf(" parameters: <testtime> <bitrate>\n");
|
||||
printf(" parameters: <testtime> <packetsize> <packets/sec>\n");
|
||||
printf(" udp-fdx | uf UDP full duplex\n");
|
||||
printf(" parameters: <testtime> <bitrate>\n");
|
||||
printf(" parameters: <testtime> <packetsize> <packets/sec>\n");
|
||||
printf(" tcp-send | ts TCP send to server\n");
|
||||
printf(" parameters: <max testtime> <bytes to send>\n");
|
||||
printf(" tcp-receive | tr TCP receive from server\n");
|
||||
printf(" parameters: <max testtime> <bytes to receive>\n");
|
||||
printf(" tcp-send-auto | tsa TCP auto send to server\n");
|
||||
printf(" tcp-receive-auto | tra TCP auto receive from server\n");
|
||||
printf(" tcp-auto | ta TCP auto (auto send + auto receive)\n");
|
||||
printf("\n");
|
||||
if (strlen(s)) {
|
||||
printf("%s\n", s);
|
||||
}
|
||||
printf("\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
TPEngine *engp;
|
||||
int selectedMode, ch;
|
||||
int succeeds = 0;
|
||||
int fails = 0;
|
||||
int not_checked = 1;
|
||||
int delay = 30;
|
||||
double tmp;
|
||||
struct timespec sleeptime;
|
||||
time_t starttime, stoptime;
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
/* 0.5 sec wait between automatic tests */
|
||||
sleeptime.tv_sec = 0;
|
||||
sleeptime.tv_nsec = 500000000;
|
||||
|
||||
/* create engine context */
|
||||
engp = CreateContext();
|
||||
|
||||
/* check command line arguments */
|
||||
while ((ch = getopt(argc, argv, "m:b:v:s:n:e:p:d:S:R:t")) != -1) {
|
||||
switch (ch) {
|
||||
case 'm':
|
||||
if (strcasecmp(optarg, "udp-send")==0 || strcasecmp(optarg, "us")==0)
|
||||
selectedMode = CLM_UDP_SEND;
|
||||
else if (strcasecmp(optarg, "udp-receive")==0 || strcasecmp(optarg, "ur")==0)
|
||||
selectedMode = CLM_UDP_RECV;
|
||||
else if (strcasecmp(optarg, "udp-full-duplex")==0 || strcasecmp(optarg, "uf")==0)
|
||||
selectedMode = CLM_UDP_FDX;
|
||||
else if (strcasecmp(optarg, "tcp-send")==0 || strcasecmp(optarg, "ts")==0)
|
||||
selectedMode = CLM_TCP_SEND;
|
||||
else if (strcasecmp(optarg, "tcp-receive")==0 || strcasecmp(optarg, "tr")==0)
|
||||
selectedMode = CLM_TCP_RECV;
|
||||
else if (strcasecmp(optarg, "tcp-send-auto")==0 || strcasecmp(optarg, "tsa")==0)
|
||||
selectedMode = CLM_AUTO_TCP_SEND;
|
||||
else if (strcasecmp(optarg, "tcp-receive-auto")==0 || strcasecmp(optarg, "tra")==0)
|
||||
selectedMode = CLM_AUTO_TCP_RECV;
|
||||
else if (strcasecmp(optarg, "tcp-auto")==0 || strcasecmp(optarg, "ta")==0)
|
||||
selectedMode = CLM_AUTO_TCP;
|
||||
else {
|
||||
/* error, no mode supplied */
|
||||
usage("Error: no test mode supplied");
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (inet_addr(optarg) != INADDR_NONE)
|
||||
engp->myLocalAddress.s_addr = inet_addr(optarg);
|
||||
else {
|
||||
/* error - invalid IP address */
|
||||
usage("Error: invalid IP address argument for -b option");
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
engp->socket_sndbuf = atoi(optarg);
|
||||
if (engp->socket_sndbuf == 0) {
|
||||
usage("Error: invalid socket send buffer size\n");
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
engp->socket_rcvbuf = atoi(optarg);
|
||||
if (engp->socket_rcvbuf == 0) {
|
||||
usage("Error: invalid socket receive buffer size\n");
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
no_output = 1;
|
||||
break;
|
||||
case 'e':
|
||||
strncpy(engp->stats.email, optarg, 99);
|
||||
engp->stats.email[99] = '\0';
|
||||
is_v4 = 1;
|
||||
break;
|
||||
case 'd':
|
||||
delay = atoi(optarg);
|
||||
use_delay = 1;
|
||||
break;
|
||||
case 'p':
|
||||
strncpy(engp->stats.pwd, optarg, 99);
|
||||
engp->stats.pwd[99] = '\0';
|
||||
is_v4 = 1;
|
||||
break;
|
||||
case 'n':
|
||||
repeat = atoi(optarg);
|
||||
if (repeat == 0 && optarg[0] != '0') {
|
||||
/* error. non-number argument */
|
||||
usage("Error: invalid argument to -n option");
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
verbosity = atoi(optarg);
|
||||
if (verbosity == 0 && optarg[0] != '0') {
|
||||
/* error - missing argument */
|
||||
usage("Error: invalid argument to -v option");
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
syslog_verbosity = atoi(optarg);
|
||||
if (syslog_verbosity == 0 && optarg[0] != '0') {
|
||||
/* error - missing argument */
|
||||
usage("Error: invalid argument to -s option");
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage("Error: command line syntax error");
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
/* check test params for individual tests */
|
||||
switch (selectedMode) {
|
||||
case CLM_UDP_SEND:
|
||||
case CLM_UDP_RECV:
|
||||
case CLM_UDP_FDX:
|
||||
/* determine test params */
|
||||
if (argc == 4) {
|
||||
engp->sessionTime = atoi(argv[0]);
|
||||
engp->bitsPerSecond = atoi(argv[1]);
|
||||
strncpy(engp->hostName, argv[2], TP_HOST_NAME_SIZE);
|
||||
engp->hostCtrlPort = atoi(argv[3]);
|
||||
RecalculatePPSSZ(engp);
|
||||
}
|
||||
else if (argc == 5) {
|
||||
engp->sessionTime = atoi(argv[0]);
|
||||
engp->packetSize = atoi(argv[1]);
|
||||
engp->packetsPerSecond = atoi(argv[2]);
|
||||
strncpy(engp->hostName, argv[3], TP_HOST_NAME_SIZE);
|
||||
engp->hostCtrlPort = atoi(argv[4]);
|
||||
}
|
||||
/* check that we have necessary values */
|
||||
if (engp->sessionTime == 0)
|
||||
usage("Error: no test session time set");
|
||||
if (engp->bitsPerSecond == 0) {
|
||||
if (engp->packetsPerSecond == 0 || engp->packetSize == 0)
|
||||
usage("Error: no bitrate (or packet size + packet rate) set");
|
||||
}
|
||||
break;
|
||||
case CLM_TCP_SEND:
|
||||
case CLM_TCP_RECV:
|
||||
if (argc == 4) {
|
||||
engp->sessionMaxTime = atoi(argv[0]);
|
||||
engp->tcpBytes = atoi(argv[1]);
|
||||
strncpy(engp->hostName, argv[2], TP_HOST_NAME_SIZE);
|
||||
engp->hostCtrlPort = atoi(argv[3]);
|
||||
}
|
||||
if (engp->sessionMaxTime == 0)
|
||||
usage("Error: no max time set for test session");
|
||||
if (engp->tcpBytes == 0)
|
||||
usage("Error: number of TCP bytes to transfer not set");
|
||||
break;
|
||||
case CLM_AUTO_TCP_SEND:
|
||||
case CLM_AUTO_TCP_RECV:
|
||||
case CLM_AUTO_TCP:
|
||||
if (argc == 2) {
|
||||
strncpy(engp->hostName, argv[0], TP_HOST_NAME_SIZE);
|
||||
engp->hostCtrlPort = atoi(argv[1]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* shouldn't happen */
|
||||
usage("Error: unknown test mode");
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
/* error - need server and server port as commandline args */
|
||||
usage("Error: need server address and control port");
|
||||
}
|
||||
|
||||
if (engp->hostCtrlPort == 0) {
|
||||
/* error - invalid server port argument */
|
||||
usage("Error: invalid server control port argument");
|
||||
}
|
||||
|
||||
/* check server address argument */
|
||||
if (inet_addr(engp->hostName) == INADDR_NONE) {
|
||||
struct hostent * hent;
|
||||
hent = gethostbyname(engp->hostName);
|
||||
if (hent == NULL) {
|
||||
log_error("Error: hostname lookup failed");
|
||||
exit(1);
|
||||
}
|
||||
engp->hostIP.s_addr = ((struct in_addr *)(hent->h_addr))->s_addr;
|
||||
}
|
||||
else
|
||||
engp->hostIP.s_addr = inet_addr(engp->hostName);
|
||||
|
||||
engp->tpMode = CLM_NONE;
|
||||
|
||||
/* init syslog, if we want that facility */
|
||||
if (syslog_verbosity) {
|
||||
openlog("tptestclient", LOG_CONS | LOG_PID, LOG_USER);
|
||||
}
|
||||
|
||||
engp->stats.MajorVersion = MAJORVERSION;
|
||||
engp->stats.MinorVersion = MINORVERSION;
|
||||
|
||||
if (is_v4) {
|
||||
delay = 30;
|
||||
use_delay = 1;
|
||||
}
|
||||
|
||||
/* ********************************* */
|
||||
/* Main loop. May run multiple tests */
|
||||
/* ********************************* */
|
||||
|
||||
while (1) {
|
||||
|
||||
time(&starttime);
|
||||
|
||||
/* Inner main loop. This loop runs individual tests or auto-tests */
|
||||
|
||||
while (1) {
|
||||
|
||||
/* use AdvanceTest() to set test params and new test mode */
|
||||
engp->tpMode = AdvanceTest(engp, selectedMode, engp->tpMode, 0);
|
||||
if (engp->tpMode == CLM_NONE)
|
||||
break;
|
||||
|
||||
/* initiate new test */
|
||||
if (StartClientContext(engp) != 0) {
|
||||
log_error("Error: StartClientContext() failed");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
not_checked = 1;
|
||||
|
||||
if (engp->tpMode == CLM_TCP_SEND || engp->tpMode == CLM_TCP_RECV) {
|
||||
sprintf(output_text, "Server: %s:%u Test:%d Time:%u Maxtime:%u Bytes: %u\n",
|
||||
inet_ntoa(engp->hostIP), engp->hostCtrlPort,
|
||||
(int)engp->tpMode, (unsigned int)engp->sessionTime,
|
||||
(unsigned int)engp->sessionMaxTime, (unsigned int)engp->tcpBytes);
|
||||
}
|
||||
else {
|
||||
sprintf(output_text, "Server: %s:%u Test:%d Time:%u Maxtime:%u Bitrate: %s\n",
|
||||
inet_ntoa(engp->hostIP), engp->hostCtrlPort,
|
||||
(int)engp->tpMode, (unsigned int)engp->sessionTime,
|
||||
(unsigned int)engp->sessionMaxTime, Int32ToString(engp->bitsPerSecond));
|
||||
}
|
||||
log_text(2);
|
||||
|
||||
/* run test until finished or an error occurs */
|
||||
while (1) {
|
||||
if (engp->state == CLSM_FAILED) {
|
||||
/* Backoff algorithm to avoid overloading the servers. */
|
||||
/* If we fail more than 2 consecutive times, we increase */
|
||||
/* the delay between tests. If we succeed more than two */
|
||||
/* consecutive times, we decrease the delay between tests */
|
||||
/* (down to a minimum of 30 seconds) */
|
||||
if (is_v4) {
|
||||
succeeds = 0;
|
||||
if (++fails > 2) {
|
||||
delay += 30;
|
||||
fails = 0;
|
||||
}
|
||||
}
|
||||
sprintf(output_text, "Test failed. Failcode:%d Ioerror:%d\n",
|
||||
(int)engp->failCode, (int)engp->ioError);
|
||||
log_text(0);
|
||||
break;
|
||||
}
|
||||
else if (engp->state == CLSM_COMPLETE) {
|
||||
/* more backoff stuff */
|
||||
if (is_v4) {
|
||||
fails = 0;
|
||||
if (++succeeds > 2) {
|
||||
delay -= 30;
|
||||
if (delay < 30)
|
||||
delay = 30;
|
||||
succeeds = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (engp->state == CLSM_TESTLOOP && not_checked) {
|
||||
not_checked = 0;
|
||||
if (engp->socket_sndbuf != 0) {
|
||||
sprintf(output_text, "Wanted SO_SNDBUF: %d Actual SO_SNDBUF: %d\n",
|
||||
engp->socket_sndbuf, engp->cur_socket_sndbuf); log_text(2);
|
||||
}
|
||||
if (engp->socket_rcvbuf != 0) {
|
||||
sprintf(output_text, "Wanted SO_RCVBUF: %d Actual SO_RCVBUF: %d\n",
|
||||
engp->socket_rcvbuf, engp->cur_socket_rcvbuf); log_text(2);
|
||||
}
|
||||
}
|
||||
RunClientContext(engp);
|
||||
}
|
||||
|
||||
if (engp->state == CLSM_COMPLETE &&
|
||||
(selectedMode != CLM_UDP_SEND &&
|
||||
selectedMode != CLM_UDP_RECV &&
|
||||
selectedMode != CLM_UDP_FDX) ) {
|
||||
tmp = (engp->stats.BytesRecvd * 8.0) /
|
||||
timediff(&engp->stats.StartRecv, &engp->stats.StopRecv);
|
||||
sprintf(output_text, "Received %u/%u bytes in %0.2f seconds.\n",
|
||||
(unsigned int)engp->stats.BytesRecvd, (unsigned int)engp->tcpBytes,
|
||||
(double)timediff(&engp->stats.StartRecv, &engp->stats.StopRecv) / 1000000.0);
|
||||
log_text(2);
|
||||
}
|
||||
|
||||
/* sleep 0.5 seconds before starting next test, if any */
|
||||
nanosleep(&sleeptime, NULL);
|
||||
|
||||
}
|
||||
|
||||
/* note when this test stopped */
|
||||
|
||||
time(&stoptime);
|
||||
|
||||
/* Update starting values for TCP tests so future tests will find */
|
||||
/* optimal value for tcpBytes quicker */
|
||||
|
||||
if (engp->bestTCPRecvRate > 0.0)
|
||||
engp->start_tcprecv_bytes = engp->bestTCPRecvRate * 20;
|
||||
if (engp->bestTCPSendRate > 0.0)
|
||||
engp->start_tcpsend_bytes = engp->bestTCPSendRate * 20;
|
||||
|
||||
/* report results */
|
||||
ReportResults(selectedMode, engp, &starttime, &stoptime);
|
||||
|
||||
/* perform more tests or quit? */
|
||||
if (repeat != 0) {
|
||||
if (--repeat <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
/* perform more tests */
|
||||
engp->tpMode = CLM_NONE;
|
||||
engp->bestTCPRecvRate = 0.0f;
|
||||
engp->bestTCPSendRate = 0.0f;
|
||||
engp->bestUDPRecvRate = 0.0f;
|
||||
engp->bestUDPSendRate = 0.0f;
|
||||
|
||||
if (use_delay) {
|
||||
sprintf(output_text, "Sleeping %d seconds until next test...\n", delay); log_text(2);
|
||||
sleep(delay);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void log_text(int level) {
|
||||
if (no_output) return;
|
||||
if (syslog_verbosity >= level)
|
||||
syslog(LOG_NOTICE, output_text);
|
||||
if (verbosity >= level)
|
||||
printf(output_text);
|
||||
}
|
||||
|
||||
|
||||
void ReportResults(int selectedMode, TPEngine *engp, time_t * starttime, time_t * stoptime) {
|
||||
int throughput;
|
||||
LONG_LONG recvtime;
|
||||
struct tm *tmPnt;
|
||||
|
||||
sprintf(output_text, "Test results:\n"); log_text(1);
|
||||
sprintf(output_text, "-------------\n"); log_text(1);
|
||||
sprintf(output_text, "Server: %s:%d\n", inet_ntoa(engp->hostIP), engp->hostCtrlPort); log_text(1);
|
||||
sprintf(output_text, "Test: %d\n", selectedMode); log_text(1);
|
||||
|
||||
if (selectedMode == CLM_UDP_SEND || selectedMode == CLM_UDP_RECV ||
|
||||
selectedMode == CLM_TCP_SEND || selectedMode == CLM_TCP_RECV ||
|
||||
selectedMode == CLM_UDP_FDX) {
|
||||
sprintf(output_text, "Time: %lu Timelimit: %lu\n",
|
||||
engp->sessionTime, engp->sessionMaxTime); log_text(1);
|
||||
}
|
||||
|
||||
sprintf(output_text, "Test started: %s", ctime(starttime)); log_text(1);
|
||||
sprintf(output_text, "Test ended: %s", ctime(stoptime)); log_text(1);
|
||||
|
||||
/* report results from an auto test (series of tests) */
|
||||
|
||||
if (selectedMode == CLM_AUTO_TCP || selectedMode == CLM_AUTO_TCP_SEND) {
|
||||
/* report best TCP SEND results */
|
||||
sprintf(output_text, "TCP Send: %d bps (%s)\n",
|
||||
(int)(engp->bestTCPSendRate * 8.0), Int32ToString((int)(engp->bestTCPSendRate * 8.0)));
|
||||
log_text(0);
|
||||
}
|
||||
if (selectedMode == CLM_AUTO_TCP || selectedMode == CLM_AUTO_TCP_RECV) {
|
||||
/* report best TCP RECV results */
|
||||
sprintf(output_text, "TCP Recv: %d bps (%s)\n",
|
||||
(int)(engp->bestTCPRecvRate * 8.0), Int32ToString((int)(engp->bestTCPRecvRate * 8.0)));
|
||||
log_text(0);
|
||||
}
|
||||
if (selectedMode == CLM_AUTO_TCP_SEND || selectedMode == CLM_AUTO_TCP_RECV ||
|
||||
selectedMode == CLM_AUTO_TCP) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* report results from an individual test */
|
||||
|
||||
if (selectedMode == CLM_TCP_SEND || selectedMode == CLM_TCP_RECV) {
|
||||
sprintf(output_text, "TCP Bytes: %lu\n", engp->tcpBytes); log_text(1);
|
||||
}
|
||||
else {
|
||||
sprintf(output_text, "# of packets: %lu\n", engp->nPackets); log_text(1);
|
||||
sprintf(output_text, "Packetsize: %lu\n", engp->packetSize); log_text(1);
|
||||
}
|
||||
|
||||
tmPnt = localtime( (time_t *)(&engp->stats.StartSend.tv_sec) );
|
||||
sprintf(output_text, "Send start: %04d-%02d-%02d %02d:%02d:%02d.%03ld\n",
|
||||
tmPnt->tm_year + 1900, tmPnt->tm_mon + 1, tmPnt->tm_mday,
|
||||
tmPnt->tm_hour, tmPnt->tm_min, tmPnt->tm_sec,
|
||||
engp->stats.StartSend.tv_usec / 1000L ); log_text(1);
|
||||
|
||||
tmPnt = localtime( (time_t *)(&engp->stats.StopSend.tv_sec) );
|
||||
sprintf(output_text, "Send stop : %04d-%02d-%02d %02d:%02d:%02d.%03ld\n",
|
||||
tmPnt->tm_year + 1900, tmPnt->tm_mon + 1, tmPnt->tm_mday,
|
||||
tmPnt->tm_hour, tmPnt->tm_min, tmPnt->tm_sec,
|
||||
engp->stats.StopSend.tv_usec / 1000L ); log_text(1);
|
||||
|
||||
tmPnt = localtime( (time_t *)(&engp->stats.StartRecv.tv_sec) );
|
||||
sprintf(output_text, "Recv start: %04d-%02d-%02d %02d:%02d:%02d.%03ld\n",
|
||||
tmPnt->tm_year + 1900, tmPnt->tm_mon + 1, tmPnt->tm_mday,
|
||||
tmPnt->tm_hour, tmPnt->tm_min, tmPnt->tm_sec,
|
||||
engp->stats.StartRecv.tv_usec / 1000L ); log_text(1);
|
||||
|
||||
tmPnt = localtime( (time_t *)(&engp->stats.StopRecv.tv_sec) );
|
||||
sprintf(output_text, "Recv stop : %04d-%02d-%02d %02d:%02d:%02d.%03ld\n",
|
||||
tmPnt->tm_year + 1900, tmPnt->tm_mon + 1, tmPnt->tm_mday,
|
||||
tmPnt->tm_hour, tmPnt->tm_min, tmPnt->tm_sec,
|
||||
engp->stats.StopRecv.tv_usec / 1000L ); log_text(1);
|
||||
|
||||
if (selectedMode == CLM_UDP_SEND || selectedMode == CLM_UDP_RECV || selectedMode == CLM_UDP_FDX) {
|
||||
sprintf(output_text, "Packets sent: %lu\n", engp->stats.PktsSent); log_text(1);
|
||||
sprintf(output_text, "Packets received: %lu\n", engp->stats.PktsRecvd); log_text(1);
|
||||
sprintf(output_text, "Packets lost: %lu (%0.2f%%)\n", engp->stats.PktsSent - engp->stats.PktsRecvd,
|
||||
((float)(engp->stats.PktsSent - engp->stats.PktsRecvd) / (float)engp->stats.PktsSent) * 100.0);
|
||||
log_text(1);
|
||||
sprintf(output_text, "Packets unsent: %lu\n", engp->stats.PktsUnSent); log_text(1);
|
||||
sprintf(output_text, "OO Packets: %lu\n", engp->stats.ooCount); log_text(1);
|
||||
if (selectedMode == CLM_UDP_FDX) {
|
||||
if (engp->stats.nRoundtrips > 0) {
|
||||
sprintf(output_text, "Max roundtrip: %0.3fms\n",
|
||||
(double)engp->stats.MaxRoundtrip / 1000.0); log_text(1);
|
||||
sprintf(output_text, "Min roundtrip: %0.3fms\n",
|
||||
(double)engp->stats.MinRoundtrip / 1000.0); log_text(1);
|
||||
sprintf(output_text, "Avg roundtrip: %0.3fms\n",
|
||||
((double)engp->stats.TotalRoundtrip / (double)engp->stats.nRoundtrips) / 1000.0); log_text(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
sprintf(output_text, "Bytes sent: %" LONG_LONG_PREFIX "d\n", engp->stats.BytesSent); log_text(1);
|
||||
sprintf(output_text, "Bytes rcvd: %" LONG_LONG_PREFIX "d\n", engp->stats.BytesRecvd); log_text(1);
|
||||
recvtime = timediff(&engp->stats.StartRecv, &engp->stats.StopRecv);
|
||||
if (recvtime > 0)
|
||||
throughput = (int)((double)(engp->stats.BytesRecvd * 8)/((double)recvtime / 1000000.0));
|
||||
else
|
||||
throughput = 0;
|
||||
sprintf(output_text, "Throughput: %d bps (%s)\n", (int)throughput, Int32ToString((int)throughput));
|
||||
log_text(0);
|
||||
}
|
||||
|
||||
LONG_LONG timediff(struct timeval * tv1, struct timeval * tv2) {
|
||||
LONG_LONG t1, t2;
|
||||
t1 = (LONG_LONG)tv1->tv_sec * (LONG_LONG)1000000 +
|
||||
(LONG_LONG)tv1->tv_usec;
|
||||
t2 = (LONG_LONG)tv2->tv_sec * (LONG_LONG)1000000 +
|
||||
(LONG_LONG)tv2->tv_usec;
|
||||
return t1 > t2 ? t1 - t2 : t2 - t1;
|
||||
}
|
||||
|
||||
void log_error(char *str) {
|
||||
fprintf(stderr, "%s\n", str);
|
||||
if (syslog_verbosity)
|
||||
syslog(LOG_ERR, "%s\n", str);
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
#ifndef UNIX
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
/*
|
||||
* static char sccsid[] = "from: @(#)getopt.c 8.2 (Berkeley) 4/2/94";
|
||||
*/
|
||||
static char *rcsid =
|
||||
"$Id: getopt.c,v 1.1 2004/04/07 13:23:00 rlonn Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _BSD
|
||||
extern char *__progname;
|
||||
#else
|
||||
#define __progname "getopt"
|
||||
#endif
|
||||
|
||||
int opterr = 1, /* if error message should be printed */
|
||||
optind = 1, /* index into parent argv vector */
|
||||
optopt, /* character checked for validity */
|
||||
optreset; /* reset getopt */
|
||||
char *optarg; /* argument associated with option */
|
||||
char EMSG[] = "";
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt(int nargc, char *const *nargv, const char *ostr)
|
||||
{
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
char *oli; /* option letter list index */
|
||||
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (place[1] && *++place == '-') { /* found "--" */
|
||||
++optind;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
} /* option letter okay? */
|
||||
if ((optopt = (int) *place++) == (int) ':' ||
|
||||
!(oli = strchr(ostr, optopt))) {
|
||||
/*
|
||||
* if the user didn't specify '-' as an option,
|
||||
* assume it means -1.
|
||||
*/
|
||||
if (optopt == (int) '-')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (opterr && *ostr != ':')
|
||||
(void) fprintf(stderr,
|
||||
"%s: illegal option -- %c\n", __progname,
|
||||
optopt);
|
||||
return (BADCH);
|
||||
}
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place)
|
||||
++optind;
|
||||
} else { /* need an argument */
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (nargc <= ++optind) { /* no arg */
|
||||
place = EMSG;
|
||||
if (*ostr == ':')
|
||||
return (BADARG);
|
||||
if (opterr)
|
||||
(void) fprintf(stderr,
|
||||
"%s: option requires an argument -- %c\n",
|
||||
__progname, optopt);
|
||||
return (BADCH);
|
||||
} else /* white space */
|
||||
optarg = nargv[optind];
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
return (optopt); /* dump back option letter */
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,552 +0,0 @@
|
||||
/*
|
||||
* $Id: tpclient.c,v 1.9 2004/03/22 20:49:12 rlonn Exp $
|
||||
* $Source: /cvsroot/tptest/engine/tpclient.c,v $
|
||||
*
|
||||
* TPTEST 3.0 (C) Copyright II-Stiftelsen 2002
|
||||
*
|
||||
* tpclient.c - test client support functions
|
||||
*
|
||||
* Written by
|
||||
* Ragnar L<>nn <prl@gatorhole.com>
|
||||
*
|
||||
* This file is part of the TPTEST system.
|
||||
* See the file LICENSE for copyright notice.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "tpclient.h"
|
||||
#include "tpengine.h"
|
||||
|
||||
void RecalculatePPSSZ(TPEngine *);
|
||||
int AdvanceTest(TPEngine *, int, int, int);
|
||||
|
||||
#ifdef UNIX
|
||||
double min(double a, double b) { return a < b ? a : b; }
|
||||
#endif
|
||||
|
||||
/*
|
||||
// Recalculate good PPS and Packetsize values after the user has changed
|
||||
// the desired data rate. Most modern PCs can output several thousand UDP packets
|
||||
// per second without stalling due to CPU shortage so I have changed the old
|
||||
// behaviour somewhat: this program increases the packetsize up to 1400
|
||||
// bytes then starts increasing the packet rate until it reaches 3000 pps.
|
||||
// It doesn't continue increasing the packet size before reaching 3000 pps.
|
||||
// This function also decreases packet rate and size until the data rate
|
||||
// matches the desired data rate as closely as possible.
|
||||
//
|
||||
*/
|
||||
|
||||
void RecalculatePPSSZ(TPEngine *engp)
|
||||
{
|
||||
if (engp->bitsPerSecond >
|
||||
(engp->packetsPerSecond * engp->packetSize * 8)) {
|
||||
while (engp->bitsPerSecond > (engp->packetsPerSecond * engp->packetSize * 8)) {
|
||||
while (engp->packetsPerSecond < 20) {
|
||||
engp->packetsPerSecond++;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetSize < 1400) {
|
||||
engp->packetSize++;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetsPerSecond < 3000) {
|
||||
engp->packetsPerSecond++;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetSize < 32000) {
|
||||
engp->packetSize++;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetsPerSecond < 6000) {
|
||||
engp->packetsPerSecond++;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetSize < 65000) {
|
||||
engp->packetSize++;
|
||||
continue;
|
||||
}
|
||||
engp->packetsPerSecond++;
|
||||
}
|
||||
}
|
||||
else if (engp->bitsPerSecond < (engp->packetsPerSecond * engp->packetSize * 8)) {
|
||||
while (engp->bitsPerSecond < (engp->packetsPerSecond * engp->packetSize * 8)) {
|
||||
if (engp->packetsPerSecond > 6000) {
|
||||
engp->packetsPerSecond--;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetSize > 32000) {
|
||||
engp->packetSize--;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetsPerSecond > 3000) {
|
||||
engp->packetsPerSecond--;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetSize > 1400) {
|
||||
engp->packetSize--;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetsPerSecond > 20) {
|
||||
engp->packetsPerSecond--;
|
||||
continue;
|
||||
}
|
||||
if (engp->packetSize > MIN_PKT_SIZE) {
|
||||
engp->packetSize--;
|
||||
continue;
|
||||
}
|
||||
engp->packetsPerSecond--;
|
||||
}
|
||||
}
|
||||
// Lower value so we don't *exceed* selected datarate
|
||||
while ((engp->packetsPerSecond * engp->packetSize * 8) > engp->bitsPerSecond)
|
||||
{
|
||||
if (engp->packetsPerSecond > 10 || engp->packetSize == 60)
|
||||
engp->packetsPerSecond--;
|
||||
else
|
||||
engp->packetSize--;
|
||||
}
|
||||
|
||||
engp->nPackets = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int AdvanceTest(TPEngine * engp, int SelMode, int Cur, int LastRet)
|
||||
{
|
||||
double BytesPerSecondRecv;
|
||||
|
||||
static double LastBytesPerSecondRecv = 0;
|
||||
static double bestTCPSendRate = 0;
|
||||
static double bestTCPRecvRate = 0;
|
||||
static double bestUDPSendRate = 0;
|
||||
static double bestUDPRecvRate = 0;
|
||||
|
||||
int msRecv;
|
||||
|
||||
if (Cur != CLM_NONE) {
|
||||
msRecv = ( engp->stats.StopRecv.tv_sec - engp->stats.StartRecv.tv_sec ) * 1000;
|
||||
msRecv += ( engp->stats.StopRecv.tv_usec - engp->stats.StartRecv.tv_usec ) / 1000;
|
||||
|
||||
if( msRecv != 0 )
|
||||
BytesPerSecondRecv = ( (double)(engp->stats.BytesRecvd) * 1000.0 )
|
||||
/ (double)(msRecv);
|
||||
else
|
||||
BytesPerSecondRecv = 0.0;
|
||||
}
|
||||
else {
|
||||
LastBytesPerSecondRecv = 0;
|
||||
bestTCPSendRate = bestTCPRecvRate = bestUDPSendRate = bestUDPRecvRate = 0.0;
|
||||
}
|
||||
|
||||
switch (SelMode) {
|
||||
|
||||
case CLM_AUTO:
|
||||
switch (Cur) {
|
||||
case CLM_NONE:
|
||||
engp->tcpBytes = engp->start_tcpsend_bytes;
|
||||
engp->sessionMaxTime = 60;
|
||||
LastBytesPerSecondRecv = 0.0;
|
||||
return CLM_TCP_SEND;
|
||||
case CLM_TCP_SEND:
|
||||
if (msRecv < 18000 && LastRet == 0) {
|
||||
// aim for 20 secs if last receive time was > 1 sec
|
||||
// The *5 multiplication can work badly for connections
|
||||
// with high, but very fluctuating bandwidth
|
||||
if (msRecv > 1000)
|
||||
engp->tcpBytes = (UINT32)
|
||||
min( (float)(engp->tcpBytes) * 5.0,
|
||||
((float)(engp->tcpBytes) * (20000.0 / (float)msRecv))
|
||||
);
|
||||
else
|
||||
engp->tcpBytes = (UINT32)(engp->tcpBytes * 1.8);
|
||||
return Cur;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestTCPSendRate) {
|
||||
bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > engp->bestTCPSendRate) {
|
||||
engp->bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
LastBytesPerSecondRecv = 0.0;
|
||||
engp->tcpBytes = engp->start_tcprecv_bytes;
|
||||
engp->sessionMaxTime = 60;
|
||||
return CLM_TCP_RECV;
|
||||
case CLM_TCP_RECV:
|
||||
if (msRecv < 18000 && LastRet == 0) {
|
||||
// aim for 20 secs if last receive time was > 1 sec
|
||||
// The *5 multiplication can work badly for connections
|
||||
// with high, but very fluctuating bandwidth
|
||||
if (msRecv > 1000)
|
||||
engp->tcpBytes = (UINT32)
|
||||
min( (float)(engp->tcpBytes) * 5.0,
|
||||
((float)(engp->tcpBytes) * (20000.0 / (float)msRecv))
|
||||
);
|
||||
else
|
||||
engp->tcpBytes = (UINT32)(engp->tcpBytes * 1.8);
|
||||
return Cur;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestTCPRecvRate) {
|
||||
bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > engp->bestTCPRecvRate) {
|
||||
engp->bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
LastBytesPerSecondRecv = 0.0;
|
||||
if ((bestTCPSendRate * 8) < 20000.0)
|
||||
engp->bitsPerSecond = 20000;
|
||||
else
|
||||
engp->bitsPerSecond = (UINT32)((bestTCPSendRate*8)*0.75);
|
||||
engp->sessionTime = 5;
|
||||
RecalculatePPSSZ(engp);
|
||||
return CLM_UDP_SEND;
|
||||
case CLM_UDP_SEND:
|
||||
if (engp->stats.PktsRecvd > ((engp->nPackets / 2) + 1) && LastRet == 0) {
|
||||
if (BytesPerSecondRecv > bestUDPSendRate) {
|
||||
bestUDPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > engp->bestUDPSendRate) {
|
||||
engp->bestUDPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > (LastBytesPerSecondRecv * 1.1)) {
|
||||
engp->bitsPerSecond = (int)((double)(engp->bitsPerSecond) * 1.5);
|
||||
RecalculatePPSSZ(engp);
|
||||
LastBytesPerSecondRecv = BytesPerSecondRecv;
|
||||
return Cur;
|
||||
}
|
||||
}
|
||||
LastBytesPerSecondRecv = 0.0;
|
||||
if ((bestTCPRecvRate * 8) < 20000.0)
|
||||
engp->bitsPerSecond = 20000;
|
||||
else
|
||||
engp->bitsPerSecond = (UINT32)((bestTCPRecvRate*8)*0.75);
|
||||
engp->sessionTime = 5;
|
||||
RecalculatePPSSZ(engp);
|
||||
return CLM_UDP_RECV;
|
||||
case CLM_UDP_RECV: /// ***
|
||||
if (engp->stats.PktsRecvd > ((engp->nPackets / 2) + 1) && LastRet == 0) {
|
||||
if (BytesPerSecondRecv > bestUDPRecvRate) {
|
||||
bestUDPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > engp->bestUDPRecvRate) {
|
||||
engp->bestUDPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > (LastBytesPerSecondRecv * 1.1)) {
|
||||
engp->bitsPerSecond = (int)((double)(engp->bitsPerSecond) * 1.5);
|
||||
RecalculatePPSSZ(engp);
|
||||
LastBytesPerSecondRecv = BytesPerSecondRecv;
|
||||
return Cur;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
default: // not reached
|
||||
return CLM_NONE;
|
||||
}
|
||||
// not reached
|
||||
|
||||
case CLM_AUTO_TCP:
|
||||
if (Cur == M_NONE) {
|
||||
engp->tcpBytes = engp->start_tcpsend_bytes;
|
||||
engp->sessionMaxTime = 60;
|
||||
return CLM_TCP_SEND;
|
||||
}
|
||||
if (msRecv < 18000 && LastRet == 0) {
|
||||
// aim for 20 secs if last receive time was > 1 sec
|
||||
// The *5 multiplication can work badly for connections
|
||||
// with high, but very fluctuating bandwidth
|
||||
if (msRecv > 1000)
|
||||
engp->tcpBytes = (UINT32)
|
||||
min( (float)(engp->tcpBytes) * 5.0,
|
||||
((float)(engp->tcpBytes) * (20000.0 / (float)msRecv))
|
||||
);
|
||||
else
|
||||
engp->tcpBytes = (UINT32)(engp->tcpBytes * 1.8);
|
||||
return Cur;
|
||||
}
|
||||
if (Cur == M_TCP_SEND) {
|
||||
if (BytesPerSecondRecv > engp->bestTCPSendRate) {
|
||||
engp->bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestTCPSendRate) {
|
||||
bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
engp->tcpBytes = engp->start_tcprecv_bytes;
|
||||
engp->sessionMaxTime = 60;
|
||||
return CLM_TCP_RECV;
|
||||
}
|
||||
else {
|
||||
if (BytesPerSecondRecv > engp->bestTCPRecvRate) {
|
||||
engp->bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestTCPRecvRate) {
|
||||
bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_AUTO_TCP_SEND:
|
||||
case CLM_AUTO_TCP_RECV:
|
||||
if (Cur == M_NONE) {
|
||||
engp->sessionMaxTime = 60;
|
||||
if (SelMode == CLM_AUTO_TCP_SEND) {
|
||||
engp->tcpBytes = engp->start_tcpsend_bytes;
|
||||
return CLM_TCP_SEND;
|
||||
}
|
||||
else {
|
||||
engp->tcpBytes = engp->start_tcprecv_bytes;
|
||||
return CLM_TCP_RECV;
|
||||
}
|
||||
}
|
||||
if (msRecv < 18000 && LastRet == 0) {
|
||||
// aim for 20 secs if last receive time was > 1 sec
|
||||
// The *5 multiplication can work badly for connections
|
||||
// with high, but very fluctuating bandwidth
|
||||
if (msRecv > 1000)
|
||||
engp->tcpBytes = (UINT32)
|
||||
min( (float)(engp->tcpBytes) * 5.0,
|
||||
((float)(engp->tcpBytes) * (20000.0 / (float)msRecv))
|
||||
);
|
||||
else
|
||||
engp->tcpBytes = (UINT32)(engp->tcpBytes * 1.8);
|
||||
return Cur;
|
||||
}
|
||||
if (Cur == M_TCP_SEND) {
|
||||
if (BytesPerSecondRecv > engp->bestTCPSendRate) {
|
||||
engp->bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestTCPSendRate) {
|
||||
bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (BytesPerSecondRecv > engp->bestTCPRecvRate) {
|
||||
engp->bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestTCPRecvRate) {
|
||||
bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_AUTO_UDP_SEND:
|
||||
case CLM_AUTO_UDP_RECV:
|
||||
if (Cur == M_NONE) {
|
||||
engp->bitsPerSecond = 30000;
|
||||
engp->sessionTime = 5;
|
||||
RecalculatePPSSZ(engp);
|
||||
if (SelMode == CLM_AUTO_UDP_SEND)
|
||||
return CLM_UDP_SEND;
|
||||
else
|
||||
return CLM_UDP_RECV;
|
||||
}
|
||||
if (engp->stats.PktsRecvd > ((engp->nPackets / 2) + 1) && LastRet == 0) {
|
||||
if (Cur == M_UDP_SEND) {
|
||||
if (BytesPerSecondRecv > engp->bestUDPSendRate) {
|
||||
engp->bestUDPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestUDPSendRate) {
|
||||
bestUDPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (BytesPerSecondRecv > engp->bestUDPRecvRate) {
|
||||
engp->bestUDPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestUDPRecvRate) {
|
||||
bestUDPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
if (BytesPerSecondRecv > (LastBytesPerSecondRecv * 1.1)) {
|
||||
engp->bitsPerSecond = (int)((double)(engp->bitsPerSecond) * 1.5);
|
||||
engp->sessionTime = 5;
|
||||
RecalculatePPSSZ(engp);
|
||||
LastBytesPerSecondRecv = BytesPerSecondRecv;
|
||||
return Cur;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_AUTO_SEND:
|
||||
switch (Cur) {
|
||||
case CLM_NONE:
|
||||
engp->tcpBytes = engp->start_tcpsend_bytes;
|
||||
engp->sessionMaxTime = 60;
|
||||
return CLM_TCP_SEND;
|
||||
case CLM_TCP_SEND:
|
||||
if (msRecv < 18000 && LastRet == 0) {
|
||||
// aim for 20 secs if last receive time was > 1 sec
|
||||
// The *5 multiplication can work badly for connections
|
||||
// with high, but very fluctuating bandwidth
|
||||
if (msRecv > 1000)
|
||||
engp->tcpBytes = (UINT32)
|
||||
min( (float)(engp->tcpBytes) * 5.0,
|
||||
((float)(engp->tcpBytes) * (20000.0 / (float)msRecv))
|
||||
);
|
||||
else
|
||||
engp->tcpBytes = (UINT32)(engp->tcpBytes * 1.8);
|
||||
return Cur;
|
||||
}
|
||||
if (BytesPerSecondRecv > engp->bestTCPSendRate) {
|
||||
engp->bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestTCPSendRate) {
|
||||
bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
LastBytesPerSecondRecv = 0.0;
|
||||
if ((engp->bestTCPSendRate * 8) < 20000.0)
|
||||
engp->bitsPerSecond = 20000;
|
||||
else
|
||||
engp->bitsPerSecond = (UINT32)((bestTCPSendRate * 8)*0.75);
|
||||
engp->sessionTime = 5;
|
||||
RecalculatePPSSZ(engp);
|
||||
return CLM_UDP_SEND;
|
||||
case CLM_UDP_SEND:
|
||||
|
||||
if (engp->stats.PktsRecvd > ((engp->nPackets / 2) + 1) && LastRet == 0) {
|
||||
if (BytesPerSecondRecv > engp->bestUDPSendRate) {
|
||||
engp->bestUDPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestUDPSendRate) {
|
||||
bestUDPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > (LastBytesPerSecondRecv * 1.1)) {
|
||||
engp->bitsPerSecond = (int)((double)(engp->bitsPerSecond) * 1.5);
|
||||
engp->sessionTime = 5;
|
||||
RecalculatePPSSZ(engp);
|
||||
LastBytesPerSecondRecv = BytesPerSecondRecv;
|
||||
return Cur;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_AUTO_RECV:
|
||||
switch (Cur) {
|
||||
case CLM_NONE:
|
||||
engp->tcpBytes = engp->start_tcprecv_bytes;
|
||||
engp->sessionMaxTime = 60;
|
||||
return CLM_TCP_RECV;
|
||||
|
||||
case CLM_TCP_RECV:
|
||||
if (msRecv < 18000 && LastRet == 0) {
|
||||
// aim for 20 secs if last receive time was > 1 sec
|
||||
// The *5 multiplication can work badly for connections
|
||||
// with high, but very fluctuating bandwidth
|
||||
if (msRecv > 1000)
|
||||
engp->tcpBytes = (UINT32)
|
||||
min( (float)(engp->tcpBytes) * 5.0,
|
||||
((float)(engp->tcpBytes) * (20000.0 / (float)msRecv))
|
||||
);
|
||||
else
|
||||
engp->tcpBytes = (UINT32)(engp->tcpBytes * 1.8);
|
||||
return Cur;
|
||||
}
|
||||
if (BytesPerSecondRecv > engp->bestTCPRecvRate) {
|
||||
engp->bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestTCPRecvRate) {
|
||||
bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
LastBytesPerSecondRecv = 0.0;
|
||||
if ((engp->bestTCPRecvRate * 8) < 20000.0)
|
||||
engp->bitsPerSecond = 20000;
|
||||
else
|
||||
engp->bitsPerSecond = (UINT32)((bestTCPRecvRate * 8)*0.75);
|
||||
engp->sessionTime = 5;
|
||||
RecalculatePPSSZ(engp);
|
||||
return CLM_UDP_RECV;
|
||||
|
||||
case CLM_UDP_RECV:
|
||||
if (engp->stats.PktsRecvd > ((engp->nPackets / 2) + 1) && LastRet == 0) {
|
||||
if (BytesPerSecondRecv > engp->bestUDPRecvRate) {
|
||||
engp->bestUDPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > bestUDPRecvRate) {
|
||||
bestUDPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
if (BytesPerSecondRecv > (LastBytesPerSecondRecv * 1.1)) {
|
||||
engp->bitsPerSecond = (int)((double)(engp->bitsPerSecond) * 1.5);
|
||||
engp->sessionTime = 5;
|
||||
RecalculatePPSSZ(engp);
|
||||
LastBytesPerSecondRecv = BytesPerSecondRecv;
|
||||
return Cur;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
|
||||
case CLM_TCP_SEND:
|
||||
if (Cur == CLM_NONE) return SelMode;
|
||||
if (msRecv >= 18000 && LastRet == 0) {
|
||||
if (BytesPerSecondRecv > engp->bestTCPSendRate) {
|
||||
engp->bestTCPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_TCP_RECV:
|
||||
if (Cur == CLM_NONE) return SelMode;
|
||||
if (msRecv >= 18000 && LastRet == 0) {
|
||||
if (BytesPerSecondRecv > engp->bestTCPRecvRate) {
|
||||
engp->bestTCPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_UDP_SEND:
|
||||
if (Cur == CLM_NONE) return SelMode;
|
||||
if (engp->stats.PktsRecvd > ((engp->nPackets / 2) + 1) &&
|
||||
LastRet == 0) {
|
||||
if (BytesPerSecondRecv > engp->bestUDPSendRate) {
|
||||
engp->bestUDPSendRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_UDP_RECV:
|
||||
if (Cur == CLM_NONE) return SelMode;
|
||||
if (engp->stats.PktsRecvd > ((engp->nPackets / 2) + 1) &&
|
||||
LastRet == 0) {
|
||||
if (BytesPerSecondRecv > engp->bestUDPRecvRate) {
|
||||
engp->bestUDPRecvRate = BytesPerSecondRecv;
|
||||
}
|
||||
}
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_UDP_FDX:
|
||||
if (Cur == CLM_NONE) return SelMode;
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_QUERY_MASTER:
|
||||
if (Cur == CLM_NONE) return SelMode;
|
||||
return CLM_NONE;
|
||||
|
||||
case CLM_NAME_LOOKUP:
|
||||
if (Cur == CLM_NONE) return SelMode;
|
||||
return CLM_NONE;
|
||||
|
||||
// not reached
|
||||
}
|
||||
// not reached
|
||||
return 0;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* $Id: tpclient.h,v 1.4 2004/03/22 20:49:12 rlonn Exp $
|
||||
* $Source: /cvsroot/tptest/engine/tpclient.h,v $
|
||||
*
|
||||
* TPTEST 3.0 (C) Copyright II-Stiftelsen 2002
|
||||
*
|
||||
* tpclient.h - header file
|
||||
*
|
||||
* Written by
|
||||
* Ragnar L<>nn <prl@gatorhole.com>
|
||||
*
|
||||
* This file is part of the TPTEST system.
|
||||
* See the file LICENSE for copyright notice.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TPCLIENT_H_
|
||||
#define _TPCLIENT_H_
|
||||
|
||||
#include "tpengine.h"
|
||||
|
||||
/*
|
||||
* Modes recognized by tpengine.c and tpclient.c
|
||||
*/
|
||||
#define CLM_NONE M_NONE
|
||||
#define CLM_UDP_FDX M_UDP_FDX
|
||||
#define CLM_UDP_SEND M_UDP_SEND
|
||||
#define CLM_UDP_RECV M_UDP_RECV
|
||||
#define CLM_TCP_SEND M_TCP_SEND
|
||||
#define CLM_TCP_RECV M_TCP_RECV
|
||||
#define CLM_QUERY_MASTER M_QUERY_MASTER
|
||||
#define CLM_NAME_LOOKUP M_NAME_LOOKUP
|
||||
|
||||
/*
|
||||
* Modes used exclusively by tpclient.c
|
||||
*/
|
||||
#define CLM_SERVER_MODE 301
|
||||
#define CLM_AUTO 302
|
||||
#define CLM_AUTO_TCP_SEND 303
|
||||
#define CLM_AUTO_TCP_RECV 304
|
||||
#define CLM_AUTO_UDP_SEND 305
|
||||
#define CLM_AUTO_UDP_RECV 306
|
||||
#define CLM_AUTO_SEND 307
|
||||
#define CLM_AUTO_RECV 308
|
||||
#define CLM_AUTO_TCP 309
|
||||
|
||||
// Client defaults
|
||||
|
||||
#define DEFAULT_TCPBYTES (START_TCP_BYTES * 2)
|
||||
#define DEFAULT_TESTTIME 10
|
||||
#define MIN_PKT_SIZE ( sizeof( struct tpHeader ) + IP_UDP_SIZE )
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void RecalculatePPSSZ(TPEngine *);
|
||||
int AdvanceTest(TPEngine *, int, int, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif // _TPCLIENT_H_
|
||||
|
||||
|
||||
@@ -1,455 +0,0 @@
|
||||
/*
|
||||
* $Id: tpcommon.c,v 1.6 2004/03/22 20:49:12 rlonn Exp $
|
||||
* $Source: /cvsroot/tptest/engine/tpcommon.c,v $
|
||||
*
|
||||
* TPTEST 3.0 (C) Copyright II-Stiftelsen 2002
|
||||
*
|
||||
* tpcommon.c - common TPTEST functions
|
||||
*
|
||||
* Written by
|
||||
* Ragnar L<>nn <prl@gatorhole.com>
|
||||
* Hans Green <hg@3tag.com>
|
||||
*
|
||||
* Based on earlier work by
|
||||
* Hans N<>st<73>n
|
||||
*
|
||||
* This file is part of the TPTEST system.
|
||||
* See the file LICENSE for copyright notice.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef UNIX
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "tpengine.h"
|
||||
#include "tpcommon.h"
|
||||
#include "tpio.h"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Convert a int value to a string formatted as
|
||||
* "64.25 kbit/s" or "10.16 Mbit/s" or "103 bit/s".
|
||||
*/
|
||||
|
||||
char *Int32ToString( int iVal )
|
||||
{
|
||||
static char sBuf[ 256 ];
|
||||
|
||||
if ( iVal >= TP_1MBPS ) {
|
||||
sprintf( sBuf, "%.2f Mbit/s", (double)(iVal) / (double)(TP_1MBPS) );
|
||||
} else if( iVal > TP_1KBPS ) {
|
||||
sprintf( sBuf, "%.2f kbit/s", (double)(iVal) / (double)(TP_1KBPS ) );
|
||||
} else {
|
||||
sprintf( sBuf, "%d bit/s", iVal );
|
||||
}
|
||||
return( sBuf );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Convert a ulong value to a string formatted as
|
||||
* "64.25 Kbyte" or "10.16 Mbyte" or "103 byte".
|
||||
*/
|
||||
char *UInt32ToString( UINT32 lVal )
|
||||
{
|
||||
static char sBuf[ 256 ];
|
||||
|
||||
if ( lVal >= 1024*1024 ) {
|
||||
sprintf( sBuf, "%.2f Mbyte",
|
||||
(double)(lVal) / ( 1024.0 * 1024.0 ) );
|
||||
}
|
||||
else if( lVal > 1024 ) {
|
||||
sprintf( sBuf, "%.2f Kbyte", (double)(lVal) / 1024.0 );
|
||||
}
|
||||
else {
|
||||
sprintf( sBuf, "%lu byte", lVal );
|
||||
}
|
||||
return( sBuf );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------- SameTag ---- *\
|
||||
|
||||
Description: Case independent tag name compare
|
||||
|
||||
Input: s1 - string one
|
||||
s2 - string two
|
||||
|
||||
Return: 1 - same tag, 0 - not same
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
int SameTag(char *s1, char *s2)
|
||||
{
|
||||
char c1, c2;
|
||||
|
||||
for (;;) {
|
||||
c1 = *s1++ & 255;
|
||||
c2 = *s2++ & 255;
|
||||
|
||||
if (c1 == 0 || c2 == 0) return (c1 == c2);
|
||||
if (c1 >= 'a') c1 -= ('a' -'A');
|
||||
if (c2 >= 'a') c2 -= ('a' -'A');
|
||||
if (c1 != c2) return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------- CopyTagField ---- *\
|
||||
|
||||
Description: Extract value field in 'x1=yy;x2=yy;'-type string
|
||||
|
||||
Input: destp Ptr to dest area
|
||||
destSize Size of dest area (including NUL byte)
|
||||
srcp Ptr to data (terminated by char < ' ')
|
||||
pname Tag to look for
|
||||
|
||||
Return: 1 if tag found
|
||||
0 if tag not found
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
int CopyTagField(
|
||||
char *destp,
|
||||
int destSize,
|
||||
char *srcp,
|
||||
char *pname)
|
||||
{
|
||||
char *cp, *dp;
|
||||
char *savep, *delp;
|
||||
char *valp;
|
||||
int len, cnt;
|
||||
char idBuf[20];
|
||||
|
||||
cp = srcp;
|
||||
while (*cp) {
|
||||
savep = cp;
|
||||
valp = strchr(savep, '=');
|
||||
if (valp == 0) goto done; /* No more assigns */
|
||||
|
||||
delp = strchr(savep, ';');
|
||||
if (delp && delp < valp) { /* Skip some leading junk */
|
||||
cp = delp + 1;
|
||||
continue;
|
||||
}
|
||||
len = valp - savep;
|
||||
if (len < sizeof(idBuf)) {
|
||||
memcpy(idBuf, savep, len);
|
||||
idBuf[len] = 0;
|
||||
|
||||
if (SameTag(idBuf, pname)) { /* Found the tag */
|
||||
valp += 1;
|
||||
for (cnt = 0, dp = destp ; *valp ; valp++) {
|
||||
if (*valp == ';' || (*valp & 255) < ' ') {
|
||||
break;
|
||||
}
|
||||
if (cnt < destSize - 1) {
|
||||
*dp++ = *valp;
|
||||
cnt += 1;
|
||||
}
|
||||
}
|
||||
*dp = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip until next field */
|
||||
/* ===================== */
|
||||
|
||||
for (cp = valp ; *cp != ';' ; cp++) if (*cp == 0) goto done;
|
||||
|
||||
cp += 1; /* Bypass delimiter
|
||||
*/
|
||||
}
|
||||
done:
|
||||
return 0; /* Not found */
|
||||
}
|
||||
|
||||
|
||||
// Fill a tpStats structure with the contents from a STATS line
|
||||
int GetStatsFromLine(char *line, TPStats *s)
|
||||
{
|
||||
char valBuf[30];
|
||||
|
||||
if (strncmp(line, "STATS ", 6) != 0)
|
||||
return -1;
|
||||
memset(valBuf, 0, 30);
|
||||
|
||||
if (CopyTagField(valBuf, 29, line+6, "majorv"))
|
||||
s->MajorVersion = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "minorv"))
|
||||
s->MinorVersion = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "pktssent"))
|
||||
s->PktsSent = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "pktsunsent"))
|
||||
s->PktsUnSent = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "pktsrcvd"))
|
||||
s->PktsRecvd = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "bytessent"))
|
||||
sscanf(valBuf, "%" LONG_LONG_PREFIX "d", &(s->BytesSent));
|
||||
if (CopyTagField(valBuf, 29, line+6, "bytesrcvd"))
|
||||
sscanf(valBuf, "%" LONG_LONG_PREFIX "d", &(s->BytesRecvd));
|
||||
if (CopyTagField(valBuf, 29, line+6, "maxrtt"))
|
||||
s->MaxRoundtrip = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "minrtt"))
|
||||
s->MinRoundtrip = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "oocount"))
|
||||
s->ooCount = atoi(valBuf);
|
||||
|
||||
if (CopyTagField(valBuf, 29, line+6, "txstart_s"))
|
||||
s->StartSend.tv_sec = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "txstart_us"))
|
||||
s->StartSend.tv_usec = atoi(valBuf);
|
||||
|
||||
if (CopyTagField(valBuf, 29, line+6, "txstop_s"))
|
||||
s->StopSend.tv_sec = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "txstop_us"))
|
||||
s->StopSend.tv_usec = atoi(valBuf);
|
||||
|
||||
if (CopyTagField(valBuf, 29, line+6, "rxstart_s"))
|
||||
s->StartRecv.tv_sec = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "rxstart_us"))
|
||||
s->StartRecv.tv_usec = atoi(valBuf);
|
||||
|
||||
if (CopyTagField(valBuf, 29, line+6, "rxstop_s"))
|
||||
s->StopRecv.tv_sec = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "rxstop_us"))
|
||||
s->StopRecv.tv_usec = atoi(valBuf);
|
||||
|
||||
if (CopyTagField(valBuf, 29, line+6, "totrtt"))
|
||||
s->TotalRoundtrip = atoi(valBuf);
|
||||
if (CopyTagField(valBuf, 29, line+6, "nortt"))
|
||||
s->nRoundtrips = atoi(valBuf);
|
||||
|
||||
if (CopyTagField(valBuf, 101, line + 6, "email"))
|
||||
strcpy(s->email, valBuf);
|
||||
|
||||
if (CopyTagField(valBuf, 101, line + 6, "pwd"))
|
||||
strcpy(s->pwd, valBuf);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Create a STATS line from a tpStats structure
|
||||
char * CreateLineFromStats(TPStats *s, char *destp)
|
||||
{
|
||||
sprintf(destp, "STATS majorv=%u;minorv=%u;pktssent=%lu;pktsunsent=%lu;pktsrcvd=%lu;"
|
||||
"bytessent=%" LONG_LONG_PREFIX "d;bytesrcvd=%" LONG_LONG_PREFIX "d;"
|
||||
"maxrtt=%lu;minrtt=%lu;totrtt=%lu;nortt=%lu;oocount=%lu;txstart_s=%ld;txstart_us=%ld;"
|
||||
"txstop_s=%ld;txstop_us=%ld;rxstart_s=%ld;rxstart_us=%ld;"
|
||||
"rxstop_s=%ld;rxstop_us=%ld;email=%s;pwd=%s",
|
||||
s->MajorVersion, s->MinorVersion, s->PktsSent, s->PktsUnSent,
|
||||
s->PktsRecvd, s->BytesSent, s->BytesRecvd, s->MaxRoundtrip,
|
||||
s->MinRoundtrip, s->TotalRoundtrip, s->nRoundtrips, s->ooCount,
|
||||
(s->StartSend.tv_sec), (s->StartSend.tv_usec),
|
||||
(s->StopSend.tv_sec), (s->StopSend.tv_usec),
|
||||
(s->StartRecv.tv_sec), (s->StartRecv.tv_usec),
|
||||
(s->StopRecv.tv_sec), (s->StopRecv.tv_usec), s->email, s->pwd );
|
||||
return destp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get 3-digit reply code from a reply string
|
||||
int ReplyCode(char * str)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = atoi(str);
|
||||
if (ret < 1000 && ret > 99) return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef NO_HTONL
|
||||
/* ------------------------------------------------------------ htonl ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
long htonl(long l)
|
||||
{
|
||||
long ti, to;
|
||||
unsigned char *ucp;
|
||||
|
||||
ucp = (unsigned char *) &ti;
|
||||
ti = 1;
|
||||
if (ucp[3] == 1) return l; // Running on hi-endian
|
||||
|
||||
ti = l;
|
||||
to = ucp[3];
|
||||
to = (to << 8) + ucp[2];
|
||||
to = (to << 8) + ucp[1];
|
||||
to = (to << 8) + ucp[0];
|
||||
return to;
|
||||
}
|
||||
#endif // NO_HTONL
|
||||
|
||||
|
||||
|
||||
#ifdef NO_NTOHL
|
||||
/* ------------------------------------------------------------ ntohl ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
long ntohl(long l)
|
||||
{
|
||||
long ti, to;
|
||||
unsigned char *ucp;
|
||||
|
||||
ucp = (unsigned char *) &ti;
|
||||
ti = 1;
|
||||
if (ucp[3] == 1) return l; // Running on hi-endian
|
||||
|
||||
ti = l;
|
||||
to = ucp[0];
|
||||
to = (to << 8) + ucp[1];
|
||||
to = (to << 8) + ucp[2];
|
||||
to = (to << 8) + ucp[3];
|
||||
return to;
|
||||
}
|
||||
#endif // NO_NTOHL
|
||||
|
||||
|
||||
/* -------------------------------------------------------- TVAddUSec ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
void TVAddUSec(struct timeval *tp, int usecs)
|
||||
{
|
||||
tp->tv_usec += usecs;
|
||||
if (tp->tv_usec > 1000000) {
|
||||
tp->tv_sec += tp->tv_usec / 1000000;
|
||||
tp->tv_usec = tp->tv_usec % 1000000;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------- TVCompare ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
int TVCompare(struct timeval *tp1, struct timeval *tp2)
|
||||
{
|
||||
if (tp1->tv_sec > tp2->tv_sec) return 1;
|
||||
if (tp1->tv_sec < tp2->tv_sec) return -1;
|
||||
if (tp1->tv_usec > tp2->tv_usec) return 1;
|
||||
if (tp1->tv_usec < tp2->tv_usec) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef TRCLOG
|
||||
|
||||
/* ----------------------------------------------------------- TrcLog ---- *\
|
||||
|
||||
Typical usage in program
|
||||
|
||||
if (debugWanted) {
|
||||
TrcSetFile("MYDEBUG.LOG"); // Please log to file "MYDEBUG.LOG"
|
||||
TrcSetOptions(TRCOPT_STDERR); // Please log to stderr
|
||||
TrcEnable(1); // Enable bit 1
|
||||
}
|
||||
|
||||
And the to get conditional runtime log:
|
||||
|
||||
TrcLog(1, "Running version %d", version); // Message without newline
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
static char logFileName[200];
|
||||
static FILE *logFp;
|
||||
static unsigned long logDebugBits;
|
||||
static unsigned long trcOptions;
|
||||
|
||||
void TrcClose(void)
|
||||
{
|
||||
if (logFp == 0) return;
|
||||
fclose(logFp);
|
||||
logFp = 0;
|
||||
}
|
||||
void TrcSetFile(char *fileName)
|
||||
{
|
||||
TrcClose();
|
||||
strncpy(logFileName, fileName, sizeof(logFileName));
|
||||
logFileName[sizeof(logFileName) -1] = 0;
|
||||
return;
|
||||
}
|
||||
unsigned long TrcSetOptions(unsigned long options)
|
||||
{
|
||||
trcOptions |= options;
|
||||
return trcOptions;
|
||||
}
|
||||
int TrcLog(unsigned long theBits, char *format, ...)
|
||||
{
|
||||
char timeBuf[40];
|
||||
time_t tid;
|
||||
struct tm *tp;
|
||||
va_list argp;
|
||||
|
||||
va_start(argp, format);
|
||||
|
||||
if ((theBits & logDebugBits) == 0) return 0;
|
||||
|
||||
time(&tid);
|
||||
tp = localtime(&tid);
|
||||
sprintf(timeBuf, "%02d-%02d:%02d.%02d.%02d", tp->tm_mon, tp->tm_mday,
|
||||
tp->tm_hour, tp->tm_min, tp->tm_sec);
|
||||
|
||||
if (logFp == 0 && logFileName[0] != 0) {
|
||||
logFp = fopen(logFileName, "a");
|
||||
}
|
||||
if (logFp) {
|
||||
fprintf(logFp, "%s: ", timeBuf);
|
||||
vfprintf(logFp, format, argp);
|
||||
fprintf(logFp, "\n");
|
||||
}
|
||||
if (trcOptions & TRCOPT_STDERR) {
|
||||
fprintf(stderr, "%s: ", timeBuf);
|
||||
vfprintf(stderr, format, argp) ;
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
unsigned long TrcEnable(unsigned long bits)
|
||||
{
|
||||
logDebugBits |= bits;
|
||||
return logDebugBits;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* TRCLOG */
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* $Id: tpcommon.h,v 1.4 2002/09/16 14:10:42 rlonn Exp $
|
||||
* $Source: /cvsroot/tptest/engine/tpcommon.h,v $
|
||||
*
|
||||
* TPTEST 3.0 (C) Copyright II-Stiftelsen 2002
|
||||
*
|
||||
* tpcommon.h - header file
|
||||
*
|
||||
* Written by
|
||||
* Ragnar L<>nn <prl@gatorhole.com>
|
||||
* Hans Green <hg@3tag.com>
|
||||
*
|
||||
* This file is part of the TPTEST system.
|
||||
* See the file LICENSE for copyright notice.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TPCOMMON_H_
|
||||
#define _TPCOMMON_H_
|
||||
|
||||
#include "tpengine.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int SameTag(char *s1, char *s2);
|
||||
int CopyTagField(char *destp, int destSize, char *srcp, char *pname);
|
||||
int GetSessionFromLine(char *, TPEngine *);
|
||||
char * CreateSessionLine(TPEngine *, char *);
|
||||
int GetStatsFromLine(char *, TPStats *);
|
||||
char * CreateLineFromStats(TPStats *, char *);
|
||||
int ReplyCode(char *);
|
||||
void TVAddUSec(struct timeval *, int);
|
||||
int TVCompare(struct timeval *, struct timeval *);
|
||||
char *Int32ToString( int );
|
||||
char *UInt32ToString( UINT32 );
|
||||
|
||||
#ifdef NO_HTONL
|
||||
long htonl(long);
|
||||
#endif
|
||||
|
||||
#ifdef NO_NTOHL
|
||||
long ntohl(long);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif // _TPCOMMON_H_
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,576 +0,0 @@
|
||||
/*
|
||||
* $Id: tpengine.h,v 1.17 2004/03/23 17:07:37 rlonn Exp $
|
||||
* $Source: /cvsroot/tptest/engine/tpengine.h,v $
|
||||
*
|
||||
* TPTEST 3.0 (C) Copyright II-Stiftelsen 2002
|
||||
*
|
||||
* tpengine.h - main test engine header file
|
||||
*
|
||||
* Written by
|
||||
* Ragnar L<>nn <prl@gatorhole.com>
|
||||
* Hans Green <hg@3tag.com>
|
||||
*
|
||||
* Based on earlier work by
|
||||
* Hans N<>st<73>n
|
||||
*
|
||||
* This file is part of the TPTEST system.
|
||||
* See the file LICENSE for copyright notice.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TPENGINE_H_
|
||||
#define _TPENGINE_H_
|
||||
|
||||
#define MAJORVERSION 3
|
||||
#define MINORVERSION 17
|
||||
|
||||
|
||||
// Select platform
|
||||
// #define __WIN32
|
||||
// #define MACOS
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
// Win32 specifics
|
||||
|
||||
#ifdef __WIN32
|
||||
#define LONG_LONG_PREFIX "I64"
|
||||
#define NO_GETTIMEOFDAY
|
||||
typedef _int64 LONG_LONG;
|
||||
typedef unsigned short USHORT;
|
||||
#define dprintf printf
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
|
||||
// Unix specifics
|
||||
|
||||
#ifdef UNIX
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
typedef long long LONG_LONG;
|
||||
typedef unsigned short USHORT;
|
||||
typedef long INT32;
|
||||
typedef unsigned long UINT32;
|
||||
|
||||
typedef struct sockaddr SOCKADDR;
|
||||
typedef struct sockaddr_in SOCKADDR_IN;
|
||||
typedef int SOCKET;
|
||||
|
||||
#define SOCKET_ERROR (-1)
|
||||
#define INVALID_SOCKET (-1)
|
||||
|
||||
// Solaris specifics
|
||||
|
||||
#ifdef SOLARIS
|
||||
#define LONG_LONG_PREFIX "ll"
|
||||
#define INADDR_NONE (-1)
|
||||
#endif // SOLARIS
|
||||
|
||||
// Linux specifics
|
||||
|
||||
#ifdef LINUX
|
||||
#define LONG_LONG_PREFIX "ll"
|
||||
#endif // LINUX
|
||||
|
||||
// OpenBSD specifics
|
||||
|
||||
#ifdef OPENBSD
|
||||
#define LONG_LONG_PREFIX "q"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // UNIX
|
||||
|
||||
|
||||
// MAC specifics
|
||||
|
||||
#ifdef MACOS
|
||||
|
||||
struct timeval {
|
||||
int tv_sec;
|
||||
int tv_usec;
|
||||
};
|
||||
struct in_addr {
|
||||
u_int32_t s_addr;
|
||||
};
|
||||
#define LONG_LONG_PREFIX "ll"
|
||||
#define NO_GETTIMEOFDAY
|
||||
#define NO_HTONL
|
||||
#define NO_NTOHL
|
||||
typedef long long LONG_LONG;
|
||||
typedef unsigned short USHORT;
|
||||
typedef long INT32;
|
||||
typedef unsigned long UINT32;
|
||||
|
||||
long htonl(long l);
|
||||
long ntohl(long l);
|
||||
void Report(char *str);
|
||||
void ClearTextWindow(void);
|
||||
#endif // MACOS
|
||||
|
||||
typedef struct in_addr IN_ADDR;
|
||||
|
||||
#define TP_DEBUGLEVEL 0
|
||||
//#define TP_DEBUGLEVEL 3
|
||||
|
||||
|
||||
#define DEFAULT_CONTROL_PORT 1634
|
||||
|
||||
#define MAXINT (2147483647)
|
||||
|
||||
|
||||
/*
|
||||
* Test modes.
|
||||
*/
|
||||
|
||||
#define M_NONE 0
|
||||
#define M_UDP_FDX 1
|
||||
#define M_UDP_SEND 2
|
||||
#define M_UDP_RECV 3
|
||||
#define M_TCP_SEND 4
|
||||
#define M_TCP_RECV 5
|
||||
#define M_QUERY_MASTER 6
|
||||
#define M_NAME_LOOKUP 7
|
||||
|
||||
|
||||
/*
|
||||
* Client engine states.
|
||||
*
|
||||
*/
|
||||
enum TPCLIENTSM_STATE {
|
||||
CLSM_IDLE = 1,
|
||||
CLSM_CONNECTING,
|
||||
CLSM_CONNECTED,
|
||||
CLSM_WAITPORTS,
|
||||
CLSM_NATOPEN,
|
||||
CLSM_TESTLOOP,
|
||||
CLSM_SENDSTAT,
|
||||
CLSM_WAITSTAT,
|
||||
CLSM_DELAYQUIT,
|
||||
CLSM_TERM_WAIT,
|
||||
CLSM_FAILED,
|
||||
CLSM_SENDMHELO,
|
||||
CLSM_SERVERLIST,
|
||||
CLSM_COMPLETE,
|
||||
CLSM_DATACONNECTING,
|
||||
CLSM_NAMELOOKUP,
|
||||
CLSM_WAITFDX
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Server engine states
|
||||
*
|
||||
*/
|
||||
enum TPSERVERSM_STATE {
|
||||
SSM_IDLE = 101,
|
||||
SSM_LISTEN,
|
||||
SSM_SENDWELCOME,
|
||||
SSM_WAITTEST,
|
||||
SSM_POSTTEST,
|
||||
SSM_WAITNAT,
|
||||
SSM_WAITTCPDATA,
|
||||
SSM_TESTLOOP,
|
||||
SSM_SENDSTAT,
|
||||
SSM_WAITSTAT,
|
||||
SSM_DELAYQUIT,
|
||||
SSM_FDXWAIT,
|
||||
SSM_COMPLETE,
|
||||
SSM_FAILED,
|
||||
SSM_DATALISTEN,
|
||||
SSM_INITTCPDATA
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Socket identifiers
|
||||
*
|
||||
*/
|
||||
enum TP_SOCKINX {
|
||||
TP_SOCKINX_CTRL = 1,
|
||||
TP_SOCKINX_DATA,
|
||||
TP_SOCKINX_SCTRL,
|
||||
TP_SOCKINX_SDATA
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* CallMeAgain-constants. Not so useful yet
|
||||
*
|
||||
*/
|
||||
#define CMA_CLIWAITPORTS 100000
|
||||
#define CMA_CLIUDPSEND 20000
|
||||
#define CMA_CLISENDSTAT 100000
|
||||
#define CMA_CLIWAITSTAT 100000
|
||||
#define CMA_CLIWAITPORTS 100000
|
||||
#define CMA_CLINATOPEN 50000
|
||||
#define CMA_CLIUDPRECV 20000
|
||||
#define CMA_CLIUDPFDX 20000
|
||||
#define CMA_CLIDATACONNECT 100000
|
||||
#define CMA_CLITCPSEND 50000
|
||||
#define CMA_CLITCPRECV 50000
|
||||
|
||||
#define CMA_SRVWAITNAT 50000
|
||||
#define CMA_SRVUDPSEND 20000
|
||||
#define CMA_SRVSENDSTAT 100000
|
||||
#define CMA_SRVWAITSTAT 100000
|
||||
#define CMA_SRVUDPRECV 20000
|
||||
#define CMA_SRVUDPFDX 20000
|
||||
#define CMA_SRVDATALISTEN 100000
|
||||
#define CMA_SRVTCPTEST 50000
|
||||
|
||||
|
||||
/*
|
||||
* Engine delays between states
|
||||
*
|
||||
*/
|
||||
#define USEC_STATDELAY 500000
|
||||
#define USEC_NATOPEN 1000000
|
||||
#define USEC_DELAYQUIT 500000
|
||||
|
||||
|
||||
/*
|
||||
* Size of IP+UDP header
|
||||
*
|
||||
*/
|
||||
#define IP_UDP_SIZE 28
|
||||
|
||||
/*
|
||||
* Size of various data structures/buffers/arrays
|
||||
*
|
||||
*/
|
||||
#define MAX_LOOKUP_IP 10
|
||||
#define MAX_SERVERS 30
|
||||
#define MAX_SERVER_NAME 40
|
||||
#define MAX_SERVER_INFO 40
|
||||
#define TP_CTRL_MSG_SIZE 200
|
||||
#define TP_HOST_NAME_SIZE 200
|
||||
#define PACKBUFSIZE 66000
|
||||
#define RANDBUFSIZE (524288)
|
||||
#define REPLYBUFSIZE 512
|
||||
|
||||
|
||||
/*
|
||||
* Other constants
|
||||
*/
|
||||
#define LISTEN_BACKLOG 5
|
||||
#define TP_1KBPS 1000
|
||||
#define TP_1MBPS 1000000
|
||||
#define START_TCP_BYTES 51200
|
||||
|
||||
/*
|
||||
* Error codes
|
||||
*
|
||||
*/
|
||||
#define TPER_CTRLCLOSED 2001
|
||||
#define TPER_TIMEOUT 2002
|
||||
#define TPER_NOCTRL 2003
|
||||
#define TPER_BADHELLO 2004
|
||||
#define TPER_BADPORTS 2005
|
||||
#define TPER_SRVABORT 2006
|
||||
#define TPER_BADMODE 2007
|
||||
#define TPER_NATFAIL 2008
|
||||
#define TPER_UDPOPENFAIL 2009
|
||||
#define TPER_USERABORT 2010
|
||||
#define TPER_MASTERBUSY 2011
|
||||
#define TPER_BADMASTERREPLY 2012
|
||||
#define TPER_MASTERDENIED 2013
|
||||
#define TPER_BADCOOKIE 2014
|
||||
#define TPER_BADNATACK 2015
|
||||
#define TPER_NOTCPDATASOCK 2016
|
||||
#define TPER_NODATA 2017
|
||||
#define TPER_MAXSERVERS 2018
|
||||
#define TPER_NOSERVNAME 2019
|
||||
#define TPER_UNSUPPROTO 2020
|
||||
#define TPER_NOHOSTNAME 2021
|
||||
#define TPER_CONNECTFAIL 2022
|
||||
#define TPER_BADWELCOME 2023
|
||||
#define TPER_WRONGCOOKIE 2024
|
||||
#define TPER_NOCOOKIE 2025
|
||||
#define TPER_WRONGMODE 2026
|
||||
#define TPER_NOMODE 2027
|
||||
#define TPER_NOTIME 2028
|
||||
#define TPER_NONPACKETS 2029
|
||||
#define TPER_NOPSIZE 2030
|
||||
#define TPER_NOUDPSENDPORT 2031
|
||||
#define TPER_NOUDPRECVPORT 2032
|
||||
#define TPER_NOTIMEOUT 2033
|
||||
#define TPER_NOTCPBYTES 2034
|
||||
#define TPER_SERVERBUSY 2035
|
||||
#define TPER_SERVERDENY 2036
|
||||
#define TPER_NLINITFAIL 2037
|
||||
#define TPER_NLFAIL 2038
|
||||
#define TPER_DATACLOSED 2039
|
||||
|
||||
#define TPER_ACCEPTFAIL 3001
|
||||
#define TPER_BADTEST 3002
|
||||
#define TPER_CLIABORT 3003
|
||||
#define TPER_STATFAIL 3004
|
||||
|
||||
|
||||
/*
|
||||
* Data packet used in tests.
|
||||
*/
|
||||
struct tpHeader {
|
||||
unsigned int Sequence;
|
||||
struct timeval ClientSendTime;
|
||||
struct timeval ServerRecvTime;
|
||||
struct timeval ServerSendTime;
|
||||
UINT32 DataSize;
|
||||
UINT32 Cookie;
|
||||
};
|
||||
|
||||
typedef struct tpPacket {
|
||||
struct tpHeader Header;
|
||||
unsigned char Data[ 1 ];
|
||||
} TPPacket;
|
||||
|
||||
|
||||
/*
|
||||
* Test results.
|
||||
*/
|
||||
typedef struct TPStats {
|
||||
USHORT MajorVersion;
|
||||
USHORT MinorVersion;
|
||||
UINT32 PktsSent;
|
||||
UINT32 PktsUnSent;
|
||||
UINT32 PktsRecvd;
|
||||
LONG_LONG BytesSent;
|
||||
LONG_LONG BytesRecvd;
|
||||
UINT32 nRoundtrips;
|
||||
UINT32 TotalRoundtrip;
|
||||
UINT32 MaxRoundtrip;
|
||||
UINT32 MinRoundtrip;
|
||||
UINT32 ooCount;
|
||||
struct timeval StartSend;
|
||||
struct timeval StopSend;
|
||||
struct timeval StartRecv;
|
||||
struct timeval StopRecv;
|
||||
char email[101];
|
||||
char pwd[101];
|
||||
} TPStats;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* TPEngine is the general info-command-struct used to communicate
|
||||
* with the test engine.
|
||||
*/
|
||||
typedef struct TPEngine {
|
||||
|
||||
/*
|
||||
* Variables supplied by user in order to start a test
|
||||
*/
|
||||
|
||||
/* Needed for all modes */
|
||||
INT32 tpMode; // Test mode
|
||||
IN_ADDR hostIP; // Host address
|
||||
USHORT hostCtrlPort; // Server TCP control port number
|
||||
UINT32 sessionMaxTime; // max test time (before timeout)
|
||||
|
||||
|
||||
/* Needed when tpMode is M_TCP_SEND or M_TCP_RECV */
|
||||
UINT32 tcpBytes; // Number of bytes to transfer in TCP test
|
||||
|
||||
/* Needed when tpMode is M_UDP_SEND, M_UDP_RECV or M_UDP_FDX */
|
||||
UINT32 packetSize; // Packet size
|
||||
UINT32 nPackets; // Number of packets to send / receive
|
||||
UINT32 sessionTime; // Total send time
|
||||
|
||||
|
||||
/*
|
||||
* Variables supplied by user to perform other actions
|
||||
*/
|
||||
|
||||
/* bitsPerSecond and packetsPerSecond can be used to calculate packetSize, nPackets and
|
||||
packetInterval. Just set the variables you know and zero the others, then call
|
||||
RecalculatePPSSZ() */
|
||||
UINT32 bitsPerSecond; // RecalculatePPSSZ
|
||||
UINT32 packetsPerSecond; // RecalculatePPSSZ
|
||||
|
||||
/* HostName allows the engine to do an asynchronous host name lookup for the user */
|
||||
char hostName[TP_HOST_NAME_SIZE+2]; // Servername (string) for hostname lookup
|
||||
int numHostIP; // Number of IP addresses for the host
|
||||
IN_ADDR hostIPTab[MAX_LOOKUP_IP]; // Array with IP addresses for hostname
|
||||
|
||||
/* Server list */
|
||||
/* Set hostIP to the IP of the master server you want to use */
|
||||
char serverNameList[MAX_SERVERS][MAX_SERVER_NAME];
|
||||
char serverInfoList[MAX_SERVERS][MAX_SERVER_INFO];
|
||||
USHORT serverPortList[MAX_SERVERS];
|
||||
int numServers;
|
||||
|
||||
/* Requested socket options */
|
||||
/* The application sets these values and the IO module tries */
|
||||
/* to make sure data sockets use them. If the IO module is not */
|
||||
/* able to use these values, it should either fill in the values */
|
||||
/* actually used, or zero (0) in the "cur_socket_sndbuf" and */
|
||||
/* "cur_socket_rcvbuf" variables */
|
||||
int socket_sndbuf;
|
||||
int socket_rcvbuf;
|
||||
|
||||
int cur_socket_sndbuf;
|
||||
int cur_socket_rcvbuf;
|
||||
|
||||
/* an application should check cur_socket_sndbuf/cur_socket_rcvbuf */
|
||||
/* when a test is running (and data sockets have been set up) to */
|
||||
/* make sure its requested socket options have been set */
|
||||
|
||||
/*
|
||||
* Internal variables
|
||||
* These can be read but should NOT be modified from outside the engine
|
||||
*/
|
||||
int active; // Bool. Is the engine running
|
||||
int state; // Engine state
|
||||
time_t startTime; // time_t for start by StartClientContext
|
||||
UINT32 packetInterval; // send interval per packet (microseconds)
|
||||
INT32 failCode;
|
||||
INT32 timeLimit; // Internal state timer set by SetTimeLimit
|
||||
INT32 callMeAgain; // How many microseconds before RunServerContext() or
|
||||
// RunClientContext() wants another call
|
||||
|
||||
UINT32 sessCookie; // set by server
|
||||
|
||||
UINT32 natCount; // How many NAT-open packets have we sent
|
||||
UINT32 curSend; // Send packet counter
|
||||
int wipeFlag; // Used internally when querying
|
||||
int natOpen; // Bool. Is NAT-open finished?
|
||||
|
||||
|
||||
UINT32 packetsRecvd; // # of packets received
|
||||
UINT32 packetsSent; // # of packets sent
|
||||
UINT32 prevPacket; // Maximum sequence number seen
|
||||
UINT32 badPackets; // received packets with incorrect cookie
|
||||
UINT32 badBytes; // received bytes in bad packets
|
||||
|
||||
char *packetBuf; // Packet buffer pointer
|
||||
UINT32 packBufSize; // Size of packet buffer
|
||||
IN_ADDR packetfromAdr; // Where did incoming packet come from
|
||||
USHORT packetfromPort; // What port did incoming packet come from
|
||||
UINT32 packetLen; // Length of incoming packet
|
||||
|
||||
char *randBuf; // Random buffer for data generation
|
||||
UINT32 randBufSize; // Size of random buffer
|
||||
|
||||
TPStats stats; // Struct for storing test results/statistics
|
||||
|
||||
struct timeval nextSendTV; // timeval for next sen
|
||||
|
||||
int (*executor)(struct TPEngine *ctxp); // Select executor for RunContext
|
||||
|
||||
void *ctrlRefp; // Local data for I/O handler
|
||||
|
||||
int ctrlMessageComplete; // Bool. Set when complete command seen
|
||||
char ctrlMessage[REPLYBUFSIZE]; // Latest command read from control port
|
||||
|
||||
int tcpCtrlConnectComplete; // Bool.
|
||||
int tcpDataConnectComplete; // Bool.
|
||||
int iAmServer; // Bool.
|
||||
|
||||
INT32 ioError; // Platform dependent io error code - set by engine
|
||||
|
||||
USHORT hostTCPDataPort; // Port used by remote host to transmit/receive TCP data
|
||||
USHORT hostUDPRecvPort; // Set by CheckPortsMessage el vad det nu blir
|
||||
USHORT hostUDPSendPort;
|
||||
|
||||
IN_ADDR myLocalAddress; // bind to this local address (optional)
|
||||
USHORT myTCPDataPort; // bind to this local TCP data port (optional)
|
||||
USHORT myUDPRecvPort; // bind to this local UDP receive data port (optional)
|
||||
USHORT myUDPSendPort; // bind to this local UDP send data port (optional)
|
||||
USHORT myTCPControlPort; // bin to this local TCP control port (optional)
|
||||
|
||||
USHORT peerMajorVersion; // Major/minor version no of peer
|
||||
USHORT peerMinorVersion;
|
||||
|
||||
double bestTCPSendRate; // Best rates seen. Bytes/sec. For the client support functions
|
||||
double bestTCPRecvRate;
|
||||
double bestUDPSendRate;
|
||||
double bestUDPRecvRate;
|
||||
|
||||
UINT32 start_tcpsend_bytes; // starting value for tcpBytes when doing TCP_AUTO_SEND
|
||||
UINT32 start_tcprecv_bytes; // starting value for tcpBytes when doing TCP_AUTO_RECV
|
||||
|
||||
char clientInfo[80]; // Client info. E.g. "TPtest 3.0.1 MacOS9"
|
||||
|
||||
} TPEngine;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Engine function prototypes
|
||||
*
|
||||
*/
|
||||
int AddServerToList(TPEngine *, char *);
|
||||
int CheckHelloReply(TPEngine *);
|
||||
int CheckServerBanner(TPEngine *);
|
||||
int CheckStatsMsg(TPEngine *);
|
||||
int CheckTestReply(TPEngine *);
|
||||
int CheckTestMessage(TPEngine *);
|
||||
void ClearBestRates(TPEngine *);
|
||||
void ClearServerList(TPEngine *);
|
||||
TPEngine *CreateContext(void); // Called by user
|
||||
void DeleteContext(TPEngine *); // Called by user
|
||||
int DoClientTCPRecv(TPEngine *);
|
||||
int DoClientTCPSend(TPEngine *);
|
||||
int DoClientUDPDuplex(TPEngine *);
|
||||
int DoClientUDPRecv(TPEngine *);
|
||||
int DoClientUDPSend(TPEngine *);
|
||||
int DoNameLookup(TPEngine *);
|
||||
int DoServerTCPSend(TPEngine *);
|
||||
int DoServerTCPRecv(TPEngine *);
|
||||
int DoServerUDPDuplex(TPEngine *);
|
||||
int DoServerUDPRecv(TPEngine *);
|
||||
int DoServerUDPSend(TPEngine *);
|
||||
void FailSession(TPEngine *, int);
|
||||
void GenerateUDPDataPacket(TPEngine *);
|
||||
int RunClientContext(TPEngine *); // Called by user
|
||||
int RunServerContext(TPEngine *); // Called by user
|
||||
int SendHeloLine(TPEngine *);
|
||||
int SendStatLine(TPEngine *);
|
||||
int SendTCPTestData(TPEngine *);
|
||||
int SendTestLine(TPEngine *);
|
||||
int SendTestOKMessage(TPEngine *);
|
||||
int SendUDPDataPacket(TPEngine *);
|
||||
void SetSMState(TPEngine *, int);
|
||||
void SetTimeLimit(TPEngine *, int); // Called by user
|
||||
int StartClientContext(TPEngine *); // Called by user
|
||||
int StartServerContext(TPEngine *); // Called by user
|
||||
void StopContext(TPEngine *); // Called by user
|
||||
int TimeLimitExceeded(TPEngine *);
|
||||
int DoQueryMaster(TPEngine *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,277 +0,0 @@
|
||||
/*
|
||||
* $Id: tpio.h,v 1.3 2002/09/16 14:10:42 rlonn Exp $
|
||||
* $Source: /cvsroot/tptest/engine/tpio.h,v $
|
||||
*
|
||||
* TPTEST 3.0 (C) Copyright II-Stiftelsen 2002
|
||||
*
|
||||
* tpio.h - I/O function prototypes
|
||||
*
|
||||
* Written by
|
||||
* Ragnar L<>nn <prl@gatorhole.com>
|
||||
*
|
||||
* This file is part of the TPTEST system.
|
||||
* See the file LICENSE for copyright notice.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TPIO_H_
|
||||
#define _TPIO_H_
|
||||
|
||||
/* ----------------------------------------------------------- tpio.h ---- *\
|
||||
|
||||
This file (tpio.h) contains prototypes for the functions the engine
|
||||
(tpengine.c) needs in order to perform TPTEST bandwidth measurements.
|
||||
|
||||
If you intend to port TPTEST to a new platform, the functions described
|
||||
here are the ones you need to provide to make things tick. The file
|
||||
containing the functions should be named tpio_platform.c where 'platform'
|
||||
is a string representing your platform. Like e.g. "linux" or "win32".
|
||||
|
||||
Below you'll find an explanation of what every function does.
|
||||
The functions are listed in alphabetical order (most of them).
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int AcceptClient(TPEngine * engp, int sockInx);
|
||||
int CheckCtrlOpen(TPEngine *);
|
||||
int ConsumeCtrlData(TPEngine *);
|
||||
int ConsumeTCPTestData(TPEngine *);
|
||||
int ConsumeUDPData(TPEngine *);
|
||||
int ContinueConnectTCP(TPEngine *);
|
||||
void ClearCtrlReply(TPEngine *);
|
||||
void CloseAllSockets(TPEngine *);
|
||||
void DeleteSessComm(TPEngine *);
|
||||
int InitConnectTCP(TPEngine *, int);
|
||||
int InitSessComm(TPEngine *);
|
||||
int InitTCPSock(TPEngine *, int);
|
||||
int InitUDP(TPEngine *);
|
||||
int QueueCtrlData(TPEngine *, char *);
|
||||
int Rand32();
|
||||
int SendCtrlData(TPEngine *);
|
||||
int SendNATPacket(TPEngine *);
|
||||
int SendTCPData(TPEngine *, char *, int, int);
|
||||
int SendUDPPacket(TPEngine *, int);
|
||||
int InitNameLookup(TPEngine *);
|
||||
int ContinueNameLookup(TPEngine *);
|
||||
|
||||
#ifdef NO_GETTIMEOFDAY
|
||||
extern void gettimeofday(struct timeval *, void *);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------- AcceptClient ---- *\
|
||||
int AcceptClient(TPEngine * engp, int sockInx)
|
||||
|
||||
Executed by RunServerContext() to accept an incoming client TCP
|
||||
connection.
|
||||
|
||||
If sockInx == TP_SOCKINX_CTRL AcceptClient() should:
|
||||
|
||||
1. Check for a pending connection on the TCP control socket
|
||||
|
||||
2. When a connection is detected and accepted, AcceptClient() must
|
||||
set engp->tcpCtrlConnectComplete = 1 to signal to the engine
|
||||
that a connection has been established. AcceptClient() must also
|
||||
store the remote host's IP address in engp->hostIP and the remote
|
||||
host's TCP port number in engp->hostCtrlPort
|
||||
|
||||
If sockInx == TP_SOCKINX_DATA AcceptClient() should:
|
||||
|
||||
1. Check for a pending connection on the TCP data socket
|
||||
|
||||
2. When a connection is detected and accepted, AcceptClient() must
|
||||
set engp->tcpDataConnectComplete = 1 to signal to the engine that
|
||||
a connection has been established. AcceptClient() must also store
|
||||
the remote host's TCP port number in engp->hostTCPDataPort
|
||||
|
||||
Return values:
|
||||
|
||||
AcceptClient() should return 0 unless an error occurs, in which case
|
||||
it should return a non-zero error code and also set engp->ioError to
|
||||
value that reflects the kind of error that occurred.
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------- CheckCtrlOpen ---- *\
|
||||
int CheckCtrlOpen(TPEngine * engp)
|
||||
|
||||
Executed by the engine to determine whether the control TCP connection
|
||||
is still open or not.
|
||||
|
||||
Return values:
|
||||
|
||||
CheckCtrlOpen should return 1 if a TCP control connection is open
|
||||
and 0 (zero) if one isn't.
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------------- ConsumeCtrlData ---- *\
|
||||
int ConsumeCtrlData(TPEngine * engp)
|
||||
|
||||
Executed repeatedly by the engine to read more data from the TCP control
|
||||
socket until a full line ending with CR+LF has been read.
|
||||
|
||||
ConsumeCtrlData() should read data from the TCP control socket, if
|
||||
there is data to read, and store it in a temporary buffer until a
|
||||
complete line ending with the characters CR (carriage return, ASCII 13)
|
||||
and LF (linefeed, ASCII 10) has been read. When such a line is
|
||||
encountered, ConsumeCtrlData() should store the whole line, except for
|
||||
the CR and LF characters and with a terminating NULL character, in
|
||||
engp->ctrlMessage and set the variable engp->ctrlMessageComplete = 1 to
|
||||
signal to the engine that a control command line has been received from
|
||||
the remote peer.
|
||||
|
||||
Caution:
|
||||
|
||||
- Be sure not to copy more than REPLYBUFSIZE characters into
|
||||
engp->ctrlMessage
|
||||
|
||||
- Don't forget to NULL-terminate engp->ctrlMessage
|
||||
|
||||
- Don't forget that a read operation on the TCP control socket
|
||||
may give you a whole line, ending with CR+LF, *and* another
|
||||
line or part of another line. The code must handle this. Look
|
||||
at the implementation of ConsumeCtrlData() in tpio_win32.c
|
||||
|
||||
Return values:
|
||||
|
||||
ConsumeCtrlData() should return 0 unless an error occurs, in which
|
||||
case it should return your non-zero error code of choice and set
|
||||
engp->ioError to some appropriate value.
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------- ConsumeTCPTestData ---- *\
|
||||
int ConsumeTCPTestData(TPEngine * engp)
|
||||
|
||||
Executed repeatedly during a TCP test on the receiving side to read TCP
|
||||
test data on the TCP data socket.
|
||||
|
||||
ConsumeTCPData() should:
|
||||
|
||||
1. Check if any data is available on the TCP data socket.
|
||||
|
||||
2. If so, ConsumeTCPTestData() should try to read engp->packBufSize
|
||||
bytes and store them in engp->packetBuf
|
||||
|
||||
If more than 0 (zero) bytes were read from the socket,
|
||||
ConsumeTCPTestData() should also do 3-5 below:
|
||||
|
||||
3. Check if engp->stats.BytesRecvd == 0 (zero) in which case this is
|
||||
the first time we see test data on the socket and that means
|
||||
means ConsumeTCPData() should store the current time in
|
||||
engp->stats.StartRecv
|
||||
|
||||
4. Add the number of bytes received to engp->stats.BytesRecvd
|
||||
|
||||
5. Store the current time in engp->stats.StopRecv
|
||||
|
||||
|
||||
Return values:
|
||||
|
||||
ConsumeTCPTestData() should return 0 unless an error occurs, in which
|
||||
case it should return your non-zero error code of choice and set
|
||||
engp->ioError to some appropriate value.
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------- ConsumeUDPData ---- *\
|
||||
int ConsumeUDPData(TPEngine * engp)
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------- SendStatLine ---- *\
|
||||
|
||||
|
||||
\* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* $Id: tpio_unix.h,v 1.3 2002/09/16 14:10:42 rlonn Exp $
|
||||
* $Source: /cvsroot/tptest/os-dep/unix/tpio_unix.h,v $
|
||||
*
|
||||
* TPTEST 3.0 (C) Copyright II-Stiftelsen 2002
|
||||
*
|
||||
* tpio_unix.h - header file
|
||||
*
|
||||
* Written by
|
||||
* Ragnar L<>nn <prl@gatorhole.com>
|
||||
*
|
||||
* This file is part of the TPTEST system.
|
||||
* See the file LICENSE for copyright notice.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TPIO_SOLARIS_H_
|
||||
#define TPIO_SOLARIS_H_
|
||||
|
||||
#define XFERBUF_SIZE (66000)
|
||||
#define REPLYBUF_SIZE (4096)
|
||||
#define CR ('\015')
|
||||
#define LF ('\012')
|
||||
|
||||
typedef struct WSInfo {
|
||||
SOCKET udpRecvSock, udpSendSock, tcpCtrlSock, tcpDataSock;
|
||||
SOCKET tcpServerCtrlSock, tcpServerDataSock;
|
||||
char replyBuf[REPLYBUF_SIZE];
|
||||
char xferBuf[XFERBUF_SIZE];
|
||||
int xferPos, replyPos, xferCnt, replyCnt;
|
||||
int lastErr;
|
||||
int ctrlConnOK, dataConnOK;
|
||||
int crSeen;
|
||||
int ctrlConnInProg, dataConnInProg;
|
||||
char sendBuf[REPLYBUF_SIZE * 2];
|
||||
int sendBufPos, sendBufCnt;
|
||||
char * lookupBuf;
|
||||
} WSInfo;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,687 +0,0 @@
|
||||
TPTEST - Network throughput measurement program
|
||||
-----------------------------------------------
|
||||
|
||||
TPTEST 3.0 differs from 2.x in several ways, as explained below.
|
||||
|
||||
1. The test logic has been separated from the rest of the code and
|
||||
placed into a test engine. The core of the test engine is platform-
|
||||
independent, while the I/O and UI functions need to be provided by
|
||||
the programmer for his/her particular platform.
|
||||
|
||||
2. The client-server protocol has been changed. Again. Now we do
|
||||
"COMMAND var1=x;var2=y;var3=z". Reply codes are the same and a
|
||||
reply can either be e.g. "200 Welcome" or "200 var1=x;var2=y"
|
||||
|
||||
3. The master server protocol has also been changed to be spoken
|
||||
in the above "var1=x;var2=y" format.
|
||||
|
||||
4. The TCP tests are no longer done on the TCP control ports but
|
||||
rather on a separate TCP data port that both client and server
|
||||
opens when performing a TCP test.
|
||||
|
||||
The changes will be discussed more thouroughly further below.
|
||||
|
||||
|
||||
The source package:
|
||||
-------------------
|
||||
|
||||
The source package consists of three main directories. They are:
|
||||
|
||||
apps/ This is contributed applications (clients & servers)
|
||||
engine/ This is the platform-independent test engine logic
|
||||
os-dep/ This is the platform-dependent I/O routines
|
||||
|
||||
The original distribution contains several simple applications:
|
||||
|
||||
apps/macos/client/ GUI MacOS 8.x/9.x/10 client
|
||||
apps/unix/client/ Text-based Unix client (*)
|
||||
apps/unix/server/ Server daemon
|
||||
apps/unix/masterserver/ Master server daemon
|
||||
apps/windows/clients/gui/ GUI Win32 client
|
||||
apps/windows/clients/cmdline/ Text-based Win32 client (*)
|
||||
|
||||
(*) = same program
|
||||
|
||||
The test engine logic in the engine/ directory consists of the
|
||||
following source files:
|
||||
|
||||
engine/tpclient.c Client support routines
|
||||
engine/tpcommon.c Miscellaneous routines
|
||||
engine/tpengine.c The core engine routines
|
||||
|
||||
and some header files:
|
||||
|
||||
engine/tpio.h Prototypes for the platform-dependent I/O functions
|
||||
engine/tpclient.h Prototypes & defines for tpclient.c
|
||||
engine/tpcommon.h Prototypes & defines for tpcommon.h
|
||||
engine/tpengine.h Prototypes & defines for tpengine.c
|
||||
|
||||
Of the above, tpengine.h is the most important for application programmers.
|
||||
This is the file where the TPEngine struct is declared. TPEngine is used by
|
||||
applications to communicate with the test engine.
|
||||
|
||||
tpio.h is a list of prototypes of all the I/O functions the engine uses
|
||||
and which should be implemented in the platform-dependent I/O module
|
||||
os-dep/xxx/tpio_xxx.c (e.g. os-dep/win32/tpio_win32.c)
|
||||
|
||||
If you intend to port TPTEST to a new platform, or maybe just write a
|
||||
better I/O module for one of the existing platforms, be sure to read all
|
||||
the comments in tpio.h. They describe the attributes of each I/O function -
|
||||
what their names are, what arguments they take, what they do and what
|
||||
return values they give - allowing you to write your own I/O package for
|
||||
your particular platform.
|
||||
|
||||
The platform-dependent I/O packages are located in the os-dep/ directory:
|
||||
|
||||
os-dep/unix/ Solaris/BSD/Linux I/O routines
|
||||
os-dep/win32/ Windows 95/98/NT/2000/XP I/O routines
|
||||
os-dep/macos/ MacOS/Carbon I/O routines
|
||||
|
||||
|
||||
Building an application:
|
||||
------------------------
|
||||
|
||||
To build a 3.0 application you'll need the test engine files, the
|
||||
platform-dependent ones, and the main code for your application. Say
|
||||
you want to build the Unix client found in apps/unix/client/
|
||||
You would then have to do something like:
|
||||
|
||||
mkdir tmp
|
||||
cp engine/* tmp
|
||||
cp os-dep/unix/* tmp
|
||||
cp apps/unix/client/* tmp
|
||||
cd tmp
|
||||
vi Makefile
|
||||
make
|
||||
|
||||
Edit the Makefile and make sure you #define the correct values for your
|
||||
operating system (e.g. -DUNIX -DLINUX for a Linux machine).
|
||||
|
||||
If the above seems overly difficult, let us know and we'll provide you with
|
||||
binaries.
|
||||
|
||||
|
||||
The included applications:
|
||||
--------------------------
|
||||
|
||||
The Win32 and MacOS GUI clients are fairly simple to use, and also have
|
||||
integrated help so we won't go into them here.
|
||||
|
||||
The Win32/Unix text-based client is a simple application to demonstrate
|
||||
how to write clients and servers using the test engine. It cannot do host
|
||||
name lookups (the current tpio_unix.c does not support name lookup), it
|
||||
parses command-line arguments in a very simple way, and will dump core if
|
||||
you give it unexpected or syntactically faulty commands. It will, however,
|
||||
do TCP and UDP tests vs a test server, auto-testing vs a test server,
|
||||
and it can retrieve a server list from a master server (provided you know
|
||||
the IP-address of the master). Start the program without any arguments to
|
||||
get a list of available commands.
|
||||
|
||||
The Unix test server is a dedicated, forking server daemon application with
|
||||
currently no configuration options. Another server, which supports all the
|
||||
old TPTEST 2.x server options (rate limiting testers, banning IP-ranges, etc)
|
||||
is on its way. The server takes only one argument and that is the TCP control
|
||||
port number it should start listening to for incoming connections.
|
||||
|
||||
The master server is similar to the test server but it doesn't use the test
|
||||
engine at all. It just accepts connections and wait for the client to send
|
||||
either the "HELO vmajor=x;vminor=y" message or the "INFO" message.
|
||||
|
||||
Following a HELO-request the server responds with the contents of the
|
||||
tptest.servers file. Look at that file for more info on what should be in it.
|
||||
An INFO request is responded to with a few lines containing contact information
|
||||
about the owners of the master server. This is to allow clients to always give
|
||||
their users up-to-date contact information. The information just needs to be
|
||||
updated on the master server. The contact info is currently hard-coded into
|
||||
the master server so a recompile is needed when the info changes.
|
||||
|
||||
|
||||
How to write a test application:
|
||||
--------------------------------
|
||||
|
||||
main.c:
|
||||
-------
|
||||
|
||||
#include <stdio.h>
|
||||
#include "tpengine.h"
|
||||
#include "tpclient.h"
|
||||
|
||||
main(int argc, char **argv) {
|
||||
TPEngine * engp;
|
||||
int msSend, msRecv;
|
||||
|
||||
if (argc < 3) {
|
||||
printf("Usage: %s <server IP> <server control port>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Initialize the test engine
|
||||
if ((engp = CreateContext()) == NULL) {
|
||||
printf("Failed to create engine context\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Set address to selected test server
|
||||
engp->hostIP = inet_addr(argv[1]);
|
||||
engp->hostCtrlPort = atoi(argv[2]);
|
||||
|
||||
// This program only does UDP receive tests
|
||||
engp->tpMode = M_UDP_RECV;
|
||||
|
||||
// ...five second long ones
|
||||
engp->sessionTime = 5;
|
||||
|
||||
// at a rate of 300 kbit/s
|
||||
engp->bitsPerSecond = 300000;
|
||||
|
||||
// Call the client support function RecalculatePPSSZ() to set the
|
||||
// packet size and packet rate values to something that fits our
|
||||
// selected bitrate
|
||||
RecalculatePPSSZ(engp);
|
||||
|
||||
if ((StartClientContext(engp) != 0) {
|
||||
printf("StartClientContext() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Do the actual test
|
||||
while (engp->state != CLSM_COMPLETE && engp->state != CLSM_FAILED) {
|
||||
RunClientContext(engp);
|
||||
}
|
||||
|
||||
// Report the results
|
||||
|
||||
printf("%d bytes sent, %d bytes received\n",
|
||||
engp->stats.BytesSent, engp->BytesRecvd);
|
||||
printf("%d packets sent, %d packets received\n",
|
||||
engp->stats.PktsSent, engp->stats.PktsRecvd);
|
||||
|
||||
// Calculate the send time, in milliseconds
|
||||
msSend = (engp->stats.StopSend.tv_sec - engp->stats.StartSend.tv_sec) * 1000;
|
||||
msSend += ((engp->stats.StopSend.tv_usec - engp->stats.StartSend.tv_usec) / 1000);
|
||||
printf("Send time: %d ms Send rate: %d bit/s", msSend,
|
||||
(engp->stats.BytesSent * 8 * 1000) / msSend);
|
||||
|
||||
// Calculate the receive time, in milliseconds
|
||||
msRecv = (engp->stats.StopRecv.tv_sec - engp->stats.StartRecv.tv_sec) * 1000;
|
||||
msRecv += ((engp->stats.StopRecv.tv_usec - engp->stats.StartRecv.tv_usec) / 1000);
|
||||
printf("Receive time: %d ms Receive rate (throughput speed): %d bit/s", msRecv,
|
||||
(engp->stats.BytesRecvd * 8 * 1000) / msRecv);
|
||||
|
||||
// Note that the receive time is always the value used for calculating
|
||||
// network throughput, in send as well as receive tests. The receive time tells
|
||||
// you when packet #1 arrived at its destination (engp->stats.StartRecv) and
|
||||
// when the last packet arrived (engp->stats.StopRecv). The difference is the
|
||||
// time the whole transfer took and that can be used to calculate the bandwidth.
|
||||
|
||||
// Clean up
|
||||
DeleteContext(engp);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Compile and link with tpengine.o, tpclient.o and your choice of tpio_xxx.o
|
||||
|
||||
|
||||
|
||||
/Ragnar Lonn <prl@gatorhole.se> 2002-09-29
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TPTEST 2.01 differs from 2.0 mainly in the fact that a TCP test has
|
||||
been introduced. The protocol has been somewhat extended to allow for
|
||||
the TCP tests but 2.0 and 2.01 are compatible (except that a test
|
||||
involving either a 2.0 client or server will not be able to perform
|
||||
a TCP test of course, only UDP).
|
||||
|
||||
The protocol now looks like this:
|
||||
|
||||
TEST Vmajor,Vminor,Testtype,UDPport,PPS,Packetsize,Packets,Time,TCPBytes
|
||||
|
||||
Vmajor = version number, major (1)
|
||||
Vminor = version number, minor (0)
|
||||
Testtype = 0 (full duplex), 1 (send only) or 2 (receive only)
|
||||
6 (TCP send) and 8 (TCP receive)
|
||||
UDPport = client UDP port number
|
||||
PPS = Requested no of packets per second
|
||||
Packetsize = Requested packet size (bytes)
|
||||
Paket = No of packets to be sent (time * PPS)
|
||||
Time = time (in seconds) the test is to be run
|
||||
TCPBytes = the number of bytes to transfer in a TCP test
|
||||
|
||||
First of all, Testtype includes a couple of new test modes, namely no 6
|
||||
and 8 (there are other modes also like server mode and some auto-test
|
||||
modes the client uses but they are, as of now, internal to the servers
|
||||
and clients. See the source code and especially tptest.h for more details).
|
||||
|
||||
Second, there is an extra value added to the end of the TEST string -
|
||||
TCPBytes. This is the number of bytes to transfer in a TCP send or receive
|
||||
test. It is 0 (zero) for other tests. Note that a 2.0 server will accept
|
||||
the whole TEST line and just ignore the last value. It will, however,
|
||||
complain about invalid test mode if you try to do a TCP send or receive
|
||||
test. A 2.01 server being contacted by a 2.0 client on the other hand,
|
||||
will look for 9 values following the TEST command and when it doesn't
|
||||
see 9 values it will scan just 8.
|
||||
|
||||
A slightly kludgy addition to the protocol, but one which I found no
|
||||
way of avoiding without spending even more unpaid hours on the program,
|
||||
was to add a "COOKIE" reply from client to server when a TCP Receive
|
||||
test was initiated. An example:
|
||||
|
||||
1. The client connects to the server
|
||||
2. The server says "200 Welcome"
|
||||
3. The client says "TEST 2,1,8,3456,0,0,0,10,200000"
|
||||
|
||||
(to do a TCP Receive test with a timeout of 10 seconds)
|
||||
|
||||
4. The server says "210 7654 7655 0xf466c204"
|
||||
|
||||
(210 = OK response code, 7654/7655 = UDP ports (not used), 0xf466c204 = cookie)
|
||||
|
||||
5. The client repeats the cookie to the server using the "COOKIE" command:
|
||||
The client says "COOKIE 0xf466c204"
|
||||
|
||||
6. The server starts sending data on the TCP connection
|
||||
|
||||
The UDP receive and full duplex tests handle this by including the cookie
|
||||
value in the NATOPEN packets sent by the client to the server to open any
|
||||
NAT gateways that may exist between the client and the server. In the TCP
|
||||
tests there is no need to open any NATs so we have to get the cookie to
|
||||
the server somehow. A better way might have been to have the server send
|
||||
a cookie to any client that connects - include it in the welcome message -
|
||||
and let the client repeat the cookie when requesting a service. Well, maybe
|
||||
in some later version.
|
||||
|
||||
Other things:
|
||||
|
||||
- Cleaned up the Makefile a little and made it easier to follow (I hope)
|
||||
|
||||
|
||||
/ Ragnar Lonn <prl@gatorhole.se> 2002-01-13
|
||||
|
||||
|
||||
|
||||
|
||||
-----------------
|
||||
|
||||
|
||||
|
||||
|
||||
TPTEST 2.0 differs from TPTEST 1.0 in a few ways, which are
|
||||
described below.
|
||||
|
||||
- TPTEST 2.0 implements a feature that opens NAT gateways/firewalls
|
||||
for testing of incoming aswell as outgoing bandwidth.
|
||||
|
||||
- TPTEST 2.0 also implements a Cookie feature to enhance security.
|
||||
|
||||
- This text file is only available in english as of now. It is too
|
||||
much work having to write everything down in more than one language
|
||||
and the people reading this are extremely likely to be used to
|
||||
reading technical documentation in english anyhow.
|
||||
|
||||
|
||||
|
||||
Changes to the client-server protocol
|
||||
-------------------------------------
|
||||
|
||||
The text-based command protocol used between test client and server
|
||||
now works like this (the reader is expected to be familiar with TCP-
|
||||
based Internet application protocols like e.g. SMTP, NNTP) :
|
||||
|
||||
1. The client connects to a test server on a TCP port (default: 1632)
|
||||
|
||||
|
||||
2. The server says "200 <welcome message>" to signal its status as
|
||||
available for testing.
|
||||
|
||||
If the server is not available it can respond "4xx <message>"
|
||||
(come back later) or "5xx <message>" (don't come back at all)
|
||||
|
||||
|
||||
3. The client requests a test session by using the TEST command:
|
||||
|
||||
TEST Vmajor,Vminor,Testtype,UDPport,PPS,Packetsize,Packets,Time
|
||||
|
||||
Vmajor = version number, major (1)
|
||||
Vminor = version number, minor (0)
|
||||
Testtype = 0 (full duplex), 1 (send only) or 2 (receive only)
|
||||
UDPport = client UDP port number
|
||||
PPS = Requested no of packets per second
|
||||
Packetsize = Requested packet size (bytes)
|
||||
Paket = No of packets to be sent (time * PPS)
|
||||
Time = time (in seconds) the test is to be run
|
||||
|
||||
(Note that the syntax here is identical to the one used in TPTEST 1.0)
|
||||
|
||||
|
||||
4. If all is OK, the server responds with:
|
||||
|
||||
210 ServerUDPReceivePort ServerUDPSendPort 0xCookie
|
||||
|
||||
ServerUDPReceivePort = The local port the server is expecting test packets on
|
||||
ServerUDPSendPort = The local port the server will use to send outgoing packets
|
||||
Cookie = A magic cookie the client has to include in all UDP packets it sends
|
||||
|
||||
The client then knows what UDP port the server expects packet to arrive at and
|
||||
also what UDP port the server will be using when sending its outgoing packets.
|
||||
The Cookie value is a random number created by the server that the client has
|
||||
to include in all UDP packets it sends to the server or the server will just
|
||||
ignore the packets as they arrive.
|
||||
|
||||
A typical server response might look like this:
|
||||
|
||||
210 3458 3459 0xbc568a3e
|
||||
|
||||
This means that the server is using UDP port 3458 as the receive port for
|
||||
incoming (to the server) UDP packets, it is using UDP port 3459 when sending
|
||||
outgoing UDP packets, and it requires the client to include the value
|
||||
bc568a3e in the "Cookie" header field of all its outgoing UDP packets
|
||||
during the test.
|
||||
|
||||
5. The test starts, if it is a SEND test. The client then starts sending
|
||||
UDP packets to the server.
|
||||
|
||||
...or...
|
||||
|
||||
5b.If the test is a "receive test" or a "full duplex test", which means that
|
||||
the server has to send packets to the client, the server will not send any
|
||||
packets to the client until the client has first sent the server an UDP
|
||||
packet containing the right cookie value. The client uses this opportunity
|
||||
to send its "NATOPEN" packets which are fairly short (60 bytes) packets
|
||||
sent from the client's UDP *RECEIVE* port to the server's UDP *SEND* port.
|
||||
|
||||
This is why the client needs to know the port the server will be using to
|
||||
send its packets. The client will send several packets until it receives
|
||||
a packet back from the server. When that happens, the client will enter
|
||||
the real test mode and start counting packets received and reception
|
||||
times. The server will always "ack" a NATOPEN packet, even when it is
|
||||
performing the actal test. An ACK packet that gets lost in transit means
|
||||
the server might fire away the test but the client will then treat the
|
||||
first received test packet as the ACK and so count one packet less during
|
||||
the test. If it doesn't get an ACK or a test packet back, the client will
|
||||
resend the NATOPEN packet a few times before giving up.
|
||||
|
||||
6. The server ACKs the NATOPEN packet (it just returns it on the same ports)
|
||||
|
||||
7. The server starts the test in case of a RECEIVE test or the client starts
|
||||
the test in case of a FULL DUPLEX test.
|
||||
|
||||
8. Statistics are exchanged between client and server using the STATS
|
||||
command on the control channel.
|
||||
|
||||
|
||||
The STATS line is exactly the same as the one in TPTEST 1.0
|
||||
|
||||
Why not release a 1.1 version instead of 2.0? Well, feature- and
|
||||
functionality-wise 1.1 seems more right but this version is *incompatible*
|
||||
with version 1.0 due to the unavoidable changes to the client-server
|
||||
protocol. It seemed more right to use the minor version number for
|
||||
feature changes that didn't affect compatibility and the major version
|
||||
number for changes that did.
|
||||
|
||||
|
||||
/prl@gatorhole.se 2001-10-23
|
||||
|
||||
|
||||
-------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TPTEST 1.0
|
||||
|
||||
New control protocol between client and server
|
||||
----------------------------------------------
|
||||
|
||||
The data structures that were sent on the control channel between
|
||||
client and server have been replaced by a text-based command
|
||||
protocol that works like this:
|
||||
|
||||
(This text requires some knowledge of text-based Internet
|
||||
application protocols in order to be completely understandable)
|
||||
|
||||
The client connects to the test server on the control (TCP) channel.
|
||||
|
||||
The test server says "200 welcome" if it accepts any clients.
|
||||
Otherwise it says "4xx try again later" or "5xx go away"
|
||||
|
||||
After a 200-response the client says:
|
||||
|
||||
TEST Vmajor,Vminor,Testtype,UDPport,PPS,Packetsize,Packets,Time
|
||||
|
||||
Vmajor = version number, major (1)
|
||||
Vminor = version number, minor (0)
|
||||
Testtype = 0 (full duplex), 1 (send only) or 2 (receive only)
|
||||
UDPport = client UDP port number
|
||||
PPS = Requested no of packets per second
|
||||
Packetsize = Requested packet size (bytes)
|
||||
Paket = No of packets to be sent (time * PPS)
|
||||
Time = time (in seconds) the test is to be run
|
||||
|
||||
The server responds with "200 ServerUDPport" if all is OK. The client
|
||||
then knows what UDP port the server is expecting packets to arrive at.
|
||||
|
||||
If something's wrong the server says "5xx error message" or if it is
|
||||
a temporary problem "4xx error message".
|
||||
|
||||
After completed test the test results are sent using a STATS
|
||||
command on the control channel. In the case of a send-only or a
|
||||
full duplex test the client will be the one to initiate the
|
||||
statistics-exchange but in the case of a receive-only test it is
|
||||
the server that first sends a STATS line. The STATS line looks
|
||||
like this:
|
||||
|
||||
STATS Vmajor,Vminor,PS,PU,PR,TXB,RXB,MaxRTT,MinRTT,
|
||||
TX1s:TX1us,TX2s:TX2us,RX1s:RX1us,RX2s:RX2us
|
||||
|
||||
(everything on a single line)
|
||||
|
||||
PS = No of packets sent
|
||||
PU = No of packets unsent
|
||||
PR = No of packets received
|
||||
TXB = No of bytes sent (64-bit integer)
|
||||
RXB = No of bytes received (64-bit integer)
|
||||
MaxRTT = Max roundtrip time (full duplex test)
|
||||
MinRTT = Min roundtrip time (full duplex test)
|
||||
TX1s:TX1us = Time in seconds and microseconds when transmission started
|
||||
TX2s:TX2us = Time in seconds and microseconds when transmission ended
|
||||
RX1s:RX1us = Time in seconds and microseconds when reception started
|
||||
RX2s:RX2us = Time in seconds and microseconds when reception ended
|
||||
|
||||
Note that The time values (TX1s:TX1us and the others) have two components
|
||||
each - two 32-bit integers that together comprise a "timeval" value with
|
||||
seconds since 1970 and microseconds since last second. In textform they
|
||||
can look like this:
|
||||
|
||||
1014336000:578459,1014336005:579388 (TX1s:TX1us,TX2s:TX2us of a test
|
||||
that lasted 5 seconds)
|
||||
|
||||
|
||||
The server program has got overload protection
|
||||
-------------------------------------------------
|
||||
|
||||
In tptest.h there is a DENYFILE definition which is defined, by default,
|
||||
as "/tmp/tptest.deny". If this file exists, tptest will refuse new client
|
||||
connections. Connecting clients will receive a "4xx" answer when they try
|
||||
to connect.
|
||||
|
||||
Read further down also, about the server config file.
|
||||
|
||||
|
||||
|
||||
The server program has got a config file
|
||||
-------------------------------------------
|
||||
|
||||
Using the -f flag it is possible to tell the server to read a config file.
|
||||
The config file contains max values for various test parameters - it tells
|
||||
the server what types of test values to accept. It is possible to limit
|
||||
bitrate per client, packet size, packet rate and test time and also the
|
||||
number of simultaneous clients the server will accept. Finally, it is
|
||||
possible to deny service to certain IP-numbers or ranges of IP-numbers
|
||||
using regular expressions. Look at the supplied sample tptest.conf file
|
||||
for more info on how to do all this.
|
||||
|
||||
Starting the server with the command line:
|
||||
|
||||
tptest -m s -f ./tptest.conf
|
||||
|
||||
Will make it read the config file on startup. If you have made changes in
|
||||
the file and want tptest to reload its config you can send it a kill -HUP
|
||||
signal and it will do a config reload.
|
||||
|
||||
|
||||
|
||||
The windows client and the master server
|
||||
----------------------------------------
|
||||
|
||||
A TPTEST client for Windows (Win32) has been written and in connection
|
||||
with this we have also invented a master server function that keeps track
|
||||
of available test servers. This is to make it easier for testers to find
|
||||
test servers they can use and also to make it easier to reach users with
|
||||
info about new versions of the client program.
|
||||
|
||||
A protocol for communication between master server and client has been
|
||||
created and it works as follows:
|
||||
|
||||
The client connects to the master server (usually on port 1632).
|
||||
|
||||
The client says:
|
||||
|
||||
HELO Vmajor,Vminor
|
||||
|
||||
Whereupon the master server responds with something like:
|
||||
|
||||
250-bleak.pdc.kth.se TCP 1632 "100Mbps, KTH, Stockholm, Sverige"
|
||||
250-croclist.gatorhole.com
|
||||
250
|
||||
|
||||
The 250 code means that all is OK and that the master server is sending
|
||||
a list of the known test servers in existence. If there is a minus sign
|
||||
directly after "250" it means that the current line is not the last line
|
||||
but will be followed by more lines. After "250" and possibly a minus
|
||||
sign follows the hostname of the test server. If there is nothing after
|
||||
that the client will assume that the test server will accept connections
|
||||
on TCP port 1632 which is default. If there is anything within quotation
|
||||
marks "" it is interpreted as a short description of the test server.
|
||||
The client may show this description to the user to help the user
|
||||
select a test server.
|
||||
|
||||
If the client has an old version of the client software, the master server
|
||||
may answer:
|
||||
|
||||
501 You need to upgrade.
|
||||
|
||||
The client can also request contact information from the master server
|
||||
using the INFO command. The syntax is:
|
||||
|
||||
The client says:
|
||||
|
||||
INFO
|
||||
|
||||
And the master server replies, for instance:
|
||||
|
||||
250-The Swedish ICT-commission network throughput test program
|
||||
250-Email: bandbreddstest@itkommissionen.se
|
||||
250-WWW: http://www.itkommissionen.se/
|
||||
250
|
||||
|
||||
The reply, then, is a number of lines of text with contact information
|
||||
for those who want to know more or upgrade their client, etc.
|
||||
|
||||
|
||||
The master server:
|
||||
|
||||
The current master server program is very simple. It only knows the
|
||||
INFO and HELO commands and when it gets a HELO command it just burps
|
||||
up the contents of a certain file to the connected client, line by
|
||||
line.
|
||||
|
||||
By default, this file is "/etc/tptest.servers" but that can easily
|
||||
be changed in tptestmaster.c by changing the DATAFILE definition
|
||||
or by supplying the filename as the only commandline argument when
|
||||
starting tptestmaster:
|
||||
|
||||
./tptestmaster /etc/tptest.servers
|
||||
|
||||
Tptestmaster also checks for a DENYFILE which is, by default,
|
||||
"/tmp/tptestmaster.deny" and if it exists it means that tptestmaster
|
||||
refuses new connections.
|
||||
|
||||
Note that tptestmaster and the tptest servers normally use the same
|
||||
TCP port (1632) by default. This means that if you want to run both
|
||||
a master server and a test server on the same machine you have to use
|
||||
another port for one of them (it's easiest to let the test server
|
||||
use another port).
|
||||
|
||||
|
||||
|
||||
The Windows client:
|
||||
|
||||
The Windows client performs its tests in the same way the Unix client
|
||||
does but it includes some extra features to make things easier to the
|
||||
user, especially when starting a test. The Unix client does not, for
|
||||
example, support the master server protocol.
|
||||
|
||||
The Windows client user may click directly on the big START button
|
||||
and by doing that immediately start a test without having to decide
|
||||
what server to use, what packet size, data rate, etc. This auto-test
|
||||
procedure works by the client first connecting to the master server
|
||||
(the address of the default master server is compiled into the
|
||||
client program), fetching a list of the available test servers and
|
||||
then selecting the first server in the list that wants to be spoken
|
||||
to using a protocol the client knows (Currently, the only protocol
|
||||
available today is "TCP" but the client supports the use of
|
||||
different TCP ports at least). The client then makes several
|
||||
5-second tests at first a really low speed and then increasing the
|
||||
speed a little for each test until the test result stops improving.
|
||||
When the test result (the throughput) doesn't get any better the
|
||||
client assumes it has found the maximum throughput and stops the
|
||||
test and displays the results to the user.
|
||||
|
||||
The user may also click on the "Select test speed" button and choose
|
||||
a certain speed to be tested. If s/he does that the selected speed
|
||||
will be the only speed tested.
|
||||
|
||||
If the user chooses to use the Advanced menu (Advanced mode) it has
|
||||
options to set what test server to use and also to control in detail
|
||||
the various parameters of the test, just like with the Unix client.
|
||||
|
||||
|
||||
Other changes
|
||||
-------------
|
||||
|
||||
TPTEST 0.97 and earlier versions regarded 1 kbps as 1024 bits/second.
|
||||
There is some confusion about this but we have concluded that when
|
||||
talking about network bandwidth it is more common that 1000 bits
|
||||
equals 1 kilobit so from version 1.0 all TPTEST software considers
|
||||
1 kbps to be 1000 bits/s.
|
||||
|
||||
When someone goes shopping for network bandwidth they often buy
|
||||
bandwidth at speeds that are multiples of 64 kbps and that means
|
||||
that a connection that is labeled "1 Mbps" can often be 1024 kbps
|
||||
(16 x 64 kbps). TPTEST will in such a case correctly state the
|
||||
speed as 1.024 Mbps or 1024 kbps.
|
||||
|
||||
A so-called T1-connection is 1536 kbps (24 x 64 kbps) and that is,
|
||||
then, not exactly 1.5 Mbps which one might think but rather 1.54 Mbps.
|
||||
|
||||
1 kB = 1 kilobyte = 1024 bytes
|
||||
64 kB = 64 kilobyte = 65536 bytes
|
||||
1 MB = 1 megabyte = 1048576 bytes
|
||||
|
||||
1 kbit = 1 kilobit = 1000 bits
|
||||
64 kbit = 64 kilobit = 64000 bits
|
||||
1 Mbit = 1 megabit = 1000000 bits
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
Usage: tptestclient [options] <-m mode> <parameters> <address> <port>
|
||||
|
||||
options: <> = required argument, [] = optional argument
|
||||
-b <local address> Bind to local address/interface
|
||||
-n <repetitions> Repeat test n number of times (0 = infinite)
|
||||
-v <verbosity> Set verbosity level
|
||||
-s <verbosity> Set syslog verbosity level
|
||||
-e <email> Set email for TPTEST/Statistik
|
||||
-p <password> Set password for TPTEST/Statistik
|
||||
-d <delaytime> Set delaytime between repeated tests
|
||||
-S <sendbuf size> Try to set size of socket send buffer
|
||||
-R <recvbuf size> Try to set size of socket receive buffer
|
||||
-t No text output
|
||||
|
||||
test modes & parameters:
|
||||
udp-send | us UDP send to server
|
||||
parameters: <testtime> <bitrate>
|
||||
parameters: <testtime> <packetsize> <packets/sec>
|
||||
udp-receive | ur UDP receive from server
|
||||
parameters: <testtime> <bitrate>
|
||||
parameters: <testtime> <packetsize> <packets/sec>
|
||||
udp-fdx | uf UDP full duplex
|
||||
parameters: <testtime> <bitrate>
|
||||
parameters: <testtime> <packetsize> <packets/sec>
|
||||
tcp-send | ts TCP send to server
|
||||
parameters: <max testtime> <bytes to send>
|
||||
tcp-receive | tr TCP receive from server
|
||||
parameters: <max testtime> <bytes to receive>
|
||||
tcp-send-auto | tsa TCP auto send to server
|
||||
tcp-receive-auto | tra TCP auto receive from server
|
||||
tcp-auto | ta TCP auto (auto send + auto receive)
|
||||
|
||||
|
||||
|
||||
Examples:
|
||||
|
||||
1. Starting an infinitely repeating TPTEST/Statistik session with user "joe"
|
||||
and pw "xyz" to server "server.some.domain" on control port 1650 :
|
||||
|
||||
./tptestclient -n0 -e joe -p xyz -m tcp-auto server.some.domain 1650
|
||||
|
||||
|
||||
2. Starting a one-time, 5-second UDP-Send test with packet size 1100 bytes
|
||||
and packet rate 200 packets per second :
|
||||
|
||||
./tptestclient -m udp-send 5 1100 200 server.some.domain 1650
|
||||
|
||||
|
||||
3. Starting three consecutive automatic (meaning they figure out the
|
||||
amount of data to send to get a good test result) TCP-Send tests,
|
||||
sending output both to stdout and to syslog at the highest verbosity
|
||||
level :
|
||||
|
||||
./tptestclient -n3 -v2 -s2 -m tcp-send-auto server.some.domain 1650
|
||||
|
||||
|
||||
|
||||
Tips:
|
||||
|
||||
- "tcp-send-auto" can be abbreviated to "tsa". All the various modes
|
||||
have abbreviations for the weaker typists out there
|
||||
|
||||
- For TPTEST/Statistik usage, the program will while running remember
|
||||
the last throughput rates up- and downstream and when starting a new
|
||||
test, it will on the first try use what it thinks is the appropriate
|
||||
amount of data to make the test run in approximately 20 seconds. This
|
||||
usually reduces the number of "sub-tests" performed in order to get
|
||||
a good result.
|
||||
|
||||
This means that running the program in stand-alone mode with infinite
|
||||
repetition, or perhaps starting it once every hour or so through cron,
|
||||
and supplying it with a "-n10" option, will result in more test
|
||||
results per hour and less load on the test servers.
|
||||
|
||||
- For standard TPTEST 3 usage, you can use e.g. "-d 60" along with
|
||||
"-n0" to cause the program to loop infinitely, performing tests but
|
||||
waiting 60 seconds between each consecutive test.
|
||||
|
||||
- Socket send and receive buffers
|
||||
@@ -11,7 +11,7 @@ PKG_NAME:=ubus-mqtt
|
||||
PKG_VERSION:=14.20.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_URL:=git@iopsys.inteno.se:$(PKG_NAME).git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/ubus-mqtt
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
@@ -16,13 +16,55 @@ define Package/voice-client
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=voice-client
|
||||
DEPENDS:=+asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/voice-client/description
|
||||
voice-client
|
||||
endef
|
||||
|
||||
define Package/voice-client/conffiles
|
||||
/etc/asterisk_templates/asterisk.conf.TEMPLATE
|
||||
/etc/asterisk_templates/brcm.conf.TEMPLATE
|
||||
/etc/asterisk_templates/brcm_line.TEMPLATE
|
||||
/etc/asterisk_templates/cdr.conf.TEMPLATE
|
||||
/etc/asterisk_templates/codecs.conf.TEMPLATE
|
||||
/etc/asterisk_templates/dnsmgr.conf.TEMPLATE
|
||||
/etc/asterisk_templates/extensions.conf.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_dialtone.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_direct.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_extra.conf.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_incoming_line.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_incoming.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_local_line.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_local.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_macro.conf.TEMPLATE
|
||||
/etc/asterisk_templates/extensions_provider.TEMPLATE
|
||||
/etc/asterisk_templates/features.conf.TEMPLATE
|
||||
/etc/asterisk_templates/indications.conf.TEMPLATE
|
||||
/etc/asterisk_templates/logger.conf.TEMPLATE
|
||||
/etc/asterisk_templates/manager.conf.TEMPLATE
|
||||
/etc/asterisk_templates/meetme.conf.TEMPLATE
|
||||
/etc/asterisk_templates/modules.conf.TEMPLATE
|
||||
/etc/asterisk_templates/musiconhold.conf.TEMPLATE
|
||||
/etc/asterisk_templates/queues.conf.TEMPLATE
|
||||
/etc/asterisk_templates/queue.TEMPLATE
|
||||
/etc/asterisk_templates/res_stun_monitor.conf.TEMPLATE
|
||||
/etc/asterisk_templates/rtp.conf.TEMPLATE
|
||||
/etc/asterisk_templates/sip.conf.TEMPLATE
|
||||
/etc/asterisk_templates/sip_provider.TEMPLATE
|
||||
/etc/asterisk_templates/sip_provider_voicesec.TEMPLATE
|
||||
/etc/asterisk_templates/sip_registration.TEMPLATE
|
||||
/etc/asterisk_templates/sip_registration_voicesec.TEMPLATE
|
||||
/etc/asterisk_templates/sip_user.TEMPLATE
|
||||
/etc/asterisk_templates/voicemail.conf.TEMPLATE
|
||||
/etc/asterisk_templates/voicemail_mailbox.TEMPLATE
|
||||
/etc/init.d/voice_client
|
||||
/etc/config/voice_client
|
||||
/etc/config/voice_codecs
|
||||
/etc/uci-defaults/99-voice_client
|
||||
/etc/idc_cc.cfg
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
|
||||
@@ -5,7 +5,7 @@ batch=no
|
||||
safeshutdown=yes
|
||||
|
||||
[csv]
|
||||
usegmtime=yes ; log date/time in GMT. Default is "no"
|
||||
usegmtime=no ; log date/time in GMT. Default is "no"
|
||||
loguniqueid=yes ; log uniqueid. Default is "no"
|
||||
loguserfield=yes ; log user field. Default is "no"
|
||||
accountlogs=no ; create separate log file for each account code. Default is "yes"
|
||||
|
||||
@@ -21,6 +21,7 @@ nat=yes
|
||||
directmedia=no
|
||||
sipdebug=no
|
||||
session-timers=refuse
|
||||
videosupport=yes
|
||||
|
||||
realm=|REALM|
|
||||
defaultexpiry=|DEFAULTEXPIRY|
|
||||
|
||||
@@ -133,24 +133,6 @@ config 'features' 'features'
|
||||
option 'callreturn_enabled' '1'
|
||||
option 'advanced_register_settings' '1'
|
||||
|
||||
config 'sip_service_provider' 'sip0'
|
||||
option 'name' 'Account 1'
|
||||
option 'enabled' '0'
|
||||
option 'codec0' 'alaw'
|
||||
option 'codec1' 'ulaw'
|
||||
option 'codec2' 'g729'
|
||||
option 'codec3' 'g726'
|
||||
option 'autoframing' '1'
|
||||
option 'call_lines' 'BRCM/0 BRCM/4'
|
||||
option 'cfim_on' '*21*'
|
||||
option 'cfim_off' '#21#'
|
||||
option 'cfbs_on' '*61*'
|
||||
option 'cfbs_off' '#61#'
|
||||
option 'call_return' '*69'
|
||||
option 'redial' '*66'
|
||||
option 'is_fax' '0'
|
||||
option 'transport' 'udp'
|
||||
|
||||
config log 'LOG'
|
||||
option console 'notice,warning,error'
|
||||
option messages 'error'
|
||||
@@ -160,3 +142,27 @@ config log 'LOG'
|
||||
config ringing_status 'RINGING_STATUS'
|
||||
option status '0'
|
||||
option enabled '1'
|
||||
|
||||
config call_filter 'call_filter0'
|
||||
option block_foreign '0'
|
||||
option block_special_rate '0'
|
||||
option block_outgoing '0'
|
||||
option block_incoming '0'
|
||||
|
||||
config 'sip_service_provider' 'sip0'
|
||||
option 'name' 'Account 1'
|
||||
option 'enabled' '0'
|
||||
option 'codec0' 'alaw'
|
||||
option 'codec1' 'ulaw'
|
||||
option 'codec2' 'g729'
|
||||
option 'codec3' 'g726'
|
||||
option 'autoframing' '1'
|
||||
option 'cfim_on' '*21*'
|
||||
option 'cfim_off' '#21#'
|
||||
option 'cfbs_on' '*61*'
|
||||
option 'cfbs_off' '#61#'
|
||||
option 'call_return' '*69'
|
||||
option 'redial' '*66'
|
||||
option 'is_fax' '0'
|
||||
option 'transport' 'udp'
|
||||
|
||||
|
||||
@@ -242,7 +242,79 @@ read_lines()
|
||||
{
|
||||
local lines=""
|
||||
local call_lines
|
||||
local fsxIdx fsxEpt dectIdx dectEpt
|
||||
|
||||
# Are lines already set by user conf?
|
||||
config_get call_lines $1 call_lines
|
||||
|
||||
# Otherwise set default depending on board HW. This
|
||||
# is only done at very first boot or a default reset.
|
||||
if test -z "$call_lines"; then
|
||||
# Get all FSX voice endpoints. Translate to uppercase with awk
|
||||
# due to tr [:upper:] doesn't work in our BusyBox.
|
||||
voicePorts=$(db get hw.board.VoicePortOrder | \
|
||||
awk '{ print toupper($0) }' | \
|
||||
sed -e "s/\([[:alpha:]]*\)\([[:digit:]]\)/\1\/\2/g")
|
||||
voiceNames=$(db get hw.board.VoicePortNames)
|
||||
hasVoice=0
|
||||
|
||||
if test $(db get hw.board.hasVoice) = "1"; then
|
||||
# Get the first FSX voice endpoint index by
|
||||
# searching for the name usually used.
|
||||
fsxIdx=$(echo $voiceNames | \
|
||||
awk -e '{
|
||||
i = 1;
|
||||
while(i <= NF && tolower($i) !~ /^tel.*$/) {
|
||||
i++;
|
||||
}
|
||||
print i;
|
||||
}
|
||||
')
|
||||
|
||||
# Convert index to endpoint ID
|
||||
if test $fsxIdx -gt 0; then
|
||||
fsxEpt=$(echo $voicePorts | awk '{ print $'$fsxIdx' }')
|
||||
fi
|
||||
|
||||
hasVoice=1
|
||||
fi
|
||||
|
||||
if test $(db get hw.board.hasDect) = "1"; then
|
||||
# Get the first Dect voice endpoint index by
|
||||
# searching for the name usually used.
|
||||
dectIdx=$(echo $voiceNames | \
|
||||
awk -e '{
|
||||
i = 1;
|
||||
while(i <= NF && tolower($i) !~ /^dect.*$/) {
|
||||
i++;
|
||||
}
|
||||
print i;
|
||||
}
|
||||
')
|
||||
|
||||
if test $dectIdx -gt 0; then
|
||||
dectEpt=$(echo $voicePorts | awk '{ print $'$dectIdx' }')
|
||||
fi
|
||||
|
||||
hasVoice=1
|
||||
fi
|
||||
|
||||
if test $hasVoice -eq 1; then
|
||||
call_lines="$dectEpt $fsxEpt"
|
||||
|
||||
# If we didn't find any endpoint ID we
|
||||
# fallback to activate them all.
|
||||
if test -z "$call_lines"; then
|
||||
call_lines="$voicePorts"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Save the endpoint IDs we found where the
|
||||
# GUI expects to find them.
|
||||
uci_set voice_client "${1}" "call_lines" "$call_lines"
|
||||
uci_commit voice_client
|
||||
fi
|
||||
|
||||
for i in $call_lines ; do
|
||||
case $i in
|
||||
''|*[!0-9]*) lines=$lines"$i&" ;;
|
||||
@@ -1503,7 +1575,7 @@ configure_extensions_provider()
|
||||
call_filter_macro=$(get_call_filter $1 incoming)
|
||||
echo "exten => $user,1,$call_filter_macro" >> $tmp
|
||||
|
||||
local call_lines call_ivr call_queue extension
|
||||
local call_ivr call_queue extension
|
||||
echo "exten => $user,n,Set(__TRANSFER_CONTEXT=\${CHANNEL(peername)}-transfer)" >> $tmp
|
||||
|
||||
# replace prefix '+' with '00'
|
||||
@@ -1511,12 +1583,11 @@ configure_extensions_provider()
|
||||
echo "exten => $user,n(rewrite),Set(CALLERID(num)=\"00\${CALLERID(num):1}\"))" >> $tmp
|
||||
echo "exten => $user,n(norewrite),NoOp()">> $tmp
|
||||
|
||||
config_get call_lines $1 call_lines
|
||||
# read a list of lines that should be dialled on incoming calls
|
||||
incoming_lines=$(read_lines $1)
|
||||
config_get call_queue $1 call_queue
|
||||
config_get call_ivr $1 call_ivr
|
||||
if ! [ -z "$call_lines" ] ; then
|
||||
# read a list of lines that should be dialled on incoming calls
|
||||
incoming_lines=$(read_lines $1)
|
||||
if [ -n "$incoming_lines" ]; then
|
||||
echo "exten => $user,n,Dial($incoming_lines,$(get_voicemail_timeout),tF(hangup,h,2))" >> $tmp
|
||||
echo "exten => $user,n,GotoIf($[\"\${DIALSTATUS}\"=\"ANSWER\"]?endcall)" >> $tmp
|
||||
echo "exten => $user,n,GotoIf($[\"\${DIALSTATUS}\"=\"BUSY\"]?noanswer)" >> $tmp
|
||||
@@ -1930,18 +2001,44 @@ done
|
||||
#
|
||||
set_line_name()
|
||||
{
|
||||
local curname
|
||||
local maxlinenum=$2
|
||||
local curname name_ix ix item lnum
|
||||
|
||||
# delete non-existing lines from config #
|
||||
case $1 in
|
||||
brcm[0-9])
|
||||
lnum=${1:4:1}
|
||||
[ $((lnum+1)) -gt $maxlinenum ] && uci -q delete voice_client.$1
|
||||
;;
|
||||
esac
|
||||
#########################################
|
||||
|
||||
config_get curname $1 name
|
||||
[ -n "$curname" ] && return
|
||||
|
||||
line_number=${1:4}
|
||||
if [ "$line_number" -lt "$dectCount" ] ; then
|
||||
uci_set voice_client $1 name "DECT $(( $line_number + 1 ))"
|
||||
elif [ "$line_number" -lt "$allCount" ] ; then
|
||||
uci_set voice_client $1 name "Tel $(( $line_number - $dectCount + 1 ))"
|
||||
else
|
||||
uci_set voice_client $1 name $1
|
||||
name_ix=""
|
||||
ix=0
|
||||
for item in $(db get hw.board.VoicePortOrder); do
|
||||
if [ "$item" == "$1" ]; then
|
||||
name_ix=$ix
|
||||
break
|
||||
fi
|
||||
ix=$((ix+1))
|
||||
done
|
||||
|
||||
ix=0
|
||||
if [ -n "$name_ix" ]; then
|
||||
for item in $(db get hw.board.VoicePortNames); do
|
||||
if [ $ix -eq $name_ix ]; then
|
||||
uci_set voice_client $1 name \
|
||||
"$(echo "$item" |tr "[_]" "[ ]")"
|
||||
return
|
||||
fi
|
||||
ix=$((ix+1))
|
||||
done
|
||||
fi
|
||||
|
||||
uci_set voice_client $1 name $1
|
||||
}
|
||||
|
||||
#
|
||||
@@ -1986,13 +2083,16 @@ start_service() {
|
||||
run_hook preinit
|
||||
mkdir -p $WORKDIR
|
||||
mkdir -p $WORKDIR/ssl
|
||||
|
||||
# Load config file
|
||||
config_load voice_client
|
||||
|
||||
########################################################
|
||||
# Set line names according to whats reported by brcminfo
|
||||
# and delete non-existing lines from voice_client config
|
||||
########################################################
|
||||
config_foreach set_line_name brcm_line
|
||||
local maxlinenum=$(db get hw.board.VoicePorts)
|
||||
config_foreach set_line_name brcm_line $maxlinenum
|
||||
uci_commit voice_client
|
||||
|
||||
#######################################
|
||||
|
||||
31
voice-client/files/etc/uci-defaults/99-voice_client
Executable file
31
voice-client/files/etc/uci-defaults/99-voice_client
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q get voice_client.call_filter0 >/dev/null || {
|
||||
|
||||
uci -q batch <<-EOT
|
||||
add voice_client call_filter
|
||||
rename voice_client.@call_filter[-1]=call_filter0
|
||||
set voice_client.call_filter0.block_foreign=0
|
||||
set voice_client.call_filter0.block_special_rate=0
|
||||
set voice_client.call_filter0.block_outgoing=0
|
||||
set voice_client.call_filter0.block_incoming=0
|
||||
commit voice_client
|
||||
EOT
|
||||
|
||||
}
|
||||
|
||||
uci -q get voice_client.RINGING_STATUS >/dev/null || {
|
||||
|
||||
uci -q batch <<-EOT
|
||||
add voice_client ringing_status
|
||||
rename voice_client.@ringing_status[-1]=RINGING_STATUS
|
||||
set voice_client.RINGING_STATUS.status=0
|
||||
set voice_client.RINGING_STATUS.enabled=1
|
||||
set voice_client.RINGING_STATUS.shouldring=1
|
||||
commit voice_client
|
||||
EOT
|
||||
|
||||
}
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
PKG_NAME:=voicesec
|
||||
PKG_VERSION:=1.0
|
||||
|
||||
PKG_SOURCE_URL:=git@ihgsp.inteno.se:voicesec
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:voicesec
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=661c0091e579e284712aeed892e921cc84a6f0bb
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@@ -8,29 +8,31 @@ include $(INCLUDE_DIR)/kernel.mk
|
||||
PKG_NAME:=wifimngr
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE_VERSION:=c8d30103f49af2db81691385dc44316a2207ada1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/wifimngr
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib
|
||||
|
||||
define Package/wifimngr
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+libpthread +libstdcpp +librt +libjson alljoyn +ubus +libuci
|
||||
TITLE:=WiFi Manager
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+libpthread +libstdcpp +librt +libjson alljoyn +ubus +libuci
|
||||
TITLE:=WiFi Manager
|
||||
endef
|
||||
|
||||
define Package/wifimngr/description
|
||||
wifimngr manages wireless driver
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Package/wifimngr/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wifimngr $(1)/sbin/
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
CC = g++
|
||||
CXXFLAGS = -Wall -pipe -std=c++98 -fno-rtti -fno-exceptions -Wno-long-long -Wno-deprecated -g -DQCC_OS_LINUX -DQCC_OS_GROUP_POSIX -DQCC_CPU_X86
|
||||
LIBS = -lalljoyn -lstdc++ -lcrypto -lpthread -lrt -luci -lubus -lubox -lblobmsg_json -ljson-c
|
||||
OBJS = wifimngr.o tools.o ubus.o jsp.o
|
||||
SRCS = wifimngr.cc tools.cc ubus.c jsp.c
|
||||
LIBSRCS =
|
||||
ISRCS = wifi.h common.h
|
||||
|
||||
all: wifimngr
|
||||
|
||||
wifimngr: ${OBJS}
|
||||
${CC} ${LDFLAGS} ${LIBSRCS} -o wifimngr ${OBJS} ${LIBS}
|
||||
|
||||
clean:
|
||||
rm -f wifimngr *.o
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user