-- Copyright (c) 1997-now, NeoNova BV, The Netherlands. All rights Reserved.
--
-- This software is the copyrighted work of NeoNova BV.
-- Use of the software is subject to the general business terms and conditions of NeoNova BV
-- and its related transaction documents like license sheets or other written notices.#
-- Any reproduction or redistribution of the software not in accordance with the license terms
-- is expressly prohibited by law, and may result in severe civil and criminally penalties.
-- Violators will be prosecuted to the maximum extent possible.

CREATE TABLE local_network (
 id serial,

 created timestamp with time zone not null default CURRENT_TIMESTAMP,
--HELP_EN_INFO:Creation Date
--HELP_EN_LONG:The date and time this record was created.
--HELP_NL_INFO:Datum aanmaak
--HELP_NL_LONG:De tijd en datum waarop dit is aangemaakt.

 lastupdate timestamp with time zone not null default CURRENT_TIMESTAMP,
--HELP_EN_INFO:Last Update
--HELP_EN_LONG:The date and time this record was updated.
--HELP_NL_INFO:Laatste wijziging
--HELP_NL_LONG:De tijd en datum van laatste wijziging.

 astium integer NOT NULL default '2',
--HELP_EN_INFO:Astium
--HELP_EN_LONG:For which Astium this record is valid.
--HELP_NL_INFO:Astium
--HELP_NL_LONG:Voor welke Astium deze gegevens gelden.

 description varchar(64) NOT NULL default '',
--HELP_EN_INFO:description
--HELP_EN_LONG:A short description of this network
--HELP_NL_INFO:omschrijving
--HELP_NL_LONG:Een korte omschrijving van dit netwerk

 network varchar(40) NOT NULL default '0.0.0.0/0',
--HELP_EN_INFO:network
--HELP_EN_LONG:Network specification (in CIDR notation) which should be marked as a local network
--HELP_NL_INFO:netwerk
--HELP_NL_LONG:De specificatie van het netwerk (in CIDR notatie) welk moet worden aangemerkt als lokaal netwerk.

 status varchar(8) NOT NULL default 'active'
   CHECK (status IN ('active', 'deleted'))
--HELP_EN_INFO:
--HELP_EN_LONG:
--HELP_NL_INFO:
--HELP_NL_LONG:
);

GRANT UPDATE, SELECT, INSERT, DELETE ON local_network TO astium;
GRANT UPDATE, SELECT, INSERT, DELETE ON local_network_id_seq TO astium;
INSERT INTO local_network (id, description) VALUES (1, 'empty');
DELETE FROM local_network;

INSERT INTO local_network (network, description) values ('192.168.0.0/16', 'RFC 1918 address');
INSERT INTO local_network (network, description) values ('172.16.0.0/12', 'RFC 1918 address');
INSERT INTO local_network (network, description) values ('10.0.0.0/8', 'RFC 1918 address');
INSERT INTO local_network (network, description) values ('169.254.0.0/16', 'Zero conf');

