Lines Matching refs:self
104 my $self = {
136 return bless $self, $class;
141 my $self = shift;
143 $self->{proxy_sock}->close() if $self->{proxy_sock};
148 my $self = shift;
150 $self->{cipherc} = "";
151 $self->{ciphersuitec} = "";
152 $self->{flight} = -1;
153 $self->{direction} = -1;
154 $self->{partial} = ["", ""];
155 $self->{record_list} = [];
156 $self->{message_list} = [];
157 $self->{clientflags} = "";
158 $self->{sessionfile} = undef;
159 $self->{clientpid} = 0;
169 my $self = shift;
171 $self->clearClient;
172 $self->{ciphers} = "AES128-SHA";
173 $self->{ciphersuitess} = "TLS_AES_128_GCM_SHA256";
174 $self->{serverflags} = "";
175 $self->{serverconnects} = 1;
176 $self->{serverpid} = 0;
177 $self->{reneg} = 0;
182 my $self = shift;
184 $self->clear;
185 $self->start;
190 my $self = shift;
192 $self->clear;
193 $self->clientstart;
198 my $self = shift;
199 my $servaddr = $self->{server_addr};
204 PeerPort => $self->{server_port},
205 Proto => $self->{isdtls} ? 'udp' : 'tcp');
208 kill(3, $self->{serverpid});
212 $self->{server_sock} = $sock;
217 my ($self) = shift;
221 my $proxaddr = $self->{proxy_addr};
223 my $clientaddr = $self->{client_addr};
228 if ($self->{isdtls}) {
233 PeerPort => $self->{client_port},
246 $self->{proxy_sock} = $sock;
247 $self->{proxy_port} = $sock->sockport();
248 $self->{proxy_addr} = $sock->sockhost();
249 $self->{proxy_addr} =~ s/(.*:.*)/[$1]/;
251 "$self->{proxy_addr}:$self->{proxy_port}\n";
253 $self->{server_addr} = $self->{proxy_addr};
258 if ($self->{proxy_sock} == 0) {
262 my $execcmd = $self->execute
270 ." -accept $self->{server_addr}:0"
271 ." -cert ".$self->cert." -cert2 ".$self->cert
272 ." -naccept ".$self->serverconnects;
273 if ($self->{isdtls}) {
281 if ($self->ciphers ne "") {
282 $execcmd .= " -cipher ".$self->ciphers;
284 if ($self->ciphersuitess ne "") {
285 $execcmd .= " -ciphersuites ".$self->ciphersuitess;
287 if ($self->serverflags ne "") {
288 $execcmd .= " ".$self->serverflags;
290 if ($self->debug) {
301 $self->{serverpid} = $pid;
309 $self->{server_port} = $1;
313 if ($self->{server_port} == 0) {
321 "$self->{server_addr}:$self->{server_port}\n";
324 $self->connect_to_server();
326 return $self->clientstart;
331 my ($self) = shift;
335 if ($self->execute) {
337 my $execcmd = $self->execute
339 ." -connect $self->{proxy_addr}:$self->{proxy_port}";
340 if ($self->{isdtls}) {
347 ." -bind $self->{client_addr}:$self->{client_port}";
351 if ($self->cipherc ne "") {
352 $execcmd .= " -cipher ".$self->cipherc;
354 if ($self->ciphersuitesc ne "") {
355 $execcmd .= " -ciphersuites ".$self->ciphersuitesc;
357 if ($self->clientflags ne "") {
358 $execcmd .= " ".$self->clientflags;
360 if ($self->clientflags !~ m/-(no)?servername/) {
363 if (defined $self->sessionfile) {
366 if ($self->debug) {
376 kill(3, $self->{serverpid});
379 $self->{clientpid} = $pid;
382 print $self->reneg ? "R" : "test";
390 my $fdset = IO::Select->new($self->{proxy_sock});
392 kill(3, $self->{serverpid});
397 if($self->{isdtls}) {
398 $client_sock = $self->{proxy_sock}
399 } elsif (!($client_sock = $self->{proxy_sock}->accept())) {
406 my $server_sock = $self->{server_sock};
414 $self->{saw_session_ticket} = undef;
416 if (defined($self->{sessionfile})) {
420 && $self->{saw_session_ticket};
424 && $self->{saw_session_ticket};
432 if ($indata = $self->process_packet(1, $indata)) {
442 if ($indata = $self->process_packet(0, $indata)) {
451 kill(3, $self->{serverpid});
458 kill(3, $self->{serverpid});
467 $self->{server_sock} = undef;
475 if (--$self->{serverconnects} == 0) {
476 $pid = $self->{serverpid};
486 $self->connect_to_server();
488 $pid = $self->{clientpid};
497 my ($self, $server, $packet) = @_;
509 if ($self->{direction} != $server) {
510 $self->{flight} = $self->{flight} + 1;
511 $self->{direction} = $server;
515 print "Processing flight ".$self->flight."\n";
519 my @ret = TLSProxy::Record->get_records($server, $self->flight,
520 $self->{partial}[$server].$packet,
521 $self->{isdtls});
523 $self->{partial}[$server] = $ret[2];
524 push @{$self->{record_list}}, @{$ret[0]};
525 push @{$self->{message_list}}, @{$ret[1]};
534 if (defined $self->filter) {
535 $self->filter->($self);
539 foreach my $message (reverse @{$self->{message_list}}) {
541 $self->{saw_session_ticket} = 1;
548 foreach my $record (@{$self->record_list}) {
560 my $self = shift;
561 return $self->{execute};
565 my $self = shift;
566 return $self->{cert};
570 my $self = shift;
571 return $self->{debug};
575 my $self = shift;
576 return $self->{flight};
580 my $self = shift;
581 return $self->{record_list};
585 my $self = shift;
586 return $self->{success};
590 my $self = shift;
591 return $self->{end};
595 my $self = shift;
600 my $self = shift;
601 return $self->{proxy_addr};
605 my $self = shift;
606 return $self->{proxy_port};
610 my $self = shift;
611 return $self->{server_addr};
615 my $self = shift;
616 return $self->{server_port};
620 my $self = shift;
621 return $self->{serverpid};
625 my $self = shift;
626 return $self->{clientpid};
632 my $self = shift;
634 $self->{filter} = shift;
636 return $self->{filter};
640 my $self = shift;
642 $self->{cipherc} = shift;
644 return $self->{cipherc};
648 my $self = shift;
650 $self->{ciphersuitesc} = shift;
652 return $self->{ciphersuitesc};
656 my $self = shift;
658 $self->{ciphers} = shift;
660 return $self->{ciphers};
664 my $self = shift;
666 $self->{ciphersuitess} = shift;
668 return $self->{ciphersuitess};
672 my $self = shift;
674 $self->{serverflags} = shift;
676 return $self->{serverflags};
680 my $self = shift;
682 $self->{clientflags} = shift;
684 return $self->{clientflags};
688 my $self = shift;
690 $self->{serverconnects} = shift;
692 return $self->{serverconnects};
700 my $self = shift;
702 $self->{message_list} = shift;
704 return $self->{message_list};
728 my $self = shift;
730 $self->{reneg} = shift;
732 return $self->{reneg};
743 my $self = shift;
745 $self->{sessionfile} = shift;
748 return $self->{sessionfile};
762 my $self = shift;
763 return $self->{isdtls}; #read-only