github.com/sagernet/gvisor@v0.0.0-20240428053021-e691de28565f/pkg/tcpip/transport/raw/raw_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package raw
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/sagernet/gvisor/pkg/state"
     9  )
    10  
    11  func (p *rawPacket) StateTypeName() string {
    12  	return "pkg/tcpip/transport/raw.rawPacket"
    13  }
    14  
    15  func (p *rawPacket) StateFields() []string {
    16  	return []string{
    17  		"rawPacketEntry",
    18  		"data",
    19  		"receivedAt",
    20  		"senderAddr",
    21  		"packetInfo",
    22  		"tosOrTClass",
    23  		"ttlOrHopLimit",
    24  	}
    25  }
    26  
    27  func (p *rawPacket) beforeSave() {}
    28  
    29  // +checklocksignore
    30  func (p *rawPacket) StateSave(stateSinkObject state.Sink) {
    31  	p.beforeSave()
    32  	var receivedAtValue int64
    33  	receivedAtValue = p.saveReceivedAt()
    34  	stateSinkObject.SaveValue(2, receivedAtValue)
    35  	stateSinkObject.Save(0, &p.rawPacketEntry)
    36  	stateSinkObject.Save(1, &p.data)
    37  	stateSinkObject.Save(3, &p.senderAddr)
    38  	stateSinkObject.Save(4, &p.packetInfo)
    39  	stateSinkObject.Save(5, &p.tosOrTClass)
    40  	stateSinkObject.Save(6, &p.ttlOrHopLimit)
    41  }
    42  
    43  func (p *rawPacket) afterLoad(context.Context) {}
    44  
    45  // +checklocksignore
    46  func (p *rawPacket) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    47  	stateSourceObject.Load(0, &p.rawPacketEntry)
    48  	stateSourceObject.Load(1, &p.data)
    49  	stateSourceObject.Load(3, &p.senderAddr)
    50  	stateSourceObject.Load(4, &p.packetInfo)
    51  	stateSourceObject.Load(5, &p.tosOrTClass)
    52  	stateSourceObject.Load(6, &p.ttlOrHopLimit)
    53  	stateSourceObject.LoadValue(2, new(int64), func(y any) { p.loadReceivedAt(ctx, y.(int64)) })
    54  }
    55  
    56  func (e *endpoint) StateTypeName() string {
    57  	return "pkg/tcpip/transport/raw.endpoint"
    58  }
    59  
    60  func (e *endpoint) StateFields() []string {
    61  	return []string{
    62  		"DefaultSocketOptionsHandler",
    63  		"transProto",
    64  		"waiterQueue",
    65  		"associated",
    66  		"net",
    67  		"stats",
    68  		"ops",
    69  		"rcvList",
    70  		"rcvBufSize",
    71  		"rcvClosed",
    72  		"rcvDisabled",
    73  		"ipv6ChecksumOffset",
    74  		"icmpv6Filter",
    75  	}
    76  }
    77  
    78  // +checklocksignore
    79  func (e *endpoint) StateSave(stateSinkObject state.Sink) {
    80  	e.beforeSave()
    81  	stateSinkObject.Save(0, &e.DefaultSocketOptionsHandler)
    82  	stateSinkObject.Save(1, &e.transProto)
    83  	stateSinkObject.Save(2, &e.waiterQueue)
    84  	stateSinkObject.Save(3, &e.associated)
    85  	stateSinkObject.Save(4, &e.net)
    86  	stateSinkObject.Save(5, &e.stats)
    87  	stateSinkObject.Save(6, &e.ops)
    88  	stateSinkObject.Save(7, &e.rcvList)
    89  	stateSinkObject.Save(8, &e.rcvBufSize)
    90  	stateSinkObject.Save(9, &e.rcvClosed)
    91  	stateSinkObject.Save(10, &e.rcvDisabled)
    92  	stateSinkObject.Save(11, &e.ipv6ChecksumOffset)
    93  	stateSinkObject.Save(12, &e.icmpv6Filter)
    94  }
    95  
    96  // +checklocksignore
    97  func (e *endpoint) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    98  	stateSourceObject.Load(0, &e.DefaultSocketOptionsHandler)
    99  	stateSourceObject.Load(1, &e.transProto)
   100  	stateSourceObject.Load(2, &e.waiterQueue)
   101  	stateSourceObject.Load(3, &e.associated)
   102  	stateSourceObject.Load(4, &e.net)
   103  	stateSourceObject.Load(5, &e.stats)
   104  	stateSourceObject.Load(6, &e.ops)
   105  	stateSourceObject.Load(7, &e.rcvList)
   106  	stateSourceObject.Load(8, &e.rcvBufSize)
   107  	stateSourceObject.Load(9, &e.rcvClosed)
   108  	stateSourceObject.Load(10, &e.rcvDisabled)
   109  	stateSourceObject.Load(11, &e.ipv6ChecksumOffset)
   110  	stateSourceObject.Load(12, &e.icmpv6Filter)
   111  	stateSourceObject.AfterLoad(func() { e.afterLoad(ctx) })
   112  }
   113  
   114  func (l *rawPacketList) StateTypeName() string {
   115  	return "pkg/tcpip/transport/raw.rawPacketList"
   116  }
   117  
   118  func (l *rawPacketList) StateFields() []string {
   119  	return []string{
   120  		"head",
   121  		"tail",
   122  	}
   123  }
   124  
   125  func (l *rawPacketList) beforeSave() {}
   126  
   127  // +checklocksignore
   128  func (l *rawPacketList) StateSave(stateSinkObject state.Sink) {
   129  	l.beforeSave()
   130  	stateSinkObject.Save(0, &l.head)
   131  	stateSinkObject.Save(1, &l.tail)
   132  }
   133  
   134  func (l *rawPacketList) afterLoad(context.Context) {}
   135  
   136  // +checklocksignore
   137  func (l *rawPacketList) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   138  	stateSourceObject.Load(0, &l.head)
   139  	stateSourceObject.Load(1, &l.tail)
   140  }
   141  
   142  func (e *rawPacketEntry) StateTypeName() string {
   143  	return "pkg/tcpip/transport/raw.rawPacketEntry"
   144  }
   145  
   146  func (e *rawPacketEntry) StateFields() []string {
   147  	return []string{
   148  		"next",
   149  		"prev",
   150  	}
   151  }
   152  
   153  func (e *rawPacketEntry) beforeSave() {}
   154  
   155  // +checklocksignore
   156  func (e *rawPacketEntry) StateSave(stateSinkObject state.Sink) {
   157  	e.beforeSave()
   158  	stateSinkObject.Save(0, &e.next)
   159  	stateSinkObject.Save(1, &e.prev)
   160  }
   161  
   162  func (e *rawPacketEntry) afterLoad(context.Context) {}
   163  
   164  // +checklocksignore
   165  func (e *rawPacketEntry) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   166  	stateSourceObject.Load(0, &e.next)
   167  	stateSourceObject.Load(1, &e.prev)
   168  }
   169  
   170  func init() {
   171  	state.Register((*rawPacket)(nil))
   172  	state.Register((*endpoint)(nil))
   173  	state.Register((*rawPacketList)(nil))
   174  	state.Register((*rawPacketEntry)(nil))
   175  }