// automatically generated by stateify.

package network

import (
	"context"

	"github.com/metacubex/gvisor/pkg/state"
)

func (e *Endpoint) StateTypeName() string {
	return "pkg/tcpip/transport/internal/network.Endpoint"
}

func (e *Endpoint) StateFields() []string {
	return []string{
		"stack",
		"ops",
		"netProto",
		"transProto",
		"waiterQueue",
		"wasBound",
		"owner",
		"writeShutdown",
		"effectiveNetProto",
		"multicastMemberships",
		"ipv4TTL",
		"ipv6HopLimit",
		"multicastTTL",
		"multicastAddr",
		"multicastNICID",
		"ipv4TOS",
		"ipv6TClass",
		"info",
		"state",
	}
}

func (e *Endpoint) beforeSave() {}

// +checklocksignore
func (e *Endpoint) StateSave(stateSinkObject state.Sink) {
	e.beforeSave()
	stateSinkObject.Save(0, &e.stack)
	stateSinkObject.Save(1, &e.ops)
	stateSinkObject.Save(2, &e.netProto)
	stateSinkObject.Save(3, &e.transProto)
	stateSinkObject.Save(4, &e.waiterQueue)
	stateSinkObject.Save(5, &e.wasBound)
	stateSinkObject.Save(6, &e.owner)
	stateSinkObject.Save(7, &e.writeShutdown)
	stateSinkObject.Save(8, &e.effectiveNetProto)
	stateSinkObject.Save(9, &e.multicastMemberships)
	stateSinkObject.Save(10, &e.ipv4TTL)
	stateSinkObject.Save(11, &e.ipv6HopLimit)
	stateSinkObject.Save(12, &e.multicastTTL)
	stateSinkObject.Save(13, &e.multicastAddr)
	stateSinkObject.Save(14, &e.multicastNICID)
	stateSinkObject.Save(15, &e.ipv4TOS)
	stateSinkObject.Save(16, &e.ipv6TClass)
	stateSinkObject.Save(17, &e.info)
	stateSinkObject.Save(18, &e.state)
}

func (e *Endpoint) afterLoad(context.Context) {}

// +checklocksignore
func (e *Endpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &e.stack)
	stateSourceObject.Load(1, &e.ops)
	stateSourceObject.Load(2, &e.netProto)
	stateSourceObject.Load(3, &e.transProto)
	stateSourceObject.Load(4, &e.waiterQueue)
	stateSourceObject.Load(5, &e.wasBound)
	stateSourceObject.Load(6, &e.owner)
	stateSourceObject.Load(7, &e.writeShutdown)
	stateSourceObject.Load(8, &e.effectiveNetProto)
	stateSourceObject.Load(9, &e.multicastMemberships)
	stateSourceObject.Load(10, &e.ipv4TTL)
	stateSourceObject.Load(11, &e.ipv6HopLimit)
	stateSourceObject.Load(12, &e.multicastTTL)
	stateSourceObject.Load(13, &e.multicastAddr)
	stateSourceObject.Load(14, &e.multicastNICID)
	stateSourceObject.Load(15, &e.ipv4TOS)
	stateSourceObject.Load(16, &e.ipv6TClass)
	stateSourceObject.Load(17, &e.info)
	stateSourceObject.Load(18, &e.state)
}

func (m *multicastMembership) StateTypeName() string {
	return "pkg/tcpip/transport/internal/network.multicastMembership"
}

func (m *multicastMembership) StateFields() []string {
	return []string{
		"nicID",
		"multicastAddr",
	}
}

func (m *multicastMembership) beforeSave() {}

// +checklocksignore
func (m *multicastMembership) StateSave(stateSinkObject state.Sink) {
	m.beforeSave()
	stateSinkObject.Save(0, &m.nicID)
	stateSinkObject.Save(1, &m.multicastAddr)
}

func (m *multicastMembership) afterLoad(context.Context) {}

// +checklocksignore
func (m *multicastMembership) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &m.nicID)
	stateSourceObject.Load(1, &m.multicastAddr)
}

func init() {
	state.Register((*Endpoint)(nil))
	state.Register((*multicastMembership)(nil))
}
