github.com/sagernet/gvisor@v0.0.0-20240428053021-e691de28565f/pkg/tcpip/header/header_state_autogen.go (about)

     1  // automatically generated by stateify.
     2  
     3  package header
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/sagernet/gvisor/pkg/state"
     9  )
    10  
    11  func (t *TCPSynOptions) StateTypeName() string {
    12  	return "pkg/tcpip/header.TCPSynOptions"
    13  }
    14  
    15  func (t *TCPSynOptions) StateFields() []string {
    16  	return []string{
    17  		"MSS",
    18  		"WS",
    19  		"TS",
    20  		"TSVal",
    21  		"TSEcr",
    22  		"SACKPermitted",
    23  		"Flags",
    24  	}
    25  }
    26  
    27  func (t *TCPSynOptions) beforeSave() {}
    28  
    29  // +checklocksignore
    30  func (t *TCPSynOptions) StateSave(stateSinkObject state.Sink) {
    31  	t.beforeSave()
    32  	stateSinkObject.Save(0, &t.MSS)
    33  	stateSinkObject.Save(1, &t.WS)
    34  	stateSinkObject.Save(2, &t.TS)
    35  	stateSinkObject.Save(3, &t.TSVal)
    36  	stateSinkObject.Save(4, &t.TSEcr)
    37  	stateSinkObject.Save(5, &t.SACKPermitted)
    38  	stateSinkObject.Save(6, &t.Flags)
    39  }
    40  
    41  func (t *TCPSynOptions) afterLoad(context.Context) {}
    42  
    43  // +checklocksignore
    44  func (t *TCPSynOptions) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    45  	stateSourceObject.Load(0, &t.MSS)
    46  	stateSourceObject.Load(1, &t.WS)
    47  	stateSourceObject.Load(2, &t.TS)
    48  	stateSourceObject.Load(3, &t.TSVal)
    49  	stateSourceObject.Load(4, &t.TSEcr)
    50  	stateSourceObject.Load(5, &t.SACKPermitted)
    51  	stateSourceObject.Load(6, &t.Flags)
    52  }
    53  
    54  func (r *SACKBlock) StateTypeName() string {
    55  	return "pkg/tcpip/header.SACKBlock"
    56  }
    57  
    58  func (r *SACKBlock) StateFields() []string {
    59  	return []string{
    60  		"Start",
    61  		"End",
    62  	}
    63  }
    64  
    65  func (r *SACKBlock) beforeSave() {}
    66  
    67  // +checklocksignore
    68  func (r *SACKBlock) StateSave(stateSinkObject state.Sink) {
    69  	r.beforeSave()
    70  	stateSinkObject.Save(0, &r.Start)
    71  	stateSinkObject.Save(1, &r.End)
    72  }
    73  
    74  func (r *SACKBlock) afterLoad(context.Context) {}
    75  
    76  // +checklocksignore
    77  func (r *SACKBlock) StateLoad(ctx context.Context, stateSourceObject state.Source) {
    78  	stateSourceObject.Load(0, &r.Start)
    79  	stateSourceObject.Load(1, &r.End)
    80  }
    81  
    82  func (t *TCPOptions) StateTypeName() string {
    83  	return "pkg/tcpip/header.TCPOptions"
    84  }
    85  
    86  func (t *TCPOptions) StateFields() []string {
    87  	return []string{
    88  		"TS",
    89  		"TSVal",
    90  		"TSEcr",
    91  		"SACKBlocks",
    92  	}
    93  }
    94  
    95  func (t *TCPOptions) beforeSave() {}
    96  
    97  // +checklocksignore
    98  func (t *TCPOptions) StateSave(stateSinkObject state.Sink) {
    99  	t.beforeSave()
   100  	stateSinkObject.Save(0, &t.TS)
   101  	stateSinkObject.Save(1, &t.TSVal)
   102  	stateSinkObject.Save(2, &t.TSEcr)
   103  	stateSinkObject.Save(3, &t.SACKBlocks)
   104  }
   105  
   106  func (t *TCPOptions) afterLoad(context.Context) {}
   107  
   108  // +checklocksignore
   109  func (t *TCPOptions) StateLoad(ctx context.Context, stateSourceObject state.Source) {
   110  	stateSourceObject.Load(0, &t.TS)
   111  	stateSourceObject.Load(1, &t.TSVal)
   112  	stateSourceObject.Load(2, &t.TSEcr)
   113  	stateSourceObject.Load(3, &t.SACKBlocks)
   114  }
   115  
   116  func init() {
   117  	state.Register((*TCPSynOptions)(nil))
   118  	state.Register((*SACKBlock)(nil))
   119  	state.Register((*TCPOptions)(nil))
   120  }