4.15.44. PeerStateChangeHook Previous topic Parent topic Child topic Next topic

This is a Perl hook that is called whenever a SIGTRAN M3UA peer (ASP or IPSP) changes state. This hook is not enabled by default.. PeerStateChangeHook is called with 3 arguments:
  • $_[0]
    This is a reference to the current PeerSP
  • $_[1]
    This is the old state
  • $_[2]
    This is the new state
PeerStateChangeHook sub { my ($self, $old_state, $new_state) = @_; \
    my $from = $Radius::M3UA::sp_state2name{$old_state}"; \
    my $to   = $Radius::M3UA::sp_state2name{$new_state}"; \
    my $msg  = "$self->{log_class_name} Changes state from $from to $to"; \
    main::log($main::LOG_DEBUG, $msg); \
    return if $new_state == $Radius::M3UA::SP_STATE::ACTIVE; \
    # Take action when the new state is INACTIVE or DOWN \
}