亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? manager.pm

?? Net-CDP-0.09 cdp相關源包
?? PM
字號:
package Net::CDP::Manager;## $Id: Manager.pm,v 1.15 2005/07/22 02:44:01 mchapman Exp $#use strict;use Carp::Clan qw(^Net::CDP);use vars qw($VERSION @ISA $AUTOLOAD @EXPORT @EXPORT_OK %EXPORT_TAGS);$VERSION = (qw$Revision: 1.15 $)[1];require Exporter;@ISA = qw(Exporter);@EXPORT = qw(	CDP_LOOP_ABORT	cdp_ports	cdp_manage cdp_manage_hard cdp_manage_soft cdp_unmanage	cdp_managed cdp_hard cdp_soft cdp_active cdp_inactive	cdp_recv cdp_send	cdp_loop	cdp_template cdp_args);use Net::CDP;use Net::CDP::Packet;use Time::HiRes qw(gettimeofday);my %managed;my %hard;my $template = eval { new Net::CDP::Packet() } or confess $@;my %args = (promiscuous => 0);{	my $ref; $ref = \$ref;	use constant CDP_LOOP_ABORT => \$ref;}sub _clear_error() {	$@ = '';}sub _try_new_cdp(@) {	my $result = eval {		local $SIG{__DIE__};		new Net::CDP(@_);	};	_clear_error();	$result;}=head1 NAMENet::CDP::Manager - Cisco Discovery Protocol (CDP) manager=head1 SYNOPSIS  use Net::CDP::Manager;    # Available network ports  @ports = cdp_ports;    # Adding ports to manage  cdp_manage(@ports);      # default is hard ports only  cdp_manage_soft(@ports);    # Removing ports to manage  cdp_unmanage(@ports);    # Returning managed ports  @managed  = cdp_managed;  @soft     = cdp_soft;  @hard     = cdp_hard;  @active   = cdp_active;  @inactive = cdp_inactive;    # Receiving a CDP packet by any managed port  cdp_recv;    # Send a CDP packet on all managed ports  cdp_send;    # Loop and dispatch CDP packets to callback  sub callback { ($port, $packet) = @_; ... }  cdp_loop(\&callback);    # The template Net::CDP::Packet object  $template = cdp_template;  	  # Arguments used when creating Net::CDP objects  %args     = cdp_args;=head1 DESCRIPTIONThe Net::CDP::Manager module provides a simple interface to manage multiple CDPadvertiser/listeners (Net::CDP objects). With this module, CDP packets canbe received and sent over multiple network ports.Ports managed by this module are treated in one of two different ways. "Hard"ports must always exist -- if any errors occur while initializing the port,reading from it or writing to it, methods in this module will return an error."Soft" ports, on the other hand, ignore errors generated by the port. Thus thismodule can manage Each soft port is in one of two states. Ports on which the last receive or sendwas successful are deemed to be "active". Newly managed ports, or ports onwhich the last receive or send was unsuccessful are deemed to be "inactive".If you are upgrading code from an older version of Net::CDP, please read theL</"UPGRADING FROM PREVIOUS VERSIONS"> section below.=head1 FUNCTIONS=over=item B<cdp_ports>    @ports = cdp_ports;Returns a list of network ports that can be used by this module. This methodreturns exactly that returned by the L<Net::CDP::ports|Net::CDP/"ports"> classmethod.=cut*cdp_ports = \&Net::CDP::ports;sub _cdp_manage($@) {	my ($hard, @ports) = @_;	my @added;	my %add;		_clear_error();		foreach (@ports) {		next if exists $add{$_};		next if $hard && exists $managed{$_} && defined $managed{$_};		push @added, $_ unless exists $managed{$_};		$add{$_} = $hard ? new Net::CDP(port => $_, %args) : undef;	}		foreach (keys %add) {		$managed{$_} = $add{$_} unless $managed{$_};		$hard{$_} = $hard;	}		@added;}=item B<cdp_manage>    @added = cdp_manage(@ports)Adds the supplied network ports to the manager's list of managed ports. Returnsthe actual ports added, which may be fewer than provided if some ports arealready managed. In scalar context the number of ports added is returned. Ifany ports could not be initialized, this method croaks.Ports added by this function are hard -- that is, errors on them will generateerrors by the functions of this module.Any ports in C<@ports> that are already managed by this module are hardened ifthey are currently soft. These ports are I<not> in the list returned by thisfunction.=cutsub cdp_manage(@) { _cdp_manage(1, @_) }*cdp_manage_hard = \&cdp_manage;=item B<cdp_manage_soft>    @added = cdp_manage_soft(@ports)Adds the supplied network ports to the manager's list of managed ports. Returnsthe actual ports added, which may be fewer than provided if some ports arealready managed. In scalar context the number of ports added is returned.Ports added by this function are soft -- that is, errors on them will besilently ignored by the functions of this module.Any ports in C<@ports> that are already managed by this module are softened ifthey are currently hard. These ports are I<not> in the list returned by thisfunction.=cutsub cdp_manage_soft(@) { _cdp_manage(0, @_) }=item B<cdp_unmanage>    @removed = cdp_unmanage(@ports)Removes the supplied network ports from the manager's list of managed ports.Returns the actual ports removed, which may be fewer than provided if C<@ports>contains duplicates. In scalar context the number of ports removed is returned.=cutsub cdp_unmanage(@) {	my %removed;		_clear_error();		foreach (@_) {		next unless exists $removed{$_} || exists $managed{$_};		$removed{$_} = 1;	}		foreach (keys %removed) {		delete $managed{$_};		delete $hard{$_};	}		keys %removed;}=item B<cdp_managed>    @managed = cdp_managed()Returns the list of ports currently being managed. In scalar context the numberof ports is returned.=cutsub cdp_managed() { keys %managed }=item B<cdp_hard>    @hard = cdp_hard()Returns the list of hard ports currently being managed. In scalar context thenumber of hard ports is returned.=cutsub cdp_hard() { grep { $hard{$_} } keys %managed }=item B<cdp_soft>    @soft = cdp_soft()Returns the list of soft ports currently being managed. In scalar context thenumber of soft ports is returned.=cutsub cdp_soft() { grep { ! $hard{$_} } keys %managed }=item B<cdp_active>    @active = cdp_active()Returns the list of active ports currently being managed. In scalar context thenumber of active ports is returned.A port is active if it is hard, or if the last send or receive on the portsucceeded.=cutsub cdp_active() { grep { defined $managed{$_} } keys %managed }=item B<cdp_inactive>    @inactive = cdp_inactive()Returns the list of inactive ports currently being managed. In scalar contextthe number of inactive ports is returned.A port is inactive if it is soft and the last send or receive on the portfailed.=cutsub cdp_inactive() { grep { ! defined $managed{$_} } keys %managed }=item B<cdp_recv>    $packet                   = cdp_recv()    ($packet, $port, $remain) = cdp_recv($timeout)Returns the next available CDP packet on any managed port as aL<Net::CDP::Packet> object.If C<$timeout> is ommitted or undefined, this method will block until apacket is received or an error occurs. Otherwise, this method will wait for upto C<$timeout> seconds before returning. If no packets are received before thistimeout expires, an undefined value is returned.When evaluated in list context, this function also returns the port on whichthe packet was received and the time remaining out of the original timeout,or an undefined value if no original timeout was specified.If an error occurs on a hard port, this function croaks with an error message.For non-blocking operation, specify a timeout of 0.=cutsub cdp_recv(;$) {	my $remain = shift;		_clear_error();		my $packet;	my $port;	do {		my @ports;		my $rin = '';		foreach (keys %managed) {			my $cdp = ($managed{$_} ||= _try_new_cdp(port => $_, %args));			next unless $cdp;			my $fd = $cdp->_fd;			$ports[$fd] = $_;			vec($rin, $fd, 1) = 1;		}		my $start = gettimeofday;		my $count = select(my $rout = $rin, undef, undef, $remain);		croak "Select failed: $!" if $count < 0;				if ($count) {			my $diff = gettimeofday - $start;			if (defined $remain) {				$remain -= $diff;				$remain = 0 if $remain < 0;			}		} else {			# No fds -- timeout definitely expired			$remain = 0;		}				if ($count) {			foreach (0 .. $#ports) {				if (vec($rout, $_, 1)) {					confess "Select returned unexpected file descriptor $_"						unless defined $ports[$_];					$port = $ports[$_];					$packet = eval { $managed{$port}->recv(nonblock => 1); };					if ($@) {						croak "Port $port failed: $@"							if $hard{$port};						$managed{$port} = undef;					}					last if $packet;					$port = undef;				}			}		}	} until ($packet || (defined $remain && !$remain));	wantarray ? ($packet, $port, $remain) : $packet;}=item B<cdp_send>    @ports = cdp_send()Sends a CDP packet over all managed ports, and returns the ports on whichpackets were successfully sent. In scalar context the number of such ports isreturned.Internally, an appropriate packet is generated and sent for each port in turn.If an error occurs while generating or sending a packet for a hard port, thisfunction croaks. Note that in this case some packets for other ports may havealready been sent.Errors while generating or sending a packet for a soft port cause the port tobecome inactive. Other errors will cause this function to croak with anerror message.=cutsub cdp_send() {	my @successful;		_clear_error();		foreach (keys %managed) {		my $cdp = ($managed{$_} ||= _try_new_cdp(port => $_, %args));		next unless $cdp;		my $packet = clone $template;		$packet->addresses([$cdp->addresses]);		$packet->port($cdp->port);		my $bytes = eval { $cdp->send($packet) };		if ($bytes) {			push @successful, $_;			next;		}		unless (defined $bytes) {			croak "Port $_ failed: $@"				if $hard{$_};			$managed{$_} = undef;		}	}	@successful;}=item B<cdp_loop>    $count = cdp_loop(\&callback)    $count = cdp_loop(\&callback, $timeout)Enters a loop to continually process received packets from managed ports anddispatches them to the specified callback function. Returns the number ofpackets processed.Upon receiving each packet C<callback> is called with the following threeparameters:=over=item 1.The packet, as a L<Net::CDP::Packet> object;=item 2.The port on which the packet was received; and=item 3.If C<$timeout> was specified, the time remaining time out of the originaltimeout, otherwise an undefined value.=backThe third parameter may be modified in-place, and C<cdp_loop> will use it asa new time remaining.It is safe for the callback function to call any function in Net::CDP::Manager,including L</"cdp_recv"> or L</"cdp_loop">. It is also safe for the callbackfunction to modify the packet template through L</"cdp_template">.The C<cdp_loop> function will continue processing packets until:=over=item 1.C<callback> returns the special value CDP_LOOP_ABORT;=item 2.If C<$timeout> was specified, the timeout expires; or=backIf an error occurs on a hard port, this function croaks with an error message.When an error is detected on a soft port, it is deactivated for up to 30seconds. No errors are generated by this function in this case.Note that if C<$timeout> is not specified and the callback function doesnot modify its third argument, this function may never exit.=cutsub cdp_loop(&;$) {	my $callback = shift;	croak "Invalid callback"		unless defined $callback && ref $callback eq 'CODE';	my $remain = shift;		_clear_error();		my $count = 0;	{ do {		# All of this is so that cdp_recv will never block		# for more than 30 seconds. That way soft ports can		# recover from errors relatively quickly.		my $start = defined $remain			? ($remain > 30 ? 30 : $remain)			: 30;		my ($packet, $port, $end) = cdp_recv($start);		$remain -= $start - $end if defined $remain;		if ($packet) {			$count++;			my $result = $callback->($packet, $port, $remain);			last if defined $result && $result == CDP_LOOP_ABORT;		}	} while (!defined $remain || $remain); }	$count;}=item B<cdp_template>    $template = cdp_template()    $template = cdp_template($new_template)Returns the current template L<Net::CDP::Packet> object. If C<$new_template> issupplied and defined, the template will be updated first.The template L<Net::CDP::Packet> object is used by L</"cdp_send"> to generateport-specific packets to send. For each managed port L</"cdp_send"> clones thetemplate, fills in the L<addresses|Net::CDP::Packet/"addresses"> andL<port|Net::CDP::Packet/"port"> fields with data relevant to the port, thensends the packet via the port.The object returned by C<cdp_template> may be manipulated directly. Note,however, that the C<port> and C<addresses> fields will always be ignored byL</"cdp_send">.=cutsub cdp_template(;$) {	my $new_template = shift;	if (defined $new_template) {		croak "Invalid new template"			unless ref $new_template eq 'Net::CDP::Packet';		$template = $new_template;	}	$template;}=item B<cdp_args>    %args = cdp_args(                [ promiscuous => $promiscuous, ] # default = 0            )Returns the current settings this module will use when creating L<Net::CDP>objects.This method allows you to change the default values for a subset of thearguments allowed in the L<Net::CDP/"new"> method. Currently, the only argumentpermitted is C<promiscuous>.This function replaces the C<cdp_flags> function from previous versions ofNet::CDP::Manager. Do not use the C<cdp_flags> function -- replace it withcalls to C<cdp_args> instead.=cutsub cdp_args(;@) {	my @allowed = qw(promiscuous);		my %temp = Net::CDP::_parse_args \@_, @allowed;	$args{$_} = $temp{$_} foreach keys %temp;	%args;}sub cdp_flags($) {	Net::CDP::_deprecated;	cdp_args promiscuous => (shift() & Net::CDP::CDP_PROMISCUOUS());}=back=head1 EXAMPLESA typical application could have the following form:  use Net::CDP::Manager;  # Callback to process each packet.  sub callback {    my ($packet, $port) = @_;    print "Received packet on $port from ", $packet->device, "\n";  }    # Manage all available ports.  cdp_manage(cdp_ports);    # Send a packet every minute. Pass received packets to callback.  while (1) {    cdp_send;    cdp_loop(\&callback, 60);  }=head1 SEE ALSOL<Net::CDP>, L<Net::CDP::Packet>=head1 AUTHORMichael Chapman, E<lt>cpan@very.puzzling.orgE<gt>=head1 COPYRIGHT AND LICENSECopyright (C) 2005 by Michael Chapmanlibcdp is released under the terms and conditions of the GNU Library GeneralPublic License version 2. Net::CDP may be redistributed and/or modified underthe same terms as Perl itself.=cut1;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美丝袜第三区| 一区二区三区在线播放| 国产精品国产馆在线真实露脸| 亚洲老司机在线| 国产黄色成人av| 欧美一区二区三区精品| 伊人夜夜躁av伊人久久| 国产老肥熟一区二区三区| 6080午夜不卡| 亚洲男人都懂的| 国产白丝精品91爽爽久久| 91精品福利在线一区二区三区| 国产精品美女www爽爽爽| 麻豆成人久久精品二区三区小说| 色又黄又爽网站www久久| 国产午夜一区二区三区| 婷婷国产v国产偷v亚洲高清| 91麻豆视频网站| 中文字幕一区二区三区不卡 | 久久久国产午夜精品| 强制捆绑调教一区二区| 在线成人av网站| 亚洲风情在线资源站| 欧美色区777第一页| 亚洲精品国产视频| 欧美性极品少妇| 欧美一区二区在线免费观看| 一个色妞综合视频在线观看| 不卡免费追剧大全电视剧网站| 26uuu另类欧美亚洲曰本| 日本成人超碰在线观看| 3751色影院一区二区三区| 亚洲成年人影院| 欧美日韩一区二区三区在线看| 依依成人精品视频| 欧美色精品天天在线观看视频| 一个色综合av| 欧美体内she精高潮| 亚洲高清中文字幕| 宅男在线国产精品| 国产最新精品精品你懂的| 久久亚洲一区二区三区四区| 精品亚洲aⅴ乱码一区二区三区| 日韩免费一区二区| 国内精品免费**视频| 国产亚洲精品精华液| 国产麻豆视频一区二区| 国产精品久久久久精k8| 不卡的电视剧免费网站有什么| 中文字幕日韩av资源站| 99re亚洲国产精品| 亚洲在线视频网站| 欧美一级国产精品| 国产传媒欧美日韩成人| 精品久久99ma| eeuss鲁片一区二区三区在线看| 亚洲男女毛片无遮挡| 欧美日韩免费在线视频| 久久精品999| 国产精品家庭影院| 欧美精品亚洲二区| 国产一区二区精品在线观看| 日韩美女精品在线| 欧美精品日韩综合在线| 国产精品1区2区3区| 亚洲柠檬福利资源导航| 精品日韩一区二区三区| 成人国产亚洲欧美成人综合网| 亚洲一区在线观看视频| 精品乱人伦小说| 99re成人精品视频| 另类的小说在线视频另类成人小视频在线| 久久日韩粉嫩一区二区三区| 色视频一区二区| 国产剧情一区二区| 亚洲福利一区二区| 亚洲国产精品成人久久综合一区 | 国产精品久久久久久福利一牛影视| 在线观看国产91| 国产麻豆视频一区二区| 亚洲电影第三页| 国产精品乱人伦| 精品嫩草影院久久| 欧美日韩一区久久| 99精品欧美一区二区蜜桃免费| 美女一区二区三区在线观看| 一区二区三区国产精品| 久久精品亚洲麻豆av一区二区| 欧美日韩免费电影| 97精品国产露脸对白| 激情五月播播久久久精品| 一区二区三区国产精华| 国产精品欧美综合在线| 欧美日韩成人一区| 在线观看av不卡| 不卡的av在线播放| 成人午夜视频在线| 国产一区二区三区免费观看| 欧美bbbbb| 日韩在线a电影| 亚洲国产成人va在线观看天堂| 国产精品动漫网站| 国产欧美精品国产国产专区| 精品久久久久久无| 欧美电影免费提供在线观看| 欧美一区二区三区成人| 欧美日韩高清一区二区不卡| 欧美三级资源在线| 色嗨嗨av一区二区三区| 91在线免费看| 91蜜桃网址入口| 91视频精品在这里| 色哟哟国产精品| 99国产精品国产精品久久| 99在线热播精品免费| 成人av电影在线观看| 成人av网址在线| 99国产精品久久久| 欧美自拍偷拍一区| 欧美日韩成人一区| 欧美成人福利视频| 精品国产成人在线影院 | 欧美一区二区女人| 欧美男男青年gay1069videost | 在线观看日韩电影| 欧美久久高跟鞋激| 欧美不卡一区二区三区| 精品理论电影在线观看 | 成人午夜激情在线| 91蝌蚪porny| 欧美日韩在线观看一区二区| 欧美日韩一区不卡| 亚洲精品一区二区三区蜜桃下载 | 日韩欧美二区三区| 亚洲精品一区二区三区蜜桃下载| 国产欧美一区二区精品秋霞影院| 国产精品久久久久久久久免费樱桃| 亚洲欧洲综合另类| 日韩和欧美一区二区| 国产自产高清不卡| 99国产精品99久久久久久| 欧美日本一道本| 久久久久亚洲蜜桃| 亚洲精品第一国产综合野| 亚洲h在线观看| 韩国在线一区二区| 色伊人久久综合中文字幕| 欧美精品123区| 国产午夜精品一区二区三区视频| 国产精品久久二区二区| 日本在线不卡一区| 粉嫩av一区二区三区| 欧美剧情片在线观看| 国产午夜三级一区二区三| 亚洲成av人片www| 国产jizzjizz一区二区| 欧美日韩国产综合视频在线观看| 久久一区二区视频| 五月婷婷欧美视频| 成人一区二区三区在线观看| 欧美一区二区三区在线观看| 亚洲欧洲精品一区二区精品久久久| 同产精品九九九| 99re成人精品视频| 久久影院视频免费| 亚洲18女电影在线观看| 99热精品一区二区| www精品美女久久久tv| 日韩综合一区二区| 色综合久久久久综合99| 久久久久久亚洲综合影院红桃| 午夜久久电影网| 97久久久精品综合88久久| 国产午夜精品一区二区三区四区| 日韩中文字幕区一区有砖一区| 91福利在线导航| 综合中文字幕亚洲| 国产sm精品调教视频网站| 欧美电视剧免费全集观看| 亚洲成a人片在线不卡一二三区| 91网上在线视频| 亚洲视频 欧洲视频| 国产91丝袜在线播放0| 精品欧美一区二区在线观看| 午夜影院在线观看欧美| 日本韩国一区二区三区| ...中文天堂在线一区| 成人妖精视频yjsp地址| 久久久国际精品| 国产成人精品午夜视频免费| 欧美精品一区在线观看| 久久精品二区亚洲w码| 欧美精品视频www在线观看| 亚洲国产精品久久不卡毛片| 在线视频中文字幕一区二区| 亚洲日本乱码在线观看| 色综合久久综合网97色综合| 亚洲精品免费看| 欧美性大战久久久久久久蜜臀| 亚洲一级片在线观看|