-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add MDNS Repeater * cleanup: remove cdata block * Update comment * rename template and use join * use the package name also in the config * remove extended description * update targets, makefile
- Loading branch information
Showing
15 changed files
with
415 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| PLUGIN_NAME= mdns-repeater | ||
| PLUGIN_VERSION= 1.0 | ||
| PLUGIN_COMMENT= Proxy multicast DNS between networks | ||
| PLUGIN_MAINTAINER= franz.fabian.94@gmail.com | ||
| PLUGIN_DEPENDS= mdns-repeater | ||
| PLUGIN_DEVEL= yes | ||
|
|
||
| .include "../../Mk/plugins.mk" |
Empty file.
68 changes: 68 additions & 0 deletions
68
net/mdns-repeater/src/etc/inc/plugins.inc.d/mdnsrepeater.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| Copyright (C) 2017 Fabian Franz | ||
| 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. | ||
| THIS SOFTWARE IS PROVIDED ``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 | ||
| AUTHOR 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. | ||
| */ | ||
|
|
||
| function mdnsrepeater_enabled() | ||
| { | ||
| $mdns_repeater = new \OPNsense\MDNSRepeater\MDNSRepeater(); | ||
| { | ||
| if ((string)$mdns_repeater->enabled == '1') { | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
|
|
||
| function mdnsrepeater_firewall($fw) | ||
| { | ||
| if (!mdnsrepeater_enabled()) { | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| function mdnsrepeater_services() | ||
| { | ||
| $services = array(); | ||
|
|
||
| // don't load the service if it is not enabled | ||
| // maybe there are no settings yet | ||
| if (!mdnsrepeater_enabled()) { | ||
| return $services; | ||
| } | ||
|
|
||
| $services[] = array( | ||
| 'description' => gettext('MDNS Repeater'), | ||
| 'configd' => array( | ||
| 'restart' => array('mdnsrepeater restart'), | ||
| 'start' => array('mdnsrepeater start'), | ||
| 'stop' => array('mdnsrepeater stop'), | ||
| ), | ||
| 'name' => 'mdns-repeater', | ||
| ); | ||
|
|
||
| return $services; | ||
| } |
69 changes: 69 additions & 0 deletions
69
...repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/ServiceController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * Copyright (C) 2017 Fabian Franz | ||
| * 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. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED ``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 | ||
| * AUTHOR 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. | ||
| */ | ||
|
|
||
| namespace OPNsense\MDNSRepeater\Api; | ||
|
|
||
| use \OPNsense\Base\ApiControllerBase; | ||
| use \OPNsense\Core\Backend; | ||
| use \OPNsense\MDNSRepeater\MDNSRepeater; | ||
|
|
||
| class ServiceController extends ApiControllerBase | ||
| { | ||
| public function statusAction() | ||
| { | ||
| $backend = new Backend(); | ||
| $result = array('result' => 'failed'); | ||
| $mdlMDNSRepeater = new MDNSRepeater(); | ||
| $result['result'] = $backend->configdRun('mdnsrepeater status'); | ||
| return $result; | ||
| } | ||
|
|
||
| public function startAction() | ||
| { | ||
| $backend = new Backend(); | ||
| $result = array('result' => 'failed'); | ||
| $backend->configdRun('template reload OPNsense/MDNSRepeater'); | ||
| $result['result'] = $backend->configdRun('mdnsrepeater start'); | ||
| return $result; | ||
| } | ||
|
|
||
| public function stopAction() | ||
| { | ||
| $backend = new Backend(); | ||
| $result = array("result" => "failed"); | ||
| $mdlMDNSRepeater = new MDNSRepeater(); | ||
| $result['result'] = $backend->configdRun('mdnsrepeater stop'); | ||
| return $result; | ||
| } | ||
|
|
||
| public function restartAction() | ||
| { | ||
| $this->stopAction(); | ||
| return $this->startAction(); | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
...epeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/Api/SettingsController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * Copyright (C) 2017 Fabian Franz | ||
| * | ||
| * 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. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED ``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 | ||
| * AUTHOR 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. | ||
| * | ||
| */ | ||
|
|
||
| namespace OPNsense\MDNSRepeater\Api; | ||
|
|
||
| use \OPNsense\Base\ApiMutableModelControllerBase; | ||
|
|
||
| class SettingsController extends ApiMutableModelControllerBase | ||
| { | ||
| static protected $internalModelClass = '\OPNsense\MDNSRepeater\MDNSRepeater'; | ||
| static protected $internalModelName = 'mdnsrepeater'; | ||
| } |
49 changes: 49 additions & 0 deletions
49
net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/IndexController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * Copyright (C) 2017 Fabian Franz | ||
| * | ||
| * 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. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED ``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 | ||
| * AUTHOR 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. | ||
| * | ||
| */ | ||
|
|
||
| namespace OPNsense\MDNSRepeater; | ||
|
|
||
| /** | ||
| * Class IndexController | ||
| * @package OPNsense\MDNSRepeater | ||
| */ | ||
| class IndexController extends \OPNsense\Base\IndexController | ||
| { | ||
| /** | ||
| * MDNS Repeater index page | ||
| * @throws \Exception | ||
| */ | ||
| public function indexAction() | ||
| { | ||
| $this->view->title = gettext('MDNS Repeater'); | ||
| $this->view->general = $this->getForm("general"); | ||
| $this->view->pick('OPNsense/MDNSRepeater/index'); | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
net/mdns-repeater/src/opnsense/mvc/app/controllers/OPNsense/MDNSRepeater/forms/general.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <form> | ||
| <field> | ||
| <id>mdnsrepeater.enabled</id> | ||
| <label>enabled</label> | ||
| <type>checkbox</type> | ||
| <help>Enable the repeater.</help> | ||
| </field> | ||
| <field> | ||
| <id>mdnsrepeater.interfaces</id> | ||
| <label>Listen Interfaces</label> | ||
| <type>select_multiple</type> | ||
| <multiple>Y</multiple> | ||
| </field> | ||
| </form> |
9 changes: 9 additions & 0 deletions
9
net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/ACL/ACL.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <acl> | ||
| <page-services-mdnsrepeater> | ||
| <name>Services: MDNS Repeatery</name> | ||
| <patterns> | ||
| <pattern>ui/mdnsrepeater/*</pattern> | ||
| <pattern>api/mdnsrepeater/*</pattern> | ||
| </patterns> | ||
| </page-services-mdnsrepeater> | ||
| </acl> |
37 changes: 37 additions & 0 deletions
37
net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * Copyright (C) 2017 Fabian Franz | ||
| * | ||
| * 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. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED ``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 | ||
| * AUTHOR 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. | ||
| * | ||
| */ | ||
|
|
||
| namespace OPNsense\MDNSRepeater; | ||
|
|
||
| use OPNsense\Base\BaseModel; | ||
|
|
||
| class MDNSRepeater extends BaseModel | ||
| { | ||
| } |
15 changes: 15 additions & 0 deletions
15
net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/MDNSRepeater.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <model> | ||
| <mount>//OPNsense/MDNSRepeater</mount> | ||
| <version>1.0.0</version> | ||
| <description>mdns-repeater settings</description> | ||
| <items> | ||
| <enabled type="BooleanField"> | ||
| <default>0</default> | ||
| <Required>Y</Required> | ||
| </enabled> | ||
| <interfaces type="InterfaceField"> | ||
| <Required>Y</Required> | ||
| <multiple>Y</multiple> | ||
| </interfaces> | ||
| </items> | ||
| </model> |
5 changes: 5 additions & 0 deletions
5
net/mdns-repeater/src/opnsense/mvc/app/models/OPNsense/MDNSRepeater/Menu/Menu.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <menu> | ||
| <Services> | ||
| <MDNSRepeater VisibleName="MDNS Repeater" cssClass="fa fa-bolt fa-fw" url="/ui/mdnsrepeater/"/> | ||
| </Services> | ||
| </menu> |
61 changes: 61 additions & 0 deletions
61
net/mdns-repeater/src/opnsense/mvc/app/views/OPNsense/MDNSRepeater/index.volt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| {# | ||
|
|
||
| Copyright © 2017 Fabian Franz | ||
| 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. | ||
|
|
||
| THIS SOFTWARE IS PROVIDED “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 | ||
| AUTHOR 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. | ||
|
|
||
| #} | ||
|
|
||
| <script type="text/javascript"> | ||
|
|
||
| $( document ).ready(function() { | ||
| var data_get_map = {'general': '/api/mdnsrepeater/settings/get'}; | ||
| mapDataToFormUI(data_get_map).done(function(data){ | ||
| formatTokenizersUI(); | ||
| $('.selectpicker').selectpicker('refresh'); | ||
| }); | ||
| ajaxCall(url="/api/mdnsrepeater/service/status", sendData={}, callback=function(data,status) { | ||
| updateServiceStatusUI(data['status']); | ||
| }); | ||
|
|
||
| // link save button to API set action | ||
| $("#saveAct").click(function(){ | ||
| saveFormToEndpoint(url="/api/mdnsrepeater/settings/set", formid='general',callback_ok=function(){ | ||
| ajaxCall(url="/api/mdnsrepeater/service/restart", sendData={}, callback=function(data,status) { | ||
| ajaxCall(url="/api/mdnsrepeater/service/status", sendData={}, callback=function(data,status) { | ||
| updateServiceStatusUI(data['status']); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| </script> | ||
|
|
||
| <div class="content-box" style="padding-bottom: 1.5em;"> | ||
| {{ partial("layout_partials/base_form",['fields': general,'id':'general'])}} | ||
| <hr /> | ||
| <div class="col-md-12"> | ||
| <button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b></button> | ||
| </div> | ||
| </div> |
Oops, something went wrong.