|
PCS
0.4
|
Public Member Functions | |
| def | getbytes |
| def | decode |
| def | encode |
| def | __init__ |
| def | __add__ |
| def | __setattr__ |
| def | __getattribute__ |
| def | __eq__ |
| def | __ne__ |
| def | matches |
| def | wildcard_mask |
| def | __repr__ |
| def | println |
| def | __str__ |
| def | __len__ |
| def | __div__ |
| def | __copy__ |
| def | __deepcopy__ |
| def | chain |
| def | next |
| def | rdiscriminate |
| def | calc_checksum |
| def | calc_length |
| def | sizeof |
| def | toXML |
| def | fromXML |
| def | toHTML |
| def | fromHTML |
Properties | |
| bytes = property(getbytes, decode) | |
A Packet is a base class for building real packets. Assigning a value to any field of a Packet, whether by keyword argument passed to a constructor, or by using the assignment operator, will cause a default comparison function to be installed. This is to make it easy to specify match filters for Connector.expect().
| def pcs.Packet.__init__ | ( | self, | |
layout = None, |
|||
bytes = None, |
|||
| kv | |||
| ) |
initialize a Packet object
layout - the layout of the packet, a list of Field objects
bytes - if the packet is being set up now the bytes to set in it
kv - if the packet is being set up now, the initial values of
each named field, specified as keyword arguments. These
are always passed as a dict from classes which inherit
from Packet.
Reimplemented in pcs.packets.rtnetlink.rtmsg, pcs.packets.bsdrtmsg.rtmsghdr, pcs.packets.rtnetlink.prefixmsg, pcs.packets.rtnetlink.ifinfomsg, pcs.packets.bsdrtmsg.rt_msg, pcs.packets.rtnetlink.ifaddrmsg, pcs.packets.bsdrtmsg.if_ieee80211_msg, pcs.packets.bsdrtmsg.ieee80211_michael_event, pcs.packets.bsdrtmsg.ieee80211_replay_event, pcs.packets.sctp.shutdown_complete, pcs.packets.bsdrtmsg.ieee80211_leave_event, pcs.packets.sctp.cookie_ack, pcs.packets.bsdrtmsg.ieee80211_join_event, pcs.packets.igmpv3.report, pcs.packets.sctp.cookie_echo, pcs.packets.bsdrtmsg.if_state_msg, pcs.packets.sctp.operation_error, pcs.packets.ptp.DelayResponse, pcs.packets.ieee80211.plcp, pcs.packets.bsdrtmsg.if_maddr_msg, pcs.packets.sctp.shutdown_ack, pcs.packets.ipv4.pseudoipv4, pcs.packets.bsdrtmsg.if_addr_msg, pcs.packets.ptp.Followup, pcs.packets.sctp.shutdown, pcs.packets.sctp.abort, pcs.packets.bsdrtmsg.if_link_msg, pcs.packets.ieee80211.frame, pcs.packets.radiotap.radiotap, pcs.packets.sctp.heartbeat, pcs.packets.ieee8023ad.slowhdr, pcs.packets.bgp.header, pcs.packets.icmpv6.icmpv6option, pcs.packets.ieee8021d.bpdu, pcs.packets.sctp.sack, pcs.packets.ptp.DelayRequest, pcs.packets.mpls.lse, pcs.packets.rtp.sender, pcs.packets.icmpv4.icmpv4, pcs.packets.netlink.nlmsghdr, pcs.packets.ieee8023ad.marker, pcs.packets.bgp.open, pcs.packets.sctp.init, pcs.packets.mpls.ldphdr, pcs.packets.rtp.rtcp, pcs.packets.ieee8023ad.lacp, pcs.packets.ipv4.ipv4, pcs.packets.icmpv4.icmpv4echo, pcs.packets.ieee8021d.stp, pcs.packets.bgp.update, pcs.packets.netlink.nlmsg_error, pcs.packets.mtrace.reply, pcs.packets.mpls.ldpmsg, pcs.packets.sctp.payload, pcs.packets.llc.llc, pcs.packets.dvmrp.dvmrp, pcs.packets.icmpv6.icmpv6, pcs.packets.ieee8021d.garp, pcs.packets.dhcpv4.dhcpv4, pcs.packets.ipsec.esp, pcs.packets.bgp.notification, pcs.packets.igmpv3.query, pcs.packets.ipv6.ipv6, pcs.packets.ethernet.ethernet, pcs.packets.arp.arp, pcs.packets.mtrace.query, pcs.packets.rtp.rtp, pcs.packets.igmpv2.igmpv2, pcs.packets.sctp.common, pcs.packets.ymsgr.ymsg_hdr, pcs.packets.tcp.tcp, pcs.packets.vlan.vlan, pcs.packets.igmp.igmp, pcs.packets.localhost.localhost, pcs.packets.udp.udp, pcs.packets.payload.payload, pcs.packets.nd6.nd6_solicit, pcs.packets.ptp_common.Common, pcs.packets.tcpv6.tcpv6, pcs.packets.udpv4.udpv4, pcs.packets.udpv6.udpv6, pcs.packets.ipsec.ah, pcs.packets.ptp.Sync, pcs.packets.http.http, and pcs.packets.null.null.
References pcs.LengthValueField.__setattr__(), pcs.TypeValueField.__setattr__(), pcs.TypeLengthValueField.__setattr__(), pcs.Packet.__setattr__(), pcs.Packet._discriminator, pcs.Packet._discriminator_inited, pcs.Packet._fieldnames, pcs.Packet._head, pcs.Layout._layout, pcs.Packet._layout, pcs.Packet._needencode, pcs.Field.decode(), pcs.StringField.decode(), pcs.LengthValueField.decode(), pcs.TypeValueField.decode(), pcs.TypeLengthValueField.decode(), pcs.OptionListField.decode(), and pcs.Packet.decode().
Referenced by pcs.packets.dns.dnsheader.__init__(), pcs.packets.http.http.__init__(), pcs.packets.null.null.__init__(), pcs.packets.pseudoipv6.pseudoipv6.__init__(), pcs.packets.ptp.Sync.__init__(), pcs.packets.ipsec.ah.__init__(), pcs.packets.tcpv6.tcpv6.__init__(), pcs.packets.nd6.nd6_solicit.__init__(), pcs.packets.ptp_common.Common.__init__(), pcs.packets.payload.payload.__init__(), pcs.packets.udp.udp.__init__(), pcs.packets.igmp.igmp.__init__(), pcs.packets.localhost.localhost.__init__(), pcs.packets.tcp.tcp.__init__(), pcs.packets.vlan.vlan.__init__(), pcs.packets.ymsgr.ymsg_hdr.__init__(), pcs.packets.sctp.common.__init__(), pcs.packets.rtp.rtp.__init__(), pcs.packets.arp.arp.__init__(), pcs.packets.ethernet.ethernet.__init__(), pcs.packets.ipv6.ipv6.__init__(), pcs.packets.bgp.notification.__init__(), pcs.packets.ipsec.esp.__init__(), pcs.packets.dhcpv4.dhcpv4.__init__(), pcs.packets.ieee8021d.garp.__init__(), pcs.packets.icmpv6.icmpv6.__init__(), pcs.packets.ymsgr.ymsg_key_value.__init__(), pcs.packets.llc.llc.__init__(), pcs.packets.sctp.payload.__init__(), pcs.packets.mpls.ldpmsg.__init__(), pcs.packets.netlink.nlmsg_error.__init__(), pcs.packets.bgp.update.__init__(), pcs.packets.ieee8021d.stp.__init__(), pcs.packets.dns.dnslabel.__init__(), pcs.packets.icmpv4.icmpv4echo.__init__(), pcs.packets.ieee8023ad.lacp.__init__(), pcs.packets.ipv4.ipv4.__init__(), pcs.packets.rtp.rtcp.__init__(), pcs.packets.dns.dnsquery.__init__(), pcs.packets.mpls.ldphdr.__init__(), pcs.packets.sctp.init.__init__(), pcs.packets.bgp.open.__init__(), pcs.packets.ieee8023ad.marker.__init__(), pcs.packets.netlink.nlmsghdr.__init__(), pcs.packets.dns.dnsrr.__init__(), pcs.packets.icmpv4.icmpv4.__init__(), pcs.packets.rtp.sender.__init__(), pcs.packets.mpls.lse.__init__(), pcs.packets.ptp.DelayRequest.__init__(), pcs.packets.sctp.sack.__init__(), pcs.packets.ieee8021d.bpdu.__init__(), pcs.packets.icmpv6.icmpv6option.__init__(), pcs.packets.bgp.header.__init__(), pcs.packets.ieee8023ad.slowhdr.__init__(), pcs.packets.sctp.heartbeat.__init__(), pcs.packets.radiotap.radiotap.__init__(), pcs.packets.ieee80211.frame.__init__(), pcs.packets.bsdrtmsg.if_link_msg.__init__(), pcs.packets.sctp.abort.__init__(), pcs.packets.sctp.shutdown.__init__(), pcs.packets.ptp.Followup.__init__(), pcs.packets.bsdrtmsg.if_addr_msg.__init__(), pcs.packets.ipv4.pseudoipv4.__init__(), pcs.packets.sctp.shutdown_ack.__init__(), pcs.packets.bsdrtmsg.if_maddr_msg.__init__(), pcs.packets.ieee80211.plcp.__init__(), pcs.packets.ptp.DelayResponse.__init__(), pcs.packets.sctp.operation_error.__init__(), pcs.packets.bsdrtmsg.if_state_msg.__init__(), pcs.packets.sctp.cookie_echo.__init__(), pcs.packets.bsdrtmsg.ieee80211_join_event.__init__(), pcs.packets.sctp.cookie_ack.__init__(), pcs.packets.bsdrtmsg.ieee80211_leave_event.__init__(), pcs.packets.sctp.shutdown_complete.__init__(), pcs.packets.bsdrtmsg.ieee80211_replay_event.__init__(), pcs.packets.bsdrtmsg.ieee80211_michael_event.__init__(), pcs.packets.bsdrtmsg.if_ieee80211_msg.__init__(), pcs.packets.rtnetlink.ifaddrmsg.__init__(), pcs.packets.bsdrtmsg.rt_msg.__init__(), pcs.packets.rtnetlink.ifinfomsg.__init__(), pcs.packets.rtnetlink.prefixmsg.__init__(), pcs.packets.bsdrtmsg.rtmsghdr.__init__(), and pcs.packets.rtnetlink.rtmsg.__init__().
| def pcs.Packet.__add__ | ( | self, | |
layout = None |
|||
| ) |
add two packets together This is really an append operation, of one packet after another.
References pcs.Packet._needencode.
| def pcs.Packet.__copy__ | ( | self | ) |
Return a shallow copy of a Packet; used by copy module. This is always implemented as a deep copy.
References pcs.Field.__deepcopy__(), pcs.LengthValueField.__deepcopy__(), pcs.TypeValueField.__deepcopy__(), pcs.TypeLengthValueField.__deepcopy__(), pcs.OptionListField.__deepcopy__(), and pcs.Packet.__deepcopy__().
| def pcs.Packet.__deepcopy__ | ( | self, | |
memo = {} |
|||
| ) |
Return a deep copy of a Packet; used by copy module. All derived classes of Packet create a new instance of Layout and what it contains every time they are constructed. We need to preserve that API contract down here in the lower layers; and we need to return an instance of the derived class, so we call its default constructor, and make a deep copy of all the field values here. The backing store in self.bytes is an immutable buffer which is dynamically reallocated when changed, so we can either copy it or forget about it.
References pcs.Packet._fieldnames.
Referenced by pcs.Packet.__copy__(), and pcs.Chain.__copy__().
| def pcs.Packet.__div__ | ( | self, | |
| packet | |||
| ) |
/ operator: Insert a packet after this packet in a chain. If I am not already part of a chain, build one. If the discriminator field in this packet has not been explicitly initialized, either by assignment or by constructor keyword arguments, then attempt to initialize it based on the type of the packet being appended. The packet being appended will have its head pointer overwritten to point to the chain it is being appended to. The head of the chain is always returned.
References pcs.Packet._discriminator_inited, pcs.Packet._head, pcs.Packet.chain(), and pcs.Packet.rdiscriminate().
| def pcs.Packet.__eq__ | ( | self, | |
| other | |||
| ) |
Do a comparison of the packets data, including fields and bytes.
References pcs.Packet._fieldnames, pcs.Layout._layout, pcs.Packet._layout, and pcs.Packet.bytes.
Referenced by pcs.packets.igmpv3.GroupRecordField.__eq__(), pcs.packets.rtnetlink.NexthopField.__eq__(), pcs.Packet.__ne__(), and pcs.Chain.__ne__().
| def pcs.Packet.__getattribute__ | ( | self, | |
| name | |||
| ) |
Getting an attribute means we may have extended an option. If we append to an options list we have to reencode the bytes.
| def pcs.Packet.__len__ | ( | self | ) |
Return the count of the number of bytes in the packet.
References pcs.Packet.bytes.
| def pcs.Packet.__ne__ | ( | self, | |
| other | |||
| ) |
Do a comparison of the packets data, including fields and bytes.
References pcs.OptionListField.__eq__(), and pcs.Packet.__eq__().
| def pcs.Packet.__repr__ | ( | self | ) |
Walk the entire packet and return the values of the fields.
Reimplemented in pcs.packets.ethernet.ethernet.
References pcs.packets.null.null.description, pcs.packets.nd6.nd6_solicit.description, pcs.packets.http.http.description, pcs.packets.igmp.igmp.description, pcs.packets.localhost.localhost.description, pcs.packets.payload.payload.description, pcs.packets.ipsec.ah.description, pcs.packets.udp.udp.description, pcs.packets.igmpv2.igmpv2.description, pcs.packets.vlan.vlan.description, pcs.packets.sctp.common.description, pcs.packets.ethernet.ethernet.description, pcs.packets.tcpv6.tcpv6.description, pcs.packets.ymsgr.ymsg_hdr.description, pcs.packets.ptp_common.Common.description, pcs.packets.rtp.rtp.description, pcs.packets.arp.arp.description, pcs.packets.tcp.tcp.description, pcs.packets.ipv6.ipv6.description, pcs.packets.bgp.notification.description, pcs.packets.mtrace.query.description, pcs.packets.dns.dnsheader.description, pcs.packets.ieee8021d.garp.description, pcs.packets.ipsec.esp.description, pcs.packets.igmpv3.query.description, pcs.packets.dvmrp.dvmrp.description, pcs.packets.llc.llc.description, pcs.packets.netlink.nlmsg_error.description, pcs.packets.mpls.ldpmsg.description, pcs.packets.dhcpv4.dhcpv4.description, pcs.packets.sctp.payload.description, pcs.packets.bgp.update.description, pcs.packets.mtrace.reply.description, pcs.packets.dns.dnslabel.description, pcs.packets.icmpv4.icmpv4echo.description, pcs.packets.ieee8023ad.lacp.description, pcs.packets.ieee8021d.stp.description, pcs.packets.rtp.rtcp.description, pcs.packets.dns.dnsquery.description, pcs.packets.ptp.Sync.description, pcs.packets.mpls.ldphdr.description, pcs.packets.ipv4.ipv4.description, pcs.packets.sctp.init.description, pcs.packets.bgp.open.description, pcs.packets.icmpv4.icmpv4.description, pcs.packets.netlink.nlmsghdr.description, pcs.packets.mpls.lse.description, pcs.packets.ieee8023ad.marker.description, pcs.packets.rtp.sender.description, pcs.packets.dns.dnsrr.description, pcs.packets.ieee8021d.bpdu.description, pcs.packets.sctp.sack.description, pcs.packets.bgp.header.description, pcs.packets.ieee8023ad.slowhdr.description, pcs.packets.sctp.heartbeat.description, pcs.packets.radiotap.radiotap.description, pcs.packets.ieee80211.frame.description, pcs.packets.bsdrtmsg.if_link_msg.description, pcs.packets.sctp.abort.description, pcs.packets.ptp.DelayRequest.description, pcs.packets.sctp.shutdown.description, pcs.packets.bsdrtmsg.if_addr_msg.description, pcs.packets.ptp.Followup.description, pcs.packets.ipv4.pseudoipv4.description, pcs.packets.sctp.shutdown_ack.description, pcs.packets.bsdrtmsg.if_maddr_msg.description, pcs.packets.ieee80211.plcp.description, pcs.packets.sctp.operation_error.description, pcs.packets.ptp.DelayResponse.description, pcs.packets.bsdrtmsg.if_state_msg.description, pcs.packets.sctp.cookie_echo.description, pcs.packets.bsdrtmsg.ieee80211_join_event.description, pcs.packets.igmpv3.report.description, pcs.packets.sctp.cookie_ack.description, pcs.packets.bsdrtmsg.ieee80211_leave_event.description, pcs.packets.sctp.shutdown_complete.description, pcs.packets.bsdrtmsg.ieee80211_replay_event.description, pcs.packets.bsdrtmsg.ieee80211_michael_event.description, pcs.packets.bsdrtmsg.if_ieee80211_msg.description, pcs.packets.rtnetlink.ifaddrmsg.description, pcs.packets.bsdrtmsg.rt_msg.description, pcs.packets.rtnetlink.ifinfomsg.description, pcs.packets.rtnetlink.prefixmsg.description, pcs.packets.bsdrtmsg.rtmsghdr.description, and pcs.packets.rtnetlink.rtmsg.description.
Referenced by pcs.Packet.println().
| def pcs.Packet.__setattr__ | ( | self, | |
| name, | |||
| value | |||
| ) |
Setting the layout is a special case because of the ramifications this has on the packet. Only fields represented in the layout may be set, no other attributes may be added
References pcs.Packet._bitlength, pcs.Packet._discriminator, pcs.Packet._discriminator_inited, pcs.Packet._fieldnames, pcs.Layout._layout, pcs.Packet._layout, and pcs.Packet._needencode.
Referenced by pcs.Packet.__init__().
| def pcs.Packet.__str__ | ( | self | ) |
Pretty print, with returns, the fields of the packet.
Reimplemented in pcs.packets.rtnetlink.rtmsg, pcs.packets.bsdrtmsg.rtmsghdr, pcs.packets.bsdrtmsg.rt_msg, pcs.packets.radiotap.radiotap, pcs.packets.bsdrtmsg.if_link_msg, pcs.packets.tcp.tcp, pcs.packets.netlink.nlmsghdr, pcs.packets.ipv4.ipv4, pcs.packets.dhcpv4.dhcpv4, pcs.packets.icmpv4.icmpv4, pcs.packets.ieee8021d.stp, pcs.packets.ethernet.ethernet, pcs.packets.igmp.igmp, pcs.packets.ipv6.ipv6, pcs.packets.arp.arp, pcs.packets.tcpv6.tcpv6, pcs.packets.igmpv2.igmpv2, pcs.packets.payload.payload, pcs.packets.http.http, pcs.packets.null.null, and pcs.packets.ipcomp.ipcomp.
References pcs.Packet._fieldnames, pcs.Layout._layout, pcs.Packet._layout, pcs.packets.null.null.description, pcs.packets.nd6.nd6_solicit.description, pcs.packets.http.http.description, pcs.packets.igmp.igmp.description, pcs.packets.localhost.localhost.description, pcs.packets.payload.payload.description, pcs.packets.ipsec.ah.description, pcs.packets.udp.udp.description, pcs.packets.igmpv2.igmpv2.description, pcs.packets.vlan.vlan.description, pcs.packets.sctp.common.description, pcs.packets.ethernet.ethernet.description, pcs.packets.tcpv6.tcpv6.description, pcs.packets.ymsgr.ymsg_hdr.description, pcs.packets.ptp_common.Common.description, pcs.packets.rtp.rtp.description, pcs.packets.arp.arp.description, pcs.packets.tcp.tcp.description, pcs.packets.ipv6.ipv6.description, pcs.packets.bgp.notification.description, pcs.packets.mtrace.query.description, pcs.packets.dns.dnsheader.description, pcs.packets.ieee8021d.garp.description, pcs.packets.ipsec.esp.description, pcs.packets.igmpv3.query.description, pcs.packets.dvmrp.dvmrp.description, pcs.packets.llc.llc.description, pcs.packets.netlink.nlmsg_error.description, pcs.packets.mpls.ldpmsg.description, pcs.packets.dhcpv4.dhcpv4.description, pcs.packets.sctp.payload.description, pcs.packets.bgp.update.description, pcs.packets.mtrace.reply.description, pcs.packets.dns.dnslabel.description, pcs.packets.icmpv4.icmpv4echo.description, pcs.packets.ieee8023ad.lacp.description, pcs.packets.ieee8021d.stp.description, pcs.packets.rtp.rtcp.description, pcs.packets.dns.dnsquery.description, pcs.packets.ptp.Sync.description, pcs.packets.mpls.ldphdr.description, pcs.packets.ipv4.ipv4.description, pcs.packets.sctp.init.description, pcs.packets.bgp.open.description, pcs.packets.icmpv4.icmpv4.description, pcs.packets.netlink.nlmsghdr.description, pcs.packets.mpls.lse.description, pcs.packets.ieee8023ad.marker.description, pcs.packets.rtp.sender.description, pcs.packets.dns.dnsrr.description, pcs.packets.ieee8021d.bpdu.description, pcs.packets.sctp.sack.description, pcs.packets.bgp.header.description, pcs.packets.ieee8023ad.slowhdr.description, pcs.packets.sctp.heartbeat.description, pcs.packets.radiotap.radiotap.description, pcs.packets.ieee80211.frame.description, pcs.packets.bsdrtmsg.if_link_msg.description, pcs.packets.sctp.abort.description, pcs.packets.ptp.DelayRequest.description, pcs.packets.sctp.shutdown.description, pcs.packets.bsdrtmsg.if_addr_msg.description, pcs.packets.ptp.Followup.description, pcs.packets.ipv4.pseudoipv4.description, pcs.packets.sctp.shutdown_ack.description, pcs.packets.bsdrtmsg.if_maddr_msg.description, pcs.packets.ieee80211.plcp.description, pcs.packets.sctp.operation_error.description, pcs.packets.ptp.DelayResponse.description, pcs.packets.bsdrtmsg.if_state_msg.description, pcs.packets.sctp.cookie_echo.description, pcs.packets.bsdrtmsg.ieee80211_join_event.description, pcs.packets.igmpv3.report.description, pcs.packets.sctp.cookie_ack.description, pcs.packets.bsdrtmsg.ieee80211_leave_event.description, pcs.packets.sctp.shutdown_complete.description, pcs.packets.bsdrtmsg.ieee80211_replay_event.description, pcs.packets.bsdrtmsg.ieee80211_michael_event.description, pcs.packets.bsdrtmsg.if_ieee80211_msg.description, pcs.packets.rtnetlink.ifaddrmsg.description, pcs.packets.bsdrtmsg.rt_msg.description, pcs.packets.rtnetlink.ifinfomsg.description, pcs.packets.rtnetlink.prefixmsg.description, pcs.packets.bsdrtmsg.rtmsghdr.description, and pcs.packets.rtnetlink.rtmsg.description.
| def pcs.Packet.calc_checksum | ( | self | ) |
Compute checksum for this packet. The base class does nothing, it has no notion of checksum.
Reimplemented in pcs.packets.tcp.tcp, pcs.packets.ipv4.ipv4, pcs.packets.icmpv4.icmpv4, pcs.packets.icmpv6.icmpv6, pcs.packets.tcpv6.tcpv6, pcs.packets.udp.udp, pcs.packets.igmp.igmp, pcs.packets.udpv6.udpv6, and pcs.packets.udpv4.udpv4.
| def pcs.Packet.calc_length | ( | self | ) |
Compute length field for this packet. The base class does nothing, it has no notion of a length field.
Reimplemented in pcs.packets.igmpv3.report, pcs.packets.tcp.tcp, pcs.packets.ipv4.ipv4, pcs.packets.udp.udp, pcs.packets.igmpv3.query, and pcs.packets.dns.dnsheader.
| def pcs.Packet.chain | ( | self | ) |
Return the packet and its next packets as a chain.
Referenced by pcs.Packet.__div__().
| def pcs.Packet.decode | ( | self, | |
| bytes | |||
| ) |
Reset the bytes field and then update the associated attributes of the packet. This method is used when a packet is read in raw form.
References pcs.Packet._bytes, pcs.Layout._layout, and pcs.Packet._layout.
Referenced by pcs.Packet.__init__().
| def pcs.Packet.encode | ( | self | ) |
Update the internal bytes representing the packet. This function ought to be considered private to the class.
References pcs.Packet._bytes, pcs.Packet._fieldnames, pcs.Layout._layout, and pcs.Packet._layout.
Referenced by pcs.Chain.__init__(), pcs.Chain.append(), pcs.Chain.fixup(), pcs.Packet.getbytes(), and pcs.Chain.insert_after().
| def pcs.Packet.fromHTML | ( | self | ) |
Create a Packet from HTML.
| def pcs.Packet.fromXML | ( | self | ) |
Create a Packet from XML.
| def pcs.Packet.getbytes | ( | self | ) |
return the bytes of the packet
References pcs.Packet._bytes, pcs.Packet._needencode, pcs.Field.encode(), pcs.StringField.encode(), pcs.LengthValueField.encode(), pcs.TypeValueField.encode(), pcs.TypeLengthValueField.encode(), pcs.OptionListField.encode(), and pcs.Packet.encode().
Referenced by pcs.packets.udpv4.udpv4.calc_checksum(), pcs.packets.udpv6.udpv6.calc_checksum(), pcs.packets.udp.udp.calc_checksum(), pcs.packets.tcpv6.tcpv6.calc_checksum(), pcs.packets.icmpv6.icmpv6.calc_checksum(), pcs.packets.icmpv4.icmpv4.calc_checksum(), pcs.packets.ipv4.ipv4.calc_checksum(), pcs.packets.tcp.tcp.calc_checksum(), pcs.packets.udp.udp.calc_checksum_v4(), pcs.packets.tcp.tcp.calc_checksum_v4(), pcs.packets.udp.udp.calc_checksum_v6(), pcs.packets.tcp.tcp.calc_checksum_v6(), pcs.packets.dns.dnsheader.calc_length(), pcs.packets.udp.udp.calc_length(), pcs.packets.ipv4.ipv4.calc_length(), pcs.packets.tcp.tcp.calc_length(), pcs.packets.udpv4.udpv4.cksum(), pcs.packets.udpv6.udpv6.cksum(), pcs.packets.tcpv6.tcpv6.cksum(), and pcs.packets.icmpv6.icmpv6.cksum().
| def pcs.Packet.matches | ( | self, | |
| other | |||
| ) |
Return True if the packets match. Each contains a reference to a comparison function. If the reference is None, we assume no comparison need be performed. This allows full flexibility in performing matches.
References pcs.Packet._fieldnames, pcs.Layout._layout, and pcs.Packet._layout.
| def pcs.Packet.next | ( | self, | |
| bytes, | |||
discriminator = None, |
|||
timestamp = None |
|||
| ) |
Demultiplex higher layer protocols based on a supplied map and discriminator field.
References pcs.Packet._discriminator, pcs.Packet._fieldnames, pcs.packets.udpv6.udpv6._map, pcs.packets.ptp_common.Common._map, pcs.packets.udpv4.udpv4._map, pcs.packets.payload.payload._map, pcs.packets.udp.udp._map, pcs.packets.igmp.igmp._map, pcs.packets.localhost.localhost._map, pcs.packets.tcp.tcp._map, pcs.packets.vlan.vlan._map, pcs.packets.sctp.common._map, pcs.packets.ethernet.ethernet._map, pcs.packets.ipv6.ipv6._map, pcs.packets.sctp.payload._map, pcs.packets.netlink.nlmsg_error._map, pcs.packets.ieee8023ad.lacp._map, pcs.packets.ipv4.ipv4._map, pcs.packets.netlink.nlmsghdr._map, pcs.packets.ieee8023ad.marker._map, pcs.packets.icmpv4.icmpv4._map, pcs.packets.ieee8021d.bpdu._map, pcs.packets.ieee8023ad.slowhdr._map, pcs.packets.ieee80211.frame._map, pcs.packets.bsdrtmsg.if_link_msg._map, pcs.packets.bsdrtmsg.if_addr_msg._map, pcs.packets.ipv4.pseudoipv4._map, pcs.packets.bsdrtmsg.if_maddr_msg._map, pcs.packets.ieee80211.plcp._map, pcs.packets.bsdrtmsg.if_state_msg._map, pcs.packets.bsdrtmsg.ieee80211_join_event._map, pcs.packets.bsdrtmsg.ieee80211_leave_event._map, pcs.packets.bsdrtmsg.ieee80211_replay_event._map, pcs.packets.bsdrtmsg.ieee80211_michael_event._map, pcs.packets.bsdrtmsg.if_ieee80211_msg._map, pcs.packets.rtnetlink.ifaddrmsg._map, pcs.packets.bsdrtmsg.rt_msg._map, pcs.packets.rtnetlink.ifinfomsg._map, pcs.packets.rtnetlink.prefixmsg._map, pcs.packets.bsdrtmsg.rtmsghdr._map, and pcs.packets.rtnetlink.rtmsg._map.
Referenced by pcs.packets.null.null.__init__(), pcs.packets.ptp.Sync.__init__(), pcs.packets.ptp_common.Common.__init__(), pcs.packets.udp.udp.__init__(), pcs.packets.igmp.igmp.__init__(), pcs.packets.localhost.localhost.__init__(), pcs.packets.vlan.vlan.__init__(), pcs.packets.tcp.tcp.__init__(), pcs.packets.sctp.common.__init__(), pcs.packets.ethernet.ethernet.__init__(), pcs.packets.llc.llc.__init__(), pcs.packets.sctp.payload.__init__(), pcs.packets.ipv4.ipv4.__init__(), pcs.packets.sctp.init.__init__(), pcs.packets.netlink.nlmsghdr.__init__(), pcs.packets.icmpv4.icmpv4.__init__(), pcs.packets.ptp.DelayRequest.__init__(), pcs.packets.sctp.sack.__init__(), pcs.packets.ieee8021d.bpdu.__init__(), pcs.packets.bgp.header.__init__(), pcs.packets.sctp.heartbeat.__init__(), pcs.packets.sctp.abort.__init__(), pcs.packets.sctp.shutdown.__init__(), pcs.packets.ptp.Followup.__init__(), pcs.packets.sctp.shutdown_ack.__init__(), pcs.packets.ptp.DelayResponse.__init__(), pcs.packets.sctp.operation_error.__init__(), pcs.packets.sctp.cookie_echo.__init__(), pcs.packets.sctp.cookie_ack.__init__(), pcs.packets.sctp.shutdown_complete.__init__(), and pcs.packets.bsdrtmsg.rtmsghdr.__init__().
| def pcs.Packet.println | ( | self | ) |
Print the packet in line format.
References pcs.Field.__repr__(), pcs.StringField.__repr__(), pcs.LengthValueField.__repr__(), pcs.TypeValueField.__repr__(), pcs.TypeLengthValueField.__repr__(), pcs.OptionListField.__repr__(), and pcs.Packet.__repr__().
| def pcs.Packet.rdiscriminate | ( | self, | |
| packet, | |||
discfieldname = None, |
|||
map = None |
|||
| ) |
Reverse-map an encapsulated packet back to a discriminator field value. Given a following packet which is about to be appended or inserted in a chain, look at its type, and fill out the discriminator field. This is 'reverse discrimination', as we are mapping a packet type back to a code field, which means a reverse dict lookup. The mapping may not be 1:1, in which case we simply return the first match; isinstance() is used to match derived classes. Individual packet classes should override this if they need to return a particular flavour of an encapsulated packet, or force a lookup against a map which isn't part of the class. This is provided as syntactic sugar, used only by the / operator. If we find a match, and set the discriminator field, we will also set its compare function to the default for the field's class if a comparison function was not already specified. Return True if we made any changes to self.
Reimplemented in pcs.packets.rtnetlink.rtmsg, pcs.packets.bsdrtmsg.rtmsghdr, pcs.packets.bsdrtmsg.if_ieee80211_msg, pcs.packets.netlink.nlmsghdr, pcs.packets.icmpv4.icmpv4, pcs.packets.udp.udp, and pcs.packets.igmp.igmp.
References pcs.Packet._discriminator, pcs.Packet._fieldnames, pcs.packets.udpv6.udpv6._map, pcs.packets.ptp_common.Common._map, pcs.packets.udpv4.udpv4._map, pcs.packets.payload.payload._map, pcs.packets.udp.udp._map, pcs.packets.igmp.igmp._map, pcs.packets.localhost.localhost._map, pcs.packets.tcp.tcp._map, pcs.packets.vlan.vlan._map, pcs.packets.sctp.common._map, pcs.packets.ethernet.ethernet._map, pcs.packets.ipv6.ipv6._map, pcs.packets.sctp.payload._map, pcs.packets.netlink.nlmsg_error._map, pcs.packets.ieee8023ad.lacp._map, pcs.packets.ipv4.ipv4._map, pcs.packets.netlink.nlmsghdr._map, pcs.packets.ieee8023ad.marker._map, pcs.packets.icmpv4.icmpv4._map, pcs.packets.ieee8021d.bpdu._map, pcs.packets.ieee8023ad.slowhdr._map, pcs.packets.ieee80211.frame._map, pcs.packets.bsdrtmsg.if_link_msg._map, pcs.packets.bsdrtmsg.if_addr_msg._map, pcs.packets.ipv4.pseudoipv4._map, pcs.packets.bsdrtmsg.if_maddr_msg._map, pcs.packets.ieee80211.plcp._map, pcs.packets.bsdrtmsg.if_state_msg._map, pcs.packets.bsdrtmsg.ieee80211_join_event._map, pcs.packets.bsdrtmsg.ieee80211_leave_event._map, pcs.packets.bsdrtmsg.ieee80211_replay_event._map, pcs.packets.bsdrtmsg.ieee80211_michael_event._map, pcs.packets.bsdrtmsg.if_ieee80211_msg._map, pcs.packets.rtnetlink.ifaddrmsg._map, pcs.packets.bsdrtmsg.rt_msg._map, pcs.packets.rtnetlink.ifinfomsg._map, pcs.packets.rtnetlink.prefixmsg._map, pcs.packets.bsdrtmsg.rtmsghdr._map, and pcs.packets.rtnetlink.rtmsg._map.
Referenced by pcs.Packet.__div__(), pcs.packets.igmp.igmp.rdiscriminate(), pcs.packets.udp.udp.rdiscriminate(), pcs.packets.icmpv4.icmpv4.rdiscriminate(), pcs.packets.netlink.nlmsghdr.rdiscriminate(), pcs.packets.bsdrtmsg.if_ieee80211_msg.rdiscriminate(), pcs.packets.bsdrtmsg.rtmsghdr.rdiscriminate(), and pcs.packets.rtnetlink.rtmsg.rdiscriminate().
| def pcs.Packet.sizeof | ( | self | ) |
Return the size, in bytes, of the packet.
Referenced by pcs.packets.ptp.Sync.__init__(), pcs.packets.ptp_common.Common.__init__(), pcs.packets.igmp.igmp.__init__(), pcs.packets.tcp.tcp.__init__(), pcs.packets.vlan.vlan.__init__(), pcs.packets.sctp.common.__init__(), pcs.packets.rtp.rtp.__init__(), pcs.packets.ethernet.ethernet.__init__(), pcs.packets.bgp.notification.__init__(), pcs.packets.dhcpv4.dhcpv4.__init__(), pcs.packets.ieee8021d.garp.__init__(), pcs.packets.llc.llc.__init__(), pcs.packets.mpls.ldpmsg.__init__(), pcs.packets.ieee8021d.stp.__init__(), pcs.packets.icmpv4.icmpv4echo.__init__(), pcs.packets.ieee8023ad.lacp.__init__(), pcs.packets.ipv4.ipv4.__init__(), pcs.packets.rtp.rtcp.__init__(), pcs.packets.mpls.ldphdr.__init__(), pcs.packets.bgp.open.__init__(), pcs.packets.ieee8023ad.marker.__init__(), pcs.packets.netlink.nlmsghdr.__init__(), pcs.packets.icmpv4.icmpv4.__init__(), pcs.packets.mpls.lse.__init__(), pcs.packets.rtp.sender.__init__(), pcs.packets.ptp.DelayRequest.__init__(), pcs.packets.ieee8021d.bpdu.__init__(), pcs.packets.bgp.header.__init__(), pcs.packets.ieee8023ad.slowhdr.__init__(), pcs.packets.radiotap.radiotap.__init__(), pcs.packets.ieee80211.frame.__init__(), pcs.packets.bsdrtmsg.if_link_msg.__init__(), pcs.packets.ptp.Followup.__init__(), pcs.packets.bsdrtmsg.if_addr_msg.__init__(), pcs.packets.bsdrtmsg.if_maddr_msg.__init__(), pcs.packets.ieee80211.plcp.__init__(), pcs.packets.ptp.DelayResponse.__init__(), pcs.packets.bsdrtmsg.if_state_msg.__init__(), pcs.packets.bsdrtmsg.ieee80211_join_event.__init__(), pcs.packets.bsdrtmsg.ieee80211_leave_event.__init__(), pcs.packets.bsdrtmsg.ieee80211_replay_event.__init__(), pcs.packets.bsdrtmsg.ieee80211_michael_event.__init__(), pcs.packets.bsdrtmsg.if_ieee80211_msg.__init__(), pcs.packets.rtnetlink.ifaddrmsg.__init__(), pcs.packets.bsdrtmsg.rt_msg.__init__(), pcs.packets.rtnetlink.ifinfomsg.__init__(), pcs.packets.rtnetlink.prefixmsg.__init__(), pcs.packets.bsdrtmsg.rtmsghdr.__init__(), and pcs.packets.rtnetlink.rtmsg.__init__().
| def pcs.Packet.toHTML | ( | self | ) |
Transform a Packet to HTML.
| def pcs.Packet.toXML | ( | self | ) |
Transform the Packet into XML.
| def pcs.Packet.wildcard_mask | ( | self, | |
fieldnames = [], |
|||
unmask = True |
|||
| ) |
Mark or unmark a list of fields in this Packet as wildcard for match(). If unmask is false, then apply a default comparison function specific to the class of the Field. If an empty list is passed, apply the mask to all fields.
References pcs.Packet._fieldnames.
1.8.0