예제 #1
0
InterfaceTree::InterfaceTree(QWidget *parent) :
    QTreeWidget(parent)
#ifdef HAVE_LIBPCAP
    ,stat_cache_(NULL)
    ,stat_timer_(NULL)
#endif // HAVE_LIBPCAP
{
    QTreeWidgetItem *ti;

    qRegisterMetaType< PointList >("PointList");

    header()->setVisible(false);
    setRootIsDecorated(false);
    setUniformRowHeights(true);
    /* Seems to have no effect, still the default value (2) is being used, as it
     * was set in the .ui file. But better safe, then sorry. */
    resetColumnCount();
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setAccessibleName(tr("Welcome screen list"));

    setItemDelegateForColumn(IFTREE_COL_STATS, new SparkLineDelegate(this));
    setDisabled(true);

    ti = new QTreeWidgetItem();
    ti->setText(IFTREE_COL_NAME, tr("Waiting for startup%1").arg(UTF8_HORIZONTAL_ELLIPSIS));
    addTopLevelItem(ti);
    resizeColumnToContents(IFTREE_COL_NAME);

    connect(wsApp, SIGNAL(appInitialized()), this, SLOT(getInterfaceList()));
    connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
    connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelectedInterfaces()));
}
예제 #2
0
InterfaceTree::InterfaceTree(QWidget *parent) :
    QTreeWidget(parent)
#ifdef HAVE_LIBPCAP
    ,stat_cache_(NULL)
    ,stat_timer_(NULL)
