Net::S...eChain(3pm)
π Net::S...eChain(3pm) π
okay bestie, so this page comes from the User Contributed Perl Documentation, and the title it's filed under is Net::S...eChain(3pm) (yes it's abbreviated like that, the full vibe is Net::SIP::ReceiveChain, iykyk). Buckle up, we're doing packet handling π
β¨ NAME β¨
Net::SIP::ReceiveChain β handle incoming packet by multiple receivers π«Ά
πΈ SYNOPSIS πΈ
# create proxy which works as a registrar too, but
# all register requests should be authorized
my $registrar = Net::SIP::Registrar->new...
my $auth = Net::SIP::Authorize->new ....
my $reg_chain = Net::SIP::ReceiveChain->new(
[ $auth,$registrar ],
methods => [ 'REGISTER' ],
);
my $proxy = Net::SIP::StatelessProxy->new...
my $chain = Net::SIP::ReceiveChain->new(
[ $registrar,$proxy ]
);
like⦠look at her go ⨠a whole authorizing chain in six lines, no cap.
π¦ DESCRIPTION π¦
So this package's whole job is handling incoming packets by multiple receivers. The classic example: make sure that requests headed for Net::SIP::Registrar get authorized first by Net::SIP::Authorize. Chain them up, and the first one that wants the packet takes it π
The objects hanging out in your chain can literally be:
Net::SIP::RegistrarNet::SIP::StatelessProxyNet::SIP::AuthorizeNet::SIP::ReceiveChainitself (yes, chains in chains, iconic π )- β¦and every other object which handles
receivelike described below π
π CONSTRUCTOR π
new ( OBJECTS, %ARGS )
This creates a new registar object (their spelling, not mine, we respect the source π). OBJECTS is a reference to an array of objects implementing the receive method.
%ARGS can have the following keys:
filterβ a callback which gets called duringreceivewith all arguments of the method. If it returns TRUE the packet will be handled by the chain, otherwise not.methodsβ iffilteris not given butmethodsis, it will setfilterto a callback which accepts only the methods specified in the array reference given tomethods. bestie that's just a filter with extra steps and we love that for her π
π METHODS π
receive ( PACKET,LEG,FROM )
PACKETis the incoming packet π¦LEGis theNet::SIP::Legwhere the packet arrived π¦΅FROMis theip:portof the sender π
Responses will be send back to the sender through the same leg. π«Ά
Called from the managing Net::SIP::Dispatcher object if a new packet arrives.
Returns TRUE if the packet was fully handled by one of the objects in the chain, else FALSE:
- If a filter was given, checks the packet against the filter and returns FALSE if the filter does return FALSE.
- Otherwise it will call
receiveon all objects in the chain until one of these returns TRUE. In this case it will return TRUE. - If no object in the chain handled the packet it will return FALSE.
no cap: FALSE means "nobody claimed this one, it's not mine", so don't go assuming it got handled. π«
and that's the whole page, bestie, we ate and left no crumbs β¨π
This one's from perl v5.40.1, dated 2025-12-07, filed as Net::S...eChain(3pm). mwah π go handle some packets π
π¦ where this page comes from
- ubuntu resolute: libnet-sip-perl 0.840-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-sip-perl 0.840-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms