6.0.23.55

This commit is contained in:
g8bpq 2023-03-16 06:52:27 +00:00
parent 39da8ffc52
commit a792602316
13 changed files with 1007 additions and 396 deletions

View File

@ -3226,335 +3226,328 @@ char * get_plane(int * Len)
} }
char * get_aprs() char * get_aprs()
{ {
char Msg[] = char Msg[] =
"<!DOCTYPE html>\n"
"<html>\n"
"<head>\n"
"<meta charset=\"utf-8\">\n"
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n"
"\n"
"<title>G8BPQ APRS Display</title>\n"
"\n"
"<link rel=\"stylesheet\" href=\"https://unpkg.com/leaflet@1.7.1/dist/leaflet.css\" integrity=\"sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==\" crossorigin=\"\" />\n"
"<script src=\"https://unpkg.com/leaflet@1.7.1/dist/leaflet.js\" integrity=\"sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==\" crossorigin=\"\"></script>\n"
"<link href=\"https://unpkg.com/maplibre-gl@2.2.1/dist/maplibre-gl.css\" rel='stylesheet' />\n"
"<script src=\"https://unpkg.com/maplibre-gl@2.2.1/dist/maplibre-gl.js\"></script>\n"
"<script src=\"https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.17/leaflet-maplibre-gl.js\"></script>\n"
"\n"
"<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\n"
"<script src=\"leaflet.rotatedMarker.js\"></script>\n"
"\n"
"<style type=\"text/css\">\n"
"html, body {height: 100%; width: 100%; margin: 0;}\n"
"#map {position: absolute; top:40px; bottom: 0;width: 100%; margin: 0;}\n"
".topnav { overflow: hidden; height: 40px; background-color: white; margin: 0;}\n"
".topnav a {float: left; color: black; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px;}\n"
".topnav form{float: left; color: black; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px;}\n"
".popup {border: 1px solid black;margin: 0; padding: 0; font-size: 12px; min-height:16px; box-shadow: none;}\n"
".leaflet-tooltip-left.popup::before {border-left-color: transparent;}\n"
".leaflet-tooltip-right.popup::before {border-right-color: transparent;}\n"
"</style>\n"
" \n"
"<script>\n"
"var map;\n"
"var layergroup;\n"
"var redIcon;\n"
"var greenIcon;\n"
"var blueIcon;\n"
"var whiteIcon;\n"
"var transIcon;\n"
"var navIcon;\n"
"var sarIcon;\n"
"var planeIcon;\n"
"var greenplaneIcon;\n"
"var lat = 0; \n"
"var lon = 0;\n"
"var zoom = 2;\n"
"var ais = 0;\n"
"var adsb = 0;\n"
"var aprs = 0;\n"
"var homeLat = 0;var homeLon = 0;var homePoint;\n"
"\n"
"var myTimeout;\n"
"\n"
"var server1 = \"http://server1.g8bpq.net:7383\"\n"
"var server2 = \"http://server2.g8bpq.net:7383\"\n"
"\n"
"function getMap(p)\n"
"{\n"
" var gl = L.maplibreGL({style: server1 + '/styles/G8BPQ/style.json'});\n"
" gl.addTo(p);\n"
" var maplibreMap = gl.getMaplibreMap();\n"
"\n"
" // if load from first server fails, switch to backup\n"
"\n"
" maplibreMap.on('error', e =>\n"
" {\n"
" console.log(e.error);\n"
"\n"
" if (e && e.error == 'Error: Failed to fetch')\n"
" {\n"
" console.log('failed to load from ' + server1 + ', trying ' + server2);\n"
" var gl2 = L.maplibreGL({style: server2 + '/styles/G8BPQ/style.json'});\n"
" p.removeLayer(gl)\n"
" gl2.addTo(p);\n"
" }\n"
" });\n"
"\n"
" p.attributionControl.addAttribution('Map data from <a href=https://www.openstreetmap.org/copyright>OpenStreetMap</a><a href=https://github.com/maplibre/maplibre-gl-leaflet> using maplibre-gl</a> <a href=https://github.com/mapbox/mapbox-gl-styles>Styles based on Mapbox gl');\n"
" L.control.scale().addTo(p);\n"
"}\n"
"\n"
"\n"
"function initialize()\n"
"{\n"
" redIcon = L.icon({iconUrl: 'aisred.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n"
" greenIcon = L.icon({iconUrl: 'aisgreen.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n"
" blueIcon = L.icon({iconUrl: 'aisblue.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n"
" whiteIcon = L.icon({iconUrl: 'aiswhite.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n"
" transIcon = L.icon({iconUrl: 'aistrans.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n"
" navIcon = L.icon({iconUrl: 'aisnavaid.png',iconSize: [21, 21],iconAnchor: [11, 11],popupAnchor: [0, 0]});\n"
" sarIcon = L.icon({iconUrl: 'helicopter.png',iconSize: [31, 31],iconAnchor: [15, 15],popupAnchor: [0, 0]});\n"
" planeIcon = L.icon({iconUrl: 'plane.png',iconSize: [39, 39],iconAnchor: [19, 19],popupAnchor: [0, 0]});\n"
" greenplaneIcon = L.icon({iconUrl: 'greenplane.png',iconSize: [39, 39],iconAnchor: [19, 19],popupAnchor: [0, 0]});\n"
" \n"
" lat = getCookie(\"Lat\");\n"
" lon = getCookie(\"Lng\");\n"
" \n"
" if (lat != \"\")\n"
" zoom = getCookie(\"Zoom\");\n"
" \t\n"
" aprs = getCookie(\"aprs\");\n"
" ais = getCookie(\"ais\");\n"
" adsb = getCookie(\"adsb\");\n"
" \n"
" if (aprs == 0 && ais == 0 && adsb == 0) \n"
"\taprs = 1; if (aprs == 1)\n"
" document.getElementById(\"aprsid\").checked = true;\n"
" if (ais == 1)\n"
" document.getElementById(\"aisid\").checked = true;\n"
" if (adsb == 1)\n"
" document.getElementById(\"adsbid\").checked = true;\n"
" \n"
" map = L.map('map', {zoomSnap: 0, zoomDelta: 0.25, wheelPxPerZoomLevel: 180}).setView([lat, lon], zoom);\n"
" \n"
" map.on('moveend zoomend', function()\n"
" { \n"
" clearTimeout(myTimeout);\n"
" myTimeout = setTimeout(Refresh, 500);\n"
" });\n"
" \n"
" getMap(map)\n"
" layergroup = L.layerGroup().addTo(map);\n"
"}\n"
"<!DOCTYPE html>\n" "\n"
"<html>\n" "function getCookie(cname)\n"
"<head>\n" " {\n"
"<meta charset=\"utf-8\">\n" " var name = cname + \"=\";\n"
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\" />\n" " var decodedCookie = decodeURIComponent(document.cookie);\n"
"\n" " var ca = decodedCookie.split(';');\n"
"<title>G8BPQ APRS Display</title>\n" " \t\n"
"\n" " for(var i = 0; i < ca.length; i++)\n"
" {\n"
"<link rel=\"stylesheet\" href=\"https://unpkg.com/leaflet@1.7.1/dist/leaflet.css\" integrity=\"sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==\" crossorigin=\"\" />\n" " var c = ca[i];\n"
"<script src=\"https://unpkg.com/leaflet@1.7.1/dist/leaflet.js\" integrity=\"sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==\" crossorigin=\"\"></script>\n" " while (c.charAt(0) == ' ')\n"
" {\n"
" c = c.substring(1);\n"
//"<link rel=\"stylesheet\" href=\"http://cdn.leafletjs.com/leaflet/v1.1.0/leaflet.css\" />\n" " }\n"
//"<script src=\"http://cdn.leafletjs.com/leaflet/v1.1.0/leaflet-src.js\"></script>\n" " if (c.indexOf(name) == 0)\n"
"<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js\"></script>\n" " return c.substring(name.length, c.length);\n"
"<script src=\"leaflet.rotatedMarker.js\"></script>\n" " }\n"
"\n" " return \"\";\n"
"<style type=\"text/css\">\n" "}\n"
"html, body {height: 100%; width: 100%; margin: 0;}\n" "\n"
"#map {position: absolute; top:40px; bottom: 0;width: 100%; margin: 0;}\n" "\n"
".topnav { overflow: hidden; height: 40px; background-color: white; margin: 0;}\n" "// Refresh map every 60 seconds\n"
".topnav a {float: left; color: black; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px;}\n" " \n"
".topnav form{float: left; color: black; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px;}\n" "setInterval( \"Refresh()\", 60000 );\n"
".popup {border: 1px solid black;margin: 0; padding: 0; font-size: 12px; min-height:16px; box-shadow: none;}\n" "\n"
".leaflet-tooltip-left.popup::before {border-left-color: transparent;}\n" "function Refresh( )\n"
".leaflet-tooltip-right.popup::before {border-right-color: transparent;}\n" "{\n"
"</style>\n" " var latlng = map.getCenter();\n"
" \n" " zoom = map.getZoom();\n"
"<script>\n" " \n"
"var map;\n" " lat = latlng.lat;\n"
"var layergroup;\n" " lon = latlng.lng\n"
"var redIcon;\n" " \n"
"var greenIcon;\n" " document.cookie = \"Lat=\" + lat;\n"
"var blueIcon;\n" " document.cookie = \"Lng=\" + lon;\n"
"var whiteIcon;\n" " document.cookie = \"Zoom=\" + zoom;\n"
"var transIcon;\n" " \n"
"var navIcon;\n" " \tdocument.cookie = \"aprs=\" + aprs;\n"
"var sarIcon;\n" " \tdocument.cookie = \"ais=\" + ais;\n"
"var planeIcon;\n" " \tdocument.cookie = \"adsb=\" + adsb;\n"
"var greenplaneIcon;\n" "\n"
"var myLayer;\n" " GetData();\n"
"var lat = 0; \n" "}\n"
"var lon = 0;\n" "\n"
"var zoom = 2;\n" " \n"
"var ais = 0;\n" "function GetData()\n"
"var adsb = 0;\n" "{\n"
"var aprs = 0;\nvar homeLat = 0;var homeLon = 0;var homePoint;" " var N = map.getBounds().getNorth();\n"
" var S = map.getBounds().getSouth();\n"
"\n" " var W = map.getBounds().getWest();\n"
"var url1 = 'http://server1.g8bpq.net:7381/styles/osm-bright/{z}/{x}/{y}.png';\n" " var E = map.getBounds().getEast();\n"
"\n" " $.ajax({url: \"aprsdata.txt?\" + N + '|' + S + '|' + W + '|' + E + '|' + aprs + '|' + ais + '|' + adsb, cache: false})\n"
"var myTimeout;\n" " .done(function(Nodes){processData(Nodes);})\t\n"
"\n" " .fail(function(jqXHR, textStatus, errorThrown){alert(\"Failed to load aprs data\");})\n"
"function initialize()\n" " ;\n"
"{\n" " }\n"
" redIcon = L.icon({iconUrl: 'aisred.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n" " \n"
" greenIcon = L.icon({iconUrl: 'aisgreen.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n" "function processData(Nodes)\n"
" blueIcon = L.icon({iconUrl: 'aisblue.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n" "{\n"
" whiteIcon = L.icon({iconUrl: 'aiswhite.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n" " var i = 0;\n"
" transIcon = L.icon({iconUrl: 'aistrans.png',iconSize: [21, 34],iconAnchor: [11, 17],popupAnchor: [0, 0]});\n" " layergroup.clearLayers();\n"
" navIcon = L.icon({iconUrl: 'aisnavaid.png',iconSize: [21, 21],iconAnchor: [11, 11],popupAnchor: [0, 0]});\n" " \n"
" sarIcon = L.icon({iconUrl: 'helicopter.png',iconSize: [31, 31],iconAnchor: [15, 15],popupAnchor: [0, 0]});\n" " var lines = Nodes.split(\"|\");\n"
" planeIcon = L.icon({iconUrl: 'plane.png',iconSize: [39, 39],iconAnchor: [19, 19],popupAnchor: [0, 0]});\n" " \n"
" greenplaneIcon = L.icon({iconUrl: 'greenplane.png',iconSize: [39, 39],iconAnchor: [19, 19],popupAnchor: [0, 0]});\n" " while (i < lines.length)\n"
" \n" " {\n"
" lat = getCookie(\"Lat\");\n" " if (lines[i].length < 5)\n"
" lon = getCookie(\"Lng\");\n" " {\n"
" \n" " i++;\n"
" if (lat != \"\")\n" " continue;\n"
" zoom = getCookie(\"Zoom\");\n" " }\n"
" \t\n" " \t\n"
" aprs = getCookie(\"aprs\");\n" " var elements = lines[i].split(\",\");\n"
" ais = getCookie(\"ais\");\n" " i++;\t\n"
" adsb = getCookie(\"adsb\");\n" " \t\n"
" \n if (aprs == 0 && ais == 0 && adsb == 0)" "if (elements[0] == \"H\")\t\t\t\t// Home Position\n"
" \n aprs = 1;" "{ homeLat = elements[1]; homeLon = elements[2]; homePoint = L.latLng(homeLat, homeLon); var m = L.circleMarker([elements[1], elements[2]], {radius: 6, color: '#000000', fillOpacity: 0.3})\n"
" if (aprs == 1)\n" " .addTo(layergroup)\n"
" document.getElementById(\"aprsid\").checked = true;\n" " .bindPopup(elements[3])\n"
" if (ais == 1)\n" " .on('click', function (e) {alert(this.getLatLng());})\n"
" document.getElementById(\"aisid\").checked = true;\n" " .on('mouseover', function (e) {this.openPopup();})\n"
" if (adsb == 1)\n" " .on('mouseout', function (e) {this.closePopup();});\n"
" document.getElementById(\"adsbid\").checked = true;\n" " if (lat == 0 || lat == \"\")\t\t// Not Set\n"
" \n" " map.setView([elements[1], elements[2]], 8);\n"
" map = L.map('map', {zoomSnap: 0, zoomDelta: 0.25, wheelPxPerZoomLevel: 180}).setView([lat, lon], zoom);\n" "}\n"
" \n" "\n"
" map.on('moveend zoomend', function()\n" " if (elements[0] == \"N\") \t// Navaid\n"
" { \n" " {\n"
" clearTimeout(myTimeout);\n" " var m = L.marker([elements[1], elements[2]], {rotationAngle: 0, icon: navIcon})\n"
" myTimeout = setTimeout(Refresh, 500);\n" " .addTo(layergroup)\n"
"\n" " .bindPopup(elements[3])\n"
" });\n" " .on('click', function (e) {alert(this.getLatLng());})\n"
"\n" " .on('mouseover', function (e) {this.openPopup();})\n"
" myLayer = L.tileLayer(url1, {\n" " .on('mouseout', function (e) {this.closePopup();});\n"
" maxZoom: 18,\n" "\n"
" attribution: 'Map data &copy; <a href=\"https://www.openstreetmap.org/\">OpenStreetMap</a> contributors, ' +\n" " }\n"
" '<a href=\"https://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>, ' +\n" " else if (elements[0] == \"A\") \t// APRS\n"
" 'Imagery &copy; <a href=\"https://openmaptiles.org//\">OpenMapTimes</a>',\n" " {\n"
" id: 'mapbox.streets'\n" " var Icon = L.icon({iconUrl: 'Icon' + elements[5] + '.png',iconSize: [22, 22],iconAnchor: [11, 11],popupAnchor: [0, 0]});\n"
" }).addTo(map);\n" " \n"
" \n" " var m = L.marker([elements[1], elements[2]], {rotationAngle: 0, icon: Icon})\n"
" myLayer.on('tileerror', function(error, tile)\n" " .addTo(layergroup)\n"
" {\n" " .bindPopup(elements[4], {minWidth: 280, maxWidth: 500})\n"
" url1 = 'http://server2.g8bpq.net:7381/styles/osm-bright/{z}/{x}/{y}.png';\n" " .bindTooltip(elements[3], {className: 'popup', permanent: true, direction: 'right', offset: [10, 0]}).openTooltip()\t\n"
"\n" " .on('click', function (e) {alert(this.getLatLng());})\n"
" myLayer = L.tileLayer(url1,\n" " .on('mouseover', function (e) {this.openPopup();})\n"
" {\n" " .on('mouseout', function (e) {this.closePopup();});\n"
" maxZoom: 18,\n" "\n"
" attribution: 'Map data &copy; <a href=\"https://www.openstreetmap.org/\">OpenStreetMap</a> \t contributors, ' +\n" " }\n"
" \t'<a href=\"https://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>, ' +\n" " else if (elements[0] == \"V\") // Vessel\n"
" \t'Imagery &copy; <a href=\"https://openmaptiles.org//\">OpenMapTimes</a>',\n" " {\n"
" id: 'mapbox.streets'\n" " var icon;\n"
" }).addTo(map);\n" " \n"
" });\n" "var dist = homePoint.distanceTo([elements[1], elements[2]]) / 1609.34;\n"
" \n" "var popup = elements[3] + '<br>Distance ' + dist.toFixed(0) + ' Miles'; if (elements[6] < 900)\n"
" layergroup = L.layerGroup().addTo(map); \n" " \ticon = blueIcon;\n"
"L.control.scale().addTo(map);" " else if (elements[6] < 1800)\n"
" myTimeout = setTimeout(Refresh, 100);\n" " \ticon = redIcon;\n"
"}\n" " else\n"
"\n" " \ticon = whiteIcon;\n"
"function getCookie(cname)\n" " \t\n"
" {\n" " var m = L.marker([elements[1], elements[2]], {rotationAngle: elements[4], icon: icon})\n"
" var name = cname + \"=\";\n" " .addTo(layergroup)\n"
" var decodedCookie = decodeURIComponent(document.cookie);\n" " .bindPopup(popup)\n"
" var ca = decodedCookie.split(';');\n" " .on('click', function (e) {alert(this.getLatLng());})\n"
" \t\n" " .on('mouseover', function (e) {this.openPopup();})\n"
" for(var i = 0; i < ca.length; i++)\n" " .on('mouseout', function (e) {this.closePopup();});\n"
" {\n" " }\n"
" var c = ca[i];\n" "\n"
" while (c.charAt(0) == ' ')\n" " else if (elements[0] == \"S\") // SAR Aircraft\n"
" {\n" " {\n"
" c = c.substring(1);\n" " var m = L.marker([elements[1], elements[2]], {icon: sarIcon})\n"
" }\n" " .addTo(layergroup)\n"
" if (c.indexOf(name) == 0)\n" " .bindPopup(elements[3])\n"
" return c.substring(name.length, c.length);\n" " .on('click', function (e) {alert(this.getLatLng());})\n"
" }\n" " .on('mouseover', function (e) {this.openPopup();})\n"
" return \"\";\n" " .on('mouseout', function (e) {this.closePopup();});\n"
"}\n" " }\n"
"\n" " \n"
"\n" " else if (elements[0] == \"P\")\n"
"// Refresh map every 60 seconds\n" " {\n"
" \n" "var dist = homePoint.distanceTo([elements[1], elements[2]]) / 1609.34;\n"
"setInterval( \"Refresh()\", 60000 );\n" "var popup = elements[3] + '<br>Distance ' + dist.toFixed(0) + ' Miles'; var icon;\n"
"\n" " \n"
"function Refresh( )\n" " if (elements[7] < 120)\n"
"{\n" " \ticon = greenplaneIcon;\n"
" var latlng = map.getCenter();\n" " else\n"
" zoom = map.getZoom();\n" " \ticon = planeIcon;\n"
" \n" "\n"
" lat = latlng.lat;\n" " var m = L.marker([elements[1], elements[2]], {rotationAngle: elements[5], icon: icon})\n"
" lon = latlng.lng\n" " .addTo(layergroup)\n"
" \n" " .bindPopup(popup)\n"
" document.cookie = \"Lat=\" + lat;\n" " .on('mouseover', function (e) {this.openPopup();})\n"
" document.cookie = \"Lng=\" + lon;\n" " .on('mouseout', function (e) {this.closePopup();});\n"
" document.cookie = \"Zoom=\" + zoom;\n" " }\n"
" \n" " \n"
" \tdocument.cookie = \"aprs=\" + aprs;\n" " else if (elements[0] == \"T\")\n"
" \tdocument.cookie = \"ais=\" + ais;\n" " {\n"
" \tdocument.cookie = \"adsb=\" + adsb;\n" " var points = [];\n"
"\n" " var point;\n"
" GetData();\n" " var n = 1;\n"
"}\n" " var l = elements.length;\n"
"\n" " \n"
" \n" " while (n < l)\n"
"function GetData()\n" " {\n"
"{\n" " \tpoint = L.latLng(elements[n], elements[n + 1]);\n"
" var N = map.getBounds().getNorth();\n" " \tpoints.push(point);\n"
" var S = map.getBounds().getSouth();\n" " \tn += 2;\n"
" var W = map.getBounds().getWest();\n" " }\n"
" var E = map.getBounds().getEast();\n" " points.pop();\t// null entry on end\n"
" $.ajax({url: \"aprsdata.txt?\" + N + '|' + S + '|' + W + '|' + E + '|' + aprs + '|' + ais + '|' + adsb, cache: false})\n" " \n"
" .done(function(Nodes){processData(Nodes);})\t\n" " L.polyline(points, {color: 'black'}).addTo(layergroup);\n"
" .fail(function(jqXHR, textStatus, errorThrown){alert(\"Failed to load aprs data\");})\n" " }\n"
" ;\n" " }\n"
" }\n" "\n"
" \n" "}\n"
"function processData(Nodes)\n" "function resize()\n"
"{\n" "{}\n"
" var i = 0;\n" "</script>\n"
" layergroup.clearLayers();\n" "</head>\n"
" \n" "\n"
" var lines = Nodes.split(\"|\");\n" "<BODY onload=initialize() onresize='resize()'>\n"
" \n" "<div class=\"topnav\" id=menu>\n"
" while (i < lines.length)\n" " <a href=\"/\">Home</a>\n"
" {\n" " <a href=\"/aprs\">APRS Pages</a>\n"
" if (lines[i].length < 5)\n" " <a href=\"Node/NodeMenu.html\">Node Menu</a>\n"
" {\n" " <form>\n"
" i++;\n" " <input type=\"checkbox\" id= \"aprsid\" onchange='aprs=this.checked | 0;\tmyTimeout = setTimeout(Refresh, 500);'>\n"
" continue;\n" " <label for=\"vehicle1\"> APRS</label>\n"
" }\n" " <input type=\"checkbox\" id= \"aisid\" onchange='ais=this.checked | 0; myTimeout = setTimeout(Refresh, 500);'>\n"
" \t\n" " <label for=\"vehicle2\"> AIS</label>\n"
" var elements = lines[i].split(\",\");\n" " <input type=\"checkbox\" id= \"adsbid\" onchange='adsb=this.checked | 0; myTimeout = setTimeout(Refresh, 500);'>\n"
" i++;\t\n" " <label for=\"vehicle3\"> ADSB</label>\n"
" \t\n" "</form>\n"
"</div>\n"
"if (elements[0] == \"H\") // Home Position\n" " <div id=\"map\"></div>\n"
"{" "</body>\n"
" homeLat = elements[1]; homeLon = elements[2]; homePoint = L.latLng(homeLat, homeLon);" "</html>";
" var m = L.circleMarker([elements[1], elements[2]], {radius: 6, color: '#000000', fillOpacity: 0.3})\n"
" .addTo(layergroup)\n"
" .bindPopup(elements[3])\n"
" .on('click', function (e) {alert(this.getLatLng());})\n"
" .on('mouseover', function (e) {this.openPopup();})\n"
" .on('mouseout', function (e) {this.closePopup();});\n"
" if (lat == 0 || lat == \"\") // Not Set\n"
" map.setView([elements[1], elements[2]], 8);\n}\n\n"
" if (elements[0] == \"N\") \t// Navaid\n"
" {\n"
" var m = L.marker([elements[1], elements[2]], {rotationAngle: 0, icon: navIcon})\n"
" .addTo(layergroup)\n"
" .bindPopup(elements[3])\n"
" .on('click', function (e) {alert(this.getLatLng());})\n"
" .on('mouseover', function (e) {this.openPopup();})\n"
" .on('mouseout', function (e) {this.closePopup();});\n"
"\n"
" }\n"
" else if (elements[0] == \"A\") \t// APRS\n"
" {\n"
" var Icon = L.icon({iconUrl: 'Icon' + elements[5] + '.png',iconSize: [22, 22],iconAnchor: [11, 11],popupAnchor: [0, 0]});\n"
" \n"
" var m = L.marker([elements[1], elements[2]], {rotationAngle: 0, icon: Icon})\n"
" .addTo(layergroup)\n"
" .bindPopup(elements[4], {minWidth: 280, maxWidth: 500})\n"
" .bindTooltip(elements[3], {className: 'popup', permanent: true, direction: 'right', offset: [10, 0]}).openTooltip()\t\n"
" .on('click', function (e) {alert(this.getLatLng());})\n"
" .on('mouseover', function (e) {this.openPopup();})\n"
" .on('mouseout', function (e) {this.closePopup();});\n"
"\n"
" }\n"
" else if (elements[0] == \"V\") // Vessel\n"
" {\n"
" var icon;\n"
" \n"
"var dist = homePoint.distanceTo([elements[1], elements[2]]) / 1609.34;\n"
"var popup = elements[3] + '<br>Distance ' + dist.toFixed(0) + ' Miles';"
" if (elements[6] < 900)\n"
" \ticon = blueIcon;\n"
" else if (elements[6] < 1800)\n"
" \ticon = redIcon;\n"
" else\n"
" \ticon = whiteIcon;\n"
" \t\n"
" var m = L.marker([elements[1], elements[2]], {rotationAngle: elements[4], icon: icon})\n"
" .addTo(layergroup)\n"
" .bindPopup(popup)\n"
" .on('click', function (e) {alert(this.getLatLng());})\n"
" .on('mouseover', function (e) {this.openPopup();})\n"
" .on('mouseout', function (e) {this.closePopup();});\n"
" }\n"
"\n"
" else if (elements[0] == \"S\") // SAR Aircraft\n"
" {\n"
" var m = L.marker([elements[1], elements[2]], {icon: sarIcon})\n"
" .addTo(layergroup)\n"
" .bindPopup(elements[3])\n"
" .on('click', function (e) {alert(this.getLatLng());})\n"
" .on('mouseover', function (e) {this.openPopup();})\n"
" .on('mouseout', function (e) {this.closePopup();});\n"
" }\n"
" \n"
" else if (elements[0] == \"P\")\n"
" {\n"
"var dist = homePoint.distanceTo([elements[1], elements[2]]) / 1609.34;\n"
"var popup = elements[3] + '<br>Distance ' + dist.toFixed(0) + ' Miles';"
" var icon;\n"
" \n"
" if (elements[7] < 120)\n"
" \ticon = greenplaneIcon;\n"
" else\n"
" \ticon = planeIcon;\n"
"\n"
" var m = L.marker([elements[1], elements[2]], {rotationAngle: elements[5], icon: icon})\n"
" .addTo(layergroup)\n"
" .bindPopup(popup)\n"
" .on('mouseover', function (e) {this.openPopup();})\n"
" .on('mouseout', function (e) {this.closePopup();});\n"
" }\n"
" \n"
" else if (elements[0] == \"T\")\n"
" {\n"
" var points = [];\n"
" var point;\n"
" var n = 1;\n"
" var l = elements.length;\n"
" \n"
" while (n < l)\n"
" {\n"
" \tpoint = L.latLng(elements[n], elements[n + 1]);\n"
" \tpoints.push(point);\n"
" \tn += 2;\n"
" }\n"
" points.pop();\t// null entry on end\n"
" \n"
" L.polyline(points, {color: 'black'}).addTo(layergroup);\n"
" }\n"
" }\n"
"\n"
"}\n"
"function resize()\n"
"{}\n"
"</script>\n"
"</head>\n"
"\n"
"<BODY onload=initialize() onresize='resize()'>\n"
"<div class=\"topnav\" id=menu>\n"
" <a href=\"/\">Home</a>\n"
" <a href=\"/aprs\">APRS Pages</a>\n"
" <a href=\"Node/NodeMenu.html\">Node Menu</a>\n"
" <form>\n"
" <input type=\"checkbox\" id= \"aprsid\" onchange='aprs=this.checked | 0;\tmyTimeout = setTimeout(Refresh, 500);'>\n"
" <label for=\"vehicle1\"> APRS</label>\n"
" <input type=\"checkbox\" id= \"aisid\" onchange='ais=this.checked | 0; myTimeout = setTimeout(Refresh, 500);'>\n"
" <label for=\"vehicle2\"> AIS</label>\n"
" <input type=\"checkbox\" id= \"adsbid\" onchange='adsb=this.checked | 0; myTimeout = setTimeout(Refresh, 500);'>\n"
" <label for=\"vehicle3\"> ADSB</label>\n"
"</form>\n"
"</div>\n"
" <div id=\"map\"></div>\n"
"</body>\n"
"</html>";
return _strdup(Msg);; return _strdup(Msg);;
} }