#endif // HAVE_LIBPCAP
{
    QTreeWidgetItem *ti;

    header()->setVisible(false);
    setRootIsDecorated(false);
    setUniformRowHeights(true);
    setColumnCount(2);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setAccessibleName(tr("Welcome screen list"));

    setItemDelegateForColumn(1, new SparkLineDelegate());
    setDisabled(true);

    ti = new QTreeWidgetItem();
    ti->setText(0, tr("Waiting for startup" UTF8_HORIZONTAL_ELLIPSIS));
    addTopLevelItem(ti);
    resizeColumnToContents(0);

    connect(wsApp, SIGNAL(appInitialized()), this, SLOT(getInterfaceList()));
    connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelectedInterfaces()));
}
예제 #3
0
int
main(int argc, char *argv[]){
	char *interface_list[MAX_NUM_IFS];

	if (argc <= 1){
		displayComputerInfo();
	} else {
		if (!strcmp(argv[1], "help")){
			puts("Usage: ./ifconfig [options]\n"
				 "Options:\n\n"
				 "up [interface name]					Brings the interface up\n"
				 "down [interface name]					Puts the interface down\n"
				 "[interface name]						Displays information only for a given interface\n"
				 "help									Shows this screen\n"
				 "[no options]							Shows the computer network interface configurations\n");
			exit(0);
		}
		// gets the interface list
		getInterfaceList(interface_list);

		if (!strcmp(argv[1], "up")){
			// bring the interface up
			if (argv[2] != NULL && isInterface(interface_list, argv[2])){
				manipulateIfState(argv[2], 1);
				printf("The device %s has been brought up\n", argv[2]);
			} else {
				puts("No such device exists. Exiting...");
			}
		} else if (!strcmp(argv[1], "down")){
			// bring the interface down
			if (argv[2] != NULL && isInterface(interface_list, argv[2])){
				manipulateIfState(argv[2], 0);
				printf("The device %s has been brought down\n", argv[2]);
			} else {
				puts("No such device exists. Exiting...");
			}
		} else if(isInterface(interface_list, argv[1])){
			// display only the particular interface's network information
			// it's done via callback
			handleSingleInterface(argv[1], &printInterfaceInfo);
		} else{
			puts("Type in ./ifconfig help for usage.");
		}
	}
    exit(0);
}
예제 #4
0
bool Netctl::updateSourceEvent(const QString &source)
{
    if (debug) qDebug() << PDEBUG;
    if (debug) qDebug() << PDEBUG << ":" << "Source name" << source;

    QString value = QString("N\\A");
    if (source == QString("active")) {
        value = getStatus(configuration[QString("NETCTLCMD")],
                          configuration[QString("NETCTLAUTOCMD")]);
    } else if (source == QString("current")) {
        value = getCurrentProfile(configuration[QString("NETCTLCMD")],
                                  configuration[QString("NETCTLAUTOCMD")])
                .join(QChar('|'));
        current = value;
    } else if (source == QString("extip4")) {
        if (configuration[QString("EXTIP4")] == QString("true"))
            value = getExtIp(configuration[QString("EXTIP4CMD")]);
    } else if (source == QString("extip6")) {
        if (configuration[QString("EXTIP6")] == QString("true"))
            value = getExtIp(configuration[QString("EXTIP6CMD")]);
    } else if (source == QString("info")) {
        value = getInfo();
    } else if (source == QString("interfaces")) {
        value = getInterfaceList().join(QChar(','));
    } else if (source == QString("intip4")) {
        value = getIntIp(QAbstractSocket::IPv4Protocol);
    } else if (source == QString("intip6")) {
        value = getIntIp(QAbstractSocket::IPv6Protocol);
    } else if (source == QString("netctlauto")) {
        value = getNetctlAutoStatus(configuration[QString("NETCTLAUTOCMD")]);
    } else if (source == QString("profiles")) {
        value = getProfileList(configuration[QString("NETCTLCMD")],
                               configuration[QString("NETCTLAUTOCMD")])
                .join(QChar(','));
    } else if (source == QString("status")) {
        value = getProfileStringStatus(configuration[QString("NETCTLCMD")],
                                       configuration[QString("NETCTLAUTOCMD")])
                .join(QChar('|'));
        status = value;
    }
    setData(source, QString("value"), value);

    return true;
}
예제 #5
0
bool Netctl::updateSourceEvent(const QString &source)
{
    if (debug) qDebug() << "[DE]" << "[updateSourceEvent]";
    if (debug) qDebug() << "[DE]" << "[updateSourceEvent]" << ":" << "Source name" << source;

    QString key = QString("value");
    QString value = QString("");
    if (source == QString("currentProfile")) {
        value = getCurrentProfile(configuration[QString("NETCTLAUTOCMD")]);
        if (value.isEmpty())
            value = getCurrentProfile(configuration[QString("CMD")]);
    }
    else if (source == QString("extIp")) {
        if (configuration[QString("EXTIP")] == QString("true"))
            value = getExtIp(configuration[QString("EXTIPCMD")]);
    }
    else if (source == QString("interfaces")) {
        value = getInterfaceList(configuration[QString("NETDIR")]).join(QChar(','));
    }
    else if (source == QString("intIp")) {
        value = getIntIp(configuration[QString("IPCMD")], configuration[QString("NETDIR")]);
    }
    else if (source == QString("profiles")) {
        value = getProfileList(configuration[QString("NETCTLAUTOCMD")]).join(QChar(','));
        if (value.isEmpty())
            value = getProfileList(configuration[QString("CMD")]).join(QChar(','));
    }
    else if (source == QString("statusBool")) {
        if (getProfileStatus(configuration[QString("NETCTLAUTOCMD")]))
            value = QString("true");
        else if (getProfileStatus(configuration[QString("CMD")]))
            value = QString("true");
        else
            value = QString("false");
    }
    else if (source == QString("statusString")) {
        value = getProfileStringStatus(configuration[QString("CMD")],
                configuration[QString("NETCTLAUTOCMD")]);
    }
    setData(source, key, value);

    return true;
}
예제 #6
0
void WSettings::setDefaultConfig()
{
    this->setPassword("1234567890");
    this->setAccessPoint("192.168.12.1");
    this->setAPName("WifiAssistForLinux");

    QStringList interface_list = getInterfaceList();
    if(interface_list.contains("eth0"))
        this->setInterface_Shared("eth0");
    else
        this->setInterface_Shared(*interface_list.begin());

    if(interface_list.contains("wlan0"))
        this->setInterface_Create("wlan0");
    else
        this->setInterface_Create(*interface_list.end());

    QString absolute_path = QCoreApplication::applicationDirPath()+"/bin/wifi.sh";
    this->setPath_exec(absolute_path);

    this->setLanguage("en_US");
}
예제 #7
0
QString Netctl::getIntIp(const QString cmd, const QString dir)
{
    if (debug) qDebug() << "[DE]" << "[getIntIp]";
    if (debug) qDebug() << "[DE]" << "[getIntIp]" << ":" << "Cmd" << cmd;
    if (debug) qDebug() << "[DE]" << "[getIntIp]" << ":" << "Directory" << dir;

    QProcess command;
    QString intIp = QString("127.0.0.1/8");
    QStringList interfaceList = getInterfaceList(dir);
    for (int i=0; i<interfaceList.count(); i++)
        if (interfaceList[i] != QString("lo")) {
            command.start(cmd + QString(" addr show ") + interfaceList[i]);
            command.waitForFinished(-1);
            QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
            QStringList deviceInfo = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
            for (int j=0; j<deviceInfo.count(); j++)
                if (deviceInfo[j].split(QChar(' '), QString::SkipEmptyParts)[0] == QString("inet"))
                    intIp = deviceInfo[j].split(QChar(' '), QString::SkipEmptyParts)[1];
        }

    return intIp;
}
예제 #8
0
int CiscoCSSInterfaces::processDeviceConfig(Device *device, ConfigLine *command, char *line, int lineSize)
{
    // Variables...
    interfaceListConfig *interfaceListPointer = 0;
    interfaceConfig *interfacePointer = 0;

    if (strcmp(command->part(0), "interface") == 0)
    {
        if (device->config->reportFormat == Config::Debug)
            printf("%sInterface Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

        // Sort out the interface list first...
        interfaceListPointer = getInterfaceList("INTERFACES");
        if (interfaceListPointer == 0)
        {
            interfaceListPointer = addInterfaceList();
            interfaceListPointer->title = i18n("Network Interfaces");
            interfaceListPointer->description = i18n("This section describes the configuration of the *DEVICETYPE* devices network interfaces.");
            interfaceListPointer->tableTitle = i18n("Network interfaces");
            interfaceListPointer->label = "INTERFACES";
            interfaceListPointer->vlanSupported = true;
            interfaceListPointer->portModeSupported = true;
            interfaceListPointer->interfaceDisableSupport = true;				// Is it possible to disable interfaces?
        }
        interfacePointer = getInterface(interfaceListPointer, command->part(1));

        // Read a line from the config...
        device->readLine(line, lineSize);

        // Split it up into parts...
        command->setConfigLine(line);

        while ((command->parts > 0) && (feof(device->inputFile) == 0))
        {

            // Description...
            if (strcmp(command->part(0), "description") == 0)
            {
                if (device->config->reportFormat == Config::Debug)
                    printf("%sInterface Description Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

                interfacePointer->description.assign(command->part(1));
            }

            // Shut...
            else if ((strcmp(command->part(0), "shut") == 0) || (strcmp(command->part(0), "admin-shutdown") == 0))
            {
                if (device->config->reportFormat == Config::Debug)
                    printf("%sInterface Shutdown Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

                interfacePointer->enabled = false;
            }

            // VLAN...
            else if (strcmp(command->part(0), "vlan") == 0)
            {
                if (device->config->reportFormat == Config::Debug)
                    printf("%sInterface VLAN Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

                addVLAN(interfacePointer, command->part(1));
            }

            // VLAN...
            else if ((strcmp(command->part(0), "bridge") == 0) && (strcmp(command->part(1), "vlan") == 0))
            {
                if (device->config->reportFormat == Config::Debug)
                    printf("%sInterface VLAN Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

                addVLAN(interfacePointer, command->part(2));
            }

            // Trunk...
            else if (strcmp(command->part(0), "trunk") == 0)
            {
                if (device->config->reportFormat == Config::Debug)
                    printf("%sInterface VLAN Trunking Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

                interfacePointer->switchportMode = portModeTrunk;
            }

            // All others...
            else
                device->lineNotProcessed(line);

            // Read a line from the config...
            device->readLine(line, lineSize);

            // Split it up into parts...
            command->setConfigLine(line);
        }
    }

    else if (strcmp(command->part(0), "circuit") == 0)
    {
        if (device->config->reportFormat == Config::Debug)
            printf("%sCircuit Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

        // Sort out the interface list first...
        interfaceListPointer = getInterfaceList("CIRCUIT");
        if (interfaceListPointer == 0)
        {
            interfaceListPointer = addInterfaceList();
            interfaceListPointer->title = i18n("Circuit Interfaces");
            interfaceListPointer->description = i18n("This section describes the configuration of the *DEVICETYPE* devices circuit interfaces.");
            interfaceListPointer->tableTitle = i18n("Circuit interfaces");
            interfaceListPointer->label = "CIRCUIT";
            interfaceListPointer->ipAddressSupported = true;				// Is it possible to disable interfaces?
            interfaceListPointer->inboundFilterSupported = true;			// Is the inbound filtering supported?
        }
        interfacePointer = getInterface(interfaceListPointer, command->part(1));

        // Read a line from the config...
        device->readLine(line, lineSize);

        // Split it up into parts...
        command->setConfigLine(line);

        while ((command->parts > 0) && (feof(device->inputFile) == 0))
        {

            // Description...
            if (strcmp(command->part(0), "description") == 0)
            {
                if (device->config->reportFormat == Config::Debug)
                    printf("%sCircuit Description Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

                interfacePointer->description.assign(command->part(1));
            }

            // Address...
            if ((strcmp(command->part(0), "ip") == 0) && (strcmp(command->part(1), "address") == 0))
            {
                if (device->config->reportFormat == Config::Debug)
                    printf("%sCircuit IP Address Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

                interfacePointer->address.assign(command->part(2));
                interfacePointer->netmask.assign(command->part(3));
            }

            // All others...
            else
                device->lineNotProcessed(line);

            // Read a line from the config...
            device->readLine(line, lineSize);

            // Split it up into parts...
            command->setConfigLine(line);
        }
    }

    // All others...
    else
        device->lineNotProcessed(line);

    return 0;
}
예제 #9
0
int PassportInterfaces::processDeviceConfig(Device *device, ConfigLine *command, char *line, int lineSize)
{
	// Variables...
	interfaceListConfig *interfaceListPointer = 0;
	interfaceConfig *interfacePointer = 0;
	string tempString;

	// ethernet...
	if (strcmp(command->part(0), "ethernet") == 0)
	{

		interfaceListPointer = getInterfaceList("ETHERINTERFACES");
		if (interfaceListPointer == 0)
		{
			interfaceListPointer = addInterfaceList();
			interfaceListPointer->title = i18n("Ethernet Interfaces");
			interfaceListPointer->description = i18n("This section describes the configuration of the *DEVICETYPE* devices ethernet interfaces.");
			interfaceListPointer->tableTitle = i18n("Ethernet interfaces");
			interfaceListPointer->label = "ETHERINTERFACES";
			interfaceListPointer->vlanSupported = true;
			interfaceListPointer->interfaceDisableSupport = true;				// Is it possible to disable interfaces?
			interfaceListPointer->inboundFilterSupported = true;					// Is the inbound filtering supported?
			interfaceListPointer->outboudFilterSupported = false;					// Is the outbound filtering supported?
		}
		tempString.assign(command->part(1));
		interfacePointer = getInterface(interfaceListPointer, "", atoi(command->part(1)), atoi(tempString.substr(tempString.find("/") + 1).c_str()));

		// State
		if (strcmp(command->part(2), "state") == 0)
		{
		
			if (device->config->reportFormat == Config::Debug)
				printf("%sEthernet State Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

			if (strcasecmp(command->part(3), "disable") == 0)
				interfacePointer->enabled = false;
		}

		// name
		else if (strcmp(command->part(2), "name") == 0)
		{
		
			if (device->config->reportFormat == Config::Debug)
				printf("%sEthernet Description Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

			interfacePointer->description.assign(command->part(3));
		}

		else if ((strcmp(command->part(2), "ip") == 0) && (strcmp(command->part(3), "traffic-filter") == 0) &&  (strcmp(command->part(4), "add") == 0) &&  (strcmp(command->part(5), "set") == 0))
		{
		
			if (device->config->reportFormat == Config::Debug)
				printf("%sEthernet Filter Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

			addFilterList(interfacePointer, command->part(6), true);
		}

		else if (strcmp(command->part(2), "default-vlan-id") == 0)
		{
		
			if (device->config->reportFormat == Config::Debug)
				printf("%sEthernet VLAN Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

			addVLAN(interfacePointer, command->part(3));
		}

		// All others...
		else
			device->lineNotProcessed(line);
	}

	// vlan...
	if (strcmp(command->part(0), "vlan") == 0)
	{

		interfaceListPointer = getInterfaceList("VLANINTERFACES");
		if (interfaceListPointer == 0)
		{
			interfaceListPointer = addInterfaceList();
			interfaceListPointer->title = i18n("*ABBREV*VLAN*-ABBREV* Interfaces");
			interfaceListPointer->description = i18n("This section describes the configuration of the *DEVICETYPE* devices *ABBREV*VLAN*-ABBREV* interfaces.");
			interfaceListPointer->tableTitle = i18n("*ABBREV*VLAN*-ABBREV* interfaces");
			interfaceListPointer->label = "VLANINTERFACES";
			interfaceListPointer->proxyArpSupported = true;
			interfaceListPointer->ipAddressSupported = true;					// Are addresses supported?
		}
		interfacePointer = getInterface(interfaceListPointer, command->part(1));

		if ((strcmp(command->part(2), "ip") == 0) && (strcmp(command->part(3), "create") == 0))
		{
		
			if (device->config->reportFormat == Config::Debug)
				printf("%sVLAN IP Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

			tempString.assign(command->part(4));
			interfacePointer->address.assign(tempString.substr(0, tempString.find("/") - 1));
			interfacePointer->netmask.assign(tempString.substr(tempString.find("/") + 1).c_str());
		}

		else if ((strcmp(command->part(2), "ip") == 0) && (strcmp(command->part(3), "proxy") == 0))
		{
		
			if (device->config->reportFormat == Config::Debug)
				printf("%sVLAN IP Proxy Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

			if (strcmp(command->part(4), "enable") == 0)
				interfacePointer->proxyARP = true;
			else
				interfacePointer->proxyARP = false;
		}

		// All others...
		else
			device->lineNotProcessed(line);
	}

	// All others...
	else
		device->lineNotProcessed(line);

	return 0;
}
예제 #10
0
int CatalystInterfaces::processDeviceConfig(Device *device, ConfigLine *command, char *line, int lineSize)
{
	// Variables...
	interfaceListConfig *interfaceListPointer = 0;
	interfaceConfig *interfacePointer = 0;
	int tempInt = 0;
	Device::listStruct *tempList = 0;
	Device::listStruct *listPointer = 0;
	Device::listStruct *tempVLANList = 0;
	Device::listStruct *listVLANPointer = 0;

	// Interface...
	if ((strcmp(command->part(0), "set") == 0) && (strcmp(command->part(1), "vlan") == 0) && (strcmp(command->part(3), "firewall-vlan") != 0))
	{
		if (device->config->reportFormat == Config::Debug)
			printf("%sVLAN Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

		interfaceListPointer = getInterfaceList("VLANINTERFACES");
		if (interfaceListPointer == 0)
		{
			interfaceListPointer = addInterfaceList();
			interfaceListPointer->title = i18n("*ABBREV*VLAN*-ABBREV* Interfaces");
			interfaceListPointer->description = i18n("This section describes the configuration of the *DEVICETYPE* devices *ABBREV*VLAN*-ABBREV* interfaces.");
			interfaceListPointer->tableTitle = i18n("*ABBREV*VLAN*-ABBREV* interfaces");
			interfaceListPointer->label = "VLANINTERFACES";
			interfaceListPointer->interfaceDisableSupport = true;			// Is it possible to disable interfaces?
			interfaceListPointer->ipAddressSupported = false;
		}

		tempList = device->createPortList(command->part(2));
		listPointer = tempList;
		while (listPointer != 0)
		{
			if (command->parts == 4)
			{
				interfaceListPointer = getInterfaceList("PORTINTERFACES");
				if (interfaceListPointer == 0)
				{
					interfaceListPointer = addInterfaceList();
					interfaceListPointer->title = i18n("Module Ports");
					interfaceListPointer->description = i18n("This section describes the configuration of the *DEVICETYPE* devices module ports.");
					interfaceListPointer->tableTitle = i18n("Module ports");
					interfaceListPointer->label = "PORTINTERFACES";
					interfaceListPointer->vlanSupported = true;
					interfaceListPointer->portModeSupported = true;
					interfaceListPointer->interfaceDisableSupport = true;
					interfaceListPointer->cdpSupported = true;
				}

				tempVLANList = device->createPortList(command->part(3));
				listVLANPointer = tempVLANList;
				while (listVLANPointer != 0)
				{
					interfacePointer = getOnlyInterface(interfaceListPointer, "", atoi(listVLANPointer->listItem.c_str()), atoi(listVLANPointer->listItem.substr(listVLANPointer->listItem.find("/") + 1).c_str()));
					if (interfacePointer == 0)
					{
						interfacePointer = getInterface(interfaceListPointer, "", atoi(listVLANPointer->listItem.c_str()), atoi(listVLANPointer->listItem.substr(listVLANPointer->listItem.find("/") + 1).c_str()));
						interfacePointer->switchportMode = switchportMode;
						interfacePointer->cdp = cdpGlobal;
					}
					addVLAN(interfacePointer, listPointer->listItem.c_str());
					listVLANPointer = listVLANPointer->next;
				}

				// Delete list
				while (tempVLANList != 0)
				{
					listVLANPointer = tempVLANList->next;
					delete tempVLANList;
					tempVLANList = listVLANPointer;
				}
			}

			else
			{
				interfacePointer = getInterface(interfaceListPointer, listPointer->listItem.c_str());

				tempInt = 3;
				while (tempInt < command->parts)
				{
					if (strcmp(command->part(tempInt), "name") == 0)
					{
						tempInt++;
						interfacePointer->description.assign(command->part(tempInt));
					}
					else if (strcmp(command->part(tempInt), "state") == 0)
					{
						tempInt++;
						if (strcmp(command->part(tempInt), "active") == 0)
							interfacePointer->enabled = true;
						else
							interfacePointer->enabled = false;
					}

					tempInt++;
				}
			}

			listPointer = listPointer->next;
		}

		// Delete list
		while (tempList != 0)
		{
			listPointer = tempList->next;
			delete tempList;
			tempList = listPointer;
		}
	}

	// unreachable...
	else if ((strcmp(command->part(0), "set") == 0) && (strcmp(command->part(1), "ip") == 0) && (strcmp(command->part(2), "unreachable") == 0))
	{
		if (device->config->reportFormat == Config::Debug)
			printf("%sUnreachables Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

		if (strcmp(command->part(3), "disable") == 0)
			globalUnreachableEnabled = false;
		else
			globalUnreachableEnabled = true;
	}

	// redirect...
	else if ((strcmp(command->part(0), "set") == 0) && (strcmp(command->part(1), "ip") == 0) && (strcmp(command->part(2), "redirect") == 0))
	{
		if (device->config->reportFormat == Config::Debug)
			printf("%sRedirect Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

		if (strcmp(command->part(3), "disable") == 0)
			globalRedirectEnabled = false;
		else
			globalRedirectEnabled = true;
	}

	// CDP Globally...
	else if ((strcmp(command->part(0), "set") == 0) && (strcmp(command->part(1), "cdp") == 0) && (command->parts == 3))
	{
		if (device->config->reportFormat == Config::Debug)
			printf("%sCDP Global Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

		if (strcmp(command->part(2), "disable") == 0)
			cdpGlobal = false;
		else
			cdpGlobal = true;
		interfaceListPointer = getInterfaceList("PORTINTERFACES");
		if (interfaceListPointer != 0)
		{
			interfacePointer = interfaceListPointer->interface;
			while (interfacePointer != 0)
			{
				interfacePointer->cdp = cdpGlobal;
				interfacePointer = interfacePointer->next;
			}
		}
	}

	// CDP Individually...
	else if ((strcmp(command->part(0), "set") == 0) && (strcmp(command->part(1), "cdp") == 0))
	{
		if (device->config->reportFormat == Config::Debug)
			printf("%sCDP Individual Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

		interfaceListPointer = getInterfaceList("PORTINTERFACES");
		tempList = device->createPortList(command->part(3));
		listPointer = tempList;
		while (listPointer != 0)
		{
			interfacePointer = getOnlyInterface(interfaceListPointer, "", atoi(listPointer->listItem.c_str()), atoi(listPointer->listItem.substr(listPointer->listItem.find("/") + 1).c_str()));
			if (interfacePointer == 0)
			{
				interfacePointer = getInterface(interfaceListPointer, "", atoi(listPointer->listItem.c_str()), atoi(listPointer->listItem.substr(listPointer->listItem.find("/") + 1).c_str()));
				interfacePointer->switchportMode = switchportMode;
				interfacePointer->cdp = cdpGlobal;
			}

			if (strcmp(command->part(2), "disable") == 0)
				interfacePointer->cdp = false;
			else
				interfacePointer->cdp = true;

			listPointer = listPointer->next;
		}

		// Delete list
		while (tempList != 0)
		{
			listPointer = tempList->next;
			delete tempList;
			tempList = listPointer;
		}
	}

	// Trunk all...
	else if ((strcmp(command->part(0), "set") == 0) && (strcmp(command->part(1), "trunk") == 0) && (strcmp(command->part(2), "all") == 0) && (strcmp(command->part(3), "off") == 0))
	{
		if (device->config->reportFormat == Config::Debug)
			printf("%sPort Trunking Off Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

		switchportMode = portModeAccess;
		interfaceListPointer = getInterfaceList("PORTINTERFACES");
		if (interfaceListPointer != 0)
		{
			interfacePointer = interfaceListPointer->interface;
			while (interfacePointer != 0)
			{
				interfacePointer->switchportMode = switchportMode;
				interfacePointer = interfacePointer->next;
			}
		}
	}

	// Trunk...
	else if ((strcmp(command->part(0), "set") == 0) && (strcmp(command->part(1), "trunk") == 0))
	{
		if (device->config->reportFormat == Config::Debug)
			printf("%sPort Trunking Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

		interfaceListPointer = getInterfaceList("PORTINTERFACES");
		if (interfaceListPointer == 0)
		{
			interfaceListPointer = addInterfaceList();
			interfaceListPointer->title = i18n("Module Ports");
			interfaceListPointer->description = i18n("This section describes the configuration of the *DEVICETYPE* devices module ports.");
			interfaceListPointer->tableTitle = i18n("Module ports");
			interfaceListPointer->label = "PORTINTERFACES";
			interfaceListPointer->vlanSupported = true;
			interfaceListPointer->portModeSupported = true;
			interfaceListPointer->interfaceDisableSupport = true;
			interfaceListPointer->cdpSupported = true;
		}

		tempList = device->createPortList(command->part(2));
		listPointer = tempList;
		while (listPointer != 0)
		{
			interfacePointer = getOnlyInterface(interfaceListPointer, "", atoi(listPointer->listItem.c_str()), atoi(listPointer->listItem.substr(listPointer->listItem.find("/") + 1).c_str()));
			if (interfacePointer == 0)
			{
				interfacePointer = getInterface(interfaceListPointer, "", atoi(listPointer->listItem.c_str()), atoi(listPointer->listItem.substr(listPointer->listItem.find("/") + 1).c_str()));
				interfacePointer->switchportMode = switchportMode;
				interfacePointer->cdp = cdpGlobal;
			}

			if ((strcmp(command->part(3), "on") == 0) || (strcmp(command->part(3), "nonegotiate") == 0))
				interfacePointer->switchportMode = portModeTrunk;

			else if (strcmp(command->part(3), "off") == 0)
				interfacePointer->switchportMode = portModeAccess;

			else
				interfacePointer->switchportMode = portModeDynamic;

			listPointer = listPointer->next;
		}

		// Delete list
		while (tempList != 0)
		{
			listPointer = tempList->next;
			delete tempList;
			tempList = listPointer;
		}
	}

	// Port...
	else if ((strcmp(command->part(0), "set") == 0) && (strcmp(command->part(1), "port") == 0)&& (strcmp(command->part(3), "all") != 0))
	{

		interfaceListPointer = getInterfaceList("PORTINTERFACES");
		if (interfaceListPointer == 0)
		{
			interfaceListPointer = addInterfaceList();
			interfaceListPointer->title = i18n("Module Ports");
			interfaceListPointer->description = i18n("This section describes the configuration of the *DEVICETYPE* devices module ports.");
			interfaceListPointer->tableTitle = i18n("Module ports");
			interfaceListPointer->label = "PORTINTERFACES";
			interfaceListPointer->vlanSupported = true;
			interfaceListPointer->portModeSupported = true;
			interfaceListPointer->interfaceDisableSupport = true;
			interfaceListPointer->cdpSupported = true;
		}

		tempList = device->createPortList(command->part(3));
		listPointer = tempList;
		while (listPointer != 0)
		{
			interfacePointer = getOnlyInterface(interfaceListPointer, "", atoi(listPointer->listItem.c_str()), atoi(listPointer->listItem.substr(listPointer->listItem.find("/") + 1).c_str()));
			if (interfacePointer == 0)
			{
				interfacePointer = getInterface(interfaceListPointer, "", atoi(listPointer->listItem.c_str()), atoi(listPointer->listItem.substr(listPointer->listItem.find("/") + 1).c_str()));
				interfacePointer->switchportMode = switchportMode;
				interfacePointer->cdp = cdpGlobal;
			}

			if (strcmp(command->part(2), "name") == 0)
			{
				if (device->config->reportFormat == Config::Debug)
					printf("%sPort Name Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

				interfacePointer->description.assign(strstr(line, command->part(3)));
			}

			else if (strcmp(command->part(2), "disable") == 0)
			{
				if (device->config->reportFormat == Config::Debug)
					printf("%sPort Disable Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

				interfacePointer->enabled = false;
			}

			else if (strcmp(command->part(2), "description") == 0)
			{
				if (device->config->reportFormat == Config::Debug)
					printf("%sPort Name Line:%s %s\n", device->config->COL_GREEN, device->config->COL_RESET, line);

				interfacePointer->description.assign(strstr(line, command->part(3)));
			}

			// All others...
			else
				device->lineNotProcessed(line);

			listPointer = listPointer->next;
		}

		// Delete list
		while (tempList != 0)
		{
			listPointer = tempList->next;
			delete tempList;
			tempList = listPointer;
		}
	}

	// All others...
	else
		device->lineNotProcessed(line);

	return 0;
}