• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_interface_list函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_interface_list函数的典型用法代码示例。如果您正苦于以下问题:PHP get_interface_list函数的具体用法?PHP get_interface_list怎么用?PHP get_interface_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_interface_list函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: available_interfaces

/**
 * list available interfaces for lagg
 * @param null $selected_id selected item index
 * @return array
 */
function available_interfaces($selected_id = null)
{
    global $config;
    // configured interfaces
    $configured_interfaces = array();
    foreach (get_configured_interface_list(false, true) as $intf) {
        $configured_interfaces[] = get_real_interface($intf);
    }
    // lagg members from other lagg interfaces
    $lagg_member_interfaces = array();
    foreach ($config['laggs']['lagg'] as $lagg_idx => $lagg) {
        if ($lagg_idx == $selected_id) {
            continue;
        }
        foreach (explode(",", $lagg['members']) as $lagg_member) {
            $lagg_member_interfaces[] = get_real_interface($lagg_member);
        }
    }
    $interfaces = array();
    foreach (get_interface_list() as $intf => $intf_info) {
        if (strpos($intf, '_vlan')) {
            // skip vlans
            continue;
        } elseif (in_array($intf, $lagg_member_interfaces)) {
            // skip members of other lagg interfaces
            continue;
        } elseif (in_array($intf, $configured_interfaces)) {
            // skip configured interfaces
            continue;
        }
        $interfaces[$intf] = $intf_info;
    }
    return $interfaces;
}
开发者ID:8191,项目名称:opnsense-core,代码行数:39,代码来源:interfaces_lagg_edit.php


示例2: elseif

        }
    } elseif ($portinfo['isqinq']) {
        $descr = $portinfo['descr'];
    } elseif (substr($portname, 0, 4) == 'ovpn') {
        $descr = $portname . " (" . $ovpn_descrs[substr($portname, 5)] . ")";
    } else {
        $descr = $portname . " (" . $portinfo['mac'] . ")";
    }
    return htmlspecialchars($descr);
}
/*
	In this file, "port" refers to the physical port name,
	while "interface" refers to LAN, WAN, or OPTn.
*/
/* get list without VLAN interfaces */
$portlist = get_interface_list();
/* add wireless clone interfaces */
if (is_array($config['wireless']['clone']) && count($config['wireless']['clone'])) {
    foreach ($config['wireless']['clone'] as $clone) {
        $portlist[$clone['cloneif']] = $clone;
        $portlist[$clone['cloneif']]['iswlclone'] = true;
    }
}
/* add VLAN interfaces */
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
    foreach ($config['vlans']['vlan'] as $vlan) {
        $portlist[$vlan['vlanif']] = $vlan;
        $portlist[$vlan['vlanif']]['isvlan'] = true;
    }
}
/* add Bridge interfaces */
开发者ID:michaeleino,项目名称:pfsense,代码行数:31,代码来源:interfaces_assign.php


