From: nwf Date: Wed, 24 Sep 2008 04:07:41 +0000 (-0400) Subject: Add 'warn_initial' callback to MasterCoder for initial TLV streams X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=2d212a92f7c041dd590d7eaa796ecc29c2da18b4;p=instirc Add 'warn_initial' callback to MasterCoder for initial TLV streams darcs-hash:20080924040741-4d648-2b333918655b399f48500d99cb6e53640335085b.gz --- diff --git a/MasterCoder.pm b/MasterCoder.pm index c487f86..c7d858a 100644 --- a/MasterCoder.pm +++ b/MasterCoder.pm @@ -173,6 +173,11 @@ sub tlv_run_callbacks($$$) { # what we think is the message, and may have to backtrack out # to find msg_suffix. It will never prematurely terminate # the encoded message if it sees msg_prefix inside the message. + # + # This form is obsolete but is still parsed for backwards + # compatibility. To emphasize the obsolescense, if this + # callback fires and a callback named 'warn_initial' is specified, + # that callback will be called (with no arguments). my $regex = "^".$$self{'msg_prefix'}."([" . (join ("",@{$$self{'code_chars'}})) ."]+)".$$self{'msg_suffix'}."(.*)\$"; @@ -189,6 +194,9 @@ sub tlv_run_callbacks($$$) { if ( $msg =~ /$regex/ ) { $tlvstr = $1; $rest = $2; + if (exists $$cbs{'warn_initial'}) { + $$cbs{'warn_initial'}(); + } } elsif ( $msg =~ /$regex2/ ) { $tlvstr = $2; $rest = $1;