Add LUCI support for HSO protocol (Option 3G card)
[project/luci.git] / protocols / hso / luasrc / model / network / proto_hso.lua
1 --[[
2 LuCI - Network model - 3G, PPP, PPtP, PPPoE and PPPoA protocol extension
3
4 Copyright 2011 Jo-Philipp Wich <xm@subsignal.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17
18 ]]--
19
20 local netmod = luci.model.network
21
22 local _, p
23
24 local proto = netmod:register_protocol("hso")
25
26 function proto.ifname(self)
27 return "hso-" .. self.sid
28 end
29
30 function proto.get_i18n(self)
31 return luci.i18n.translate("HSO")
32 end
33
34 function proto.opkg_package(self)
35 return "comgt"
36 end
37
38 function proto.is_installed(self)
39 return nixio.fs.access("/lib/netifd/proto/hso.sh")
40 end
41
42 function proto.is_floating(self)
43 return false
44 end
45
46 function proto.is_virtual(self)
47 return false
48 end
49
50 function proto.get_interfaces(self)
51 return netmod.protocol.get_interfaces(self)
52 end
53
54 function proto.contains_interface(self, ifc)
55 return netmod.protocol.contains_interface(self, ifc)
56 end
57
58 netmod:register_pattern_virtual("^hso-%%w")
59