Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

net::sip::dropper::byipport(3pm) [debian man page]

Net::SIP::Dropper::ByIPPort(3pm)			User Contributed Perl Documentation			  Net::SIP::Dropper::ByIPPort(3pm)

NAME
Net::SIP::Dropper::ByIPPort - drops SIP messages based on senders IP and port SYNOPSIS
use Net::SIP::Dropper::ByIPPort; my $drop_by_ipport = Net::SIP::Dropper::ByIPPort->new( database => '/path/to/database.drop', methods => [ 'REGISTER', '...', '' ], attempts => 10, interval => 60, ); my $dropper = Net::SIP::Dropper->new( cb => $drop_by_ipport ); my $chain = Net::SIP::ReceiveChain->new([ $dropper, ... ]); DESCRIPTION
With "Net::SIP::Dropper::ByIPPort" one can drop packets, if too much packets are received from the same IP and port within a specific interval. This is to stop bad behaving clients. CONSTRUCTOR
new ( ARGS ) ARGS is a hash with the following keys: database Optional file name of database or callback for storing/retrieving the data. If it is a callback it will be called with "$callback->(\%data)" to retrieve the data (%data will be updated) and "$callback->(\%data,true)" to save the data. No return value will be expected from the callback. %data contains the number of attempts from a specific IP, port at a specific time in the following format: "$data{ip}{port}{time} = count" attempts After how many attempts within the specific interval the packet will be dropped. Argument is required. interval The interval for attempts. Argument is required. methods Optional argument to restrict dropping to specific methods. Is array reference of method names, if one of the names is empty also responses will be considered. If not given all packets will be checked. METHODS
run ( PACKET, LEG, FROM ) This method is called as a callback from the Net::SIP::Dropper object. It returns true if the packet should be dropped, e.g. if there are too much packets from the same ip,port within the given interval. expire This method is called from within "run" but can also be called by hand. It will expire all entries which are outside of the interval. savedb This method is called from "expire" and "run" for saving to the database after changes, but can be called by hand to, useful if you made manual changes using the "data" method. data This method gives access to the internal hash which stores the attempts. An attempt from a specific IP and port and a specific time (as int, like time() gives) will be added to "$self->data->{ip}{port}{time}". By manually manipulating the hash one can restrict a specific IP,port forever (just set time to a large value and add a high number of attempts) or even restrict access for the whole IP (all ports) until time by using a port number of 0. After changes to the data it is advised to call "savedb". perl v5.14.2 2012-06-26 Net::SIP::Dropper::ByIPPort(3pm)

Check Out this Related Man Page

Net::SIP::StatelessProxy(3pm)				User Contributed Perl Documentation			     Net::SIP::StatelessProxy(3pm)

NAME
Net::SIP::StatelessProxy - Simple implementation of a stateless proxy SYNOPSIS
.. DESCRIPTION
This package implements a simple stateless SIP proxy. Basic idea is that the proxy has either a single or two legs and that the packets are exchanged between those legs, e.g. packets incoming on one leg will be forwarded through the other leg. Because this is a stateless proxy no retransmits will be done by the proxy. If the proxy should work as a registrar too it should be put after a Net::SIP::Registrar in a Net::SIP::ReceiveChain. While forwarding the proxy will be insert itself into the packet, e.g. it will add Via and Record-Route header while forwarding requests. Additionally it will rewrite the Contact header while forwarding packets (see below), e.g. if the Contact header points to some client it will rewrite it, so that it points to the proxy and if it already points to the proxy it will rewrite it back so that it again points to the client. CONSTRUCTOR
new ( %ARGS ) Creates a new stateless proxy. With %ARGS the behavior can be influenced: dispatcher The Net::SIP::Dispatcher object managing the proxy. rewrite_contact Callback which is used in rewriting Contact headers. If one puts user@host in it should rewrite it and if one puts something without '@' it should try to rewrite it back (and return () if it cannot rewrite it back). A working default implementation is provided. nathelper Optional Net::SIP::NATHelper::* object. When given it will be used to do NAT, e.g. if the incoming and outgoing legs are different it will rewrite the SDP bodies to use local sockets and the nathelper will transfer the RTP data between the local and the original sockets. force_rewrite Usually the contact header will only be rewritten, if the incoming and outgoing leg are different. With this option one can force the rewrite, even if they are the same. METHODS
receive ( PACKET, LEG, FROM ) PACKET is the incoming packet, LEG is the Net::SIP::Leg where the packet arrived and FROM is the "ip:port" of the sender. Called from the dispatcher on incoming packets. The packet will be rewritten ("Via" and "Record-Route" headers added, Contact modified) and then the packet will be forwarded. For requests it can determine the target of the forwarded packet by looking at the route or if no route it looks at the URI. For responses it looks at the next Via header. do_nat ( PACKET, INCOMING_LEG, OUTGOING_LEG ) This will be called from receive while forwarding data. If nathelper is defined it will be used to rewrite SDP bodies and update nathelpers internal states to forward RTP data. Return values are like forward_outgoing in Net::SIP::Leg, e.g. it will return "[code,text]" on error or "()" on success, where success can be that the packet was rewritten or that there was no need to touch it. UNDOCUMENTED METHODS
idside2hash perl v5.14.2 2010-02-02 Net::SIP::StatelessProxy(3pm)
Man Page