View File

@ -1104,10 +1104,11 @@
// Add auto-refresh option to Webmail index page (25) // Add auto-refresh option to Webmail index page (25)
// Fix displaying help and info files with crlf line endings on Linux (28) // Fix displaying help and info files with crlf line endings on Linux (28)
// Improve validation of extended FC message (32) // Improve validation of extended FC message (32)
// Improve WP check for SYSTEM as a callsihn (33) // Improve WP check for SYSTEM as a callsign (33)
// Improvements to RMS Relay SYNC mode (47) // Improvements to RMS Relay SYNC mode (47)
// Fix BID Hold and Reject filters // Fix BID Hold and Reject filters
// Fix Webmail auto-refresh when page exceeds 64K bytes (54)
// Fix Webmail send when using both headers/footers and attachmonts (55)
#include "bpqmail.h" #include "bpqmail.h"

View File

@ -1147,7 +1147,10 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// Check L4 connects against EXCLUDE list (47) // Check L4 connects against EXCLUDE list (47)
// Add vaidation of LOC in WL2K Session Reports (49) // Add vaidation of LOC in WL2K Session Reports (49)
// Change gpsd support for compatibility with Share Gps (50) // Change gpsd support for compatibility with Share Gps (50)
// Switch APRS Map to my Tiles (52)
// Fix using ; in UNPROTO Mode messages (52)
// Use sha1 code from https://www.packetizer.com/security/sha1/ instead of openssl (53)
// Fix TNC Emulator Monitoring (53)
#define CKernel #define CKernel
@ -1162,7 +1165,6 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
#include <fcntl.h> #include <fcntl.h>
#include "compatbits.h" #include "compatbits.h"
#include "AsmStrucs.h" #include "AsmStrucs.h"
#include "SHELLAPI.H" #include "SHELLAPI.H"

