// automatically generated by stateify.

package tcpconntrack

import (
	"context"

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

func (t *TCB) StateTypeName() string {
	return "pkg/tcpip/transport/tcpconntrack.TCB"
}

func (t *TCB) StateFields() []string {
	return []string{
		"reply",
		"original",
		"firstFin",
		"state",
	}
}

func (t *TCB) beforeSave() {}

// +checklocksignore
func (t *TCB) StateSave(stateSinkObject state.Sink) {
	t.beforeSave()
	stateSinkObject.Save(0, &t.reply)
	stateSinkObject.Save(1, &t.original)
	stateSinkObject.Save(2, &t.firstFin)
	stateSinkObject.Save(3, &t.state)
}

func (t *TCB) afterLoad(context.Context) {}

// +checklocksignore
func (t *TCB) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &t.reply)
	stateSourceObject.Load(1, &t.original)
	stateSourceObject.Load(2, &t.firstFin)
	stateSourceObject.Load(3, &t.state)
}

func (s *stream) StateTypeName() string {
	return "pkg/tcpip/transport/tcpconntrack.stream"
}

func (s *stream) StateFields() []string {
	return []string{
		"una",
		"nxt",
		"end",
		"finSeen",
		"fin",
		"rstSeen",
		"shiftCnt",
	}
}

func (s *stream) beforeSave() {}

// +checklocksignore
func (s *stream) StateSave(stateSinkObject state.Sink) {
	s.beforeSave()
	stateSinkObject.Save(0, &s.una)
	stateSinkObject.Save(1, &s.nxt)
	stateSinkObject.Save(2, &s.end)
	stateSinkObject.Save(3, &s.finSeen)
	stateSinkObject.Save(4, &s.fin)
	stateSinkObject.Save(5, &s.rstSeen)
	stateSinkObject.Save(6, &s.shiftCnt)
}

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

// +checklocksignore
func (s *stream) StateLoad(ctx context.Context, stateSourceObject state.Source) {
	stateSourceObject.Load(0, &s.una)
	stateSourceObject.Load(1, &s.nxt)
	stateSourceObject.Load(2, &s.end)
	stateSourceObject.Load(3, &s.finSeen)
	stateSourceObject.Load(4, &s.fin)
	stateSourceObject.Load(5, &s.rstSeen)
	stateSourceObject.Load(6, &s.shiftCnt)
}

func init() {
	state.Register((*TCB)(nil))
	state.Register((*stream)(nil))
}
