// automatically generated by stateify.

package netlink

import (
	"context"

	"gvisor.dev/gvisor/pkg/state"
)

func (s *Socket) StateTypeName() string {
	return "pkg/sentry/socket/netlink.Socket"
}

func (s *Socket) StateFields() []string {
	return []string{
		"vfsfd",
		"FileDescriptionDefaultImpl",
		"DentryMetadataFileDescriptionImpl",
		"LockFD",
		"SendReceiveTimeout",
		"ports",
		"protocol",
		"skType",
		"ep",
		"connection",
		"bound",
		"portID",
		"sendBufferSize",
		"filter",
		"netns",
	}
}

func (s *Socket) beforeSave() {}

// +checklocksignore
func (s *Socket) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	stateSinkObject.Save(0, &s.vfsfd)
	stateSinkObject.Save(1, &s.FileDescriptionDefaultImpl)
	stateSinkObject.Save(2, &s.DentryMetadataFileDescriptionImpl)
	stateSinkObject.Save(3, &s.LockFD)
	stateSinkObject.Save(4, &s.SendReceiveTimeout)
	stateSinkObject.Save(5, &s.ports)
	stateSinkObject.Save(6, &s.protocol)
	stateSinkObject.Save(7, &s.skType)
	stateSinkObject.Save(8, &s.ep)
	stateSinkObject.Save(9, &s.connection)
	stateSinkObject.Save(10, &s.bound)
	stateSinkObject.Save(11, &s.portID)
	stateSinkObject.Save(12, &s.sendBufferSize)
	stateSinkObject.Save(13, &s.filter)
	stateSinkObject.Save(14, &s.netns)
}

func (s *Socket) afterLoad(context.Context) {}

// +checklocksignore
func (s *Socket) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &s.vfsfd)
	stateSourceObject.Load(1, &s.FileDescriptionDefaultImpl)
	stateSourceObject.Load(2, &s.DentryMetadataFileDescriptionImpl)
	stateSourceObject.Load(3, &s.LockFD)
	stateSourceObject.Load(4, &s.SendReceiveTimeout)
	stateSourceObject.Load(5, &s.ports)
	stateSourceObject.Load(6, &s.protocol)
	stateSourceObject.Load(7, &s.skType)
	stateSourceObject.Load(8, &s.ep)
	stateSourceObject.Load(9, &s.connection)
	stateSourceObject.Load(10, &s.bound)
	stateSourceObject.Load(11, &s.portID)
	stateSourceObject.Load(12, &s.sendBufferSize)
	stateSourceObject.Load(13, &s.filter)
	stateSourceObject.Load(14, &s.netns)
}

func (k *kernelSCM) StateTypeName() string {
	return "pkg/sentry/socket/netlink.kernelSCM"
}

func (k *kernelSCM) StateFields() []string {
	return []string{}
}

func (k *kernelSCM) beforeSave() {}

// +checklocksignore
func (k *kernelSCM) StateSave(stateSinkObject state.Sink) {
	k.beforeSave()
}

func (k *kernelSCM) afterLoad(context.Context) {}

// +checklocksignore
func (k *kernelSCM) StateLoad(ctx context.Context, stateSourceObject state.Source) {
}

func init() {
	state.Register((*Socket)(nil))
	state.Register((*kernelSCM)(nil))
}