26
Cmd.c
View File

@ -4064,6 +4064,24 @@ noFlip1:
checkattachandcall: checkattachandcall:
// If set freq on attach is defined, do it
if (TNC && TNC->ActiveRXFreq && TNC->RXRadio)
{
char Msg[128];
sprintf(Msg, "R%d %f", TNC->RXRadio, TNC->ActiveRXFreq);
Rig_Command(-1, Msg);
}
if (TNC && TNC->ActiveTXFreq && TNC->TXRadio && TNC->TXRadio != TNC->RXRadio)
{
char Msg[128];
sprintf(Msg, "R%d %f", TNC->TXRadio, TNC->ActiveTXFreq);
Rig_Command(-1, Msg);
}
if (ptr) if (ptr)
{ {
// we have a call to connect to // we have a call to connect to
@ -4529,6 +4547,14 @@ VOID InnerCommandHandler(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer)
ReleaseBuffer((UINT *)Buffer); // Not using buffer for reply ReleaseBuffer((UINT *)Buffer); // Not using buffer for reply
// Assume we don't allow multiple lines in buffer with UI
if (Session->PARTCMDBUFFER)
{
Buffer = Session->PARTCMDBUFFER;
ReleaseBuffer((UINT *)Buffer); // Not using buffer for reply
Session->PARTCMDBUFFER = NULL;
}
return; return;
} }

