Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Add pkg gluon-hoodselector from google summer of code 2016 #1226

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions package/gluon-hoodselector/Makefile
@@ -0,0 +1,30 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=gluon-hoodselector

GLUON_VERSION = 3
PKG_VERSION:=2

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include ../gluon.mk

define Package/gluon-hoodselector
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Automatically sorte routers into network hoods.
DEPENDS:=+gluon-site +gluon-mesh-batman-adv-15 @GLUON_MULTIDOMAIN
CONFLICTS:=+gluon-config-mode-domain-select
endef

define Package/gluon-hoodselector/description
This is the hoodselector. The hoodselector is one of the main components for
splitting a layer 2 mesh network into seperated network segments (hoods).
The job of the hoodselector is to automatically detect in which hood
the router is located based on geo settings or by scanning its environment.
Based on these informations the hoodselector should select a hood from a
list of known hoods (hoodlist) and adjust vpn, wireless and mesh on lan
configuration based on the settings given for the selected hood.
endef

$(eval $(call BuildPackageGluon,gluon-hoodselector))
37 changes: 37 additions & 0 deletions package/gluon-hoodselector/check_site.lua
@@ -0,0 +1,37 @@
need_string_match(in_domain({'domain_seed'}), '^' .. ('%x'):rep(64) .. '$')

function need_nil(path)
need(path, function(val)
if val == nil then
return true
end
return false
end, true, "default hood should not contain shapes")
return nil
end

--Need to check if not default hood and does the default not contain shapes
if this_domain() ~= need_string(in_site({'default_domain'})) then
local no_shapes = true
for _,shape in ipairs(need_table(in_domain({'hoodselector', 'shapes'}))) do
no_shapes = false
if #shape >= 2 then
for _, pos in ipairs(shape) do
if pos.lat == nil or not ( pos.lat < 90.0 and pos.lat > -90.0 ) then
need(in_domain({'hoodselector', 'shapes'}), function(err) return false end, true, "lat muss match a rage +/-90.0")
end
if pos.lon == nil or not ( pos.lon < 180.0 and pos.lon > -180.0 ) then
need(in_domain({'hoodselector', 'shapes'}), function(err) return false end, true, "lon muss match a rage +/-180.0")
end
end
end
if #shape < 2 then
need(in_domain({'hoodselector', 'shapes'}), function(err) return false end, true, "needs to have at lease 2 coordiantes for rectangular shapes.")
end
end
if no_shapes then
need(in_domain({'hoodselector', 'shapes'}), function(err) return false end, true, "no shapes are defined in hoods")
end
else -- ente by default hood
need_nil(in_domain({'hoodselector', 'shapes'}))
end
@@ -0,0 +1 @@
*/2 * * * * /usr/sbin/hoodselector