// automatically generated by stateify.

package veth

import (
	"context"

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

func (v *veth) StateTypeName() string {
	return "pkg/tcpip/link/veth.veth"
}

func (v *veth) StateFields() []string {
	return []string{
		"closed",
		"mtu",
		"endpoints",
	}
}

func (v *veth) beforeSave() {}

// +checklocksignore
func (v *veth) StateSave(stateSinkObject state.Sink) {
	v.beforeSave()
	stateSinkObject.Save(0, &v.closed)
	stateSinkObject.Save(1, &v.mtu)
	stateSinkObject.Save(2, &v.endpoints)
}

func (v *veth) afterLoad(context.Context) {}

// +checklocksignore
func (v *veth) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &v.closed)
	stateSourceObject.Load(1, &v.mtu)
	stateSourceObject.Load(2, &v.endpoints)
}

func (v *vethPacket) StateTypeName() string {
	return "pkg/tcpip/link/veth.vethPacket"
}

func (v *vethPacket) StateFields() []string {
	return []string{
		"e",
		"protocol",
		"pkt",
	}
}

func (v *vethPacket) beforeSave() {}

// +checklocksignore
func (v *vethPacket) StateSave(stateSinkObject state.Sink) {
	v.beforeSave()
	stateSinkObject.Save(0, &v.e)
	stateSinkObject.Save(1, &v.protocol)
	stateSinkObject.Save(2, &v.pkt)
}

func (v *vethPacket) afterLoad(context.Context) {}

// +checklocksignore
func (v *vethPacket) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &v.e)
	stateSourceObject.Load(1, &v.protocol)
	stateSourceObject.Load(2, &v.pkt)
}

func (e *Endpoint) StateTypeName() string {
	return "pkg/tcpip/link/veth.Endpoint"
}

func (e *Endpoint) StateFields() []string {
	return []string{
		"peer",
		"veth",
		"dispatcher",
		"linkAddr",
	}
}

func (e *Endpoint) beforeSave() {}

// +checklocksignore
func (e *Endpoint) StateSave(stateSinkObject state.Sink) {
	e.beforeSave()
	stateSinkObject.Save(0, &e.peer)
	stateSinkObject.Save(1, &e.veth)
	stateSinkObject.Save(2, &e.dispatcher)
	stateSinkObject.Save(3, &e.linkAddr)
}

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

// +checklocksignore
func (e *Endpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &e.peer)
	stateSourceObject.Load(1, &e.veth)
	stateSourceObject.Load(2, &e.dispatcher)
	stateSourceObject.Load(3, &e.linkAddr)
}

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