View File

@ -772,6 +772,22 @@ NotConnected:
CloseComplete(TNC, Stream); CloseComplete(TNC, Stream);
if (TNC->DefaultRXFreq && TNC->RXRadio)
{
char Msg[128];
sprintf(Msg, "R%d %f", TNC->RXRadio, TNC->DefaultRXFreq);
Rig_Command(-1, Msg);
}
if (TNC->DefaultTXFreq && TNC->TXRadio && TNC->TXRadio != TNC->RXRadio)
{
char Msg[128];
sprintf(Msg, "R%d %f", TNC->TXRadio, TNC->DefaultTXFreq);
Rig_Command(-1, Msg);
}
while(STREAM->BPQtoPACTOR_Q) while(STREAM->BPQtoPACTOR_Q)
{ {
buffptr=Q_REM(&STREAM->BPQtoPACTOR_Q); buffptr=Q_REM(&STREAM->BPQtoPACTOR_Q);

View File

@ -1870,8 +1870,14 @@ int standardParams(struct TNCINFO * TNC, char * buf)
TNC->RXRadio = atoi(&buf[8]); TNC->RXRadio = atoi(&buf[8]);
else if (_memicmp(buf, "TXFreq", 6) == 0) // For PTT Sets Freq mode else if (_memicmp(buf, "TXFreq", 6) == 0) // For PTT Sets Freq mode
TNC->TXFreq = strtoll(&buf[7], NULL, 10); TNC->TXFreq = strtoll(&buf[7], NULL, 10);
else if (_memicmp(buf, "DefaultFreq", 11) == 0) // For PTT Sets Freq mode else if (_memicmp(buf, "DefaultTXFreq", 13) == 0) // Set at end of session
TNC->DefaultFreq = strtoll(&buf[12], NULL, 10); TNC->DefaultTXFreq = atof(&buf[14]);
else if (_memicmp(buf, "DefaultRXFreq", 13) == 0) // Set at end of session
TNC->DefaultRXFreq = atof(&buf[14]);
else if (_memicmp(buf, "ActiveTXFreq", 12) == 0) // Set at start of session
TNC->ActiveTXFreq = atof(&buf[13]);
else if (_memicmp(buf, "ActiveRXFreq", 12) == 0) // Set at start of session
TNC->ActiveRXFreq = atof(&buf[13]);
else if (_memicmp(buf, "PTTONHEX", 8) == 0) else if (_memicmp(buf, "PTTONHEX", 8) == 0)
{ {
// Hex String to use for PTT on for this port // Hex String to use for PTT on for this port

View File

@ -2035,6 +2035,11 @@ Returnit:
return 0; return 0;
} }
// Add tail
strcpy(&Reply[ReplyLen], Tail);
ReplyLen += strlen(Tail);
// compress if allowed // compress if allowed
if (allowDeflate) if (allowDeflate)
@ -2096,7 +2101,29 @@ doHeader:
return 0; return 0;
} }
HeaderLen = sprintf(Header, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n", ReplyLen + (int)strlen(Tail)); // Add tail
strcpy(&_REPLYBUFFER[ReplyLen], Tail);
ReplyLen += strlen(Tail);
// compress if allowed
if (allowDeflate)
Compressed = Compressit(_REPLYBUFFER, ReplyLen, &ReplyLen);
else
Compressed = Reply;
HeaderLen = sprintf(Header, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\nContent-Type: text/html\r\n%s\r\n", ReplyLen, Encoding);
sendandcheck(sock, Header, HeaderLen);
sendandcheck(sock, Compressed, ReplyLen);
if (allowDeflate)
free (Compressed);
return 0;
/*
HeaderLen = sprintf(Header, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n", ReplyLen + (int)strlen(Tail)); HeaderLen = sprintf(Header, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\nContent-Type: text/html\r\n\r\n", ReplyLen + (int)strlen(Tail));
send(sock, Header, HeaderLen, 0); send(sock, Header, HeaderLen, 0);
@ -2124,7 +2151,7 @@ doHeader:
send(sock, Tail, (int)strlen(Tail), 0); send(sock, Tail, (int)strlen(Tail), 0);
return 0; return 0;
*/
} }
if (_memicmp(Context, "/CHAT/", 6) == 0) if (_memicmp(Context, "/CHAT/", 6) == 0)
@ -4176,54 +4203,97 @@ int ProcessChatSignon(struct TCPINFO * TCP, char * MsgPtr, char * Appl, char * R
} }
#ifdef WIN32
#include <windows.h>
#include <wincrypt.h>
#define SHA1_HASH_LEN 20 #define SHA1_HASH_LEN 20
/*
Copyright (C) 1998, 2009
Paul E. Jones <paulej@packetizer.com>
Freeware Public License (FPL)
This software is licensed as "freeware." Permission to distribute
this software in source and binary forms, including incorporation
into other products, is hereby granted without a fee. THIS SOFTWARE
IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHOR SHALL NOT BE HELD
LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE, EITHER
DIRECTLY OR INDIRECTLY, INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA
OR DATA BEING RENDERED INACCURATE.
*/
/* sha1.h
*
* Copyright (C) 1998, 2009
* Paul E. Jones <paulej@packetizer.com>
* All Rights Reserved
*
*****************************************************************************
* $Id: sha1.h 12 2009-06-22 19:34:25Z paulej $
*****************************************************************************
*
* Description:
* This class implements the Secure Hashing Standard as defined
* in FIPS PUB 180-1 published April 17, 1995.
*
* Many of the variable names in the SHA1Context, especially the
* single character names, were used because those were the names
* used in the publication.
*
* Please read the file sha1.c for more information.
*
*/
#ifndef _SHA1_H_
#define _SHA1_H_
/*
* This structure will hold context information for the hashing
* operation
*/
typedef struct SHA1Context
{
unsigned Message_Digest[5]; /* Message Digest (output) */
unsigned Length_Low; /* Message length in bits */
unsigned Length_High; /* Message length in bits */
unsigned char Message_Block[64]; /* 512-bit message blocks */
int Message_Block_Index; /* Index into message block array */
int Computed; /* Is the digest computed? */
int Corrupted; /* Is the message digest corruped? */
} SHA1Context;
/*
* Function Prototypes
*/
void SHA1Reset(SHA1Context *);
int SHA1Result(SHA1Context *);
void SHA1Input( SHA1Context *, const unsigned char *, unsigned);
#endif
BOOL SHA1PasswordHash(char * lpszPassword, char * Hash) BOOL SHA1PasswordHash(char * lpszPassword, char * Hash)
{ {
HCRYPTPROV hCryptProv; // Handle to our context SHA1Context sha;
HCRYPTHASH hCryptHash; // Handle to our hash int i;
BYTE bHashValue[SHA1_HASH_LEN]; // This will hold our SHA-1 hash
DWORD dwSize = SHA1_HASH_LEN; // Size of output
BOOL bSuccess = FALSE; // We change this to TRUE if we complete the operations
// Declare all the variables at the start of our code for C89 compatability
if(CryptAcquireContext(&hCryptProv, NULL, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) SHA1Reset(&sha);
{ // Initiate usage of the functions SHA1Input(&sha, lpszPassword, strlen(lpszPassword));
if(CryptCreateHash(hCryptProv, CALG_SHA1, 0, 0, &hCryptHash)) SHA1Result(&sha);
{ // Create a SHA1 hash
if(CryptHashData(hCryptHash, (PBYTE)lpszPassword, lstrlen(lpszPassword) * sizeof(TCHAR), 0))
{ // Update the hash, (process our password)
if(CryptGetHashParam(hCryptHash, HP_HASHVAL, bHashValue, &dwSize, 0))
{ // Extract the hash
memcpy(Hash, bHashValue, 20); // swap byte order if little endian
bSuccess = TRUE;
}
}
CryptDestroyHash(hCryptHash);
}
CryptReleaseContext(hCryptProv, 0);
}
return bSuccess; for (i = 0; i < 5; i++)
sha.Message_Digest[i] = htonl(sha.Message_Digest[i]);
memcpy(Hash, &sha.Message_Digest[0], 20);
return TRUE;
} }
#else
#include <openssl/sha.h>
BOOL SHA1PasswordHash(char * data, char * Hash)
{
SHA1(data, strlen(data), Hash);
return 1;
}
#endif
int BuildRigCtlPage(char * _REPLYBUFFER) int BuildRigCtlPage(char * _REPLYBUFFER)
{ {
int ReplyLen; int ReplyLen;
@ -4341,9 +4411,9 @@ void ProcessWebmailWebSockThread(void * conn)
char * URL = sockptr->WebURL; char * URL = sockptr->WebURL;
int Loops = 0; int Loops = 0;
int Sent; int Sent;
int InputLen;
struct HTTPConnectionInfo Dummy = {0}; struct HTTPConnectionInfo Dummy = {0};
int ReplyLen = 0; int ReplyLen = 0;
int InputLen = 0;
#ifdef LINBPQ #ifdef LINBPQ
@ -4423,6 +4493,377 @@ void ProcessWebmailWebSockThread(void * conn)
return; return;
} }
/*
* sha1.c
*
* Copyright (C) 1998, 2009
* Paul E. Jones <paulej@packetizer.com>
* All Rights Reserved
*
*****************************************************************************
* $Id: sha1.c 12 2009-06-22 19:34:25Z paulej $
*****************************************************************************
*
* Description:
* This file implements the Secure Hashing Standard as defined
* in FIPS PUB 180-1 published April 17, 1995.
*
* The Secure Hashing Standard, which uses the Secure Hashing
* Algorithm (SHA), produces a 160-bit message digest for a
* given data stream. In theory, it is highly improbable that
* two messages will produce the same message digest. Therefore,
* this algorithm can serve as a means of providing a "fingerprint"
* for a message.
*
* Portability Issues:
* SHA-1 is defined in terms of 32-bit "words". This code was
* written with the expectation that the processor has at least
* a 32-bit machine word size. If the machine word size is larger,
* the code should still function properly. One caveat to that
* is that the input functions taking characters and character
* arrays assume that only 8 bits of information are stored in each
* character.
*
* Caveats:
* SHA-1 is designed to work with messages less than 2^64 bits
* long. Although SHA-1 allows a message digest to be generated for
* messages of any number of bits less than 2^64, this
* implementation only works with messages with a length that is a
* multiple of the size of an 8-bit character.
*
*/
/*
* Define the circular shift macro
*/
#define SHA1CircularShift(bits,word) \
((((word) << (bits)) & 0xFFFFFFFF) | \
((word) >> (32-(bits))))
/* Function prototypes */
void SHA1ProcessMessageBlock(SHA1Context *);
void SHA1PadMessage(SHA1Context *);
/*
* SHA1Reset
*
* Description:
* This function will initialize the SHA1Context in preparation
* for computing a new message digest.
*
* Parameters:
* context: [in/out]
* The context to reset.
*
* Returns:
* Nothing.
*
* Comments:
*
*/
void SHA1Reset(SHA1Context *context)
{
context->Length_Low = 0;
context->Length_High = 0;
context->Message_Block_Index = 0;
context->Message_Digest[0] = 0x67452301;
context->Message_Digest[1] = 0xEFCDAB89;
context->Message_Digest[2] = 0x98BADCFE;
context->Message_Digest[3] = 0x10325476;
context->Message_Digest[4] = 0xC3D2E1F0;
context->Computed = 0;
context->Corrupted = 0;
}
/*
* SHA1Result
*
* Description:
* This function will return the 160-bit message digest into the
* Message_Digest array within the SHA1Context provided
*
* Parameters:
* context: [in/out]
* The context to use to calculate the SHA-1 hash.
*
* Returns:
* 1 if successful, 0 if it failed.
*
* Comments:
*
*/
int SHA1Result(SHA1Context *context)
{
if (context->Corrupted)
{
return 0;
}
if (!context->Computed)
{
SHA1PadMessage(context);
context->Computed = 1;
}
return 1;
}
/*
* SHA1Input
*
* Description:
* This function accepts an array of octets as the next portion of
* the message.
*
* Parameters:
* context: [in/out]
* The SHA-1 context to update
* message_array: [in]
* An array of characters representing the next portion of the
* message.
* length: [in]
* The length of the message in message_array
*
* Returns:
* Nothing.
*
* Comments:
*
*/
void SHA1Input( SHA1Context *context,
const unsigned char *message_array,
unsigned length)
{
if (!length)
{
return;
}
if (context->Computed || context->Corrupted)
{
context->Corrupted = 1;
return;
}
while(length-- && !context->Corrupted)
{
context->Message_Block[context->Message_Block_Index++] =
(*message_array & 0xFF);
context->Length_Low += 8;
/* Force it to 32 bits */
context->Length_Low &= 0xFFFFFFFF;
if (context->Length_Low == 0)
{
context->Length_High++;
/* Force it to 32 bits */
context->Length_High &= 0xFFFFFFFF;
if (context->Length_High == 0)
{
/* Message is too long */
context->Corrupted = 1;
}
}
if (context->Message_Block_Index == 64)
{
SHA1ProcessMessageBlock(context);
}
message_array++;
}
}
/*
* SHA1ProcessMessageBlock
*
* Description:
* This function will process the next 512 bits of the message
* stored in the Message_Block array.
*
* Parameters:
* None.
*
* Returns:
* Nothing.
*
* Comments:
* Many of the variable names in the SHAContext, especially the
* single character names, were used because those were the names
* used in the publication.
*
*
*/
void SHA1ProcessMessageBlock(SHA1Context *context)
{
const unsigned K[] = /* Constants defined in SHA-1 */
{
0x5A827999,
0x6ED9EBA1,
0x8F1BBCDC,
0xCA62C1D6
};
int t; /* Loop counter */
unsigned temp; /* Temporary word value */
unsigned W[80]; /* Word sequence */
unsigned A, B, C, D, E; /* Word buffers */
/*
* Initialize the first 16 words in the array W
*/
for(t = 0; t < 16; t++)
{
W[t] = ((unsigned) context->Message_Block[t * 4]) << 24;
W[t] |= ((unsigned) context->Message_Block[t * 4 + 1]) << 16;
W[t] |= ((unsigned) context->Message_Block[t * 4 + 2]) << 8;
W[t] |= ((unsigned) context->Message_Block[t * 4 + 3]);
}
for(t = 16; t < 80; t++)
{
W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]);
}
A = context->Message_Digest[0];
B = context->Message_Digest[1];
C = context->Message_Digest[2];
D = context->Message_Digest[3];
E = context->Message_Digest[4];
for(t = 0; t < 20; t++)
{
temp = SHA1CircularShift(5,A) +
((B & C) | ((~B) & D)) + E + W[t] + K[0];
temp &= 0xFFFFFFFF;
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 20; t < 40; t++)
{
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1];
temp &= 0xFFFFFFFF;
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 40; t < 60; t++)
{
temp = SHA1CircularShift(5,A) +
((B & C) | (B & D) | (C & D)) + E + W[t] + K[2];
temp &= 0xFFFFFFFF;
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
for(t = 60; t < 80; t++)
{
temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3];
temp &= 0xFFFFFFFF;
E = D;
D = C;
C = SHA1CircularShift(30,B);
B = A;
A = temp;
}
context->Message_Digest[0] =
(context->Message_Digest[0] + A) & 0xFFFFFFFF;
context->Message_Digest[1] =
(context->Message_Digest[1] + B) & 0xFFFFFFFF;
context->Message_Digest[2] =
(context->Message_Digest[2] + C) & 0xFFFFFFFF;
context->Message_Digest[3] =
(context->Message_Digest[3] + D) & 0xFFFFFFFF;
context->Message_Digest[4] =
(context->Message_Digest[4] + E) & 0xFFFFFFFF;
context->Message_Block_Index = 0;
}
/*
* SHA1PadMessage
*
* Description:
* According to the standard, the message must be padded to an even
* 512 bits. The first padding bit must be a '1'. The last 64
* bits represent the length of the original message. All bits in
* between should be 0. This function will pad the message
* according to those rules by filling the Message_Block array
* accordingly. It will also call SHA1ProcessMessageBlock()
* appropriately. When it returns, it can be assumed that the
* message digest has been computed.
*
* Parameters:
* context: [in/out]
* The context to pad
*
* Returns:
* Nothing.
*
* Comments:
*
*/
void SHA1PadMessage(SHA1Context *context)
{
/*
* Check to see if the current message block is too small to hold
* the initial padding bits and length. If so, we will pad the
* block, process it, and then continue padding into a second
* block.
*/
if (context->Message_Block_Index > 55)
{
context->Message_Block[context->Message_Block_Index++] = 0x80;
while(context->Message_Block_Index < 64)
{
context->Message_Block[context->Message_Block_Index++] = 0;
}
SHA1ProcessMessageBlock(context);
while(context->Message_Block_Index < 56)
{
context->Message_Block[context->Message_Block_Index++] = 0;
}
}
else
{
context->Message_Block[context->Message_Block_Index++] = 0x80;
while(context->Message_Block_Index < 56)
{
context->Message_Block[context->Message_Block_Index++] = 0;
}
}
/*
* Store the message length as the last 8 octets
*/
context->Message_Block[56] = (context->Length_High >> 24) & 0xFF;
context->Message_Block[57] = (context->Length_High >> 16) & 0xFF;
context->Message_Block[58] = (context->Length_High >> 8) & 0xFF;
context->Message_Block[59] = (context->Length_High) & 0xFF;
context->Message_Block[60] = (context->Length_Low >> 24) & 0xFF;
context->Message_Block[61] = (context->Length_Low >> 16) & 0xFF;
context->Message_Block[62] = (context->Length_Low >> 8) & 0xFF;
context->Message_Block[63] = (context->Length_Low) & 0xFF;
SHA1ProcessMessageBlock(context);
}

