.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 "IO::Interface::Simple 3pm" .TH IO::Interface::Simple 3pm 2024-03-07 "perl v5.38.2" "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 IO::Interface::Simple \- Perl extension for access to network card configuration information .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use IO::Interface::Simple; \& \& my $if1 = IO::Interface::Simple\->new(\*(Aqeth0\*(Aq); \& my $if2 = IO::Interface::Simple\->new_from_address(\*(Aq127.0.0.1\*(Aq); \& my $if3 = IO::Interface::Simple\->new_from_index(1); \& \& my @interfaces = IO::Interface::Simple\->interfaces; \& \& for my $if (@interfaces) { \& print "interface = $if\en"; \& print "addr = ",$if\->address,"\en", \& "broadcast = ",$if\->broadcast,"\en", \& "netmask = ",$if\->netmask,"\en", \& "dstaddr = ",$if\->dstaddr,"\en", \& "hwaddr = ",$if\->hwaddr,"\en", \& "mtu = ",$if\->mtu,"\en", \& "metric = ",$if\->metric,"\en", \& "index = ",$if\->index,"\en"; \& \& print "is running\en" if $if\->is_running; \& print "is broadcast\en" if $if\->is_broadcast; \& print "is p\-to\-p\en" if $if\->is_pt2pt; \& print "is loopback\en" if $if\->is_loopback; \& print "is promiscuous\en" if $if\->is_promiscuous; \& print "is multicast\en" if $if\->is_multicast; \& print "is notrailers\en" if $if\->is_notrailers; \& print "is noarp\en" if $if\->is_noarp; \& } .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" IO::Interface::Simple allows you to interrogate and change network interfaces. It has overlapping functionality with Net::Interface, but might compile and run on more platforms. .SS "Class Methods" .IX Subsection "Class Methods" .ie n .IP "$interface = IO::Interface::Simple\->new('eth0')" 4 .el .IP "\f(CW$interface\fR = IO::Interface::Simple\->new('eth0')" 4 .IX Item "$interface = IO::Interface::Simple->new('eth0')" Given an interface name, \fBnew()\fR creates an interface object. .ie n .IP "@iflist = IO::Interface::Simple\->interfaces;" 4 .el .IP "\f(CW@iflist\fR = IO::Interface::Simple\->interfaces;" 4 .IX Item "@iflist = IO::Interface::Simple->interfaces;" Returns a list of active interface objects. .ie n .IP "$interface = IO::Interface::Simple\->new_from_address('192.168.0.1')" 4 .el .IP "\f(CW$interface\fR = IO::Interface::Simple\->new_from_address('192.168.0.1')" 4 .IX Item "$interface = IO::Interface::Simple->new_from_address('192.168.0.1')" Returns the interface object corresponding to the given address. .ie n .IP "$interface = IO::Interface::Simple\->\fBnew_from_index\fR\|(2)" 4 .el .IP "\f(CW$interface\fR = IO::Interface::Simple\->\fBnew_from_index\fR\|(2)" 4 .IX Item "$interface = IO::Interface::Simple->new_from_index" Returns the interface object corresponding to the given numeric index. This is only supported on BSD-ish platforms. .SS "Object Methods" .IX Subsection "Object Methods" .ie n .IP "$name = $interface\->name" 4 .el .IP "\f(CW$name\fR = \f(CW$interface\fR\->name" 4 .IX Item "$name = $interface->name" Get the name of the interface. The interface object is also overloaded so that if you use it in a string context it is the same as calling \&\fBname()\fR. .ie n .IP "$index = $interface\->index" 4 .el .IP "\f(CW$index\fR = \f(CW$interface\fR\->index" 4 .IX Item "$index = $interface->index" Get the index of the interface. This is only supported on BSD-like platforms. .ie n .IP "$addr = $interface\->address([$newaddr])" 4 .el .IP "\f(CW$addr\fR = \f(CW$interface\fR\->address([$newaddr])" 4 .IX Item "$addr = $interface->address([$newaddr])" Get or set the interface's address. .ie n .IP "$addr = $interface\->broadcast([$newaddr])" 4 .el .IP "\f(CW$addr\fR = \f(CW$interface\fR\->broadcast([$newaddr])" 4 .IX Item "$addr = $interface->broadcast([$newaddr])" Get or set the interface's broadcast address. .ie n .IP "$addr = $interface\->netmask([$newmask])" 4 .el .IP "\f(CW$addr\fR = \f(CW$interface\fR\->netmask([$newmask])" 4 .IX Item "$addr = $interface->netmask([$newmask])" Get or set the interface's netmask. .ie n .IP "$addr = $interface\->hwaddr([$newaddr])" 4 .el .IP "\f(CW$addr\fR = \f(CW$interface\fR\->hwaddr([$newaddr])" 4 .IX Item "$addr = $interface->hwaddr([$newaddr])" Get or set the interface's hardware address. .ie n .IP "$addr = $interface\->mtu([$newmtu])" 4 .el .IP "\f(CW$addr\fR = \f(CW$interface\fR\->mtu([$newmtu])" 4 .IX Item "$addr = $interface->mtu([$newmtu])" Get or set the interface's MTU. .ie n .IP "$addr = $interface\->metric([$newmetric])" 4 .el .IP "\f(CW$addr\fR = \f(CW$interface\fR\->metric([$newmetric])" 4 .IX Item "$addr = $interface->metric([$newmetric])" Get or set the interface's metric. .ie n .IP "$flags = $interface\->flags([$newflags])" 4 .el .IP "\f(CW$flags\fR = \f(CW$interface\fR\->flags([$newflags])" 4 .IX Item "$flags = $interface->flags([$newflags])" Get or set the interface's flags. These can be ANDed with the IFF constants exported by IO::Interface or Net::Interface in order to interrogate the state and capabilities of the interface. However, it is probably more convenient to use the broken-out methods listed below. .ie n .IP "$flag = $interface\->is_running([$newflag])" 4 .el .IP "\f(CW$flag\fR = \f(CW$interface\fR\->is_running([$newflag])" 4 .IX Item "$flag = $interface->is_running([$newflag])" .PD 0 .ie n .IP "$flag = $interface\->is_broadcast([$newflag])" 4 .el .IP "\f(CW$flag\fR = \f(CW$interface\fR\->is_broadcast([$newflag])" 4 .IX Item "$flag = $interface->is_broadcast([$newflag])" .ie n .IP "$flag = $interface\->is_pt2pt([$newflag])" 4 .el .IP "\f(CW$flag\fR = \f(CW$interface\fR\->is_pt2pt([$newflag])" 4 .IX Item "$flag = $interface->is_pt2pt([$newflag])" .ie n .IP "$flag = $interface\->is_loopback([$newflag])" 4 .el .IP "\f(CW$flag\fR = \f(CW$interface\fR\->is_loopback([$newflag])" 4 .IX Item "$flag = $interface->is_loopback([$newflag])" .ie n .IP "$flag = $interface\->is_promiscuous([$newflag])" 4 .el .IP "\f(CW$flag\fR = \f(CW$interface\fR\->is_promiscuous([$newflag])" 4 .IX Item "$flag = $interface->is_promiscuous([$newflag])" .ie n .IP "$flag = $interface\->is_multicast([$newflag])" 4 .el .IP "\f(CW$flag\fR = \f(CW$interface\fR\->is_multicast([$newflag])" 4 .IX Item "$flag = $interface->is_multicast([$newflag])" .ie n .IP "$flag = $interface\->is_notrailers([$newflag])" 4 .el .IP "\f(CW$flag\fR = \f(CW$interface\fR\->is_notrailers([$newflag])" 4 .IX Item "$flag = $interface->is_notrailers([$newflag])" .ie n .IP "$flag = $interface\->is_noarp([$newflag])" 4 .el .IP "\f(CW$flag\fR = \f(CW$interface\fR\->is_noarp([$newflag])" 4 .IX Item "$flag = $interface->is_noarp([$newflag])" .PD Get or set the corresponding configuration parameters. Note that the operating system may not let you set some of these. .SH AUTHOR .IX Header "AUTHOR" Lincoln D. Stein Copyright 2001\-2014, Lincoln D. Stein. .PP This library is distributed under the Perl Artistic License 2.0. Please see LICENSE for more information. .SH SUPPORT .IX Header "SUPPORT" For feature requests, bug reports and code contributions, please use the GitHub repository at https://github.com/lstein/LibIO\-Interface\-Perl .SH "SEE ALSO" .IX Header "SEE ALSO" perl, IO::Socket, IO::Multicast), IO::Interface, Net::Interface