示例3: get_interface_list

     $size = "size=\"{$field['size']}\"";
 }
 if ($field['multiple'] != "" and $field['multiple'] != "0") {
     $multiple = "multiple=\"multiple\"";
     $name .= "[]";
 }
 echo "<select class='formselect' id='{$name}' name='{$name}' {$size} {$multiple}>\n";
 if ($field['add_to_interfaces_selection'] != "") {
     $SELECTED = "";
     if ($field['add_to_interfaces_selection'] == $value) {
         $SELECTED = " SELECTED";
     }
     echo "<option value='" . $field['add_to_interfaces_selection'] . "'" . $SELECTED . ">" . $field['add_to_interfaces_selection'] . "</option>\n";
 }
 if ($field['type'] == "interface_select") {
     $interfaces = get_interface_list();
 } else {
     $interfaces = get_configured_interface_with_descr();
 }
 foreach ($interfaces as $ifname => $iface) {
     if ($field['type'] == "interface_select") {
         $iface = $ifname;
         if ($iface['mac']) {
             $iface .= " ({$iface['mac']})";
         }
     }
     $SELECTED = "";
     if ($value == $ifname) {
         $SELECTED = " SELECTED";
     }
     $to_echo = "<option value='" . $ifname . "'" . $SELECTED . ">" . $iface . "</option>\n";
开发者ID:rdmenezes,项目名称:pfsense,代码行数:31,代码来源:wizard.php


示例4: build_link_list

function build_link_list()
{
    global $config, $pconfig;
    $linklist = array('list' => array(), 'selected' => array());
    $selected_ports = array();
    if (is_array($pconfig['interfaces'])) {
        $selected_ports = $pconfig['interfaces'];
    } elseif (!empty($pconfig['interfaces'])) {
        $selected_ports = explode(',', $pconfig['interfaces']);
    }
    if (!is_dir("/var/spool/lock")) {
        mwexec("/bin/mkdir -p /var/spool/lock");
    }
    if ($pconfig['type'] == 'ppp') {
        $serialports = glob("/dev/cua[a-zA-Z][0-9]{,.[0-9],.[0-9][0-9],[0-9],[0-9].[0-9],[0-9].[0-9][0-9]}", GLOB_BRACE);
        $serport_count = 0;
        foreach ($serialports as $port) {
            $serport_count++;
            $linklist['list'][$port] = trim($port);
            if (in_array($port, $selected_ports)) {
                array_push($linklist['selected'], $port);
            }
        }
    } else {
        $port_count = 0;
        $portlist = get_interface_list();
        if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
            foreach ($config['vlans']['vlan'] as $vlan) {
                $portlist[$vlan['vlanif']] = $vlan;
            }
        }
        foreach ($portlist as $ifn => $ifinfo) {
            $port_count++;
            $string = "";
            if (is_array($ifinfo)) {
                $string .= $ifn;
                if ($ifinfo['mac']) {
                    $string .= " ({$ifinfo['mac']})";
                }
                if ($ifinfo['friendly']) {
                    $string .= " - {$ifinfo['friendly']}";
                }
                if ($ifinfo['descr']) {
                    $string .= " - {$ifinfo['descr']}";
                }
            } else {
                $string .= $ifinfo;
            }
            $linklist['list'][$ifn] = $string;
            if (in_array($ifn, $selected_ports)) {
                array_push($linklist['selected'], $ifn);
            }
        }
        if ($serport_count > $port_count) {
            $port_count = $serport_count;
        }
    }
    return $linklist;
}
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:59,代码来源:interfaces_ppps_edit.php


