| 1 | # | ||||||||||
| 2 | # Written by Ryan Kereliuk <ryker@ryker.org>. This file may be | ||||||||||
| 3 | # distributed under the same terms as Perl itself. | ||||||||||
| 4 | # | ||||||||||
| 5 | # The RFC 3261 sip URI is <scheme>:<authority>;<params>?<query>. | ||||||||||
| 6 | # | ||||||||||
| 7 | |||||||||||
| 8 | package URI::sip; | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | use parent qw(URI::_server URI::_userpass); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | use URI::Escape (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 1 | our $VERSION = '5.40'; | |||||||||
| 18 | |||||||||||
| 19 | 6 | ▶ | sub default_port {5060} | ||||||||
|
Subroutine
default_port: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 20 | |||||||||||
| 21 | 35 | ▶ | sub authority { | ||||||||
|
Subroutine
authority: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||
| 22 | 35 | my $self = shift; | |||||||||
| 23 | 35 | ▶ | $$self =~ m,^($URI::scheme_re:)?([^;?]*)(.*)$,os or die; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 35 | my $start = $1; | |||||||||
| 25 | 35 | my $authoritystr = $2; | |||||||||
| 26 | 35 | my $rest = $3; | |||||||||
| 27 | |||||||||||
| 28 | 35 | ▶ | if (@_) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 5 | $authoritystr = shift; | |||||||||
| 30 | 0 | $authoritystr =~ s/([^$URI::uric])/ URI::Escape::escape_char($1)/ego; | |||||||||
| 31 | 5 | $$self = $start . $authoritystr . $rest; | |||||||||
| 32 | } | ||||||||||
| 33 | 35 | return $authoritystr; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 2 | ▶ | sub params_form { | ||||||||
|
Subroutine
params_form: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 37 | 2 | my $self = shift; | |||||||||
| 38 | 2 | ▶ | $$self =~ m,^((?:$URI::scheme_re:)?)(?:([^;?]*))?(;[^?]*)?(.*)$,os or die; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 2 | my $start = $1 . $2; | |||||||||
| 40 | 2 | my $paramstr = $3; | |||||||||
| 41 | 2 | my $rest = $4; | |||||||||
| 42 | |||||||||||
| 43 | 2 | ▶ | if (@_) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 1 | my @paramarr; | |||||||||
| 45 | 1 | ▶ | for (my $i = 0; $i < @_; $i += 2) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 2 | push(@paramarr, "$_[$i]=$_[$i+1]"); | |||||||||
| 47 | } | ||||||||||
| 48 | 1 | $paramstr = join(";", @paramarr); | |||||||||
| 49 | 1 | $$self = $start . ";" . $paramstr . $rest; | |||||||||
| 50 | } | ||||||||||
| 51 | 2 | $paramstr =~ s/^;//o; | |||||||||
| 52 | 2 | return split(/[;=]/, $paramstr); | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 4 | ▶ | sub params { | ||||||||
|
Subroutine
params: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 56 | 4 | my $self = shift; | |||||||||
| 57 | 4 | ▶ | $$self =~ m,^((?:$URI::scheme_re:)?)(?:([^;?]*))?(;[^?]*)?(.*)$,os or die; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 4 | my $start = $1 . $2; | |||||||||
| 59 | 4 | my $paramstr = $3; | |||||||||
| 60 | 4 | my $rest = $4; | |||||||||
| 61 | |||||||||||
| 62 | 4 | ▶ | if (@_) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 1 | $paramstr = shift; | |||||||||
| 64 | 1 | $$self = $start . ";" . $paramstr . $rest; | |||||||||
| 65 | } | ||||||||||
| 66 | 4 | $paramstr =~ s/^;//o; | |||||||||
| 67 | 4 | return $paramstr; | |||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | # Inherited methods that make no sense for a SIP URI. | ||||||||||
| 71 | 0 | ▶ | sub path { } | ||||||||
|
Subroutine
path: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 72 | 0 | ▶ | sub path_query { } | ||||||||
|
Subroutine
path_query: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 73 | 0 | ▶ | sub path_segments { } | ||||||||
|
Subroutine
path_segments: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 74 | 2 | ▶ | sub abs {shift} | ||||||||
|
Subroutine
abs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 75 | 1 | ▶ | sub rel {shift} | ||||||||
|
Subroutine
rel: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 76 | 0 | ▶ | sub query_keywords { } | ||||||||
|
Subroutine
query_keywords: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 77 | |||||||||||
| 78 | 1 | 1; | |||||||||