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
PortSecurity Class Reference

PortSecurity handles and manipulates port security on switch ports. More...

Inheritance diagram for PortSecurity:
Process

Public Member Functions

bool isEnabled ()
 Returns true if port security is enabled, otherwise false. More...
 
void setEnabled (bool)
 Enables or disables port security. More...
 
bool setMaxMacNumber (int)
 Sets the port security max-mac-count. More...
 
int getMaxMacNumber ()
 Returns the port security max-mac-count. More...
 
int getTotalMac ()
 Returns the total number of MAC addresses. More...
 
int getViolationCount ()
 Returns the number of violations. More...
 
pair< mac, int > getLastSourceMacVlan ()
 Returns the last source MAC address and VLAN number. More...
 
void setViolationMode (PortViolation)
 Sets the violation mode. More...
 
bool addSecureMacEntry (mac, bool)
 Adds a secure MAC address entry. More...
 
bool removeSecureMacEntry (mac)
 Removes the specified secure MAC address entry. More...
 
int getSecureMacCount ()
 Returns the number of secure MAC addresses. More...
 
bool secureMacExist (mac)
 Returns true if the specified secure MAC address exists, otherwise false. More...
 
Port getPort ()
 Returns the switch port. More...
 
bool isStickyOn ()
 Returns true if sticky is enabled, otherwise false. More...
 
void setStickyflag (bool)
 Enables or disables sticky. More...
 
- Public Member Functions inherited from Process
Device getOwnerDevice ()
 Returns the device for this process. More...
 

Detailed Description

PortSecurity handles and manipulates port security on switch ports.

Member Function Documentation

◆ addSecureMacEntry()

bool PortSecurity::addSecureMacEntry ( mac  ,
bool   
)

Adds a secure MAC address entry.

Parameters
macAddress,theMAC address to add.
isSticky,truefor sticky, false for not sticky.
Returns
bool, true if successful, otherwise false.

◆ getLastSourceMacVlan()

pair< mac, int > PortSecurity::getLastSourceMacVlan ( )

Returns the last source MAC address and VLAN number.

Returns
pair<mac, int>, the last source MAC address and VLAN number.

◆ getMaxMacNumber()

int PortSecurity::getMaxMacNumber ( )

Returns the port security max-mac-count.

Returns
int, the port security max-mac-count value.

◆ getPort()

Port PortSecurity::getPort ( )

Returns the switch port.

Returns
Port, the Port object.

◆ getSecureMacCount()

int PortSecurity::getSecureMacCount ( )

Returns the number of secure MAC addresses.

Returns
int, the number of secure MAC addresses.

◆ getTotalMac()

int PortSecurity::getTotalMac ( )

Returns the total number of MAC addresses.

Returns
int, the total number of MAC addresses.

◆ getViolationCount()

int PortSecurity::getViolationCount ( )

Returns the number of violations.

Returns
int, the number of violations.

◆ isEnabled()

bool PortSecurity::isEnabled ( )

Returns true if port security is enabled, otherwise false.

Returns
bool, true if port security is enabled, otherwise false.

◆ isStickyOn()

bool PortSecurity::isStickyOn ( )

Returns true if sticky is enabled, otherwise false.

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

◆ removeSecureMacEntry()

bool PortSecurity::removeSecureMacEntry ( mac  )

Removes the specified secure MAC address entry.

Parameters
macAddress,theMAC address to remove.
Returns
bool, true if successful, otherwise false.

◆ secureMacExist()

bool PortSecurity::secureMacExist ( mac  )

Returns true if the specified secure MAC address exists, otherwise false.

Parameters
macAddress,theMAC address of interest.
Returns
bool, true if the specified secure MAC address exists, otherwise false.

◆ setEnabled()

void PortSecurity::setEnabled ( bool  )

Enables or disables port security.

Parameters
bEnable,trueto enable port security, false to disable it.

◆ setMaxMacNumber()

bool PortSecurity::setMaxMacNumber ( int  )

Sets the port security max-mac-count.

Parameters
max,theport security max-mac-count value.
Returns
bool, true if successful, otherwise false.

◆ setStickyflag()

void PortSecurity::setStickyflag ( bool  )

Enables or disables sticky.

Parameters
isSticky,trueto enable sticky, false to disable it.

◆ setViolationMode()

void PortSecurity::setViolationMode ( PortViolation  )

Sets the violation mode.

Parameters
type,theviolation mode. Violation modes: eShutdown = 0, eProtect = 1, eRestrict = 2

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