View File

@ -303,6 +303,8 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC)
{ {
char FreqString[80]; char FreqString[80];
char * CmdPtr = onString; char * CmdPtr = onString;
UCHAR * Poll = PORT->TXBuffer;
RIG->lastSetFreq = txfreq; RIG->lastSetFreq = txfreq;
@ -330,6 +332,7 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC)
*(CmdPtr++) = (FreqString[9] - 48) | ((FreqString[8] - 48) << 4); *(CmdPtr++) = (FreqString[9] - 48) | ((FreqString[8] - 48) << 4);
*(CmdPtr++) = (FreqString[7] - 48) | ((FreqString[6] - 48) << 4); *(CmdPtr++) = (FreqString[7] - 48) | ((FreqString[6] - 48) << 4);
*(CmdPtr++) = (FreqString[5] - 48) | ((FreqString[4] - 48) << 4); *(CmdPtr++) = (FreqString[5] - 48) | ((FreqString[4] - 48) << 4);
if (RIG->IC735) if (RIG->IC735)
{ {
*(CmdPtr++) = 0xFD; *(CmdPtr++) = 0xFD;
@ -349,6 +352,40 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC)
break; break;
case YAESU:
*(Poll++) = (FreqString[4] - 48) | ((FreqString[3] - 48) << 4);
*(Poll++) = (FreqString[6] - 48) | ((FreqString[5] - 48) << 4);
*(Poll++) = (FreqString[8] - 48) | ((FreqString[7] - 48) << 4);
*(Poll++) = (FreqString[10] - 48) | ((FreqString[9] - 48) << 4);
*(Poll++) = 1; // Set Freq
PORT->TXLen = 5;
RigWriteCommBlock(PORT);
if (RIG->PTTMode & PTTCI_V)
{
Sleep(150);
Poll = PORT->TXBuffer;
*(Poll++) = 0;
*(Poll++) = 0;
*(Poll++) = 0;
*(Poll++) = 0;
*(Poll++) = PTTState ? 0x08 : 0x88; // CMD = 08 : PTT ON CMD = 88 : PTT OFF
PORT->TXLen = 5;
RigWriteCommBlock(PORT);
}
PORT->Retries = 1;
PORT->Timeout = 0;
return;
case HAMLIB: case HAMLIB:
// Dont need to save, as we can send strings separately // Dont need to save, as we can send strings separately
@ -356,6 +393,9 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC)
Len = sprintf(cmd, "F %lld\n", txfreq); Len = sprintf(cmd, "F %lld\n", txfreq);
i = send(PORT->remoteSock, cmd, Len, 0); i = send(PORT->remoteSock, cmd, Len, 0);
RIG->PollCounter = 100; // Don't read for 10 secs to avoid clash with PTT OFF RIG->PollCounter = 100; // Don't read for 10 secs to avoid clash with PTT OFF
break;
} }
} }
} }
@ -395,6 +435,7 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC)
{ {
char FreqString[80]; char FreqString[80];
char * CmdPtr = offString; char * CmdPtr = offString;
UCHAR * Poll = PORT->TXBuffer;
RIG->lastSetFreq = txfreq; RIG->lastSetFreq = txfreq;
@ -444,6 +485,40 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC)
FLRIGSendCommand(PORT, "rig.set_vfo", cmd); FLRIGSendCommand(PORT, "rig.set_vfo", cmd);
RIG->PollCounter = 100; // Don't read for 10 secs to avoid clash with PTT OFF RIG->PollCounter = 100; // Don't read for 10 secs to avoid clash with PTT OFF
case YAESU:
// Easier to add PTT string, send and return;
Len = 0;
if (RIG->PTTMode & PTTCI_V)
{
*(Poll++) = 0;
*(Poll++) = 0;
*(Poll++) = 0;
*(Poll++) = 0;
*(Poll++) = PTTState ? 0x08 : 0x88; // CMD = 08 : PTT ON CMD = 88 : PTT OFF
PORT->TXLen = 5;
RigWriteCommBlock(PORT);
Poll = PORT->TXBuffer;
Sleep(100);
}
*(Poll++) = (FreqString[4] - 48) | ((FreqString[3] - 48) << 4);
*(Poll++) = (FreqString[6] - 48) | ((FreqString[5] - 48) << 4);
*(Poll++) = (FreqString[8] - 48) | ((FreqString[7] - 48) << 4);
*(Poll++) = (FreqString[10] - 48) | ((FreqString[9] - 48) << 4);
*(Poll++) = 1; // Set Freq
PORT->TXLen = 5;
RigWriteCommBlock(PORT);
PORT->Retries = 1;
PORT->Timeout = 0;
return;
case HAMLIB: case HAMLIB:
// Dont need to save, as we can send strings separately // Dont need to save, as we can send strings separately
@ -1633,6 +1708,8 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, int Session,
C_Q_ADD(&RIG->BPQtoRADIO_Q, buffptr); C_Q_ADD(&RIG->BPQtoRADIO_Q, buffptr);
saveNewFreq(RIG, Freq, Mode);
return TRUE; return TRUE;

View File

@ -2224,16 +2224,27 @@ VOID DOMONITORING(int NeedTrace)
BOOL SaveMTX = MTX; BOOL SaveMTX = MTX;
BOOL SaveMCOM = MCOM; BOOL SaveMCOM = MCOM;
BOOL SaveMUI = MUIONLY; BOOL SaveMUI = MUIONLY;
int BPQStream = 0;
if (NeedTrace) if (NeedTrace)
Tracebit = 0x80; Tracebit = 0x80;
if (TNC->CONOK) if (TNC->Channels[0])
SetAppl(TNC->BPQPort, TNC->APPLFLAGS | Tracebit, TNC->APPLICATION); BPQStream = TNC->Channels[0]->BPQStream;
else else if (TNC->TNC2Stream[0])
SetAppl(TNC->BPQPort, TNC->APPLFLAGS | Tracebit, 0); BPQStream = TNC->TNC2Stream[0]->BPQPort;
else if (TNC->BPQPort)
BPQStream = TNC->BPQPort;
Stamp = GetRaw(TNC->BPQPort, (char *)&MONITORDATA, &len, &count); if (BPQStream)
{
if (TNC->CONOK)
SetAppl(BPQStream, TNC->APPLFLAGS | Tracebit, TNC->APPLICATION);
else
SetAppl(BPQStream, TNC->APPLFLAGS | Tracebit, 0);
}
Stamp = GetRaw(BPQStream, (char *)&MONITORDATA, &len, &count);
if (len == 0) if (len == 0)
return; return;

18
VARA.c
View File

@ -2433,6 +2433,24 @@ static VOID CloseComplete(struct TNCINFO * TNC, int Stream)
VARASendCommand(TNC, "BW500\r", TRUE); VARASendCommand(TNC, "BW500\r", TRUE);
else if (TNC->DefaultMode == 54) else if (TNC->DefaultMode == 54)
VARASendCommand(TNC, "BW2750\r", TRUE); VARASendCommand(TNC, "BW2750\r", TRUE);
// If a default frequency is specified, set it
if (TNC->DefaultTXFreq && TNC->TXRadio)
{
char Msg[128];
sprintf(Msg, "R%d %f", TNC->TXRadio, TNC->DefaultTXFreq);
Rig_Command(-1, Msg);
}
if (TNC->DefaultRXFreq && TNC->RXRadio && TNC->TXRadio != TNC->RXRadio)
{
char Msg[128];
sprintf(Msg, "R%d %f", TNC->RXRadio, TNC->DefaultRXFreq);
Rig_Command(-1, Msg);
}
} }

