Documentation ¶
Overview ¶
Package tcp implements the TCP header support in Lucius.
Index ¶
- func ChecksumIPv4(tcpHeader, tcpPayload, ipSrc, ipDst []byte) uint
- func ChecksumIPv6(tcpHeader, tcpPayload, ipSrc, ipDst []byte) uint
- type TCP
- func (tcp *TCP) Field(id fwdpacket.FieldID) ([]byte, error)
- func (tcp *TCP) Header() []byte
- func (TCP) ID(int) fwdpb.PacketHeaderId
- func (TCP) Modify(fwdpb.PacketHeaderId) error
- func (tcp *TCP) Rebuild() error
- func (tcp *TCP) Remove(id fwdpb.PacketHeaderId) error
- func (TCP) Trailer() []byte
- func (tcp *TCP) UpdateField(id fwdpacket.FieldID, op int, arg []byte) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChecksumIPv4 ¶
ChecksumIPv4 computes the TCP header checksum for IP4 packets. The checksum is computed over the TCP header, TCP payload and the source and destination IP addresses. A couple of notes: 1. It is assumed that the checksum in the TCP header is already zeroed. 2. The IP addresses can be padded. As the IPv4 addresses are padded, we need to truncate them.
func ChecksumIPv6 ¶
ChecksumIPv6 computes the TCP header checksum for IP6 packets. The checksum is computed over the TCP header, TCP payload and the source and destination IP addresses. A couple of notes: 1. It is assumed that the checksum in the TCP header is already zeroed. 2. It is assumed that the IPv6 addresses are the correct padded, we need to truncate them.
Types ¶
type TCP ¶
type TCP struct {
// contains filtered or unexported fields
}
A TCP represents a TCP header in the packet. It can parse, query and operate on the TCP header (including TCP extensions). However it cannot add a new TCP header to a packet and it cannot interpret, add or remove TCP extensions. All TCP payload is considered OPAQUE.
func (TCP) Modify ¶
func (TCP) Modify(fwdpb.PacketHeaderId) error
Modify returns an error as the TCP header does not support adding extensions.
func (*TCP) Rebuild ¶
Rebuild update the TCP header checksum using the update L3. The checksum is computed over the TCP header, the Opaque payload and various IP fields corresponding to the innermost IP header.