// The source code packaged with this file is Free Software, Copyright (C) 2010 by // Eduard Duran <eduard.duran at iglu.cat>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "LICENSE.txt". require 'guifi_api.php'; /** * Configuration of authentication against guifi.net */ $username = ""; $password = ""; /** * Code from here! */ $gapi = new guifiAPI($username, $password); $action = $_GET['action']; switch ($action) { case 'add': $title = "Plaça Major, 34"; $zone_id = 27182; $lat = '42.187065853813635'; $lon = '2.0233726501464844'; $node = array(); $node['nick'] = 'PlacaMajor34'; // Abbreviated name of the node $node['body'] = "Aquest és el meu node, situat a la Plaça Major, 34, al nucli antic del poble."; // Body of the node $node['zone_description'] = "Situat al nucli antic del poble, al costat de la carnisseria"; // Description of the zone $node['notification'] = "*****@*****.**";
// The source code packaged with this file is Free Software, Copyright (C) 2010 by // Eduard Duran <eduard.duran at iglu.cat>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "LICENSE.txt". require 'guifi_api.php'; /** * Configuration of authentication against guifi.net */ $username = ""; $password = ""; /** * Code from here! */ $gapi = new guifiAPI($username, $password); $action = $_GET['action']; switch ($action) { case 'model': $model = array(); $model['fid'] = 8; $model['supported'] = 'Yes'; $models = $gapi->getModels($model); if ($models) { echo '<ul>'; foreach ($models as $model) { echo '<li>'; echo '<ul>'; echo "<li>Model ID: {$model->mid}</li>"; echo "<li>Manufacturer ID: {$model->fid}</li>"; echo "<li>Model: {$model->model}</li>";
// The source code packaged with this file is Free Software, Copyright (C) 2010 by // Eduard Duran <eduard.duran at iglu.cat>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "LICENSE.txt". require 'guifi_api.php'; /** * Configuration of authentication against guifi.net */ $username = ""; $password = ""; /** * Code from here! */ $gapi = new guifiAPI($username, $password); $action = $_GET['action']; switch ($action) { case 'add': $node_id = 27192; $type = 'radio'; $mac = 'AB:CD:EF:AB:CD:EE'; $device = array(); $device['nick'] = "DispositiuTroncal3"; $device['notification'] = '*****@*****.**'; $device['comment'] = "Aquest dispositiu servirà per extendre la troncal"; $device['status'] = 'Planned'; $device['graph_server'] = 15902; $device['model_id'] = 27; // Routerboard 600 $device['firmware'] = "RouterOSv3.x";
// The source code packaged with this file is Free Software, Copyright (C) 2010 by // Eduard Duran <eduard.duran at iglu.cat>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "LICENSE.txt". require 'guifi_api.php'; /** * Configuration of authentication against guifi.net */ $username = ""; $password = ""; /** * Code from here! */ $gapi = new guifiAPI($username, $password); $action = $_GET['action']; switch ($action) { case 'add': $mode = "ap"; $device_id = 19534; $mac = 'AA:BB:CC:DD:EE:FA'; $radio = array(); $radio['antenna_angle'] = 120; // 60º $radio['antenna_gain'] = "21"; $radio['antenna_azimuth'] = 30; $radio['protocol'] = '802.11b'; $radio['channel'] = 13; $radio['clients_accepted'] = 'Yes'; $added = $gapi->addRadio($mode, $device_id, $mac, $radio);
} } if (!empty($_GET['m'])) { $messages[1] = "Hi ha hagut un error al crear el teu node. Revisa bé les dades introduïdes!"; if (isset($messages[$_GET['m']])) { $message = $messages[$_GET['m']]; } } if (!empty($_POST)) { $username = $_POST['username']; $password = $_POST['password']; $title = $_POST['title']; $zone_id = $_POST['zone_id']; $lat = $_POST['lat']; $lon = $_POST['lon']; $gapi = new guifiAPI($username, $password); $node = $gapi->addNode($title, $zone_id, $lat, $lon); if (!empty($node->node_id)) { header("Location: examples.guifi_api.simple_user.step2.php?node_id={$node->node_id}"); die; } else { $message = "No s'ha pogut crear el teu node. Revisa bé les dades introduïdes!"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Client PHP per l'API de guifi.net</title> <script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
// The source code packaged with this file is Free Software, Copyright (C) 2010 by // Eduard Duran <eduard.duran at iglu.cat>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "LICENSE.txt". require 'guifi_api.php'; /** * Configuration of authentication against guifi.net */ $username = ""; $password = ""; /** * Code from here! */ $gapi = new guifiAPI($username, $password); $action = $_GET['action']; switch ($action) { case 'add': // All possible parameters to add a zone $title = "Sant Jaume de Frontanyà"; // Nom de la zona $master = 4176; // Zona pare $min_lat = '42.183122730364815'; // Latitud de l'escaire SO de la zona $min_lon = '2.0180511474609375'; // Longitud de l'escaire SO de la zona $max_lat = '42.19139028706819'; // Latitud de l'escaire NE de la zona $max_lon = '2.0276641845703125';
$username = ""; $password = ""; $gapi = new guifiAPI($username, $password); if (!empty($_GET['node_id'])) { $node_id = $_GET['node_id']; } if (empty($node_id)) { header("Location: examples.guifi_api.simple_user.php?m=1"); } if ($_POST) { $username = $_POST['username']; $password = $_POST['password']; $to_radio = explode(':', $_POST['radio_to']); $to_device_id = $to_radio[0]; $to_radiodev_counter = $to_radio[1]; $gapi = new guifiAPI($username, $password); /** * CREATE THE DEVICE */ $type = 'radio'; $mac = $_POST['mac']; $device = array(); $device['model_id'] = 25; // NanoStation2 $device['firmware'] = "AirOsv30"; $added = $gapi->addDevice($node_id, $type, $mac, $device); if ($added) { $device_id = $added->device_id; $added = $gapi->addRadio('client', $device_id); if ($added) { $from_radiodev_counter = $added->radiodev_counter;
// The source code packaged with this file is Free Software, Copyright (C) 2010 by // Eduard Duran <eduard.duran at iglu.cat>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "LICENSE.txt". require 'guifi_api.php'; /** * Configuration of authentication against guifi.net */ $username = ""; $password = ""; /** * Code from here! */ $gapi = new guifiAPI($username, $password); $action = $_GET['action']; switch ($action) { case 'add': $device_id = 19534; $radiodev_counter = 1; $added = $gapi->addInterface($device_id, $radiodev_counter); if ($added) { echo "Interface created correctly!!<br />\n<br />\n"; echo "The identificator of the new interface is: interface_id = <strong>{$added->interface_id}</strong>"; if ($added->ipv4) { echo "<br /><br />\n\n"; echo "New IPv4 configuration:<br />"; echo '<ul>'; foreach ($added->ipv4 as $ipv4) { echo '<li>';
// The source code packaged with this file is Free Software, Copyright (C) 2010 by // Eduard Duran <eduard.duran at iglu.cat>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "LICENSE.txt". require 'guifi_api.php'; /** * Configuration of authentication against guifi.net */ $username = ""; $password = ""; /** * Code from here! */ $gapi = new guifiAPI($username, $password); $action = $_GET['action']; switch ($action) { case 'add': $from_device_id = 19534; $from_radiodev_counter = 2; $to_device_id = 8595; $to_radiodev_counter = 0; $link = array(); $link['status'] = 'Building'; $link['ipv4'] = '10.145.5.15'; $added = $gapi->addLink($from_device_id, $from_radiodev_counter, $to_device_id, $to_radiodev_counter, $link); if ($added) { echo "Link created correctly!!<br />\n<br />\n"; echo "The identificator of the new link is: link_id = <strong>{$added->link_id}</strong>"; if ($added->ipv4) {