| 1 | =pod | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | Net::OSCAR::Connection::Server -- Net::OSCAR server connection | ||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||
| 5 | =cut | ||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||
| 7 | package Net::OSCAR::Connection::Server; | ||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 9 | 1 | $Net::OSCAR::Connection::Server::VERSION = '1.928'; | |||||||||||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||
| 12 | 1 | $REVISION = '$Revision$'; | |||||||||||||||||||||||||||||||||||
| 13 | 1 | @ISA = qw(Net::OSCAR::Connection); | |||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use vars qw(@ISA); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use Socket; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use Symbol; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Net::OSCAR::Common qw(:all); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Net::OSCAR::Constants; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Net::OSCAR::Connection; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use Net::OSCAR::ServerCallbacks; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub new($@) { | ||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||
| 28 | 0 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | $self->listen($self->{session}->{port}) unless exists($self->{socket}); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||
| 31 | 0 | $self->{oscar_state} = "listening"; | |||||||||||||||||||||||||||||||||||
| 32 | 0 | $self->{signon_done} = 0; | |||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||
| 34 | 0 | return $self; | |||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub process_one($;$$$) { | ||||||||||||||||||||||||||||||||||
|
Subroutine
process_one: not called CC=13 SCAR=52.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 38 | 0 | my($self, $read, $write, $error) = @_; | |||||||||||||||||||||||||||||||||||
| 39 | 0 | my $snac; | |||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if($error) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 42 | 0 | $self->{sockerr} = 1; | |||||||||||||||||||||||||||||||||||
| 43 | 0 | return $self->disconnect(); | |||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if($write && $self->{outbuff}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$write and $self->{"outbuff"}
MC/DC0%0/2
$write and $self->{"outbuff"}
$write
$self->{"outbuff"}
Truth table0%0/3
A and B
A= $writeB= $self->{"outbuff"}
| |||||||||||||||||||||||||||||||||||||
| 47 | 0 | $self->log_print(OSCAR_DBG_DEBUG, "Flushing output buffer."); | |||||||||||||||||||||||||||||||||||
| 48 | 0 | $self->flap_put(); | |||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | if($read && !$self->{connected}) { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
$read and not $self->{"connected"}
MC/DC0%0/2
$read and not $self->{"connected"}
$read
not $self->{"connected"}
Truth table0%0/3
A and not(B)
A= $readB= not $self->{"connected"}
| |||||||||||||||||||||||||||||||||||||
| 52 | 0 | $self->log_print(OSCAR_DBG_NOTICE, "Incoming connection."); | |||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $socket = gensym(); | |||||||||||||||||||||||||||||||||||
| 55 | 0 | accept($socket, $self->{socket}); | |||||||||||||||||||||||||||||||||||
| 56 | 0 | my $peer = $self->{session}->addconn(socket => $socket, conntype => CONNTYPE_SERVER, description => "new peer"); | |||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||
| 58 | 0 | $peer->set_blocking(0); | |||||||||||||||||||||||||||||||||||
| 59 | 0 | $peer->{connected} = 1; | |||||||||||||||||||||||||||||||||||
| 60 | 0 | $peer->{state} = "write"; | |||||||||||||||||||||||||||||||||||
| 61 | 0 | $peer->{oscar_state} = "new"; | |||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->{session}->callback_connection_changed($peer, "write"); | |||||||||||||||||||||||||||||||||||
| 63 | 0 | return 1; | |||||||||||||||||||||||||||||||||||
| 64 | ▶ | } elsif($write and $self->{oscar_state} eq "new") { | |||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$write and $self->{"oscar_state"} eq "new"
MC/DC0%0/2
$write and $self->{"oscar_state"} eq "new"
$write
$self->{"oscar_state"} eq "new"
Truth table0%0/3
A and B
A= $writeB= $self->{"oscar_state"} eq "new"
| |||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->log_print(OSCAR_DBG_DEBUG, "Putting connack."); | |||||||||||||||||||||||||||||||||||
| 66 | 0 | $self->flap_put(pack("N", 1), FLAP_CHAN_NEWCONN); | |||||||||||||||||||||||||||||||||||
| 67 | 0 | $self->{state} = "readwrite"; | |||||||||||||||||||||||||||||||||||
| 68 | 0 | $self->{session}->callback_connection_changed($self, "readwrite"); | |||||||||||||||||||||||||||||||||||
| 69 | 0 | $self->{oscar_state} = "ready"; | |||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||
| 71 | 0 | $self->{families} = {}; | |||||||||||||||||||||||||||||||||||
| 72 | 0 | $self->{families}->{$_} = 1 foreach (1..30); | |||||||||||||||||||||||||||||||||||
| 73 | } elsif($read) { | ||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $no_reread = 0; | |||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||
| 76 | 0 | while(1) { | |||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my $flap = $self->flap_get($no_reread) or return 0; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | next if length($flap) == 4; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | my $snac = $self->snac_decode($flap) or return 0; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 80 | 0 | Net::OSCAR::ServerCallbacks::process_snac($self, $snac); | |||||||||||||||||||||||||||||||||||
| 81 | } continue { | ||||||||||||||||||||||||||||||||||||
| 82 | 0 | $no_reread = 1; | |||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||
| 87 | 1 | 1; | |||||||||||||||||||||||||||||||||||