proto-shell: prefix protocol callback functions with proto_
authorFelix Fietkau <nbd@openwrt.org>
Thu, 27 Oct 2011 18:04:52 +0000 (20:04 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 27 Oct 2011 18:04:52 +0000 (20:04 +0200)
dummy/netifd-proto.sh
dummy/proto/ppp.sh

index e7f0d9e..b04bc89 100755 (executable)
@@ -28,14 +28,14 @@ add_default_handler() {
 
 _proto_do_teardown() {
        json_load "$data"
-       eval "$1_teardown \"$interface\" \"$ifname\""
+       eval "proto_$1_teardown \"$interface\" \"$ifname\""
 }
 
 _proto_do_setup() {
        json_load "$data"
        _EXPORT_VAR=0
        _EXPORT_VARS=
-       eval "$1_setup \"$interface\" \"$ifname\""
+       eval "proto_$1_setup \"$interface\" \"$ifname\""
 }
 
 proto_init_update() {
@@ -225,12 +225,12 @@ init_proto() {
                                no_device=0
                                available=0
 
-                               add_default_handler "$1_init_config"
+                               add_default_handler "proto_$1_init_config"
 
                                json_init
                                json_add_string "name" "$1"
                                json_add_array "config"
-                               eval "$1_init_config"
+                               eval "proto_$1_init_config"
                                json_close_array
                                json_add_boolean no-device "$no_device"
                                json_add_boolean available "$available"
index fc918a5..bc7fd3c 100755 (executable)
@@ -9,27 +9,27 @@ ppp_generic_init_config() {
        proto_config_add_int "keepalive"
 }
 
-ppp_init_config() {
+proto_ppp_init_config() {
        no_device=1
        available=1
        ppp_generic_init_config
 }
 
-ppp_setup() {
+proto_ppp_setup() {
        echo "ppp_setup($1): $2"
 }
 
-ppp_teardown() {
+proto_ppp_teardown() {
        return
 }
 
 add_protocol ppp
 
-pppoe_init_config() {
+proto_pppoe_init_config() {
        ppp_generic_init_config
 }
 
-pppoe_setup() {
+proto_pppoe_setup() {
        local interface="$1"
        local device="$2"
 
@@ -43,7 +43,7 @@ pppoe_setup() {
        proto_run_command "$interface" sleep 30
 }
 
-pppoe_teardown() {
+proto_pppoe_teardown() {
        [ "$ERROR" = 9 ] && {
                proto_notify_error "$interface" PROCESS_KILLED
                proto_block_restart "$interface"