示例5: unset

    $pconfig['bw_up'] = $a_passthrumacs[$id]['bw_up'];
    $pconfig['bw_down'] = $a_passthrumacs[$id]['bw_down'];
    $pconfig['descr'] = $a_passthrumacs[$id]['descr'];
    $pconfig['username'] = $a_passthrumacs[$id]['username'];
}
if ($_POST) {
    unset($input_errors);
    $pconfig = $_POST;
    /* input validation */
    $reqdfields = explode(" ", "action mac");
    $reqdfieldsn = array(gettext("Action"), gettext("MAC address"));
    do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
    $_POST['mac'] = strtolower(str_replace("-", ":", $_POST['mac']));
    if ($_POST['mac']) {
        if (is_macaddr($_POST['mac'])) {
            $iflist = get_interface_list();
            foreach ($iflist as $if) {
                if ($_POST['mac'] == strtolower($if['mac'])) {
                    $input_errors[] = sprintf(gettext("The MAC address %s belongs to a local interface. It cannot be used here."), $_POST['mac']);
                    break;
                }
            }
        } else {
            $input_errors[] = sprintf("%s. [%s]", gettext("A valid MAC address must be specified"), $_POST['mac']);
        }
    }
    if ($_POST['bw_up'] && !is_numeric($_POST['bw_up'])) {
        $input_errors[] = gettext("Upload speed needs to be an integer");
    }
    if ($_POST['bw_down'] && !is_numeric($_POST['bw_down'])) {
        $input_errors[] = gettext("Download speed needs to be an integer");
开发者ID:KyleJohnstonNet,项目名称:pfsense,代码行数:31,代码来源:services_captiveportal_mac_edit.php


示例6: list_interfaces

function list_interfaces()
{
    global $config;
    $interfaces = array();
    // define config sections to fetch interfaces from.
    $config_sections = array();
    $config_sections['wireless.clone'] = array('descr' => 'cloneif', 'key' => 'cloneif');
    $config_sections['vlans.vlan'] = array('descr' => "tag,if,descr", 'format' => gettext('vlan %s on %s') . ' (%s)', 'key' => 'vlanif');
    $config_sections['bridges.bridged'] = array('descr' => 'bridgeif, descr', 'key' => 'bridgeif', 'format' => '%s (%s)');
    $config_sections['gifs.gif'] = array('descr' => 'remote-addr,descr', 'key' => 'gifif', 'format' => 'gif %s (%s)');
    $config_sections['gres.gre'] = array('descr' => 'remote-addr,descr', 'key' => 'greif', 'format' => 'gre %s (%s)');
    $config_sections['laggs.lagg'] = array('descr' => 'laggif, descr', 'key' => 'laggif', 'format' => '%s (%s)', 'fields' => 'members');
    $config_sections['ppps.ppp'] = array('descr' => 'if,ports,descr,username', 'key' => 'if', 'format' => '%s (%s) - %s %s', 'fields' => 'type');
    // add physical network interfaces
    foreach (get_interface_list() as $key => $intf_item) {
        $interfaces[$key] = array('descr' => $key . ' (' . $intf_item['mac'] . ')', 'section' => 'interfaces');
    }
    // collect interfaces from defined config sections
    foreach ($config_sections as $key => $value) {
        $cnf_location = explode(".", $key);
        if (!empty($config[$cnf_location[0]][$cnf_location[1]])) {
            foreach ($config[$cnf_location[0]][$cnf_location[1]] as $cnf_item) {
                $interface_item = array("section" => $key);
                // construct item description
                $descr = array();
                foreach (explode(',', $value['descr']) as $fieldname) {
                    if (isset($cnf_item[trim($fieldname)])) {
                        $descr[] = $cnf_item[trim($fieldname)];
                    } else {
                        $descr[] = "";
                    }
                }
                if (!empty($value['format'])) {
                    $interface_item['descr'] = vsprintf($value['format'], $descr);
                } else {
                    $interface_item['descr'] = implode(" ", $descr);
                }
                // copy requested additional fields into temp structure
                if (isset($value['fields'])) {
                    foreach (explode(',', $value['fields']) as $fieldname) {
                        if (isset($cnf_item[$fieldname])) {
                            $interface_item[$fieldname] = $cnf_item[$fieldname];
                        }
                    }
                }
                $interfaces[$cnf_item[$value['key']]] = $interface_item;
            }
        }
    }
    /* QinQ interfaces can't be directly extracted from config without additional logic */
    if (isset($config['qinqs']['qinqentry'])) {
        foreach ($config['qinqs']['qinqentry'] as $qinq) {
            $interfaces["vlan{$qinq['tag']}"] = array('descr' => "VLAN {$qinq['tag']}");
            foreach (explode(' ', $qinq['members']) as $qinqif) {
                // QinQ members
                $interfaces["vlan{$qinq['tag']}_{$qinqif}"] = array('descr' => "QinQ {$qinqif}");
            }
        }
    }
    // enforce constraints
    foreach ($interfaces as $intf_id => $intf_details) {
        // LAGG members cannot be assigned
        if (isset($intf_details['members']) && $intf_details['section'] == 'laggs.lagg') {
            foreach (explode(',', $intf_details['members']) as $intf) {
                if (isset($interfaces[trim($intf)])) {
                    unset($interfaces[trim($intf)]);
                }
            }
        }
    }
    /* add tun0 interface (required for sixxs-aiccu) */
    //   This is a temporary solution to allow using sixxs-aiccu without manual code change
    //   until the aiccu service is correctly included in the web interface.
    //   (to avoid additional temporary code in the interface_assign_description function).
    $tunfound = "";
    exec("/sbin/ifconfig | /usr/bin/grep -c '^tun0'", $tunfound);
    if (intval($tunfound[0]) > 0) {
        $interfaces['tun0'] = array('descr' => 'sixxs-aiccu');
    }
    return $interfaces;
}
开发者ID:8191,项目名称:opnsense-core,代码行数:81,代码来源:interfaces_assign.php


示例7: print_input_errors

			<form action="interfaces_lagg_edit.php" method="post" name="iform" id="iform">
				<?php 
if ($input_errors) {
    print_input_errors($input_errors);
}
?>
				<table width="100%" border="0" cellpadding="6" cellspacing="0">
					<?php 
html_inputbox("if", gettext("Interface"), $pconfig['if'], "", true, 5, true);
?>
					<?php 
html_combobox("laggproto", gettext("Aggregation protocol"), $pconfig['laggproto'], array("failover" => gettext("Failover"), "fec" => gettext("FEC (Fast EtherChannel)"), "lacp" => gettext("LACP (Link Aggregation Control Protocol)"), "loadbalance" => gettext("Loadbalance"), "roundrobin" => gettext("Roundrobin"), "none" => gettext("None")), "", true);
?>
					<?php 
$a_port = array();
foreach (get_interface_list() as $ifk => $ifv) {
    if (eregi('lagg', $ifk)) {
        continue;
    }
    if (!(isset($uuid) && FALSE !== $cnid) && false !== array_search_ex($ifk, $a_lagg, "laggport")) {
        continue;
    }
    $a_port[$ifk] = htmlspecialchars("{$ifk} ({$ifv['mac']})");
}
?>
					<?php 
html_listbox("laggport", gettext("Ports"), $pconfig['laggport'], $a_port, gettext("Note: Ctrl-click (or command-click on the Mac) to select multiple entries."), true);
?>
					<?php 
html_inputbox("desc", gettext("Description"), $pconfig['desc'], gettext("You may enter a description here for your reference."), false, 40);
?>
开发者ID:ZenaVault,项目名称:FreeNAS-Source,代码行数:31,代码来源:interfaces_lagg_edit.php


示例8: write_config

            if (!empty($auxparam)) {
                $config['dynamicdns']['auxparam'][] = $auxparam;
            }
        }
        write_config();
        $retval = 0;
        if (!file_exists($d_sysrebootreqd_path)) {
            config_lock();
            $retval |= rc_update_service("inadyn");
            config_unlock();
        }
        $savemsg = get_std_save_message($retval);
    }
}
// Get list of available interfaces.
$a_interface = get_interface_list();
include "fbegin.inc";
?>
<script type="text/javascript">
<!--
function enable_change(enable_change) {
	var endis = !(document.iform.enable.checked || enable_change);
	document.iform.provider.disabled = endis;
	document.iform.domainname.disabled = endis;
	document.iform.username.disabled = endis;
	document.iform.password.disabled = endis;
	document.iform.updateperiod.disabled = endis;
	document.iform.forcedupdateperiod.disabled = endis;
	document.iform.wildcard.disabled = endis;
	document.iform.auxparam.disabled = endis;
}
开发者ID:sdoney,项目名称:nas4free,代码行数:31,代码来源:services_dynamicdns.php