View File

@ -10,8 +10,8 @@
#endif #endif
#define KVers 6,0,23,51 #define KVers 6,0,23,55
#define KVerstring "6.0.23.51\0" #define KVerstring "6.0.23.55\0"
#ifdef CKernel #ifdef CKernel

View File

@ -3589,7 +3589,7 @@ char * BuildB2Header(WebMailInfo * WebMail, struct MsgInfo * Msg, char ** ToCall
"Mbo: %s\r\n", "Mbo: %s\r\n",
Msg->title, BBSName); Msg->title, BBSName);
NewMsg += sprintf(NewMsg, "Body: %d\r\n", (int)strlen(WebMail->Body)); NewMsg += sprintf(NewMsg, "Body: %d\r\n", (int)strlen(WebMail->Body) + WebMail->HeaderLen + WebMail->FooterLen);
Msg->B2Flags = B2Msg; Msg->B2Flags = B2Msg;
@ -6063,7 +6063,7 @@ int ProcessWebmailWebSock(char * MsgPtr, char * OutBuffer)
struct UserInfo * User; struct UserInfo * User;
int m; int m;
struct MsgInfo * Msg; struct MsgInfo * Msg;
char * ptr = &OutBuffer[4]; char * ptr = &OutBuffer[10]; // allow room for full payload length (64 bit)
int n = NumberofMessages; int n = NumberofMessages;
char Via[64]; char Via[64];
@ -6145,25 +6145,39 @@ int ProcessWebmailWebSock(char * MsgPtr, char * OutBuffer)
ptr += sprintf(ptr, "%s</pre> \r\n", ptr); ptr += sprintf(ptr, "%s</pre> \r\n", ptr);
Len = ptr - &OutBuffer[4]; Len = ptr - &OutBuffer[10];
OutBuffer[0] = 0x81; // Fin, Data OutBuffer[0] = 0x81; // Fin, Data
if (Len < 126) if (Len < 126)
{ {
OutBuffer[1] = Len; OutBuffer[1] = Len;
memmove(&OutBuffer[2], &OutBuffer[4], Len); memmove(&OutBuffer[2], &OutBuffer[10], Len);
return Len + 2; return Len + 2;
} }
else if (Len < 65536)
{
OutBuffer[1] = 126; // Unmasked, Extended Len 16
OutBuffer[2] = Len >> 8;
OutBuffer[3] = Len & 0xff;
memmove(&OutBuffer[4], &OutBuffer[10], Len);
return Len + 4;
}
else else
{ {
OutBuffer[1] = 126; // Unmasked, Extended Len OutBuffer[1] = 127; // Unmasked, Extended Len 64 bits
OutBuffer[2] = Len >> 8; // Len is 32 bits, so pad with zeros
OutBuffer[3] = Len & 0xff; OutBuffer[2] = 0;
OutBuffer[3] = 0;
OutBuffer[4] = 0;
OutBuffer[5] = 0;
OutBuffer[6] = (Len >> 24) & 0xff;
OutBuffer[7] = (Len >> 16) & 0xff;
OutBuffer[8] = (Len >> 8) & 0xff;
OutBuffer[9] = Len & 0xff;
return Len + 4; return Len + 10;
} }
} }

View File

@ -538,7 +538,13 @@ typedef struct TNCINFO
int RXRadio; // Rigcontrol Radio Number for RX int RXRadio; // Rigcontrol Radio Number for RX
long long int TXFreq; // Freq to set on tx before ptt long long int TXFreq; // Freq to set on tx before ptt
long long int DefaultFreq; // Freq to set on tx after ptt double ActiveTXFreq; // Freq to set on tx after attach
double ActiveRXFreq; // Freq to set on rx after attach
double DefaultTXFreq; // Freq to set on tx after close
double DefaultRXFreq; // Freq to set on rx after close
int TXOffset; // Correction to TXFreq int TXOffset; // Correction to TXFreq
int PID; // Process ID for Software TNC int PID; // Process ID for Software TNC