-
Notifications
You must be signed in to change notification settings - Fork 155
/
structs.gen.go
105 lines (100 loc) · 3.01 KB
/
structs.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Code generated by go/proto/structs_gen_go.sh; DO NOT EDIT.
package proto
import (
"zombiezen.com/go/capnproto2"
"github.com/scionproto/scion/go/lib/common"
)
// NewRootStruct calls the appropriate NewRoot<x> function corresponding to the capnp proto type ID,
// and returns the inner capnp.Struct that it receives. This allows the helper
// functions in cereal.go to support generic capnp root struct types.
func NewRootStruct(id ProtoIdType, seg *capnp.Segment) (capnp.Struct, error) {
var blank capnp.Struct
switch id {
case ASEntry_TypeID:
v, err := NewRootASEntry(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new ASEntry capnp struct", err)
}
return v.Struct, nil
case CtrlPld_TypeID:
v, err := NewRootCtrlPld(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new CtrlPld capnp struct", err)
}
return v.Struct, nil
case PathSegment_TypeID:
v, err := NewRootPathSegment(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new PathSegment capnp struct", err)
}
return v.Struct, nil
case PathSegmentSignedData_TypeID:
v, err := NewRootPathSegmentSignedData(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new PathSegmentSignedData capnp struct", err)
}
return v.Struct, nil
case RevInfo_TypeID:
v, err := NewRootRevInfo(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new RevInfo capnp struct", err)
}
return v.Struct, nil
case SCIONDMsg_TypeID:
v, err := NewRootSCIONDMsg(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new SCIONDMsg capnp struct", err)
}
return v.Struct, nil
case SignedBlob_TypeID:
v, err := NewRootSignedBlob(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new SignedBlob capnp struct", err)
}
return v.Struct, nil
case SignedCtrlPld_TypeID:
v, err := NewRootSignedCtrlPld(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new SignedCtrlPld capnp struct", err)
}
return v.Struct, nil
case SVCResolutionReply_TypeID:
v, err := NewRootSVCResolutionReply(seg)
if err != nil {
return blank, common.NewBasicError("Error creating new SVCResolutionReply capnp struct", err)
}
return v.Struct, nil
}
return blank, common.NewBasicError(
"Unsupported capnp struct type (i.e. not listed in go/proto/structs_gen_go.sh:ROOTTYPES)",
nil,
"id", id,
)
}
func (s ASEntry) GetStruct() capnp.Struct {
return s.Struct
}
func (s CtrlPld) GetStruct() capnp.Struct {
return s.Struct
}
func (s PathSegment) GetStruct() capnp.Struct {
return s.Struct
}
func (s PathSegmentSignedData) GetStruct() capnp.Struct {
return s.Struct
}
func (s RevInfo) GetStruct() capnp.Struct {
return s.Struct
}
func (s SCIONDMsg) GetStruct() capnp.Struct {
return s.Struct
}
func (s SignedBlob) GetStruct() capnp.Struct {
return s.Struct
}
func (s SignedCtrlPld) GetStruct() capnp.Struct {
return s.Struct
}
func (s SVCResolutionReply) GetStruct() capnp.Struct {
return s.Struct
}