2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

93_Log2Syslog: version numbering

git-svn-id: https://svn.fhem.de/fhem/trunk@18536 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-02-08 21:08:47 +00:00
parent 4cfa52f3f9
commit ae4737b007
2 changed files with 133 additions and 65 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- change: 93_Log2Syslog: version numbering
- bugfix: 12_HProtocolGateway: PMS-IB checksum calculation corrected - bugfix: 12_HProtocolGateway: PMS-IB checksum calculation corrected
- change: 12_HProtocolGateway: move sensorSystem attribute to HProtocolTank - change: 12_HProtocolGateway: move sensorSystem attribute to HProtocolTank
- feature: 98_Verkehrsinfo.pm: add attribut timeout - feature: 98_Verkehrsinfo.pm: add attribut timeout

View File

@ -3,7 +3,7 @@
########################################################################################################################## ##########################################################################################################################
# 93_Log2Syslog.pm # 93_Log2Syslog.pm
# #
# (c) 2017-2018 by Heiko Maaz # (c) 2017-2019 by Heiko Maaz
# e-mail: Heiko dot Maaz at t-online dot de # e-mail: Heiko dot Maaz at t-online dot de
# #
# This script is part of fhem. # This script is part of fhem.
@ -40,6 +40,7 @@ eval "use Net::Domain qw(hostname hostfqdn hostdomain domainname);1" or my $Mis
# Versions History intern: # Versions History intern:
our %Log2Syslog_vNotesIntern = ( our %Log2Syslog_vNotesIntern = (
"5.3.2" => "08.02.2019 fix version numbering ",
"5.3.1" => "21.10.2018 get of FQDN changed ", "5.3.1" => "21.10.2018 get of FQDN changed ",
"5.3.0" => "16.10.2018 attribute sslCertPrefix added (Forum:#92030), module hints & release info order switched ", "5.3.0" => "16.10.2018 attribute sslCertPrefix added (Forum:#92030), module hints & release info order switched ",
"5.2.1" => "08.10.2018 setpayload of BSD-format changed, commandref revised ", "5.2.1" => "08.10.2018 setpayload of BSD-format changed, commandref revised ",
@ -92,6 +93,7 @@ our %Log2Syslog_vNotesIntern = (
# Versions History extern: # Versions History extern:
our %Log2Syslog_vNotesExtern = ( our %Log2Syslog_vNotesExtern = (
"5.3.2" => "08.02.2019 fix version numbering ",
"5.3.0" => "16.10.2018 attribute sslCertPrefix added to support multiple SSL-keys (Forum:#92030)", "5.3.0" => "16.10.2018 attribute sslCertPrefix added to support multiple SSL-keys (Forum:#92030)",
"5.2.1" => "08.10.2018 Send format of BSD changed. The TAG-field was changed to \"IDENT[PID]: \" ", "5.2.1" => "08.10.2018 Send format of BSD changed. The TAG-field was changed to \"IDENT[PID]: \" ",
"5.2.0" => "02.10.2018 direct help for attributes added", "5.2.0" => "02.10.2018 direct help for attributes added",
@ -132,13 +134,6 @@ our %Log2Syslog_vNotesExtern = (
"1.0.0" => "25.07.2017 initial version " "1.0.0" => "25.07.2017 initial version "
); );
# Hint Hash
our %Log2Syslog_vHintsExt = (
"3" => "The <a href=\"https://tools.ietf.org/pdf/rfc5425.pdf\">RFC5425</a> TLS Transport Protocol",
"2" => "The basics of <a href=\"https://tools.ietf.org/html/rfc3164\">RFC3164 (BSD)</a> protocol",
"1" => "Informations about <a href=\"https://tools.ietf.org/html/rfc5424\">RFC5424 (IETF)</a> syslog protocol"
);
# Mappinghash BSD-Formatierung Monat # Mappinghash BSD-Formatierung Monat
our %Log2Syslog_BSDMonth = ( our %Log2Syslog_BSDMonth = (
"01" => "Jan", "01" => "Jan",
@ -232,6 +227,8 @@ my %RFC5425len = ("DL" => 8192, # max. Lange Message insgesamt mit TLS
# Forward declarations # Forward declarations
# #
sub Log2Syslog_Log3slog($$$); sub Log2Syslog_Log3slog($$$);
use vars qw(%Log2Syslog_vHintsExt_en);
use vars qw(%Log2Syslog_vHintsExt_de);
############################################################################### ###############################################################################
sub Log2Syslog_Initialize($) { sub Log2Syslog_Initialize($) {
@ -1096,7 +1093,7 @@ sub Log2Syslog_Get($@) {
my $st; my $st;
my $getlist = "Unknown argument $opt, choose one of ". my $getlist = "Unknown argument $opt, choose one of ".
(($hash->{MODEL} !~ /Collector/)?"certInfo:noArg ":""). (($hash->{MODEL} !~ /Collector/)?"certInfo:noArg ":"").
"versionNotes:noArg " "versionNotes "
; ;
return if(AttrVal($name, "disable", "") eq "1"); return if(AttrVal($name, "disable", "") eq "1");
@ -1114,62 +1111,85 @@ sub Log2Syslog_Get($@) {
return "no SSL session has been created"; return "no SSL session has been created";
} elsif ($opt =~ /versionNotes/) { } elsif ($opt =~ /versionNotes/) {
my $header = "<b>Module release information table</b><br>"; my $header = "<b>Module release information</b><br>";
my $header1 = "<b>Helpful hints</b><br>"; my $header1 = "<b>Helpful hints</b><br>";
my $i; my %hs;
# Ausgabetabelle erstellen # Ausgabetabelle erstellen
my ($ret,$val0,$val1); my ($ret,$val0,$val1);
$ret = "<html>"; my $i = 0;
$ret .= sprintf("<div class=\"makeTable wide\"; style=\"text-align:left\">$header1 <br>"); $ret = "<html>";
$ret .= "<table class=\"block wide internals\">";
$ret .= "<tbody>"; # Hints
$ret .= "<tr class=\"even\">"; if(!$prop || $prop =~ /hints/i || $prop =~ /[\d]+/) {
$i = 0; $ret .= sprintf("<div class=\"makeTable wide\"; style=\"text-align:left\">$header1 <br>");
foreach my $key (reverse sort(keys %Log2Syslog_vHintsExt)) { $ret .= "<table class=\"block wide internals\">";
$val0 = $Log2Syslog_vHintsExt{$key}; $ret .= "<tbody>";
$ret .= sprintf("<td style=\"vertical-align:top\"><b>$key</b> </td><td style=\"vertical-align:top\">$val0</td>" ); $ret .= "<tr class=\"even\">";
$ret .= "</tr>"; if($prop && $prop =~ /[\d]+/) {
$i++; my @hints = split(",",$prop);
if ($i & 1) { foreach (@hints) {
# $i ist ungerade if(AttrVal("global","language","EN") eq "DE") {
$ret .= "<tr class=\"odd\">"; $hs{$_} = $Log2Syslog_vHintsExt_de{$_};
} else {
$hs{$_} = $Log2Syslog_vHintsExt_en{$_};
}
}
} else { } else {
$ret .= "<tr class=\"even\">"; if(AttrVal("global","language","EN") eq "DE") {
%hs = %Log2Syslog_vHintsExt_de;
} else {
%hs = %Log2Syslog_vHintsExt_en;
}
}
$i = 0;
foreach my $key (Log2Syslog_sortVersion("desc",keys %hs)) {
$val0 = $hs{$key};
$ret .= sprintf("<td style=\"vertical-align:top\"><b>$key</b> </td><td style=\"vertical-align:top\">$val0</td>" );
$ret .= "</tr>";
$i++;
if ($i & 1) {
# $i ist ungerade
$ret .= "<tr class=\"odd\">";
} else {
$ret .= "<tr class=\"even\">";
}
} }
} $ret .= "</tr>";
$ret .= "</tbody>";
$ret .= "</tr>"; $ret .= "</table>";
$ret .= "</tbody>"; $ret .= "</div>";
$ret .= "</table>"; }
$ret .= "</div>";
# Notes
$ret .= sprintf("<div class=\"makeTable wide\"; style=\"text-align:left\">$header <br>"); if(!$prop || $prop =~ /rel/i) {
$ret .= "<table class=\"block wide internals\">"; $ret .= sprintf("<div class=\"makeTable wide\"; style=\"text-align:left\">$header <br>");
$ret .= "<tbody>"; $ret .= "<table class=\"block wide internals\">";
$ret .= "<tr class=\"even\">"; $ret .= "<tbody>";
$i = 0; $ret .= "<tr class=\"even\">";
foreach my $key (reverse sort(keys %Log2Syslog_vNotesExtern)) { $i = 0;
($val0,$val1) = split(/\s/,$Log2Syslog_vNotesExtern{$key},2); foreach my $key (Log2Syslog_sortVersion("desc",keys %Log2Syslog_vNotesExtern)) {
$ret .= sprintf("<td style=\"vertical-align:top\"><b>$key</b> </td><td style=\"vertical-align:top\">$val0 </td><td>$val1</td>" ); ($val0,$val1) = split(/\s/,$Log2Syslog_vNotesExtern{$key},2);
$ret .= "</tr>"; $ret .= sprintf("<td style=\"vertical-align:top\"><b>$key</b> </td><td style=\"vertical-align:top\">$val0 </td><td>$val1</td>" );
$i++; $ret .= "</tr>";
if ($i & 1) { $i++;
# $i ist ungerade if ($i & 1) {
$ret .= "<tr class=\"odd\">"; # $i ist ungerade
} else { $ret .= "<tr class=\"odd\">";
$ret .= "<tr class=\"even\">"; } else {
$ret .= "<tr class=\"even\">";
}
} }
} $ret .= "</tr>";
$ret .= "</tr>"; $ret .= "</tbody>";
$ret .= "</tbody>"; $ret .= "</table>";
$ret .= "</table>"; $ret .= "</div>";
$ret .= "</div>"; }
$ret .= "</html>"; $ret .= "</html>";
return $ret; return $ret;
} else { } else {
return "$getlist"; return "$getlist";
@ -1934,6 +1954,47 @@ sub Log2Syslog_deleteMemLock($) {
return; return;
} }
################################################################
# sortiert eine Liste von Versionsnummern x.x.x
# Schwartzian Transform and the GRT transform
# Übergabe: "asc | desc",<Liste von Versionsnummern>
################################################################
sub Log2Syslog_sortVersion (@){
my ($sseq,@versions) = @_;
my @sorted = map {$_->[0]}
sort {$a->[1] cmp $b->[1]}
map {[$_, pack "C*", split /\./]} @versions;
@sorted = map {join ".", unpack "C*", $_}
sort
map {pack "C*", split /\./} @versions;
if($sseq eq "desc") {
@sorted = reverse @sorted;
}
return @sorted;
}
#############################################################################################
# Hint Hash EN
#############################################################################################
our %Log2Syslog_vHintsExt_en = (
"3" => "The <a href=\"https://tools.ietf.org/pdf/rfc5425.pdf\">RFC5425</a> TLS Transport Protocol",
"2" => "The basics of <a href=\"https://tools.ietf.org/html/rfc3164\">RFC3164 (BSD)</a> protocol",
"1" => "Informations about <a href=\"https://tools.ietf.org/html/rfc5424\">RFC5424 (IETF)</a> syslog protocol"
);
#############################################################################################
# Hint Hash DE
#############################################################################################
our %Log2Syslog_vHintsExt_de = (
"3" => "Die Beschreibung des <a href=\"https://tools.ietf.org/pdf/rfc5425.pdf\">RFC5425</a> TLS Transport Protokoll",
"2" => "Die Grundlagen des <a href=\"https://tools.ietf.org/html/rfc3164\">RFC3164 (BSD)</a> Protokolls",
"1" => "Informationen über das <a href=\"https://tools.ietf.org/html/rfc5424\">RFC5424 (IETF)</a> Syslog Protokoll"
);
1; 1;
=pod =pod
@ -2209,9 +2270,11 @@ Aug 18 21:08:27 fhemtest.myds.me 1 2017-08-18T21:08:27.095 fhemtest.myds.me Test
<br> <br>
<ul> <ul>
<li><b>versionNotes </b><br> <li><b>versionNotes [hints | rel | &lt;key&gt;] </b><br>
<br> <br>
Shows release informations and hints about the module. Contains only main informations for module users. Shows realease informations and/or hints about the module. It contains only main release informations for module users. <br>
If no options are specified, both release informations and hints will be shown. "rel" shows only release informations and
"hints" shows only hints. By the &lt;key&gt;-specification only the hint with the specified number is shown.
</li> </li>
</ul> </ul>
<br> <br>
@ -2885,10 +2948,14 @@ Aug 18 21:08:27 fhemtest.myds.me 1 2017-08-18T21:08:27.095 fhemtest.myds.me Test
<br> <br>
<ul> <ul>
<li><b>versionNotes </b><br> <li><b>versionNotes [hints | rel | &lt;key&gt;]</b> <br>
<br> <br>
Zeigt Release Informationen und Hinweise zum Modul an. Es sind nur Informationen mit Bedeutung für den Modulnutzer Zeigt Release Informationen und/oder Hinweise zum Modul an. Es sind nur Release Informationen mit Bedeutung für den
enthalten. Modulnutzer enthalten. <br>
Sind keine Optionen angegben, werden sowohl Release Informationen als auch Hinweise angezeigt. "rel" zeigt nur Release
Informationen und "hints" nur Hinweise an. Mit der &lt;key&gt;-Angabe wird der Hinweis mit der angegebenen Nummer
angezeigt.
Ist das Attribut "language = DE" im global Device gesetzt, erfolgt die Ausgabe der Hinweise in deutscher Sprache.
</li> </li>
</ul> </ul>
<br> <br>