示例9: build_parent_list

function build_parent_list()
{
    global $g;
    $parentlist = array();
    $portlist = get_interface_list();
    $count = 0;
    foreach ($portlist as $ifn => $ifinfo) {
        if (preg_match($g['wireless_regex'], $ifn)) {
            $parentlist[$ifn] = htmlspecialchars($ifn . ' (' . $ifinfo['mac'] . ')');
            $count++;
        }
    }
    if ($count > 0) {
        return $parentlist;
    } else {
        return array('0' => gettext('None available'));
    }
}
开发者ID:LFCavalcanti,项目名称:pfsense,代码行数:18,代码来源:interfaces_wireless_edit.php


示例10: gettext

 </small>
                        <i class="fa fa-toggle-off text-danger"  style="cursor: pointer;" id="show_all_help_page" type="button"></i></a>
                        &nbsp;
                      </td>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td><i class="fa fa-info-circle text-muted"></i> <?php 
echo gettext("Parent interface");
?>
</td>
                      <td>
                        <select name="if" class="selectpicker">
<?php 
foreach (get_interface_list() as $ifn => $ifinfo) {
    if (match_wireless_interface($ifn)) {
        if (strstr($ifn, '_wlan')) {
            continue;
        }
        ?>
                          <option value="<?php 
        echo $ifn;
        ?>
" <?php 
        echo $ifn == $pconfig['if'] ? "selected=\"selected\"" : "";
        ?>
>
                              <?php 
        echo htmlspecialchars($ifn . " (" . $ifinfo['mac'] . ")");
        ?>
开发者ID:8191,项目名称:opnsense-core,代码行数:31,代码来源:interfaces_wireless_edit.php


示例11: humantime

        $periods[$j] .= "s";
    }
    $text = "{$difference} {$periods[$j]}";
    return $text;
}
$havg = humantime($average);
$hperiod = humantime($seconds);
if (strstr($curdatabase, "-traffic.rrd") && file_exists("{$rrddbpath}{$curdatabase}")) {
    /* define graphcmd for traffic stats */
    $graphcmd = "{$rrdtool} graph {$rrdtmppath}{$curdatabase}-{$interval}.png \\\r\n\t\t--start -{$seconds} -e -{$average} \\\r\n\t\t--vertical-label \"bits/sec\" \\\r\n\t\t--color SHADEA#eeeeee --color SHADEB#eeeeee \\\r\n\t\t--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" \\\r\n\t\t--height 200 --width 620 -x \"{$scale}\" \\\r\n\t\tDEF:{$curif}-in_bytes={$rrddbpath}{$curdatabase}:in:AVERAGE \\\r\n\t\tDEF:{$curif}-out_bytes={$rrddbpath}{$curdatabase}:out:AVERAGE \\\r\n\t\t\"CDEF:{$curif}-in_bits={$curif}-in_bytes,8,*\" \\\r\n\t\t\"CDEF:{$curif}-out_bits={$curif}-out_bytes,8,*\" \\\r\n\t\t\"CDEF:{$curif}-bits_io={$curif}-in_bits,{$curif}-out_bits,+\" \\\r\n\t\t\"CDEF:{$curif}-out_bits_neg={$curif}-out_bits,{$multiplier},*\" \\\r\n\t\t\"CDEF:{$curif}-bytes_in={$curif}-in_bytes,0,{$speedlimit},LIMIT,UN,0,{$curif}-in_bytes,IF,{$average},*\" \\\r\n\t\t\"CDEF:{$curif}-bytes_out={$curif}-out_bytes,0,{$speedlimit},LIMIT,UN,0,{$curif}-out_bytes,IF,{$average},*\" \\\r\n\t\t\"CDEF:{$curif}-bytes={$curif}-bytes_in,{$curif}-bytes_out,+\" \\\r\n\t\t\"CDEF:{$curif}-bytes_in_t={$curif}-in_bytes,0,{$speedlimit},LIMIT,UN,0,{$curif}-in_bytes,IF,{$seconds},*\" \\\r\n\t\t\"CDEF:{$curif}-bytes_out_t={$curif}-out_bytes,0,{$speedlimit},LIMIT,UN,0,{$curif}-out_bytes,IF,{$seconds},*\" \\\r\n\t\t\"CDEF:{$curif}-bytes_t={$curif}-bytes_in_t,{$curif}-bytes_out_t,+\" \\\r\n\t\tAREA:{$curif}-in_bits#{$colortrafficdown}:{$curif}-in \\\r\n\t\t{$AREA}:{$curif}-out_bits_neg#{$colortrafficup}:{$curif}-out \\\r\n\t\tCOMMENT:\"\\n\"\\\r\n\t\tCOMMENT:\"\t\t  maximum       average       current        period\\n\"\\\r\n\t\tCOMMENT:\"in\t\"\\\r\n\t\tGPRINT:{$curif}-in_bits:MAX:'%7.2lf %sb/s'\\\r\n\t\tGPRINT:{$curif}-in_bits:AVERAGE:'%7.2lf %Sb/s'\\\r\n\t\tGPRINT:{$curif}-in_bits:LAST:'%7.2lf %Sb/s'\\\r\n\t\tGPRINT:{$curif}-bytes_in_t:AVERAGE:'%7.2lf %sB i'\\\r\n\t\tCOMMENT:\"\\n\"\\\r\n\t\tCOMMENT:\"out\t\"\\\r\n\t\tGPRINT:{$curif}-out_bits:MAX:'%7.2lf %sb/s'\\\r\n\t\tGPRINT:{$curif}-out_bits:AVERAGE:'%7.2lf %Sb/s'\\\r\n\t\tGPRINT:{$curif}-out_bits:LAST:'%7.2lf %Sb/s'\\\r\n\t\tGPRINT:{$curif}-bytes_out_t:AVERAGE:'%7.2lf %sB o'\\\r\n\t\tCOMMENT:\"\\n\"\\\r\n\t\tCOMMENT:\"totals\"\\\r\n\t\tGPRINT:{$curif}-bits_io:MAX:'%7.2lf %sb/s'\\\r\n\t\tGPRINT:{$curif}-bits_io:AVERAGE:'%7.2lf %sb/s'\\\r\n\t\tGPRINT:{$curif}-bits_io:LAST:'%7.2lf %sb/s'\\\r\n\t\tGPRINT:{$curif}-bytes_t:AVERAGE:'%7.2lf %sB t'\\\r\n        \tCOMMENT:\"\\n\"\\\r\n\t\tCOMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\\:%M\\:%S %Y\"`\"";
} elseif (strstr($curdatabase, "-throughput.rrd")) {
    /* define graphcmd for throughput stats */
    /* this gathers all interface statistics, the database does not actually exist */
    $graphcmd = "{$rrdtool} graph {$rrdtmppath}{$curdatabase}-{$interval}.png \\\r\n\t\t--start -{$seconds} -e -{$average} \\\r\n\t\t--vertical-label \"bits/sec\" \\\r\n\t\t--color SHADEA#eeeeee --color SHADEB#eeeeee \\\r\n\t\t--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" \\\r\n\t\t--height 200 --width 620 -x \"{$scale}\" ";
    $vfaces = array("vlan.?*");
    $ifdescrs = get_interface_list();
    $g = 0;
    $operand = "";
    $comma = "";
    $graphtputbi = "";
    $graphtputbo = "";
    $graphtputbt = "";
    $graphtputbyi = "";
    $graphtputbyo = "";
    $graphtputbyt = "";
    foreach ($ifdescrs as $ifdescr) {
        $ifname = $ifdescr['friendly'];
        $state = $ifdescr['up'];
        /* skip interfaces that do not have a friendly name */
        if ("{$ifname}" == "") {
            continue;
开发者ID:rootsghost,项目名称:5651-pfsense,代码行数:31,代码来源:status_rrd_graph_img.php



注:本文中的get_interface_list函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_interface_subnet函数代码示例发布时间:2022-05-15
下一篇:
PHP get_interface_ipv6函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap