Cisco Packet Tracer Extensions API 8.1.0
API for communication between Cisco Packet Tracer application and its extension applications and modules.
Public Member Functions | List of all members
SwitchPort Class Reference

SwitchPort handles and manipulates switch ports. More...

Inheritance diagram for SwitchPort:
Port Process

Public Member Functions

void setAccessPort (bool)
 Enables or disables switch mode access. More...
 
bool isAccessPort ()
 Returns true if switch mode access is enabled, otherwise false. More...
 
void setAccessVlan (int)
 Sets the access VLAN. More...
 
int getAccessVlan ()
 Returns the access VLAN. More...
 
void addTrunkVlans (int, int)
 Adds trunk VLANs. More...
 
void removeTrunkVlans (int, int)
 Removes the specified trunk VLANs. More...
 
void setCdpEnable (bool)
 Enables or disables CDP. More...
 
bool isCdpEnable ()
 Returns true if CDP is enabled, otherwise false. More...
 
void setNativeVlanId (int)
 Sets the native VLAN ID. More...
 
int getNativeVlanId ()
 Returns the native VLAN ID. More...
 
void setVoipVlanId (int)
 Sets the VOIP VLAN ID. More...
 
int getVoipVlanId ()
 Returns the VOIP VLAN ID. More...
 
void setNonegotiateFlag (bool)
 Enables or disables nonnegotiate. More...
 
bool isNonegotiate ()
 Returns true if this nonnegotiate is enabled, otherwise false. More...
 
void setAdminOpMode (SwitchPortMode)
 Sets the admin op port mode. More...
 
int getAdminOpMode ()
 Returns the admin op port mode. More...
 
bool isAdminModeSet ()
 Returns true if admin op port mode is set, otherwise false. More...
 
PortSecurity getPortSecurity ()
 Returns the port security. More...
 
- Public Member Functions inherited from Port
string getName ()
 Returns the name of the port. More...
 
int getChannel ()
 Returns the channel of the port. More...
 
void setChannel (int)
 Sets the channel of the port. More...
 
string getTerminalTypeShortString ()
 Returns the name of the port shortened, without number. More...
 
string getPortNameNumber ()
 Returns the port number. Can have something like 0/0/0, etc. More...
 
PortType getType ()
 Returns the type of the port. More...
 
void setDescription (string)
 Sets the description for the port. More...
 
string getDescription ()
 Returns the description of the port. More...
 
void setPower (bool)
 Sets the power state for the port. More...
 
bool getPower ()
 Returns true if the port is on, false if the port is off. More...
 
void powerChanged (bool)
 This event is emitted when the power state of the port changes. More...
 
bool isStraightPins ()
 Returns true if the pins are straight, for ethernet. More...
 
bool isAutoCross ()
 Returns true if the port is configured for auto crossover, for ethernet. More...
 
void setBandwidth (int)
 Sets the bandwidth for the port. More...
 
int getBandwidth ()
 Returns the bandwidth of the port. More...
 
void setBandwidthAutoNegotiate (bool)
 Enables or disables bandwidth auto negotiation. More...
 
bool isBandwidthAutoNegotiate ()
 Returns true if bandwidth auto negotiation is enabled, otherwise false. More...
 
void setFullDuplex (bool)
 Enables or disables full duplex mode. More...
 
bool isFullDuplex ()
 Returns true if full duplex mode is enabled, otherwise false. More...
 
void setDuplexAutoNegotiate (bool)
 Enables or disables duplex auto negotiation. More...
 
bool isDuplexAutoNegotiate ()
 Returns true if duplex auto negotiation is enabled, otherwise false. More...
 
void setMacAddress (mac)
 Sets the MAC address on the port. More...
 
mac getMacAddress ()
 Returns the MAC address set on the port. More...
 
void macChanged (mac, mac)
 This event is emitted when the MAC address on the port changes. More...
 
mac getBia ()
 Returns the burned-in address of the port. More...
 
void setClockRate (int)
 Sets the clock rate on the port. More...
 
int getClockRate ()
 Returns the clock rate on the port. More...
 
Link getLink ()
 Returns the link connected to the port. More...
 
bool isProtocolUp ()
 Returns true if the line protocol is up on the port, otherwise false. More...
 
bool isPortUp ()
 Returns true if the status is up on the port, otherwise false. More...
 
Process getEncapProcess ()
 Returns the encapsulation process. More...
 
Process getKeepAliveProcess ()
 Returns the keepalive process. More...
 
QString getRemotePortName ()
 Returns the name of the remote port. More...
 
LightStatus getLightStatus ()
 Returns the link light status. More...
 
void lightStatusChanged (LightStatus)
 This event is emitted when the link light changes. More...
 
void lightBlinked ()
 This event is emitted when the link light blinks. More...
 
void portStatusChanged (bool)
 This event is emitted when the port status changes. More...
 
