]> hydra-www.ietfng.org Git - instirc/commitdiff
Add 'warn_initial' callback to MasterCoder for initial TLV streams
authornwf <nwf@cs.jhu.edu>
Wed, 24 Sep 2008 04:07:41 +0000 (00:07 -0400)
committernwf <nwf@cs.jhu.edu>
Wed, 24 Sep 2008 04:07:41 +0000 (00:07 -0400)
darcs-hash:20080924040741-4d648-2b333918655b399f48500d99cb6e53640335085b.gz

MasterCoder.pm

index c487f862f86bf795f11fa1758035344e136da80a..c7d858a2b69969a86020120ad68e4b64c12559a5 100644 (file)
@@ -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;