.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::SIP::NATHelper::Server 3pm" .TH Net::SIP::NATHelper::Server 3pm "2023-09-29" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::SIP::NATHelper::Server \- server for Net::SIP::NATHelper::Client .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is a wrapper around Net::SIP::NATHelper::Base and will receive it's instructions from Net::SIP::NATHelper::Client using \s-1RPC\s0 via sockets. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .ie n .IP "new ( [ \s-1HELPER\s0 ], @FDS )" 4 .el .IP "new ( [ \s-1HELPER\s0 ], \f(CW@FDS\fR )" 4 .IX Item "new ( [ HELPER ], @FDS )" Will create an object which listens on all file descriptors given in \s-1FDS\s0 for \s-1RPC\s0 from clients. .Sp If \s-1HELPER\s0 is given and a Net::SIP::NATHelper::Base object or derived it will be used, otherwise the helper will be created. .SH "METHODS" .IX Header "METHODS" .IP "do_command ( \s-1FD\s0 )" 4 .IX Item "do_command ( FD )" Called when \s-1FD\s0 is available for reading. Calls \fBaccept\fR on \s-1FD\s0 and reads the \s-1RPC\s0 packet from the resulting file descriptor, executes it and returns result back. .Sp Currently implemented commands are \*(L"allocate\*(R",\*(L"activate\*(R" and \&\*(L"close\*(R" which will map to the local methods \fBallocate_sockets\fR, \&\fBactivate_session\fR and \fBclose_session\fR. .Sp One might redefine or add commands by changing \f(CW\*(C`$self\->{commands}\*(C'\fR. The key of this hash reference is the command name and the value is the callback. .Sp Unknown commands will be ignored, e.g nothing returned. .IP "loop" 4 .IX Item "loop" This will loop over all file descriptors it gets from \fBcallbacks\fR in Net::SIP::NATHelper::Base and the file descriptors for the \s-1RPC\s0 sockets. .Sp When file descriptors gets available for reading it will execute the callbacks, e.g. forward the \s-1RTP\s0 data or call \fBdo_command\fR. In regular intervals it will call \fBexpire\fR from Net::SIP::NATHelper::Base to expire the \s-1RTP\s0 sockets and sessions. .IP "allocate_sockets ( ... )" 4 .IX Item "allocate_sockets ( ... )" Calls \fBallocate_sockets\fR of the local Net::SIP::NATHelper::Base object. Takes and returns the same arguments. .IP "activate_session ( ... )" 4 .IX Item "activate_session ( ... )" Calls \fBactivate_session\fR of the local Net::SIP::NATHelper::Base object. Takes the same arguments and returns 1 if the session was newly activated, \-1 if it was activated before and false if activation failed. Updates callbacks into the event loop. .IP "close_session ( ... )" 4 .IX Item "close_session ( ... )" Calls \fBactivate_session\fR of the local Net::SIP::NATHelper::Base object. Takes the same arguments and returns the number of closed sessions. Updates callbacks into the event loop. .IP "expire ( ... )" 4 .IX Item "expire ( ... )" Calls \fBexpire\fR of the local Net::SIP::NATHelper::Base object. Takes the same arguments and returns the number of expired sessions. Updates callbacks into the event loop if necessary. .SH "BUGS" .IX Header "BUGS" The local event loop should be pluggable, so that other implementations could be used. Right now it's a hard coded loop using select.