void lineProtocolChanged (bool)
 This event is emitted when the line protocol status changes. More...
 
void packetReceived (string, int)
 This event is emitted when the port receives a packet. More...
 
void packetSent (string, int)
 This event is emitted when the port sends a packet. More...
 
void packetReceivedWithDetails (Signal, int)
 This event is emitted when the port receives a packet with details. More...
 
void packetSentWithDetails (Signal, int)
 This event is emitted when the port sends a packet with details. More...
 
int getHigherProcessCount ()
 Returns the higher process count. More...
 
HardwareQueue getHardwareQueue ()
 Returns the hardware queue. More...
 
QueueProcess getQosQueue ()
 Returns the qos queue. More...
 
bool isEthernetPort ()
 Returns true if it is a ethernet port, false if not. More...
 
bool isWirelessPort ()
 Returns true if it is a wireless port, false if not. More...
 
bool isPowerOn ()
 Returns true if the power is on, false if not. More...
 
void deleteLink ()
 
- Public Member Functions inherited from Process
Device getOwnerDevice ()
 Returns the device for this process. More...
 

Detailed Description

SwitchPort handles and manipulates switch ports.

Member Function Documentation

◆ addTrunkVlans()

void SwitchPort::addTrunkVlans ( int  ,
int   
)

Adds trunk VLANs.

Parameters
start,thefirst trunk VLAN number.
end,thelast trunk VLAN number.

◆ getAccessVlan()

int SwitchPort::getAccessVlan ( )

Returns the access VLAN.

Returns
int, the VLAN number.

◆ getAdminOpMode()

int SwitchPort::getAdminOpMode ( )

Returns the admin op port mode.

Returns
int, the port mode. Port modes: eAdminDynamicDesirable = 0, eAdminDynamicAuto = 1, eAdminOperationTrunk = 2, eAdminOperationAccess = 3

◆ getNativeVlanId()

int SwitchPort::getNativeVlanId ( )

Returns the native VLAN ID.

Returns
int, the native VLAN number.

◆ getPortSecurity()

PortSecurity SwitchPort::getPortSecurity ( )

Returns the port security.

Returns
PortSecurity, the PortSecurity object.

◆ getVoipVlanId()

int SwitchPort::getVoipVlanId ( )

Returns the VOIP VLAN ID.

Returns
int, the VOIP VLAN number.

◆ isAccessPort()

bool SwitchPort::isAccessPort ( )

Returns true if switch mode access is enabled, otherwise false.

Returns
bool, true if switch mode access is enabled, otherwise false.

◆ isAdminModeSet()

bool SwitchPort::isAdminModeSet ( )

Returns true if admin op port mode is set, otherwise false.

Returns
bool, true if admin op port mode is set, otherwise false.

◆ isCdpEnable()

bool SwitchPort::isCdpEnable ( )

Returns true if CDP is enabled, otherwise false.

Returns
bool, true if CDP is enabled, otherwise false.

◆ isNonegotiate()

bool SwitchPort::isNonegotiate ( )

Returns true if this nonnegotiate is enabled, otherwise false.

Returns
bool, true if this nonnegotiate is enabled, otherwise false.

◆ removeTrunkVlans()

void SwitchPort::removeTrunkVlans ( int  ,
int   
)

Removes the specified trunk VLANs.

Parameters
start,thefirst trunk VLAN number.
end,thelast trunk VLAN number.

◆ setAccessPort()

void SwitchPort::setAccessPort ( bool  )

Enables or disables switch mode access.

Parameters
bAccessPort,trueto enable switch mode access, false to disable it.

◆ setAccessVlan()

void SwitchPort::setAccessVlan ( int  )

Sets the access VLAN.

Parameters
int,theVLAN number.

◆ setAdminOpMode()

void SwitchPort::setAdminOpMode ( SwitchPortMode  )

Sets the admin op port mode.

Parameters
type,theport mode. Port modes: eAdminDynamicDesirable = 0, eAdminDynamicAuto = 1, eAdminOperationTrunk = 2, eAdminOperationAccess = 3

◆ setCdpEnable()

void SwitchPort::setCdpEnable ( bool  )

Enables or disables CDP.

Parameters
bCDPEnable,trueto enable CDP, false to disable it.

◆ setNativeVlanId()

void SwitchPort::setNativeVlanId ( int  )

Sets the native VLAN ID.

Parameters
vlanID,thenative VLAN number.

◆ setNonegotiateFlag()

void SwitchPort::setNonegotiateFlag ( bool  )

Enables or disables nonnegotiate.

Parameters
bFlag,trueto enable nonnegotiate, false to disable it.

◆ setVoipVlanId()

void SwitchPort::setVoipVlanId ( int  )

Sets the VOIP VLAN ID.

Parameters
vlanID,theVOIP VLAN number.

The documentation for this class was generated from the following file: