The system provides a python object for PAP packet encapsulated in the input PPPoE packets: alc.pap.
Use alc.pppoe.getPAP() to get the alc.pap object in the input PPPoE packet.
To apply changes to PAP packet, alc.pppoe.setPAP(new_alc.pap_obj) must be called.
Table: PAP header fields provides PAP header field information. alc.pap has following attributes to represent the PAP header fields:
Class attributes | PAP field | Access |
---|---|---|
alc.pap.code |
Integer, code field in pap protocol header |
Read |
alc.pap.id |
Integer, identifier field in pap protocol header |
Read |
alc.pap.len |
Integer, length field in pap protocol header |
Read |
The following is a list of functions in the class:
alc.pap.getCred()
Only apply to Authentication-Request packet. Returns a tuple: (peer-id, password), both are str. If either of them has 0 length, it is ‟”; if the system failed to parse the packet, such as the length < 6 bytes or the packet is not an authentication-request, then the system raises an exception. If the packet has a wrong type it returns None (that is, no exception is raised).
alc.pap.setCred(cred_tuple)
Only apply to Authentication-Request packet. Set the peer-id and password to cred_tuple; cred_tuple is a tuple:(peer-id, password) both are str. ‟” is allowed as the value for either of them. If the packet is not authentication-request, then system raises an exception.
alc.pap.getMsg()
Only apply to Authentication-Ack/Nak packet. Return the message in the packet as a str; return ‟” if len of message is 0; raise an exception for wrong type of packet (such as an auth-request). If the packet has a wrong type it returns None (that is, no exception is raised).
alc.pap.setMsg(msg)
Only apply to Authentication-Ack/Nak packet. set the message in the packet to parameter msg; msg is a str; ‟” is allowed; raise an exception for wrong type of packet (such as an auth-request).