ICMPv6¶
- class os_ken.lib.packet.icmpv6.echo(id_=0, seq=0, data=None)¶
ICMPv6 sub encoder/decoder class for Echo Request and Echo Reply messages.
This is used with os_ken.lib.packet.icmpv6.icmpv6 for ICMPv6 Echo Request and Echo Reply messages.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
id
Identifier
seq
Sequence Number
data
Data
- class os_ken.lib.packet.icmpv6.icmpv6(type_=0, code=0, csum=0, data=b'')¶
ICMPv6 (RFC 2463) header encoder/decoder class.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
type_
Type
code
Code
csum
CheckSum (0 means automatically-calculate when encoding)
data
Payload.
os_ken.lib.packet.icmpv6.echo object, os_ken.lib.packet.icmpv6.nd_neighbor object, os_ken.lib.packet.icmpv6.nd_router_solicit object, os_ken.lib.packet.icmpv6.nd_router_advert object, os_ken.lib.packet.icmpv6.mld object, or a bytearray.
- classmethod parser(buf)¶
Decode a protocol header.
This method is used only when decoding a packet.
Decode a protocol header at offset 0 in bytearray buf. Returns the following three objects.
An object to describe the decoded header.
A packet_base.PacketBase subclass appropriate for the rest of the packet. None when the rest of the packet should be considered as raw payload.
The rest of packet.
- serialize(payload, prev)¶
Encode a protocol header.
This method is used only when encoding a packet.
Encode a protocol header. Returns a bytearray which contains the header.
payload is the rest of the packet which will immediately follow this header.
prev is a packet_base.PacketBase subclass for the outer protocol header. prev is None if the current header is the outer-most. For example, prev is ipv4 or ipv6 for tcp.serialize.
- class os_ken.lib.packet.icmpv6.mld(maxresp=0, address='::')¶
ICMPv6 sub encoder/decoder class for MLD Lister Query, MLD Listener Report, and MLD Listener Done messages. (RFC 2710)
http://www.ietf.org/rfc/rfc2710.txt
This is used with os_ken.lib.packet.icmpv6.icmpv6.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
maxresp
max response time in millisecond. it is meaningful only in Query Message.
address
a group address value.
- class os_ken.lib.packet.icmpv6.mldv2_query(maxresp=0, address='::', s_flg=0, qrv=2, qqic=0, num=0, srcs=None)¶
ICMPv6 sub encoder/decoder class for MLD v2 Lister Query messages. (RFC 3810)
http://www.ietf.org/rfc/rfc3810.txt
This is used with os_ken.lib.packet.icmpv6.icmpv6.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
maxresp
max response time in millisecond. it is meaningful only in Query Message.
address
a group address value.
s_flg
when set to 1, routers suppress the timer process.
qrv
robustness variable for a querier.
qqic
an interval time for a querier in unit of seconds.
num
a number of the multicast servers.
srcs
a list of IPv6 addresses of the multicast servers.
- class os_ken.lib.packet.icmpv6.mldv2_report(record_num=0, records=None)¶
ICMPv6 sub encoder/decoder class for MLD v2 Lister Report messages. (RFC 3810)
http://www.ietf.org/rfc/rfc3810.txt
This is used with os_ken.lib.packet.icmpv6.icmpv6.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
record_num
a number of the group records.
records
a list of os_ken.lib.packet.icmpv6.mldv2_report_group. None if no records.
- class os_ken.lib.packet.icmpv6.mldv2_report_group(type_=0, aux_len=0, num=0, address='::', srcs=None, aux=None)¶
ICMPv6 sub encoder/decoder class for MLD v2 Lister Report Group Record messages. (RFC 3810)
This is used with os_ken.lib.packet.icmpv6.mldv2_report.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
type_
a group record type for v3.
aux_len
the length of the auxiliary data in 32-bit words.
num
a number of the multicast servers.
address
a group address value.
srcs
a list of IPv6 addresses of the multicast servers.
aux
the auxiliary data.
- class os_ken.lib.packet.icmpv6.nd_neighbor(res=0, dst='::', option=None)¶
ICMPv6 sub encoder/decoder class for Neighbor Solicitation and Neighbor Advertisement messages. (RFC 4861)
This is used with os_ken.lib.packet.icmpv6.icmpv6.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
res
R,S,O Flags for Neighbor Advertisement. The 3 MSBs of "Reserved" field for Neighbor Solicitation.
dst
Target Address
option
a derived object of os_ken.lib.packet.icmpv6.nd_option or a bytearray. None if no options.
- class os_ken.lib.packet.icmpv6.nd_option_pi(length=0, pl=0, res1=0, val_l=0, pre_l=0, res2=0, prefix='::')¶
ICMPv6 sub encoder/decoder class for Neighbor discovery Prefix Information Option. (RFC 4861)
This is used with os_ken.lib.packet.icmpv6.nd_router_advert.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
length
length of the option. (0 means automatically-calculate when encoding)
pl
Prefix Length.
res1
L,A,R* Flags for Prefix Information.
val_l
Valid Lifetime.
pre_l
Preferred Lifetime.
res2
This field is unused. It MUST be initialized to zero.
prefix
An IP address or a prefix of an IP address.
*R flag is defined in (RFC 3775)
- class os_ken.lib.packet.icmpv6.nd_option_sla(length=0, hw_src='00:00:00:00:00:00', data=None)¶
ICMPv6 sub encoder/decoder class for Neighbor discovery Source Link-Layer Address Option. (RFC 4861)
This is used with os_ken.lib.packet.icmpv6.nd_neighbor, os_ken.lib.packet.icmpv6.nd_router_solicit or os_ken.lib.packet.icmpv6.nd_router_advert.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
length
length of the option. (0 means automatically-calculate when encoding)
hw_src
Link-Layer Address. NOTE: If the address is longer than 6 octets this contains the first 6 octets in the address. This implementation assumes the address has at least 6 octets.
data
A bytearray which contains the rest of Link-Layer Address and padding. When encoding a packet, it's user's responsibility to provide necessary padding for 8-octets alignment required by the protocol.
- class os_ken.lib.packet.icmpv6.nd_option_tla(length=0, hw_src='00:00:00:00:00:00', data=None)¶
ICMPv6 sub encoder/decoder class for Neighbor discovery Target Link-Layer Address Option. (RFC 4861)
This is used with os_ken.lib.packet.icmpv6.nd_neighbor.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
length
length of the option. (0 means automatically-calculate when encoding)
hw_src
Link-Layer Address. NOTE: If the address is longer than 6 octets this contains the first 6 octets in the address. This implementation assumes the address has at least 6 octets.
data
A bytearray which contains the rest of Link-Layer Address and padding. When encoding a packet, it's user's responsibility to provide necessary padding for 8-octets alignment required by the protocol.
- class os_ken.lib.packet.icmpv6.nd_router_advert(ch_l=0, res=0, rou_l=0, rea_t=0, ret_t=0, options=None)¶
ICMPv6 sub encoder/decoder class for Router Advertisement messages. (RFC 4861)
This is used with os_ken.lib.packet.icmpv6.icmpv6.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
ch_l
Cur Hop Limit.
res
M,O Flags for Router Advertisement.
rou_l
Router Lifetime.
rea_t
Reachable Time.
ret_t
Retrans Timer.
options
List of a derived object of os_ken.lib.packet.icmpv6.nd_option or a bytearray. None if no options.
- class os_ken.lib.packet.icmpv6.nd_router_solicit(res=0, option=None)¶
ICMPv6 sub encoder/decoder class for Router Solicitation messages. (RFC 4861)
This is used with os_ken.lib.packet.icmpv6.icmpv6.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute
Description
res
This field is unused. It MUST be initialized to zero.
option
a derived object of os_ken.lib.packet.icmpv6.nd_option or a bytearray. None if no options.