The following are the system-provided Python API PPPoE packets:
The system provides a Python object for input PPPoE packet: alc.pppoe.
alc.pppoe class is always available even when Python script is trigger by other type of packet that encapsulated in PPPoE, such as LCP/IPCP/PAP/CHAP, and so on.
alc.pppoe has the following attributes to represent the PPPoE header fields.
Table: System provided Python API PPPoE packets displays information about system-provided Python API PPPoE packets.
Class attributes | PPPoE header field | Access |
---|---|---|
alc.pppoe.dest_mac |
Str, destination MAC address; the format is ‟xx:xx:xx:xx:xx:xx” |
Read |
alc.pppoe.src_mac |
Str, source MAC address; the format is ‟xx:xx:xx:xx:xx:xx” |
Read |
alc.pppoe.port_id |
Str, the port-id of the PPPoE session like ‟1/1/3” |
Read |
alc.pppoe.vlan_tag |
Str, the vlan tag of the PPPoE session like ‟100” or ‟100.200” |
Read |
alc.pppoe.ver |
Integer, ver field in PPPoE header |
Read |
alc.pppoe.type |
Integer, type field in PPPoE header |
Read |
alc.pppoe.code |
Integer, code field in PPPoE header |
Read |
alc.pppoe.session_id |
Integer, session_id field in PPPoE header |
Read |
alc.pppoe.len |
Integer, length field in PPPoE header |
Read |
The following is a list of functions of alic.pppoe:
alc.pppoe.drop()
The system drops the resulting packet.
alc.pppoe.getTagList()
The system returns a tuple that includes tag-type of existing PPPoE tags in the packet. The order of the element in the tuple is as same as the tags appear in the packet. If there are multiple instances of same option, then each instance is one element in the tuple.
alc.pppoe.get(tag-type)
The system returns a tuple of strings, each string represent one instance of the specified tags, the value of this string is exact bytes of the tag_value as it appears in packet (excludes tag_type and tag_len); if tag does not exist, return (); if a specific instance’s tag_length=0, return ‟” for this instance.
alc.pppoe.set(tag-type,valTuple)
This function removes all the existing instances of specified tags and insert a list of new tags. Each element in valTuple is a string, represent one instance of the new tag to be inserted. For each new option, the type is specified in tag-type, the option-len is the length of the element, reset of option is the element itself.
alc.pppoe.clear(tag-type)
This function removes all the existing instances of specified tags. In fact this function is a shortcut version of alc.pppoe.set(tag-type,()).
alc.pppoe.getPPP()
This function returns an alc.ppp object which represent the LCP/IPCP/IP6CP packet encapsulated inside the PPPoE packet. It returns none if there is no such packet.
alc.pppoe.getPAP()
This function returns an alc.pap object which represents the PAP packet encapsulated inside the PPPoE packet. It returns none if there is no PAP packet.
alc.pppoe.setPAP(pap_obj)
This function accepts an alc.pap object as the parameter and replace the existing PAP packet that encapsulated in the PPPoE packet. An exception is raised when there is no existing PAP packet.
alc.pppoe.getCHAP()
This function returns an alc.chap object, which represent the CHAP packet encapsulated inside the PPPoE packet. It returns none if there is no CHAP packet.
alc.pppoe.setCHAP(chap_obj)
This function accepts an alc.chap object as the parameter and replace the existing CHAP packet that encapsulated in the PPPoE packet. An exception is raised when there is no existing CHAP packet.