diff --git a/fhem/CHANGED b/fhem/CHANGED
index b3562c325..9613d4bdf 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# 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.
+ - change: 93_Log2Syslog: version numbering
- bugfix: 12_HProtocolGateway: PMS-IB checksum calculation corrected
- change: 12_HProtocolGateway: move sensorSystem attribute to HProtocolTank
- feature: 98_Verkehrsinfo.pm: add attribut timeout
diff --git a/fhem/FHEM/93_Log2Syslog.pm b/fhem/FHEM/93_Log2Syslog.pm
index c2fdb52a6..cbaf7e41a 100644
--- a/fhem/FHEM/93_Log2Syslog.pm
+++ b/fhem/FHEM/93_Log2Syslog.pm
@@ -3,7 +3,7 @@
##########################################################################################################################
# 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
#
# 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:
our %Log2Syslog_vNotesIntern = (
+ "5.3.2" => "08.02.2019 fix version numbering ",
"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.2.1" => "08.10.2018 setpayload of BSD-format changed, commandref revised ",
@@ -92,6 +93,7 @@ our %Log2Syslog_vNotesIntern = (
# Versions History extern:
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.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",
@@ -132,13 +134,6 @@ our %Log2Syslog_vNotesExtern = (
"1.0.0" => "25.07.2017 initial version "
);
-# Hint Hash
-our %Log2Syslog_vHintsExt = (
- "3" => "The RFC5425 TLS Transport Protocol",
- "2" => "The basics of RFC3164 (BSD) protocol",
- "1" => "Informations about RFC5424 (IETF) syslog protocol"
-);
-
# Mappinghash BSD-Formatierung Monat
our %Log2Syslog_BSDMonth = (
"01" => "Jan",
@@ -232,6 +227,8 @@ my %RFC5425len = ("DL" => 8192, # max. Lange Message insgesamt mit TLS
# Forward declarations
#
sub Log2Syslog_Log3slog($$$);
+use vars qw(%Log2Syslog_vHintsExt_en);
+use vars qw(%Log2Syslog_vHintsExt_de);
###############################################################################
sub Log2Syslog_Initialize($) {
@@ -1096,7 +1093,7 @@ sub Log2Syslog_Get($@) {
my $st;
my $getlist = "Unknown argument $opt, choose one of ".
(($hash->{MODEL} !~ /Collector/)?"certInfo:noArg ":"").
- "versionNotes:noArg "
+ "versionNotes "
;
return if(AttrVal($name, "disable", "") eq "1");
@@ -1114,62 +1111,85 @@ sub Log2Syslog_Get($@) {
return "no SSL session has been created";
} elsif ($opt =~ /versionNotes/) {
- my $header = "Module release information table
";
+ my $header = "Module release information
";
my $header1 = "Helpful hints
";
- my $i;
-
- # Ausgabetabelle erstellen
- my ($ret,$val0,$val1);
- $ret = "";
-
- $ret .= sprintf("
$header1
");
- $ret .= "
";
- $ret .= "";
- $ret .= "";
- $i = 0;
- foreach my $key (reverse sort(keys %Log2Syslog_vHintsExt)) {
- $val0 = $Log2Syslog_vHintsExt{$key};
- $ret .= sprintf("$key | $val0 | " );
- $ret .= "
";
- $i++;
- if ($i & 1) {
- # $i ist ungerade
- $ret .= "";
+ my %hs;
+
+ # Ausgabetabelle erstellen
+ my ($ret,$val0,$val1);
+ my $i = 0;
+
+ $ret = "";
+
+ # Hints
+ if(!$prop || $prop =~ /hints/i || $prop =~ /[\d]+/) {
+ $ret .= sprintf("$header1
");
+ $ret .= "
";
+ $ret .= "";
+ $ret .= "";
+ if($prop && $prop =~ /[\d]+/) {
+ my @hints = split(",",$prop);
+ foreach (@hints) {
+ if(AttrVal("global","language","EN") eq "DE") {
+ $hs{$_} = $Log2Syslog_vHintsExt_de{$_};
+ } else {
+ $hs{$_} = $Log2Syslog_vHintsExt_en{$_};
+ }
+ }
} else {
- $ret .= "
";
+ 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("$key | $val0 | " );
+ $ret .= "
";
+ $i++;
+ if ($i & 1) {
+ # $i ist ungerade
+ $ret .= "";
+ } else {
+ $ret .= "
";
+ }
}
- }
-
- $ret .= "
";
- $ret .= "";
- $ret .= "
";
- $ret .= "
";
-
- $ret .= sprintf("$header
");
- $ret .= "
";
- $ret .= "";
- $ret .= "";
- $i = 0;
- foreach my $key (reverse sort(keys %Log2Syslog_vNotesExtern)) {
- ($val0,$val1) = split(/\s/,$Log2Syslog_vNotesExtern{$key},2);
- $ret .= sprintf("$key | $val0 | $val1 | " );
- $ret .= "
";
- $i++;
- if ($i & 1) {
- # $i ist ungerade
- $ret .= "";
- } else {
- $ret .= "
";
+ $ret .= "
";
+ $ret .= "";
+ $ret .= "
";
+ $ret .= "
";
+ }
+
+ # Notes
+ if(!$prop || $prop =~ /rel/i) {
+ $ret .= sprintf("$header
");
+ $ret .= "
";
+ $ret .= "";
+ $ret .= "";
+ $i = 0;
+ foreach my $key (Log2Syslog_sortVersion("desc",keys %Log2Syslog_vNotesExtern)) {
+ ($val0,$val1) = split(/\s/,$Log2Syslog_vNotesExtern{$key},2);
+ $ret .= sprintf("$key | $val0 | $val1 | " );
+ $ret .= "
";
+ $i++;
+ if ($i & 1) {
+ # $i ist ungerade
+ $ret .= "";
+ } else {
+ $ret .= "
";
+ }
}
- }
- $ret .= "
";
- $ret .= "";
- $ret .= "
";
- $ret .= "
";
-
+ $ret .= "
";
+ $ret .= "";
+ $ret .= "
";
+ $ret .= "
";
+ }
+
$ret .= "";
-
- return $ret;
+
+ return $ret;
} else {
return "$getlist";
@@ -1934,6 +1954,47 @@ sub Log2Syslog_deleteMemLock($) {
return;
}
+################################################################
+# sortiert eine Liste von Versionsnummern x.x.x
+# Schwartzian Transform and the GRT transform
+# Übergabe: "asc | desc",
+################################################################
+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 RFC5425 TLS Transport Protocol",
+ "2" => "The basics of RFC3164 (BSD) protocol",
+ "1" => "Informations about RFC5424 (IETF) syslog protocol"
+);
+
+#############################################################################################
+# Hint Hash DE
+#############################################################################################
+our %Log2Syslog_vHintsExt_de = (
+ "3" => "Die Beschreibung des RFC5425 TLS Transport Protokoll",
+ "2" => "Die Grundlagen des RFC3164 (BSD) Protokolls",
+ "1" => "Informationen über das RFC5424 (IETF) Syslog Protokoll"
+);
+
1;
=pod
@@ -2209,9 +2270,11 @@ Aug 18 21:08:27 fhemtest.myds.me 1 2017-08-18T21:08:27.095 fhemtest.myds.me Test
- - versionNotes
+ - versionNotes [hints | rel | <key>]
- 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.
+ 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 <key>-specification only the hint with the specified number is shown.
@@ -2885,10 +2948,14 @@ Aug 18 21:08:27 fhemtest.myds.me 1 2017-08-18T21:08:27.095 fhemtest.myds.me Test
- - versionNotes
+ - versionNotes [hints | rel | <key>]
- Zeigt Release Informationen und Hinweise zum Modul an. Es sind nur Informationen mit Bedeutung für den Modulnutzer
- enthalten.
+ Zeigt Release Informationen und/oder Hinweise zum Modul an. Es sind nur Release Informationen mit Bedeutung für den
+ Modulnutzer enthalten.
+ Sind keine Optionen angegben, werden sowohl Release Informationen als auch Hinweise angezeigt. "rel" zeigt nur Release
+ Informationen und "hints" nur Hinweise an. Mit der <key>-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.