id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
list
docstring
stringlengths
6
2.61k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
85
252
136,800
netrack/openflow
ofp/switch.go
WriteTo
func (sc *SwitchConfig) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, *sc) }
go
func (sc *SwitchConfig) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, *sc) }
[ "func", "(", "sc", "*", "SwitchConfig", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "*", "sc", ")", "\n", "}" ]
// WriteTo implements io.WriterTo interface. It serializes the // switch configuration into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "switch", "configuration", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/switch.go#L131-L133
136,801
netrack/openflow
ofp/switch.go
ReadFrom
func (sc *SwitchConfig) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &sc.Flags, &sc.MissSendLength) }
go
func (sc *SwitchConfig) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &sc.Flags, &sc.MissSendLength) }
[ "func", "(", "sc", "*", "SwitchConfig", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "sc", ".", "Flags", ",", "&", "sc", ".", "MissSendLength",...
// ReadFrom implements io.ReaderFrom interface. It deserializes // the switch configuration from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "switch", "configuration", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/switch.go#L137-L139
136,802
netrack/openflow
ofp/meter.go
WriteTo
func (m MeterBands) WriteTo(w io.Writer) (int64, error) { var n int64 for _, meter := range m { nn, err := meter.WriteTo(w) n += nn if err != nil { return n, err } } return n, nil }
go
func (m MeterBands) WriteTo(w io.Writer) (int64, error) { var n int64 for _, meter := range m { nn, err := meter.WriteTo(w) n += nn if err != nil { return n, err } } return n, nil }
[ "func", "(", "m", "MeterBands", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "var", "n", "int64", "\n\n", "for", "_", ",", "meter", ":=", "range", "m", "{", "nn", ",", "err", ":=", "meter", ".", "Wri...
// WriteTo implements io.WriterTo interface. It serializes the // list of meter bands into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "list", "of", "meter", "bands", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L105-L118
136,803
netrack/openflow
ofp/meter.go
ReadFrom
func (m MeterBands) ReadFrom(r io.Reader) (int64, error) { var meterBandType MeterBandType rm := func() (io.ReaderFrom, error) { if rm, ok := meterBandMap[meterBandType]; ok { rd, err := rm.MakeReader() m = append(m, rd.(MeterBand)) return rd, err } format := "ofp: unknown meter band type: '%x'" re...
go
func (m MeterBands) ReadFrom(r io.Reader) (int64, error) { var meterBandType MeterBandType rm := func() (io.ReaderFrom, error) { if rm, ok := meterBandMap[meterBandType]; ok { rd, err := rm.MakeReader() m = append(m, rd.(MeterBand)) return rd, err } format := "ofp: unknown meter band type: '%x'" re...
[ "func", "(", "m", "MeterBands", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "var", "meterBandType", "MeterBandType", "\n\n", "rm", ":=", "func", "(", ")", "(", "io", ".", "ReaderFrom", ",", "error", ")",...
// ReadFrom implements io.ReaderFrom interface. It deserializes // the list of meter bands from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "list", "of", "meter", "bands", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L122-L138
136,804
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterBandDrop) WriteTo(w io.Writer) (int64, error) { header := meterBand{m.Type(), meterBandLen} return encoding.WriteTo(w, header, m.Rate, m.BurstSize, pad4{}) }
go
func (m *MeterBandDrop) WriteTo(w io.Writer) (int64, error) { header := meterBand{m.Type(), meterBandLen} return encoding.WriteTo(w, header, m.Rate, m.BurstSize, pad4{}) }
[ "func", "(", "m", "*", "MeterBandDrop", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "header", ":=", "meterBand", "{", "m", ".", "Type", "(", ")", ",", "meterBandLen", "}", "\n", "return", "encoding", "....
// WriteTo implements io.WriterTo interface. It serializes the rate // limiter meter band into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "rate", "limiter", "meter", "band", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L158-L161
136,805
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterBandDrop) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &meterBand{}, &m.Rate, &m.BurstSize, &defaultPad4) }
go
func (m *MeterBandDrop) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &meterBand{}, &m.Rate, &m.BurstSize, &defaultPad4) }
[ "func", "(", "m", "*", "MeterBandDrop", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "meterBand", "{", "}", ",", "&", "m", ".", "Rate", ",", ...
// ReadFrom implements io.ReadFrom interface. It deserializes the // rate limiter meter band from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReadFrom", "interface", ".", "It", "deserializes", "the", "rate", "limiter", "meter", "band", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L165-L168
136,806
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterBandDSCPRemark) WriteTo(w io.Writer) (int64, error) { header := meterBand{m.Type(), meterBandLen} return encoding.WriteTo(w, header, m.Rate, m.BurstSize, m.PrecLevel, pad3{}) }
go
func (m *MeterBandDSCPRemark) WriteTo(w io.Writer) (int64, error) { header := meterBand{m.Type(), meterBandLen} return encoding.WriteTo(w, header, m.Rate, m.BurstSize, m.PrecLevel, pad3{}) }
[ "func", "(", "m", "*", "MeterBandDSCPRemark", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "header", ":=", "meterBand", "{", "m", ".", "Type", "(", ")", ",", "meterBandLen", "}", "\n", "return", "encoding"...
// WriteTo implements io.WriterTo interface. It serializes the // DSCP remark meter band into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "DSCP", "remark", "meter", "band", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L193-L197
136,807
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterBandDSCPRemark) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &meterBand{}, &m.Rate, &m.BurstSize, &m.PrecLevel, &defaultPad3) }
go
func (m *MeterBandDSCPRemark) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &meterBand{}, &m.Rate, &m.BurstSize, &m.PrecLevel, &defaultPad3) }
[ "func", "(", "m", "*", "MeterBandDSCPRemark", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "meterBand", "{", "}", ",", "&", "m", ".", "Rate", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // DSCP remark meter band from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "DSCP", "remark", "meter", "band", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L201-L204
136,808
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterBandExperimenter) WriteTo(w io.Writer) (int64, error) { header := meterBand{m.Type(), meterBandLen} return encoding.WriteTo(w, header, m.Rate, m.BurstSize, m.Experimenter) }
go
func (m *MeterBandExperimenter) WriteTo(w io.Writer) (int64, error) { header := meterBand{m.Type(), meterBandLen} return encoding.WriteTo(w, header, m.Rate, m.BurstSize, m.Experimenter) }
[ "func", "(", "m", "*", "MeterBandExperimenter", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "header", ":=", "meterBand", "{", "m", ".", "Type", "(", ")", ",", "meterBandLen", "}", "\n", "return", "encodin...
// WriteTo implements io.WriterTo interface. It serializes the // experimental meter band into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "experimental", "meter", "band", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L226-L230
136,809
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterBandExperimenter) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &meterBand{}, &m.Rate, &m.BurstSize, &m.Experimenter) }
go
func (m *MeterBandExperimenter) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &meterBand{}, &m.Rate, &m.BurstSize, &m.Experimenter) }
[ "func", "(", "m", "*", "MeterBandExperimenter", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "meterBand", "{", "}", ",", "&", "m", ".", "Rate",...
// ReadFrom implements io.ReadFrom interface. It deserializes the // experimental meter band from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReadFrom", "interface", ".", "It", "deserializes", "the", "experimental", "meter", "band", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L234-L237
136,810
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterMod) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, m.Command, m.Flags, m.Meter, m.Bands) }
go
func (m *MeterMod) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, m.Command, m.Flags, m.Meter, m.Bands) }
[ "func", "(", "m", "*", "MeterMod", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "m", ".", "Command", ",", "m", ".", "Flags", ",", "m", ".", "Meter...
// WriteTo implements io.WriterTo interface. It serializes the meter // modification message into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "meter", "modification", "message", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L277-L279
136,811
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterMod) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.Command, &m.Flags, &m.Meter, m.Bands) }
go
func (m *MeterMod) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.Command, &m.Flags, &m.Meter, m.Bands) }
[ "func", "(", "m", "*", "MeterMod", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "m", ".", "Command", ",", "&", "m", ".", "Flags", ",", "&",...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // meter modfiication message from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "meter", "modfiication", "message", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L283-L285
136,812
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterConfigRequest) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, m.Meter, pad4{}) }
go
func (m *MeterConfigRequest) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, m.Meter, pad4{}) }
[ "func", "(", "m", "*", "MeterConfigRequest", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "m", ".", "Meter", ",", "pad4", "{", "}", ")", "\n", "}" ]
// WriteTo implements io.WriterTo interface. It serializes the meter // configuration request into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "meter", "configuration", "request", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L296-L298
136,813
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterConfigRequest) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.Meter, &defaultPad4) }
go
func (m *MeterConfigRequest) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.Meter, &defaultPad4) }
[ "func", "(", "m", "*", "MeterConfigRequest", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "m", ".", "Meter", ",", "&", "defaultPad4", ")", "\n"...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // meter configuration request from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "meter", "configuration", "request", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L302-L304
136,814
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterConfig) WriteTo(w io.Writer) (int64, error) { // Write the list of meter bands to the temporary // buffer to calculate the total length of the message. var buf bytes.Buffer _, err := m.Bands.WriteTo(&buf) if err != nil { return 0, err } length := uint16(meterConfigLen + buf.Len()) return encodi...
go
func (m *MeterConfig) WriteTo(w io.Writer) (int64, error) { // Write the list of meter bands to the temporary // buffer to calculate the total length of the message. var buf bytes.Buffer _, err := m.Bands.WriteTo(&buf) if err != nil { return 0, err } length := uint16(meterConfigLen + buf.Len()) return encodi...
[ "func", "(", "m", "*", "MeterConfig", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "// Write the list of meter bands to the temporary", "// buffer to calculate the total length of the message.", "var", "buf", "bytes", ".", ...
// WriteTo implements io.WriterTo interface. It serializes the // meter configuration into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "meter", "configuration", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L325-L336
136,815
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterConfig) ReadFrom(r io.Reader) (int64, error) { var length uint16 // Read the header of the message, so we could use // the rest of the reader to unmarshal list of bands. n, err := encoding.ReadFrom(r, &length, &m.Flags, &m.Meter) if err != nil { return n, err } // Use the rest of bytes to decod...
go
func (m *MeterConfig) ReadFrom(r io.Reader) (int64, error) { var length uint16 // Read the header of the message, so we could use // the rest of the reader to unmarshal list of bands. n, err := encoding.ReadFrom(r, &length, &m.Flags, &m.Meter) if err != nil { return n, err } // Use the rest of bytes to decod...
[ "func", "(", "m", "*", "MeterConfig", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "var", "length", "uint16", "\n\n", "// Read the header of the message, so we could use", "// the rest of the reader to unmarshal list of ba...
// ReadFrom implements io.ReadFrom interface. It deserializes the // meter configuration from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReadFrom", "interface", ".", "It", "deserializes", "the", "meter", "configuration", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L340-L354
136,816
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterFeatures) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, m.MaxMeter, m.BandTypes, m.Capabilities, m.MaxBands, m.MaxColor, pad2{}) }
go
func (m *MeterFeatures) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, m.MaxMeter, m.BandTypes, m.Capabilities, m.MaxBands, m.MaxColor, pad2{}) }
[ "func", "(", "m", "*", "MeterFeatures", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "m", ".", "MaxMeter", ",", "m", ".", "BandTypes", ",", "m", "."...
// WriteTo implements io.WriterTo interface. It serializes the // meter features into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "meter", "features", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L381-L384
136,817
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterFeatures) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.MaxMeter, &m.BandTypes, &m.Capabilities, &m.MaxBands, &m.MaxColor, &defaultPad2) }
go
func (m *MeterFeatures) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.MaxMeter, &m.BandTypes, &m.Capabilities, &m.MaxBands, &m.MaxColor, &defaultPad2) }
[ "func", "(", "m", "*", "MeterFeatures", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "m", ".", "MaxMeter", ",", "&", "m", ".", "BandTypes", "...
// ReadFrom implements io.ReaderFrom interface. It deserializes // the meter features from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "meter", "features", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L388-L391
136,818
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterBandStats) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, m.PacketBandCount, m.ByteBandCount) }
go
func (m *MeterBandStats) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, m.PacketBandCount, m.ByteBandCount) }
[ "func", "(", "m", "*", "MeterBandStats", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "m", ".", "PacketBandCount", ",", "m", ".", "ByteBandCount", ")", ...
// WriteTo implements io.WriterTo interface. It serializes the meter // band statistics into the fire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "meter", "band", "statistics", "into", "the", "fire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L405-L407
136,819
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterBandStats) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.PacketBandCount, &m.ByteBandCount) }
go
func (m *MeterBandStats) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.PacketBandCount, &m.ByteBandCount) }
[ "func", "(", "m", "*", "MeterBandStats", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "m", ".", "PacketBandCount", ",", "&", "m", ".", "ByteBan...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // meter band statistics from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "meter", "band", "statistics", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L411-L413
136,820
netrack/openflow
ofp/meter.go
WriteTo
func (m *MeterStats) WriteTo(w io.Writer) (int64, error) { var buf bytes.Buffer // Write the list of meter band statistics into // the temporary buffer to calculate the total // message length. _, err := encoding.WriteSliceTo(&buf, m.BandStats) if err != nil { return 0, err } length := uint16(meterStatsLen ...
go
func (m *MeterStats) WriteTo(w io.Writer) (int64, error) { var buf bytes.Buffer // Write the list of meter band statistics into // the temporary buffer to calculate the total // message length. _, err := encoding.WriteSliceTo(&buf, m.BandStats) if err != nil { return 0, err } length := uint16(meterStatsLen ...
[ "func", "(", "m", "*", "MeterStats", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "var", "buf", "bytes", ".", "Buffer", "\n\n", "// Write the list of meter band statistics into", "// the temporary buffer to calculate th...
// WriteTo implements io.WriterTo interface. It serializes the meter // statistics into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "meter", "statistics", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L467-L483
136,821
netrack/openflow
ofp/meter.go
ReadFrom
func (m *MeterStats) ReadFrom(r io.Reader) (int64, error) { var length uint16 // Unmarshal all elements from the reader except // of the list of meter band statistics. n, err := encoding.ReadFrom(r, &m.Meter, &length, &defaultPad6, &m.FlowCount, &m.PacketInCount, &m.ByteInCount, &m.DurationSec, &m.DurationNSec...
go
func (m *MeterStats) ReadFrom(r io.Reader) (int64, error) { var length uint16 // Unmarshal all elements from the reader except // of the list of meter band statistics. n, err := encoding.ReadFrom(r, &m.Meter, &length, &defaultPad6, &m.FlowCount, &m.PacketInCount, &m.ByteInCount, &m.DurationSec, &m.DurationNSec...
[ "func", "(", "m", "*", "MeterStats", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "var", "length", "uint16", "\n\n", "// Unmarshal all elements from the reader except", "// of the list of meter band statistics.", "n", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // meter statistics from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "meter", "statistics", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/meter.go#L487-L501
136,822
netrack/openflow
runner.go
NewMultiRoutineRunner
func NewMultiRoutineRunner(num int) *MultiRoutineRunner { if num <= 0 { panic("number of routines must be positive") } return &MultiRoutineRunner{ num: num, q: make(chan func(), num), } }
go
func NewMultiRoutineRunner(num int) *MultiRoutineRunner { if num <= 0 { panic("number of routines must be positive") } return &MultiRoutineRunner{ num: num, q: make(chan func(), num), } }
[ "func", "NewMultiRoutineRunner", "(", "num", "int", ")", "*", "MultiRoutineRunner", "{", "if", "num", "<=", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "&", "MultiRoutineRunner", "{", "num", ":", "num", ",", "q", ":", "make", ...
// NewMultiRoutineRunner creates a new instance of MultiRoutinerRunner // with a specified amount of workers. Method panics when number is // not positive.
[ "NewMultiRoutineRunner", "creates", "a", "new", "instance", "of", "MultiRoutinerRunner", "with", "a", "specified", "amount", "of", "workers", ".", "Method", "panics", "when", "number", "is", "not", "positive", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/runner.go#L48-L56
136,823
netrack/openflow
runner.go
init
func (mrr *MultiRoutineRunner) init() { for i := 0; i < mrr.num; i++ { go mrr.runner() } }
go
func (mrr *MultiRoutineRunner) init() { for i := 0; i < mrr.num; i++ { go mrr.runner() } }
[ "func", "(", "mrr", "*", "MultiRoutineRunner", ")", "init", "(", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "mrr", ".", "num", ";", "i", "++", "{", "go", "mrr", ".", "runner", "(", ")", "\n", "}", "\n", "}" ]
// init starts all workers.
[ "init", "starts", "all", "workers", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/runner.go#L59-L63
136,824
netrack/openflow
runner.go
Run
func (mrr *MultiRoutineRunner) Run(fn func()) { mrr.once.Do(mrr.init) mrr.q <- fn }
go
func (mrr *MultiRoutineRunner) Run(fn func()) { mrr.once.Do(mrr.init) mrr.q <- fn }
[ "func", "(", "mrr", "*", "MultiRoutineRunner", ")", "Run", "(", "fn", "func", "(", ")", ")", "{", "mrr", ".", "once", ".", "Do", "(", "mrr", ".", "init", ")", "\n", "mrr", ".", "q", "<-", "fn", "\n", "}" ]
// Run puts a function in the waiting queue and exists. This method // returns control to the parent caller.
[ "Run", "puts", "a", "function", "in", "the", "waiting", "queue", "and", "exists", ".", "This", "method", "returns", "control", "to", "the", "parent", "caller", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/runner.go#L73-L76
136,825
netrack/openflow
cookie.go
ReadCookie
func (fn CookieReaderFunc) ReadCookie(r io.Reader) (CookieJar, error) { return fn(r) }
go
func (fn CookieReaderFunc) ReadCookie(r io.Reader) (CookieJar, error) { return fn(r) }
[ "func", "(", "fn", "CookieReaderFunc", ")", "ReadCookie", "(", "r", "io", ".", "Reader", ")", "(", "CookieJar", ",", "error", ")", "{", "return", "fn", "(", "r", ")", "\n", "}" ]
// ReadCookie calls the function with the specifier reader argument.
[ "ReadCookie", "calls", "the", "function", "with", "the", "specifier", "reader", "argument", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/cookie.go#L32-L34
136,826
netrack/openflow
cookie.go
NewCookieMatcher
func NewCookieMatcher(j CookieJar) *CookieMatcher { var cookies uint64 // The default random generator does not allow to create unsigned // 64-bit integers, therefore, we will glue that type from the // two 32-bit pieces. cookiesLow := rand.Uint32() cookiesHigh := rand.Uint32() cookies = (uint64(cookiesHigh) <...
go
func NewCookieMatcher(j CookieJar) *CookieMatcher { var cookies uint64 // The default random generator does not allow to create unsigned // 64-bit integers, therefore, we will glue that type from the // two 32-bit pieces. cookiesLow := rand.Uint32() cookiesHigh := rand.Uint32() cookies = (uint64(cookiesHigh) <...
[ "func", "NewCookieMatcher", "(", "j", "CookieJar", ")", "*", "CookieMatcher", "{", "var", "cookies", "uint64", "\n\n", "// The default random generator does not allow to create unsigned", "// 64-bit integers, therefore, we will glue that type from the", "// two 32-bit pieces.", "cook...
// NewCookieMatcher creates a new cookie matcher. The cookie value will // be randomly generated using the functions from the standard library.
[ "NewCookieMatcher", "creates", "a", "new", "cookie", "matcher", ".", "The", "cookie", "value", "will", "be", "randomly", "generated", "using", "the", "functions", "from", "the", "standard", "library", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/cookie.go#L50-L65
136,827
netrack/openflow
cookie.go
Match
func (f *CookieMatcher) Match(r *Request) bool { rd, ok := r.Body.(*bytes.Buffer) if ok { // If the body is a bytes buffer, we will simply reset // it to reduce the amount of memory to allocate. defer rd.Reset() } else { // Otherwise, we will re-create a new one. body, err := ioutil.ReadAll(r.Body) defe...
go
func (f *CookieMatcher) Match(r *Request) bool { rd, ok := r.Body.(*bytes.Buffer) if ok { // If the body is a bytes buffer, we will simply reset // it to reduce the amount of memory to allocate. defer rd.Reset() } else { // Otherwise, we will re-create a new one. body, err := ioutil.ReadAll(r.Body) defe...
[ "func", "(", "f", "*", "CookieMatcher", ")", "Match", "(", "r", "*", "Request", ")", "bool", "{", "rd", ",", "ok", ":=", "r", ".", "Body", ".", "(", "*", "bytes", ".", "Buffer", ")", "\n\n", "if", "ok", "{", "// If the body is a bytes buffer, we will s...
// Match compares the cookie from the message with the given one. // // Cookie of each incoming request will be compared to the given cookie // jar cookie. If the request cookie matches the registered one, the given // handler will be used to process the request.
[ "Match", "compares", "the", "cookie", "from", "the", "message", "with", "the", "given", "one", ".", "Cookie", "of", "each", "incoming", "request", "will", "be", "compared", "to", "the", "given", "cookie", "jar", "cookie", ".", "If", "the", "request", "cook...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/cookie.go#L72-L98
136,828
netrack/openflow
cookie.go
CookieReaderOf
func CookieReaderOf(j CookieJar) CookieReader { valueType := reflect.TypeOf(j).Elem() cr := func(r io.Reader) (CookieJar, error) { value := reflect.New(valueType) jar, ok := value.Interface().(io.ReaderFrom) // The CookieJar have to implement the io.ReaderFrom // interface, so it could be unmarshaled. if ...
go
func CookieReaderOf(j CookieJar) CookieReader { valueType := reflect.TypeOf(j).Elem() cr := func(r io.Reader) (CookieJar, error) { value := reflect.New(valueType) jar, ok := value.Interface().(io.ReaderFrom) // The CookieJar have to implement the io.ReaderFrom // interface, so it could be unmarshaled. if ...
[ "func", "CookieReaderOf", "(", "j", "CookieJar", ")", "CookieReader", "{", "valueType", ":=", "reflect", ".", "TypeOf", "(", "j", ")", ".", "Elem", "(", ")", "\n\n", "cr", ":=", "func", "(", "r", "io", ".", "Reader", ")", "(", "CookieJar", ",", "erro...
// CookieReaderOf creates a new cookie reader instance from the cookie // jar. It uses reflection to create a new examplar of the given type, // so the resulting reader is safe to use in multiple go-routines.
[ "CookieReaderOf", "creates", "a", "new", "cookie", "reader", "instance", "from", "the", "cookie", "jar", ".", "It", "uses", "reflection", "to", "create", "a", "new", "examplar", "of", "the", "given", "type", "so", "the", "resulting", "reader", "is", "safe", ...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/cookie.go#L103-L123
136,829
netrack/openflow
ofp/packet.go
WriteTo
func (p *PacketIn) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, p.Buffer, p.Length, p.Reason, p.Table, p.Cookie, &p.Match, pad2{}, p.Data) }
go
func (p *PacketIn) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, p.Buffer, p.Length, p.Reason, p.Table, p.Cookie, &p.Match, pad2{}, p.Data) }
[ "func", "(", "p", "*", "PacketIn", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "p", ".", "Buffer", ",", "p", ".", "Length", ",", "p", ".", "Reaso...
// WriteTo implements io.WriterTo interface. It serializes the packet-in // message into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "packet", "-", "in", "message", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/packet.go#L105-L108
136,830
netrack/openflow
ofp/packet.go
ReadFrom
func (p *PacketIn) ReadFrom(r io.Reader) (int64, error) { // Read the Packet-In header, list of match rules // that used to match the processing packet, // then the original frame, if any. n, err := encoding.ReadFrom(r, &p.Buffer, &p.Length, &p.Reason, &p.Table, &p.Cookie, &p.Match, &defaultPad2) if err != nil {...
go
func (p *PacketIn) ReadFrom(r io.Reader) (int64, error) { // Read the Packet-In header, list of match rules // that used to match the processing packet, // then the original frame, if any. n, err := encoding.ReadFrom(r, &p.Buffer, &p.Length, &p.Reason, &p.Table, &p.Cookie, &p.Match, &defaultPad2) if err != nil {...
[ "func", "(", "p", "*", "PacketIn", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "// Read the Packet-In header, list of match rules", "// that used to match the processing packet,", "// then the original frame, if any.", "n", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // packet-in message from wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "packet", "-", "in", "message", "from", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/packet.go#L112-L127
136,831
netrack/openflow
ofp/packet.go
WriteTo
func (p *PacketOut) WriteTo(w io.Writer) (n int64, err error) { var buf bytes.Buffer // Simply serialize the list of actions into the buffer, // and then write the message with necessary paddings. _, err = p.Actions.WriteTo(&buf) if err != nil { return } return encoding.WriteTo(w, p.Buffer, p.InPort, uint1...
go
func (p *PacketOut) WriteTo(w io.Writer) (n int64, err error) { var buf bytes.Buffer // Simply serialize the list of actions into the buffer, // and then write the message with necessary paddings. _, err = p.Actions.WriteTo(&buf) if err != nil { return } return encoding.WriteTo(w, p.Buffer, p.InPort, uint1...
[ "func", "(", "p", "*", "PacketOut", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "var", "buf", "bytes", ".", "Buffer", "\n\n", "// Simply serialize the list of actions into the buffer,", "// and then wri...
// WriteTo implements io.WriterTo interface. It serializes the message // into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "message", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/packet.go#L155-L167
136,832
netrack/openflow
ofp/packet.go
ReadFrom
func (p *PacketOut) ReadFrom(r io.Reader) (int64, error) { var plen uint16 n, err := encoding.ReadFrom(r, &p.Buffer, &p.InPort, &plen, &defaultPad6) if err != nil { return n, err } limrd := io.LimitReader(r, int64(plen)) p.Actions = nil nn, err := p.Actions.ReadFrom(limrd) if n += nn; err != nil { ret...
go
func (p *PacketOut) ReadFrom(r io.Reader) (int64, error) { var plen uint16 n, err := encoding.ReadFrom(r, &p.Buffer, &p.InPort, &plen, &defaultPad6) if err != nil { return n, err } limrd := io.LimitReader(r, int64(plen)) p.Actions = nil nn, err := p.Actions.ReadFrom(limrd) if n += nn; err != nil { ret...
[ "func", "(", "p", "*", "PacketOut", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "var", "plen", "uint16", "\n\n", "n", ",", "err", ":=", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "p", ".", "B...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // packet-out message from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "packet", "-", "out", "message", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/packet.go#L171-L191
136,833
netrack/openflow
internal/encoding/encoding.go
WriteSliceTo
func WriteSliceTo(w io.Writer, slice interface{}) (int64, error) { var n int64 // Retrieve the lengt of the provided slice. sliceValue := reflect.ValueOf(slice) sliceLen := sliceValue.Len() for index := 0; index < sliceLen; index++ { // It is expected, that elements of the slice would not implement // the io...
go
func WriteSliceTo(w io.Writer, slice interface{}) (int64, error) { var n int64 // Retrieve the lengt of the provided slice. sliceValue := reflect.ValueOf(slice) sliceLen := sliceValue.Len() for index := 0; index < sliceLen; index++ { // It is expected, that elements of the slice would not implement // the io...
[ "func", "WriteSliceTo", "(", "w", "io", ".", "Writer", ",", "slice", "interface", "{", "}", ")", "(", "int64", ",", "error", ")", "{", "var", "n", "int64", "\n\n", "// Retrieve the lengt of the provided slice.", "sliceValue", ":=", "reflect", ".", "ValueOf", ...
// WriteSliceTo writes the slice of the types, that implement io.WriterTo // interface into the given writer. // // The function will panic if the given variable is not a slice or elements // of the slice does not implement interface io.WriterTo.
[ "WriteSliceTo", "writes", "the", "slice", "of", "the", "types", "that", "implement", "io", ".", "WriterTo", "interface", "into", "the", "given", "writer", ".", "The", "function", "will", "panic", "if", "the", "given", "variable", "is", "not", "a", "slice", ...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/internal/encoding/encoding.go#L120-L143
136,834
netrack/openflow
internal/encoding/encoding.go
ReadSliceFrom
func ReadSliceFrom(r io.Reader, rm ReaderMaker, slice interface{}) (int64, error) { sliceValue := reflect.ValueOf(slice) return ReadFunc(r, rm, func(reader io.ReaderFrom) { elem := reflect.ValueOf(reader).Elem() reflect.Append(sliceValue, elem) }) }
go
func ReadSliceFrom(r io.Reader, rm ReaderMaker, slice interface{}) (int64, error) { sliceValue := reflect.ValueOf(slice) return ReadFunc(r, rm, func(reader io.ReaderFrom) { elem := reflect.ValueOf(reader).Elem() reflect.Append(sliceValue, elem) }) }
[ "func", "ReadSliceFrom", "(", "r", "io", ".", "Reader", ",", "rm", "ReaderMaker", ",", "slice", "interface", "{", "}", ")", "(", "int64", ",", "error", ")", "{", "sliceValue", ":=", "reflect", ".", "ValueOf", "(", "slice", ")", "\n", "return", "ReadFun...
// ReadSliceFrom appends elements decoded using reader from reader maker // into slice of arbitrary type. Elements of the slice should be the // same type as produced by reader maker.
[ "ReadSliceFrom", "appends", "elements", "decoded", "using", "reader", "from", "reader", "maker", "into", "slice", "of", "arbitrary", "type", ".", "Elements", "of", "the", "slice", "should", "be", "the", "same", "type", "as", "produced", "by", "reader", "maker"...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/internal/encoding/encoding.go#L148-L154
136,835
netrack/openflow
internal/encoding/encoding.go
ReadFunc
func ReadFunc(r io.Reader, rm ReaderMaker, fn func(r io.ReaderFrom)) (int64, error) { var n int64 for { reader, err := rm.MakeReader() if err != nil { return n, err } nn, err := reader.ReadFrom(r) n += nn if err != nil { return n, SkipEOF(err) } fn(reader) } }
go
func ReadFunc(r io.Reader, rm ReaderMaker, fn func(r io.ReaderFrom)) (int64, error) { var n int64 for { reader, err := rm.MakeReader() if err != nil { return n, err } nn, err := reader.ReadFrom(r) n += nn if err != nil { return n, SkipEOF(err) } fn(reader) } }
[ "func", "ReadFunc", "(", "r", "io", ".", "Reader", ",", "rm", "ReaderMaker", ",", "fn", "func", "(", "r", "io", ".", "ReaderFrom", ")", ")", "(", "int64", ",", "error", ")", "{", "var", "n", "int64", "\n\n", "for", "{", "reader", ",", "err", ":="...
// ReadFunc decodes elements using reader created by reader maker and // calls a callback function for each of them. // // Returns a number of extracted bytes and error instance.
[ "ReadFunc", "decodes", "elements", "using", "reader", "created", "by", "reader", "maker", "and", "calls", "a", "callback", "function", "for", "each", "of", "them", ".", "Returns", "a", "number", "of", "extracted", "bytes", "and", "error", "instance", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/internal/encoding/encoding.go#L160-L178
136,836
netrack/openflow
internal/encoding/encoding.go
ReaderMakerOf
func ReaderMakerOf(v interface{}) ReaderMaker { valueType := reflect.TypeOf(v) return ReaderMakerFunc(func() (io.ReaderFrom, error) { value := reflect.New(valueType) return value.Interface().(io.ReaderFrom), nil }) }
go
func ReaderMakerOf(v interface{}) ReaderMaker { valueType := reflect.TypeOf(v) return ReaderMakerFunc(func() (io.ReaderFrom, error) { value := reflect.New(valueType) return value.Interface().(io.ReaderFrom), nil }) }
[ "func", "ReaderMakerOf", "(", "v", "interface", "{", "}", ")", "ReaderMaker", "{", "valueType", ":=", "reflect", ".", "TypeOf", "(", "v", ")", "\n", "return", "ReaderMakerFunc", "(", "func", "(", ")", "(", "io", ".", "ReaderFrom", ",", "error", ")", "{...
// ReaderMakerOf creates a new ReaderMaker based on the specified // type. Pointer to the type must implement io.ReaderFrom interface.
[ "ReaderMakerOf", "creates", "a", "new", "ReaderMaker", "based", "on", "the", "specified", "type", ".", "Pointer", "to", "the", "type", "must", "implement", "io", ".", "ReaderFrom", "interface", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/internal/encoding/encoding.go#L188-L194
136,837
netrack/openflow
mux.go
Match
func (t TypeMatcher) Match(r *Request) bool { return r.Header.Type == Type(t) }
go
func (t TypeMatcher) Match(r *Request) bool { return r.Header.Type == Type(t) }
[ "func", "(", "t", "TypeMatcher", ")", "Match", "(", "r", "*", "Request", ")", "bool", "{", "return", "r", ".", "Header", ".", "Type", "==", "Type", "(", "t", ")", "\n", "}" ]
// Match implements Matcher interface and matches the request by the type.
[ "Match", "implements", "Matcher", "interface", "and", "matches", "the", "request", "by", "the", "type", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L29-L31
136,838
netrack/openflow
mux.go
MultiMatcher
func MultiMatcher(m ...Matcher) Matcher { fn := func(r *Request) bool { for _, matcher := range m { if !matcher.Match(r) { return false } } return true } return &MatcherFunc{fn} }
go
func MultiMatcher(m ...Matcher) Matcher { fn := func(r *Request) bool { for _, matcher := range m { if !matcher.Match(r) { return false } } return true } return &MatcherFunc{fn} }
[ "func", "MultiMatcher", "(", "m", "...", "Matcher", ")", "Matcher", "{", "fn", ":=", "func", "(", "r", "*", "Request", ")", "bool", "{", "for", "_", ",", "matcher", ":=", "range", "m", "{", "if", "!", "matcher", ".", "Match", "(", "r", ")", "{", ...
// MultiMatcher creates a new Matcher instance that matches the request // by all specified criteria.
[ "MultiMatcher", "creates", "a", "new", "Matcher", "instance", "that", "matches", "the", "request", "by", "all", "specified", "criteria", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L35-L47
136,839
netrack/openflow
mux.go
handle
func (mux *ServeMux) handle(e *muxEntry) { mux.mu.Lock() defer mux.mu.Unlock() if e.matcher == nil { panic("openflow: nil matcher") } if e.handler == nil { panic("openflow: nil handler") } if _, dup := mux.handlers[e.matcher]; dup { text := "openflow: multiple registrations for %v" panic(fmt.Errorf(te...
go
func (mux *ServeMux) handle(e *muxEntry) { mux.mu.Lock() defer mux.mu.Unlock() if e.matcher == nil { panic("openflow: nil matcher") } if e.handler == nil { panic("openflow: nil handler") } if _, dup := mux.handlers[e.matcher]; dup { text := "openflow: multiple registrations for %v" panic(fmt.Errorf(te...
[ "func", "(", "mux", "*", "ServeMux", ")", "handle", "(", "e", "*", "muxEntry", ")", "{", "mux", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "mux", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "e", ".", "matcher", "==", "nil", "{", "...
// handle appends to the list of registered handlers a new one. If the // matcher or handler of the entry is not defined, a panic function will // be called.
[ "handle", "appends", "to", "the", "list", "of", "registered", "handlers", "a", "new", "one", ".", "If", "the", "matcher", "or", "handler", "of", "the", "entry", "is", "not", "defined", "a", "panic", "function", "will", "be", "called", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L75-L93
136,840
netrack/openflow
mux.go
HandleOnce
func (mux *ServeMux) HandleOnce(m Matcher, h Handler) { mux.handle(&muxEntry{m, h, true}) }
go
func (mux *ServeMux) HandleOnce(m Matcher, h Handler) { mux.handle(&muxEntry{m, h, true}) }
[ "func", "(", "mux", "*", "ServeMux", ")", "HandleOnce", "(", "m", "Matcher", ",", "h", "Handler", ")", "{", "mux", ".", "handle", "(", "&", "muxEntry", "{", "m", ",", "h", ",", "true", "}", ")", "\n", "}" ]
// HandleOnce registers disposable handler for the given pattern. // // It is not guaranteed that handler will process the first message // exemplar of the matching message.
[ "HandleOnce", "registers", "disposable", "handler", "for", "the", "given", "pattern", ".", "It", "is", "not", "guaranteed", "that", "handler", "will", "process", "the", "first", "message", "exemplar", "of", "the", "matching", "message", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L104-L106
136,841
netrack/openflow
mux.go
HandleFunc
func (mux *ServeMux) HandleFunc(m Matcher, h HandlerFunc) { mux.Handle(m, h) }
go
func (mux *ServeMux) HandleFunc(m Matcher, h HandlerFunc) { mux.Handle(m, h) }
[ "func", "(", "mux", "*", "ServeMux", ")", "HandleFunc", "(", "m", "Matcher", ",", "h", "HandlerFunc", ")", "{", "mux", ".", "Handle", "(", "m", ",", "h", ")", "\n", "}" ]
// HandleFunc registers handler function for the given pattern.
[ "HandleFunc", "registers", "handler", "function", "for", "the", "given", "pattern", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L109-L111
136,842
netrack/openflow
mux.go
Handler
func (mux *ServeMux) Handler(r *Request) Handler { var matcher Matcher var entry *muxEntry // Acquire a read lock to ensure that list would not // be modified during the search of registered handler. mux.mu.RLock() var matched bool // Try to match the processing request to any of the registered // filters. f...
go
func (mux *ServeMux) Handler(r *Request) Handler { var matcher Matcher var entry *muxEntry // Acquire a read lock to ensure that list would not // be modified during the search of registered handler. mux.mu.RLock() var matched bool // Try to match the processing request to any of the registered // filters. f...
[ "func", "(", "mux", "*", "ServeMux", ")", "Handler", "(", "r", "*", "Request", ")", "Handler", "{", "var", "matcher", "Matcher", "\n", "var", "entry", "*", "muxEntry", "\n\n", "// Acquire a read lock to ensure that list would not", "// be modified during the search of...
// Handler returns a handler of the specified request.
[ "Handler", "returns", "a", "handler", "of", "the", "specified", "request", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L114-L162
136,843
netrack/openflow
mux.go
Handle
func (mux *TypeMux) Handle(t Type, h Handler) { mux.mux.Handle(TypeMatcher(t), h) }
go
func (mux *TypeMux) Handle(t Type, h Handler) { mux.mux.Handle(TypeMatcher(t), h) }
[ "func", "(", "mux", "*", "TypeMux", ")", "Handle", "(", "t", "Type", ",", "h", "Handler", ")", "{", "mux", ".", "mux", ".", "Handle", "(", "TypeMatcher", "(", "t", ")", ",", "h", ")", "\n", "}" ]
// Handle registers the handler for the given message type.
[ "Handle", "registers", "the", "handler", "for", "the", "given", "message", "type", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L184-L186
136,844
netrack/openflow
mux.go
HandleOnce
func (mux *TypeMux) HandleOnce(t Type, h Handler) { mux.mux.HandleOnce(TypeMatcher(t), h) }
go
func (mux *TypeMux) HandleOnce(t Type, h Handler) { mux.mux.HandleOnce(TypeMatcher(t), h) }
[ "func", "(", "mux", "*", "TypeMux", ")", "HandleOnce", "(", "t", "Type", ",", "h", "Handler", ")", "{", "mux", ".", "mux", ".", "HandleOnce", "(", "TypeMatcher", "(", "t", ")", ",", "h", ")", "\n", "}" ]
// HandleOnce registers a disposable handler for the given message type.
[ "HandleOnce", "registers", "a", "disposable", "handler", "for", "the", "given", "message", "type", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L189-L191
136,845
netrack/openflow
mux.go
HandleFunc
func (mux *TypeMux) HandleFunc(t Type, f HandlerFunc) { mux.Handle(t, f) }
go
func (mux *TypeMux) HandleFunc(t Type, f HandlerFunc) { mux.Handle(t, f) }
[ "func", "(", "mux", "*", "TypeMux", ")", "HandleFunc", "(", "t", "Type", ",", "f", "HandlerFunc", ")", "{", "mux", ".", "Handle", "(", "t", ",", "f", ")", "\n", "}" ]
// HandleFunc registers handler function for the given message type.
[ "HandleFunc", "registers", "handler", "function", "for", "the", "given", "message", "type", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L194-L196
136,846
netrack/openflow
mux.go
Handler
func (mux *TypeMux) Handler(r *Request) Handler { return mux.mux.Handler(r) }
go
func (mux *TypeMux) Handler(r *Request) Handler { return mux.mux.Handler(r) }
[ "func", "(", "mux", "*", "TypeMux", ")", "Handler", "(", "r", "*", "Request", ")", "Handler", "{", "return", "mux", ".", "mux", ".", "Handler", "(", "r", ")", "\n", "}" ]
// Handler returns a Handler instance for the given OpenFlow request.
[ "Handler", "returns", "a", "Handler", "instance", "for", "the", "given", "OpenFlow", "request", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L199-L201
136,847
netrack/openflow
mux.go
HandleFunc
func HandleFunc(t Type, f func(ResponseWriter, *Request)) { DefaultMux.HandleFunc(t, f) }
go
func HandleFunc(t Type, f func(ResponseWriter, *Request)) { DefaultMux.HandleFunc(t, f) }
[ "func", "HandleFunc", "(", "t", "Type", ",", "f", "func", "(", "ResponseWriter", ",", "*", "Request", ")", ")", "{", "DefaultMux", ".", "HandleFunc", "(", "t", ",", "f", ")", "\n", "}" ]
// HandleFunc registers the handler function on the given message type // in the DefaultMux.
[ "HandleFunc", "registers", "the", "handler", "function", "on", "the", "given", "message", "type", "in", "the", "DefaultMux", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/mux.go#L227-L229
136,848
netrack/openflow
server.go
Write
func (r *response) Write(header *Header, w io.WriterTo) (err error) { var buf bytes.Buffer // When the version is not configured properly, we will // use the version from the response header, to minimize // manual configuration. if header.Version == 0 { header.Version = r.header.Version } r.bufMu.Lock() def...
go
func (r *response) Write(header *Header, w io.WriterTo) (err error) { var buf bytes.Buffer // When the version is not configured properly, we will // use the version from the response header, to minimize // manual configuration. if header.Version == 0 { header.Version = r.header.Version } r.bufMu.Lock() def...
[ "func", "(", "r", "*", "response", ")", "Write", "(", "header", "*", "Header", ",", "w", "io", ".", "WriterTo", ")", "(", "err", "error", ")", "{", "var", "buf", "bytes", ".", "Buffer", "\n\n", "// When the version is not configured properly, we will", "// u...
// Write sends an OpenFlow response.
[ "Write", "sends", "an", "OpenFlow", "response", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/server.go#L58-L90
136,849
netrack/openflow
server.go
receive
func (r *receiver) receive() { for { req, err := r.Conn.Receive() r.ch <- reqwrap{req, err} if err != nil { close(r.ch) return } } }
go
func (r *receiver) receive() { for { req, err := r.Conn.Receive() r.ch <- reqwrap{req, err} if err != nil { close(r.ch) return } } }
[ "func", "(", "r", "*", "receiver", ")", "receive", "(", ")", "{", "for", "{", "req", ",", "err", ":=", "r", ".", "Conn", ".", "Receive", "(", ")", "\n", "r", ".", "ch", "<-", "reqwrap", "{", "req", ",", "err", "}", "\n\n", "if", "err", "!=", ...
// The receive starts an infinite loop of reading the requests from // the client connection. When the receive call returns an error, a // submission channel closes and loop terminates.
[ "The", "receive", "starts", "an", "infinite", "loop", "of", "reading", "the", "requests", "from", "the", "client", "connection", ".", "When", "the", "receive", "call", "returns", "an", "error", "a", "submission", "channel", "closes", "and", "loop", "terminates...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/server.go#L112-L122
136,850
netrack/openflow
server.go
C
func (r *receiver) C() <-chan reqwrap { // Wait for a new request from the client. r.once.Do(r.start) return r.ch }
go
func (r *receiver) C() <-chan reqwrap { // Wait for a new request from the client. r.once.Do(r.start) return r.ch }
[ "func", "(", "r", "*", "receiver", ")", "C", "(", ")", "<-", "chan", "reqwrap", "{", "// Wait for a new request from the client.", "r", ".", "once", ".", "Do", "(", "r", ".", "start", ")", "\n", "return", "r", ".", "ch", "\n", "}" ]
// C returns a read-only channel of request plus error.
[ "C", "returns", "a", "read", "-", "only", "channel", "of", "request", "plus", "error", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/server.go#L132-L136
136,851
netrack/openflow
server.go
ListenAndServe
func (srv *Server) ListenAndServe() error { ln, err := net.Listen("tcp", srv.Addr) if err != nil { return err } return srv.Serve(ln) }
go
func (srv *Server) ListenAndServe() error { ln, err := net.Listen("tcp", srv.Addr) if err != nil { return err } return srv.Serve(ln) }
[ "func", "(", "srv", "*", "Server", ")", "ListenAndServe", "(", ")", "error", "{", "ln", ",", "err", ":=", "net", ".", "Listen", "(", "\"", "\"", ",", "srv", ".", "Addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\...
// ListenAndServe listens on the network address and then calls Server // to handle requests on the incoming connections.
[ "ListenAndServe", "listens", "on", "the", "network", "address", "and", "then", "calls", "Server", "to", "handle", "requests", "on", "the", "incoming", "connections", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/server.go#L210-L217
136,852
netrack/openflow
server.go
Serve
func (srv *Server) Serve(l net.Listener) error { defer l.Close() // When the handler is not specified, the default dispatcher // will be used instead. handler := srv.Handler if handler == nil { handler = DefaultMux } hr := srv.HandlerRunner if hr == nil { hr = OnDemandRoutineRunner{} } cr := srv.ConnRu...
go
func (srv *Server) Serve(l net.Listener) error { defer l.Close() // When the handler is not specified, the default dispatcher // will be used instead. handler := srv.Handler if handler == nil { handler = DefaultMux } hr := srv.HandlerRunner if hr == nil { hr = OnDemandRoutineRunner{} } cr := srv.ConnRu...
[ "func", "(", "srv", "*", "Server", ")", "Serve", "(", "l", "net", ".", "Listener", ")", "error", "{", "defer", "l", ".", "Close", "(", ")", "\n\n", "// When the handler is not specified, the default dispatcher", "// will be used instead.", "handler", ":=", "srv", ...
// Serve accepts incoming connections on the Listener l, creating a // new service goroutine for each.
[ "Serve", "accepts", "incoming", "connections", "on", "the", "Listener", "l", "creating", "a", "new", "service", "goroutine", "for", "each", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/server.go#L221-L250
136,853
netrack/openflow
server.go
accept
func (srv *Server) accept(l net.Listener, cr, hr Runner, h Handler) error { rwc, err := l.Accept() if err != nil { return err } c := newConn(rwc) c.ReadTimeout = srv.ReadTimeout c.WriteTimeout = srv.WriteTimeout srv.setState(c, StateNew) // Terminate the connection when count of open connections exceed //...
go
func (srv *Server) accept(l net.Listener, cr, hr Runner, h Handler) error { rwc, err := l.Accept() if err != nil { return err } c := newConn(rwc) c.ReadTimeout = srv.ReadTimeout c.WriteTimeout = srv.WriteTimeout srv.setState(c, StateNew) // Terminate the connection when count of open connections exceed //...
[ "func", "(", "srv", "*", "Server", ")", "accept", "(", "l", "net", ".", "Listener", ",", "cr", ",", "hr", "Runner", ",", "h", "Handler", ")", "error", "{", "rwc", ",", "err", ":=", "l", ".", "Accept", "(", ")", "\n", "if", "err", "!=", "nil", ...
// The accept block until a new connection will be extracted from the // queue. It keeps track of count of incoming connections and closes all // that exceed the MaxConns threshold.
[ "The", "accept", "block", "until", "a", "new", "connection", "will", "be", "extracted", "from", "the", "queue", ".", "It", "keeps", "track", "of", "count", "of", "incoming", "connections", "and", "closes", "all", "that", "exceed", "the", "MaxConns", "thresho...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/server.go#L255-L282
136,854
netrack/openflow
server.go
serveReq
func (srv *Server) serveReq(c *conn, req *Request, h Handler) { state := StateActive if req.Header.Type == TypeHello { state = StateHandshake } srv.setState(c, state) // Define a response version from the request version, so // it will potentially reduce the amount of additional // header configurations. hea...
go
func (srv *Server) serveReq(c *conn, req *Request, h Handler) { state := StateActive if req.Header.Type == TypeHello { state = StateHandshake } srv.setState(c, state) // Define a response version from the request version, so // it will potentially reduce the amount of additional // header configurations. hea...
[ "func", "(", "srv", "*", "Server", ")", "serveReq", "(", "c", "*", "conn", ",", "req", "*", "Request", ",", "h", "Handler", ")", "{", "state", ":=", "StateActive", "\n", "if", "req", ".", "Header", ".", "Type", "==", "TypeHello", "{", "state", "=",...
// The serveReq serves a single request from the given connection using // specified handler.
[ "The", "serveReq", "serves", "a", "single", "request", "from", "the", "given", "connection", "using", "specified", "handler", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/server.go#L315-L343
136,855
netrack/openflow
ofp/multipart.go
read
func (r *reader) read(b []byte) (int, error) { // Initialize a buffer only once, to dump // the content of the writer to the buffer. r.once.Do(func() { r.buf = new(bytes.Buffer) _, r.bufE = r.WriterTo.WriteTo(r.buf) }) if r.bufE != nil { return 0, r.bufE } // And then read the data from the buffer back. ...
go
func (r *reader) read(b []byte) (int, error) { // Initialize a buffer only once, to dump // the content of the writer to the buffer. r.once.Do(func() { r.buf = new(bytes.Buffer) _, r.bufE = r.WriterTo.WriteTo(r.buf) }) if r.bufE != nil { return 0, r.bufE } // And then read the data from the buffer back. ...
[ "func", "(", "r", "*", "reader", ")", "read", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "// Initialize a buffer only once, to dump", "// the content of the writer to the buffer.", "r", ".", "once", ".", "Do", "(", "func", "(", ")",...
// read is used to enclose the content of the WriterTo instance into // the underlying buffer instance.
[ "read", "is", "used", "to", "enclose", "the", "content", "of", "the", "WriterTo", "instance", "into", "the", "underlying", "buffer", "instance", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/multipart.go#L172-L186
136,856
netrack/openflow
ofp/multipart.go
Read
func (r *reader) Read(b []byte) (int, error) { switch r := r.WriterTo.(type) { case io.Reader: return r.Read(b) } return r.read(b) }
go
func (r *reader) Read(b []byte) (int, error) { switch r := r.WriterTo.(type) { case io.Reader: return r.Read(b) } return r.read(b) }
[ "func", "(", "r", "*", "reader", ")", "Read", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "switch", "r", ":=", "r", ".", "WriterTo", ".", "(", "type", ")", "{", "case", "io", ".", "Reader", ":", "return", "r", ".", ...
// Read implements io.Reader interface. When the underlying instance of // the io.WriterTo interface implements io.Reader, it will be used to // read the given bytes. Otherwise, a buffer of bytes will be used to // store the bytes.
[ "Read", "implements", "io", ".", "Reader", "interface", ".", "When", "the", "underlying", "instance", "of", "the", "io", ".", "WriterTo", "interface", "implements", "io", ".", "Reader", "it", "will", "be", "used", "to", "read", "the", "given", "bytes", "."...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/multipart.go#L192-L199
136,857
netrack/openflow
ofp/multipart.go
NewMultipartRequest
func NewMultipartRequest(t MultipartType, body io.WriterTo) *MultipartRequest { var rd io.Reader // When the body is not defined then bypass wrapping // it with a reader type. if body != nil { rd = &reader{WriterTo: body} } return &MultipartRequest{t, 0, rd} }
go
func NewMultipartRequest(t MultipartType, body io.WriterTo) *MultipartRequest { var rd io.Reader // When the body is not defined then bypass wrapping // it with a reader type. if body != nil { rd = &reader{WriterTo: body} } return &MultipartRequest{t, 0, rd} }
[ "func", "NewMultipartRequest", "(", "t", "MultipartType", ",", "body", "io", ".", "WriterTo", ")", "*", "MultipartRequest", "{", "var", "rd", "io", ".", "Reader", "\n\n", "// When the body is not defined then bypass wrapping", "// it with a reader type.", "if", "body", ...
// NewMultipartRequest creates a new multipart request of the given // type. If the body is not equal to nil, it will be sent as part of // the multipart request message.
[ "NewMultipartRequest", "creates", "a", "new", "multipart", "request", "of", "the", "given", "type", ".", "If", "the", "body", "is", "not", "equal", "to", "nil", "it", "will", "be", "sent", "as", "part", "of", "the", "multipart", "request", "message", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/multipart.go#L225-L235
136,858
netrack/openflow
ofp/multipart.go
WriteTo
func (m *MultipartRequest) WriteTo(w io.Writer) (int64, error) { // By default, body will be embedded into the reader type. return encoding.WriteTo(w, m.Type, m.Flags, pad4{}, m.Body) }
go
func (m *MultipartRequest) WriteTo(w io.Writer) (int64, error) { // By default, body will be embedded into the reader type. return encoding.WriteTo(w, m.Type, m.Flags, pad4{}, m.Body) }
[ "func", "(", "m", "*", "MultipartRequest", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "// By default, body will be embedded into the reader type.", "return", "encoding", ".", "WriteTo", "(", "w", ",", "m", ".", ...
// WriteTo implements io.WriterTo interface. It serializes the multipart // request into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "multipart", "request", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/multipart.go#L239-L242
136,859
netrack/openflow
ofp/multipart.go
WriteTo
func (m *MultipartReply) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, *m, pad4{}) }
go
func (m *MultipartReply) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, *m, pad4{}) }
[ "func", "(", "m", "*", "MultipartReply", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "*", "m", ",", "pad4", "{", "}", ")", "\n", "}" ]
// WriteTo implements io.WriterTo interface. It serializes the multipart // reply into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "multipart", "reply", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/multipart.go#L272-L274
136,860
netrack/openflow
ofp/multipart.go
WriteTo
func (m *ExperimenterMultipartHeader) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, *m) }
go
func (m *ExperimenterMultipartHeader) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, *m) }
[ "func", "(", "m", "*", "ExperimenterMultipartHeader", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "*", "m", ")", "\n", "}" ]
// WriteTo implements io.WriterTo interface. It serializes the multipart // experimenter header into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "multipart", "experimenter", "header", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/multipart.go#L294-L296
136,861
netrack/openflow
ofp/multipart.go
ReadFrom
func (m *ExperimenterMultipartHeader) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.Experimenter, &m.ExpType) }
go
func (m *ExperimenterMultipartHeader) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &m.Experimenter, &m.ExpType) }
[ "func", "(", "m", "*", "ExperimenterMultipartHeader", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "m", ".", "Experimenter", ",", "&", "m", ".", ...
// ReadFrom implements io.ReadFrom interface. It deserializes the multipart // experimenter header from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReadFrom", "interface", ".", "It", "deserializes", "the", "multipart", "experimenter", "header", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/multipart.go#L300-L302
136,862
netrack/openflow
header.go
Copy
func (h *Header) Copy() *Header { return &Header{h.Version, h.Type, h.Length, h.Transaction} }
go
func (h *Header) Copy() *Header { return &Header{h.Version, h.Type, h.Length, h.Transaction} }
[ "func", "(", "h", "*", "Header", ")", "Copy", "(", ")", "*", "Header", "{", "return", "&", "Header", "{", "h", ".", "Version", ",", "h", ".", "Type", ",", "h", ".", "Length", ",", "h", ".", "Transaction", "}", "\n", "}" ]
// Copy returns a copy of the request header.
[ "Copy", "returns", "a", "copy", "of", "the", "request", "header", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/header.go#L223-L225
136,863
netrack/openflow
header.go
WriteTo
func (h *Header) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, *h) }
go
func (h *Header) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, *h) }
[ "func", "(", "h", "*", "Header", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "*", "h", ")", "\n", "}" ]
// WriteTo writes the header in the write format to the given writer.
[ "WriteTo", "writes", "the", "header", "in", "the", "write", "format", "to", "the", "given", "writer", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/header.go#L233-L235
136,864
netrack/openflow
header.go
ReadFrom
func (h *Header) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &h.Version, &h.Type, &h.Length, &h.Transaction) }
go
func (h *Header) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &h.Version, &h.Type, &h.Length, &h.Transaction) }
[ "func", "(", "h", "*", "Header", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "h", ".", "Version", ",", "&", "h", ".", "Type", ",", "&", ...
// ReadFrom reads the header from the given reader in the wire format.
[ "ReadFrom", "reads", "the", "header", "from", "the", "given", "reader", "in", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/header.go#L238-L240
136,865
netrack/openflow
header.go
TransactionMatcher
func TransactionMatcher(h *Header) Matcher { // When the trasnaction is not defined, we will generate a // random number, that will be used to match the response. if h.Transaction == 0 { h.Transaction = rand.Uint32() } transaction := h.Transaction matcher := func(r *Request) bool { return r.Header.Transactio...
go
func TransactionMatcher(h *Header) Matcher { // When the trasnaction is not defined, we will generate a // random number, that will be used to match the response. if h.Transaction == 0 { h.Transaction = rand.Uint32() } transaction := h.Transaction matcher := func(r *Request) bool { return r.Header.Transactio...
[ "func", "TransactionMatcher", "(", "h", "*", "Header", ")", "Matcher", "{", "// When the trasnaction is not defined, we will generate a", "// random number, that will be used to match the response.", "if", "h", ".", "Transaction", "==", "0", "{", "h", ".", "Transaction", "=...
// TransactionMatcher creates a new matcher that matches the request // by the transaction identifier. // // If the header has non-zero transaction identifier, it will be used // to create a new matcher, otherwise a random number will be generated.
[ "TransactionMatcher", "creates", "a", "new", "matcher", "that", "matches", "the", "request", "by", "the", "transaction", "identifier", ".", "If", "the", "header", "has", "non", "-", "zero", "transaction", "identifier", "it", "will", "be", "used", "to", "create...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/header.go#L247-L261
136,866
netrack/openflow
ofp/echo.go
WriteTo
func (er *EchoRequest) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, er.Data) }
go
func (er *EchoRequest) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, er.Data) }
[ "func", "(", "er", "*", "EchoRequest", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "er", ".", "Data", ")", "\n", "}" ]
// WriteTo implements io.WriterTo interface. It serializes the echo // request message into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "echo", "request", "message", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/echo.go#L25-L27
136,867
netrack/openflow
ofp/echo.go
ReadFrom
func (er *EchoRequest) ReadFrom(r io.Reader) (n int64, err error) { // The header of the echo request will be unmarshalled by the // previous read, so we need to read up to the end of the // buffer. So it is responsibility of the called to provide // fixed-length reader. er.Data, err = ioutil.ReadAll(r) if err !=...
go
func (er *EchoRequest) ReadFrom(r io.Reader) (n int64, err error) { // The header of the echo request will be unmarshalled by the // previous read, so we need to read up to the end of the // buffer. So it is responsibility of the called to provide // fixed-length reader. er.Data, err = ioutil.ReadAll(r) if err !=...
[ "func", "(", "er", "*", "EchoRequest", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "// The header of the echo request will be unmarshalled by the", "// previous read, so we need to read up to the end of the", "/...
// ReadFrom implements io.ReaderFrom interface. It deserializes the echo // request message from the wire format. // // The passed reader instance have to be limited up to the length of message // body.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "echo", "request", "message", "from", "the", "wire", "format", ".", "The", "passed", "reader", "instance", "have", "to", "be", "limited", "up", "to", "the", "le...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/echo.go#L34-L45
136,868
netrack/openflow
ofp/description.go
copyTo
func (d *Description) copyTo(s string, length int) []byte { b := make([]byte, length) copy(b, []byte(s)) return b }
go
func (d *Description) copyTo(s string, length int) []byte { b := make([]byte, length) copy(b, []byte(s)) return b }
[ "func", "(", "d", "*", "Description", ")", "copyTo", "(", "s", "string", ",", "length", "int", ")", "[", "]", "byte", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "length", ")", "\n", "copy", "(", "b", ",", "[", "]", "byte", "(", "s", ...
// copyTo copies the specified string into the slice of bytes of given // length.
[ "copyTo", "copies", "the", "specified", "string", "into", "the", "slice", "of", "bytes", "of", "given", "length", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/description.go#L47-L51
136,869
netrack/openflow
ofp/description.go
WriteTo
func (d *Description) WriteTo(w io.Writer) (int64, error) { mfr := d.copyTo(d.Manufacturer, descLen) hw := d.copyTo(d.Hardware, descLen) sw := d.copyTo(d.Software, descLen) sn := d.copyTo(d.SerialNum, serialNumLen) dp := d.copyTo(d.Datapath, descLen) return encoding.WriteTo(w, mfr, hw, sw, sn, dp) }
go
func (d *Description) WriteTo(w io.Writer) (int64, error) { mfr := d.copyTo(d.Manufacturer, descLen) hw := d.copyTo(d.Hardware, descLen) sw := d.copyTo(d.Software, descLen) sn := d.copyTo(d.SerialNum, serialNumLen) dp := d.copyTo(d.Datapath, descLen) return encoding.WriteTo(w, mfr, hw, sw, sn, dp) }
[ "func", "(", "d", "*", "Description", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "mfr", ":=", "d", ".", "copyTo", "(", "d", ".", "Manufacturer", ",", "descLen", ")", "\n", "hw", ":=", "d", ".", "co...
// WriteTo implements io.WriterTo interface. It serializes the switch // description into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "switch", "description", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/description.go#L55-L63
136,870
netrack/openflow
ofp/description.go
ReadFrom
func (d *Description) ReadFrom(r io.Reader) (int64, error) { var mfr, hw, sw, dp [descLen]byte var sn [serialNumLen]byte n, err := encoding.ReadFrom(r, &mfr, &hw, &sw, &sn, &dp) if err != nil { return n, err } d.Manufacturer = string(mfr[:]) d.Hardware = string(hw[:]) d.Software = string(sw[:]) d.SerialNum...
go
func (d *Description) ReadFrom(r io.Reader) (int64, error) { var mfr, hw, sw, dp [descLen]byte var sn [serialNumLen]byte n, err := encoding.ReadFrom(r, &mfr, &hw, &sw, &sn, &dp) if err != nil { return n, err } d.Manufacturer = string(mfr[:]) d.Hardware = string(hw[:]) d.Software = string(sw[:]) d.SerialNum...
[ "func", "(", "d", "*", "Description", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "var", "mfr", ",", "hw", ",", "sw", ",", "dp", "[", "descLen", "]", "byte", "\n", "var", "sn", "[", "serialNumLen", ...
// ReadFrom implements io.ReadFrom interface. It deserializes the // switch description from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReadFrom", "interface", ".", "It", "deserializes", "the", "switch", "description", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/description.go#L67-L82
136,871
netrack/openflow
ofp/table.go
WriteTo
func (t *TableMod) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, t.Table, pad3{}, t.Config) }
go
func (t *TableMod) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, t.Table, pad3{}, t.Config) }
[ "func", "(", "t", "*", "TableMod", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "t", ".", "Table", ",", "pad3", "{", "}", ",", "t", ".", "Config",...
// WriteTo implements io.WriterTo interface. It serializes the table // modification message into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "table", "modification", "message", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L58-L60
136,872
netrack/openflow
ofp/table.go
ReadFrom
func (t *TableMod) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &t.Table, &pad3{}, &t.Config) }
go
func (t *TableMod) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &t.Table, &pad3{}, &t.Config) }
[ "func", "(", "t", "*", "TableMod", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "t", ".", "Table", ",", "&", "pad3", "{", "}", ",", "&", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // table modification message from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "table", "modification", "message", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L64-L66
136,873
netrack/openflow
ofp/table.go
WriteTo
func (t *TableStats) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, t.Table, pad3{}, t.ActiveCount, t.LookupCount, t.MatchedCount) }
go
func (t *TableStats) WriteTo(w io.Writer) (int64, error) { return encoding.WriteTo(w, t.Table, pad3{}, t.ActiveCount, t.LookupCount, t.MatchedCount) }
[ "func", "(", "t", "*", "TableStats", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "WriteTo", "(", "w", ",", "t", ".", "Table", ",", "pad3", "{", "}", ",", "t", ".", "Active...
// WriteTo implements io.WriterTo interface. It serializes the table // statistics into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "table", "statistics", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L87-L90
136,874
netrack/openflow
ofp/table.go
ReadFrom
func (t *TableStats) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &t.Table, &defaultPad3, &t.ActiveCount, &t.LookupCount, &t.MatchedCount) }
go
func (t *TableStats) ReadFrom(r io.Reader) (int64, error) { return encoding.ReadFrom(r, &t.Table, &defaultPad3, &t.ActiveCount, &t.LookupCount, &t.MatchedCount) }
[ "func", "(", "t", "*", "TableStats", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "encoding", ".", "ReadFrom", "(", "r", ",", "&", "t", ".", "Table", ",", "&", "defaultPad3", ",", "&", "t", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // table statistics from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "table", "statistics", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L94-L97
136,875
netrack/openflow
ofp/table.go
WriteTo
func (t *TableFeatures) WriteTo(w io.Writer) (int64, error) { var buf bytes.Buffer for _, prop := range t.Properties { _, err := prop.WriteTo(&buf) if err != nil { return 0, err } } // Copy the table name into the fixed-length slice. name := make([]byte, maxTableNameLen) copy(name, []byte(t.Name)) le...
go
func (t *TableFeatures) WriteTo(w io.Writer) (int64, error) { var buf bytes.Buffer for _, prop := range t.Properties { _, err := prop.WriteTo(&buf) if err != nil { return 0, err } } // Copy the table name into the fixed-length slice. name := make([]byte, maxTableNameLen) copy(name, []byte(t.Name)) le...
[ "func", "(", "t", "*", "TableFeatures", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "var", "buf", "bytes", ".", "Buffer", "\n\n", "for", "_", ",", "prop", ":=", "range", "t", ".", "Properties", "{", "...
// WriteTo implements io.WriterTo interface. It serializes the table // features into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "table", "features", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L136-L155
136,876
netrack/openflow
ofp/table.go
ReadFrom
func (t *TableFeatures) ReadFrom(r io.Reader) (int64, error) { var name [maxTableNameLen]byte var length uint16 n, err := encoding.ReadFrom(r, &length, &t.Table, &defaultPad5, &name, &t.MetadataMatch, &t.MetadataWrite, &t.Config, &t.MaxEntries) if err != nil { return n, err } t.Name = string(name[:]) t....
go
func (t *TableFeatures) ReadFrom(r io.Reader) (int64, error) { var name [maxTableNameLen]byte var length uint16 n, err := encoding.ReadFrom(r, &length, &t.Table, &defaultPad5, &name, &t.MetadataMatch, &t.MetadataWrite, &t.Config, &t.MaxEntries) if err != nil { return n, err } t.Name = string(name[:]) t....
[ "func", "(", "t", "*", "TableFeatures", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "var", "name", "[", "maxTableNameLen", "]", "byte", "\n", "var", "length", "uint16", "\n\n", "n", ",", "err", ":=", "...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // table features from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "table", "features", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L159-L191
136,877
netrack/openflow
ofp/table.go
tablePropType
func tablePropType(miss bool, rt, mt TablePropType) TablePropType { if miss { return mt } return rt }
go
func tablePropType(miss bool, rt, mt TablePropType) TablePropType { if miss { return mt } return rt }
[ "func", "tablePropType", "(", "miss", "bool", ",", "rt", ",", "mt", "TablePropType", ")", "TablePropType", "{", "if", "miss", "{", "return", "mt", "\n", "}", "\n\n", "return", "rt", "\n", "}" ]
// tablePropType returns the type of the table feature property, based // on the miss flag. If the specified flag is set to true, then miss // table feature property type will be returned.
[ "tablePropType", "returns", "the", "type", "of", "the", "table", "feature", "property", "based", "on", "the", "miss", "flag", ".", "If", "the", "specified", "flag", "is", "set", "to", "true", "then", "miss", "table", "feature", "property", "type", "will", ...
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L342-L348
136,878
netrack/openflow
ofp/table.go
readTablePropActions
func readTablePropActions(r io.Reader, a *[]ActionType, m *bool) (int64, error) { header, limrd, n, err := yieldTableProp(r, m) if err != nil { return n, err } // Truncate any data specified within a list of action types, // in this way, list will always contain only decoded messages. *a = (*a)[:0] amaker := ...
go
func readTablePropActions(r io.Reader, a *[]ActionType, m *bool) (int64, error) { header, limrd, n, err := yieldTableProp(r, m) if err != nil { return n, err } // Truncate any data specified within a list of action types, // in this way, list will always contain only decoded messages. *a = (*a)[:0] amaker := ...
[ "func", "readTablePropActions", "(", "r", "io", ".", "Reader", ",", "a", "*", "[", "]", "ActionType", ",", "m", "*", "bool", ")", "(", "int64", ",", "error", ")", "{", "header", ",", "limrd", ",", "n", ",", "err", ":=", "yieldTableProp", "(", "r", ...
// readTablePropActions reads the list of actions from the given reader // and appends them into the specified list of action types. The list will // be truncated first.
[ "readTablePropActions", "reads", "the", "list", "of", "actions", "from", "the", "given", "reader", "and", "appends", "them", "into", "the", "specified", "list", "of", "action", "types", ".", "The", "list", "will", "be", "truncated", "first", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L401-L422
136,879
netrack/openflow
ofp/table.go
String
func (t *TablePropInstructions) String() string { const text = "TablePropInstructions{Miss: %v, Instructions: %v}" return fmt.Sprintf(text, t.Miss, t.Instructions) }
go
func (t *TablePropInstructions) String() string { const text = "TablePropInstructions{Miss: %v, Instructions: %v}" return fmt.Sprintf(text, t.Miss, t.Instructions) }
[ "func", "(", "t", "*", "TablePropInstructions", ")", "String", "(", ")", "string", "{", "const", "text", "=", "\"", "\"", "\n", "return", "fmt", ".", "Sprintf", "(", "text", ",", "t", ".", "Miss", ",", "t", ".", "Instructions", ")", "\n", "}" ]
// String returns a string representation of instructions table property.
[ "String", "returns", "a", "string", "representation", "of", "instructions", "table", "property", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L435-L438
136,880
netrack/openflow
ofp/table.go
WriteTo
func (t *TablePropInstructions) WriteTo(w io.Writer) (int64, error) { nit := len(t.Instructions) proplen := tablePropLen + int(instructionHeaderLen)*nit header := tableProp{t.Type(), uint16(proplen)} its := make([]instruction, nit) for ii, it := range t.Instructions { its[ii] = instruction{it, instructionHeader...
go
func (t *TablePropInstructions) WriteTo(w io.Writer) (int64, error) { nit := len(t.Instructions) proplen := tablePropLen + int(instructionHeaderLen)*nit header := tableProp{t.Type(), uint16(proplen)} its := make([]instruction, nit) for ii, it := range t.Instructions { its[ii] = instruction{it, instructionHeader...
[ "func", "(", "t", "*", "TablePropInstructions", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "nit", ":=", "len", "(", "t", ".", "Instructions", ")", "\n", "proplen", ":=", "tablePropLen", "+", "int", "(", ...
// WriteTo implements io.WriterTo interface. It serializes the table // instruction property into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "table", "instruction", "property", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L450-L467
136,881
netrack/openflow
ofp/table.go
ReadFrom
func (t *TablePropInstructions) ReadFrom(r io.Reader) (int64, error) { header, limrd, n, err := yieldTableProp(r, &t.Miss) if err != nil { return n, err } // Truncate the list of instructions, but leave the underlying // allocated memory, thereby decoded instructions will be saved // without memory allocation ...
go
func (t *TablePropInstructions) ReadFrom(r io.Reader) (int64, error) { header, limrd, n, err := yieldTableProp(r, &t.Miss) if err != nil { return n, err } // Truncate the list of instructions, but leave the underlying // allocated memory, thereby decoded instructions will be saved // without memory allocation ...
[ "func", "(", "t", "*", "TablePropInstructions", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "header", ",", "limrd", ",", "n", ",", "err", ":=", "yieldTableProp", "(", "r", ",", "&", "t", ".", "Miss", ...
// ReadFrom implements io.ReaderFrom interface. It serializes the table // instruction property from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "serializes", "the", "table", "instruction", "property", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L471-L496
136,882
netrack/openflow
ofp/table.go
String
func (t *TablePropNextTables) String() string { const text = "TablePropNextTables{Miss: %v, NextTables: %v}" return fmt.Sprintf(text, t.Miss, t.NextTables) }
go
func (t *TablePropNextTables) String() string { const text = "TablePropNextTables{Miss: %v, NextTables: %v}" return fmt.Sprintf(text, t.Miss, t.NextTables) }
[ "func", "(", "t", "*", "TablePropNextTables", ")", "String", "(", ")", "string", "{", "const", "text", "=", "\"", "\"", "\n", "return", "fmt", ".", "Sprintf", "(", "text", ",", "t", ".", "Miss", ",", "t", ".", "NextTables", ")", "\n", "}" ]
// String returns a string representation of next tables table property.
[ "String", "returns", "a", "string", "representation", "of", "next", "tables", "table", "property", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L509-L512
136,883
netrack/openflow
ofp/table.go
WriteTo
func (t *TablePropNextTables) WriteTo(w io.Writer) (int64, error) { headerlen := tablePropLen + len(t.NextTables) header := tableProp{t.Type(), uint16(headerlen)} padding := makePad(headerlen) return encoding.WriteTo(w, header, t.NextTables, padding) }
go
func (t *TablePropNextTables) WriteTo(w io.Writer) (int64, error) { headerlen := tablePropLen + len(t.NextTables) header := tableProp{t.Type(), uint16(headerlen)} padding := makePad(headerlen) return encoding.WriteTo(w, header, t.NextTables, padding) }
[ "func", "(", "t", "*", "TablePropNextTables", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "headerlen", ":=", "tablePropLen", "+", "len", "(", "t", ".", "NextTables", ")", "\n", "header", ":=", "tableProp", ...
// WriteTo implements io.WriterTo interface. It serializes the next // tables property into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "next", "tables", "property", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L524-L530
136,884
netrack/openflow
ofp/table.go
ReadFrom
func (t *TablePropNextTables) ReadFrom(r io.Reader) (int64, error) { header, _, n, err := yieldTableProp(r, &t.Miss) if err != nil { return n, err } t.NextTables = make([]Table, header.Len-tablePropLen) padding := makePad(int(header.Len)) nn, err := encoding.ReadFrom(r, &t.NextTables, padding) return n + nn,...
go
func (t *TablePropNextTables) ReadFrom(r io.Reader) (int64, error) { header, _, n, err := yieldTableProp(r, &t.Miss) if err != nil { return n, err } t.NextTables = make([]Table, header.Len-tablePropLen) padding := makePad(int(header.Len)) nn, err := encoding.ReadFrom(r, &t.NextTables, padding) return n + nn,...
[ "func", "(", "t", "*", "TablePropNextTables", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "header", ",", "_", ",", "n", ",", "err", ":=", "yieldTableProp", "(", "r", ",", "&", "t", ".", "Miss", ")", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // next tables property from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "next", "tables", "property", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L534-L545
136,885
netrack/openflow
ofp/table.go
ReadFrom
func (t *TablePropWriteActions) ReadFrom(r io.Reader) (int64, error) { return readTablePropActions(r, &t.Actions, &t.Miss) }
go
func (t *TablePropWriteActions) ReadFrom(r io.Reader) (int64, error) { return readTablePropActions(r, &t.Actions, &t.Miss) }
[ "func", "(", "t", "*", "TablePropWriteActions", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "readTablePropActions", "(", "r", ",", "&", "t", ".", "Actions", ",", "&", "t", ".", "Miss", ")", "...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // write actions property from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "write", "actions", "property", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L579-L581
136,886
netrack/openflow
ofp/table.go
String
func (t *TablePropApplyActions) String() string { const text = "TablePropApplyActions{Miss: %v, Actions: [%v]}" return fmt.Sprintf(text, t.Miss, t.Actions) }
go
func (t *TablePropApplyActions) String() string { const text = "TablePropApplyActions{Miss: %v, Actions: [%v]}" return fmt.Sprintf(text, t.Miss, t.Actions) }
[ "func", "(", "t", "*", "TablePropApplyActions", ")", "String", "(", ")", "string", "{", "const", "text", "=", "\"", "\"", "\n", "return", "fmt", ".", "Sprintf", "(", "text", ",", "t", ".", "Miss", ",", "t", ".", "Actions", ")", "\n", "}" ]
// String returns a string representation of apply actions table property.
[ "String", "returns", "a", "string", "representation", "of", "apply", "actions", "table", "property", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L594-L597
136,887
netrack/openflow
ofp/table.go
WriteTo
func (t *TablePropApplyActions) WriteTo(w io.Writer) (int64, error) { return writeTablePropActions(w, t, t.Actions) }
go
func (t *TablePropApplyActions) WriteTo(w io.Writer) (int64, error) { return writeTablePropActions(w, t, t.Actions) }
[ "func", "(", "t", "*", "TablePropApplyActions", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "writeTablePropActions", "(", "w", ",", "t", ",", "t", ".", "Actions", ")", "\n", "}" ]
// WriteTo implements io.WriterTo interface. It serializes the // apply actions property into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "apply", "actions", "property", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L609-L611
136,888
netrack/openflow
ofp/table.go
ReadFrom
func (t *TablePropWildcards) ReadFrom(r io.Reader) (int64, error) { return readTablePropXM(r, &t.Fields, nil) }
go
func (t *TablePropWildcards) ReadFrom(r io.Reader) (int64, error) { return readTablePropXM(r, &t.Fields, nil) }
[ "func", "(", "t", "*", "TablePropWildcards", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "readTablePropXM", "(", "r", ",", "&", "t", ".", "Fields", ",", "nil", ")", "\n", "}" ]
// ReadFrom implements io.ReaderFrom interface. It deserializes the // wildcard property from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "wildcard", "property", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L663-L665
136,889
netrack/openflow
ofp/table.go
String
func (t *TablePropApplySetField) String() string { const text = "TablePropApplySetField{Miss: %v, Fields: %v}" return fmt.Sprintf(text, t.Miss, t.Fields) }
go
func (t *TablePropApplySetField) String() string { const text = "TablePropApplySetField{Miss: %v, Fields: %v}" return fmt.Sprintf(text, t.Miss, t.Fields) }
[ "func", "(", "t", "*", "TablePropApplySetField", ")", "String", "(", ")", "string", "{", "const", "text", "=", "\"", "\"", "\n", "return", "fmt", ".", "Sprintf", "(", "text", ",", "t", ".", "Miss", ",", "t", ".", "Fields", ")", "\n", "}" ]
// String returns a string representation of apply set field table property.
[ "String", "returns", "a", "string", "representation", "of", "apply", "set", "field", "table", "property", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L708-L711
136,890
netrack/openflow
ofp/table.go
WriteTo
func (t *TablePropApplySetField) WriteTo(w io.Writer) (int64, error) { return writeTablePropXM(w, t, t.Fields) }
go
func (t *TablePropApplySetField) WriteTo(w io.Writer) (int64, error) { return writeTablePropXM(w, t, t.Fields) }
[ "func", "(", "t", "*", "TablePropApplySetField", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "return", "writeTablePropXM", "(", "w", ",", "t", ",", "t", ".", "Fields", ")", "\n", "}" ]
// WriteTo implements io.WriterTo interface. It serializes the apply // set-field property into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "apply", "set", "-", "field", "property", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L723-L725
136,891
netrack/openflow
ofp/table.go
ReadFrom
func (t *TablePropApplySetField) ReadFrom(r io.Reader) (int64, error) { return readTablePropXM(r, &t.Fields, &t.Miss) }
go
func (t *TablePropApplySetField) ReadFrom(r io.Reader) (int64, error) { return readTablePropXM(r, &t.Fields, &t.Miss) }
[ "func", "(", "t", "*", "TablePropApplySetField", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "return", "readTablePropXM", "(", "r", ",", "&", "t", ".", "Fields", ",", "&", "t", ".", "Miss", ")", "\n", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // apply set-field property from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "apply", "set", "-", "field", "property", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L729-L731
136,892
netrack/openflow
ofp/table.go
WriteTo
func (t *TablePropExperimenter) WriteTo(w io.Writer) (int64, error) { header := tableProp{t.Type(), uint16(tablePropLen + len(t.Data) + 8)} padding := makePad(int(header.Len)) return encoding.WriteTo(w, header, t.Experimenter, t.ExpType, t.Data, padding) }
go
func (t *TablePropExperimenter) WriteTo(w io.Writer) (int64, error) { header := tableProp{t.Type(), uint16(tablePropLen + len(t.Data) + 8)} padding := makePad(int(header.Len)) return encoding.WriteTo(w, header, t.Experimenter, t.ExpType, t.Data, padding) }
[ "func", "(", "t", "*", "TablePropExperimenter", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "header", ":=", "tableProp", "{", "t", ".", "Type", "(", ")", ",", "uint16", "(", "tablePropLen", "+", "len", ...
// WriteTo implements io.WriterTo interface. It serializes the // experimenter property into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "experimenter", "property", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L759-L765
136,893
netrack/openflow
ofp/table.go
ReadFrom
func (t *TablePropExperimenter) ReadFrom(r io.Reader) (int64, error) { var header tableProp n, err := encoding.ReadFrom(r, &header, &t.Experimenter, &t.ExpType) if err != nil { return n, err } limrd := io.LimitReader(r, int64(header.Len-tablePropLen-8)) t.Data, err = ioutil.ReadAll(limrd) n += int64(len(t.Da...
go
func (t *TablePropExperimenter) ReadFrom(r io.Reader) (int64, error) { var header tableProp n, err := encoding.ReadFrom(r, &header, &t.Experimenter, &t.ExpType) if err != nil { return n, err } limrd := io.LimitReader(r, int64(header.Len-tablePropLen-8)) t.Data, err = ioutil.ReadAll(limrd) n += int64(len(t.Da...
[ "func", "(", "t", "*", "TablePropExperimenter", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "var", "header", "tableProp", "\n\n", "n", ",", "err", ":=", "encoding", ".", "ReadFrom", "(", "r", ",", "&", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // experimenter property from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "experimenter", "property", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/table.go#L769-L789
136,894
netrack/openflow
ofp/port.go
String
func (f PortFeature) String() string { var features []string // Iterate though all of the port features and check if the // respective bit is set. for _, feature := range portFeaturesText { if feature.mask&f != 0 { features = append(features, feature.text) } } // Return space-joined list of the port feat...
go
func (f PortFeature) String() string { var features []string // Iterate though all of the port features and check if the // respective bit is set. for _, feature := range portFeaturesText { if feature.mask&f != 0 { features = append(features, feature.text) } } // Return space-joined list of the port feat...
[ "func", "(", "f", "PortFeature", ")", "String", "(", ")", "string", "{", "var", "features", "[", "]", "string", "\n\n", "// Iterate though all of the port features and check if the", "// respective bit is set.", "for", "_", ",", "feature", ":=", "range", "portFeatures...
// String returns the human-redable representation of the port features.
[ "String", "returns", "the", "human", "-", "redable", "representation", "of", "the", "port", "features", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/port.go#L102-L115
136,895
netrack/openflow
ofp/port.go
String
func (c PortConfig) String() string { var configs []string // When the port is not DOWN, we will automatically assume // it is UP and append the respective text message. if PortConfigDown&c == 0 { configs = append(configs, "up") } for _, config := range portConfigText { if config.mask&c != 0 { configs = ...
go
func (c PortConfig) String() string { var configs []string // When the port is not DOWN, we will automatically assume // it is UP and append the respective text message. if PortConfigDown&c == 0 { configs = append(configs, "up") } for _, config := range portConfigText { if config.mask&c != 0 { configs = ...
[ "func", "(", "c", "PortConfig", ")", "String", "(", ")", "string", "{", "var", "configs", "[", "]", "string", "\n\n", "// When the port is not DOWN, we will automatically assume", "// it is UP and append the respective text message.", "if", "PortConfigDown", "&", "c", "==...
// String returns a human representation of the port configuration.
[ "String", "returns", "a", "human", "representation", "of", "the", "port", "configuration", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/port.go#L163-L179
136,896
netrack/openflow
ofp/port.go
String
func (s PortState) String() string { if text, ok := portStateText[s]; ok { return text } return "link up" }
go
func (s PortState) String() string { if text, ok := portStateText[s]; ok { return text } return "link up" }
[ "func", "(", "s", "PortState", ")", "String", "(", ")", "string", "{", "if", "text", ",", "ok", ":=", "portStateText", "[", "s", "]", ";", "ok", "{", "return", "text", "\n", "}", "\n\n", "return", "\"", "\"", "\n", "}" ]
// PortState returns a human-readable representation of the port state.
[ "PortState", "returns", "a", "human", "-", "readable", "representation", "of", "the", "port", "state", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/port.go#L207-L213
136,897
netrack/openflow
ofp/port.go
WriteTo
func (p *Port) WriteTo(w io.Writer) (int64, error) { name := make([]byte, portNameLen) copy(name, []byte(p.Name)) return encoding.WriteTo(w, p.PortNo, pad4{}, p.HWAddr, pad2{}, name, p.Config, p.State, p.Curr, p.Advertised, p.Supported, p.Peer, p.CurrSpeed, p.MaxSpeed, ) }
go
func (p *Port) WriteTo(w io.Writer) (int64, error) { name := make([]byte, portNameLen) copy(name, []byte(p.Name)) return encoding.WriteTo(w, p.PortNo, pad4{}, p.HWAddr, pad2{}, name, p.Config, p.State, p.Curr, p.Advertised, p.Supported, p.Peer, p.CurrSpeed, p.MaxSpeed, ) }
[ "func", "(", "p", "*", "Port", ")", "WriteTo", "(", "w", "io", ".", "Writer", ")", "(", "int64", ",", "error", ")", "{", "name", ":=", "make", "(", "[", "]", "byte", ",", "portNameLen", ")", "\n", "copy", "(", "name", ",", "[", "]", "byte", "...
// WriteTo implements io.WriterTo interface. It serializes the port // description into the wire format.
[ "WriteTo", "implements", "io", ".", "WriterTo", "interface", ".", "It", "serializes", "the", "port", "description", "into", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/port.go#L295-L303
136,898
netrack/openflow
ofp/port.go
ReadFrom
func (p *Port) ReadFrom(r io.Reader) (int64, error) { p.HWAddr = make(net.HardwareAddr, 6) var name [portNameLen]byte n, err := encoding.ReadFrom(r, &p.PortNo, &defaultPad4, &p.HWAddr, &defaultPad2, &name, &p.Config, &p.State, &p.Curr, &p.Advertised, &p.Supported, &p.Peer, &p.CurrSpeed, &p.MaxSpeed, ) p.Name...
go
func (p *Port) ReadFrom(r io.Reader) (int64, error) { p.HWAddr = make(net.HardwareAddr, 6) var name [portNameLen]byte n, err := encoding.ReadFrom(r, &p.PortNo, &defaultPad4, &p.HWAddr, &defaultPad2, &name, &p.Config, &p.State, &p.Curr, &p.Advertised, &p.Supported, &p.Peer, &p.CurrSpeed, &p.MaxSpeed, ) p.Name...
[ "func", "(", "p", "*", "Port", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "int64", ",", "error", ")", "{", "p", ".", "HWAddr", "=", "make", "(", "net", ".", "HardwareAddr", ",", "6", ")", "\n", "var", "name", "[", "portNameLen", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // port description from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "port", "description", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/port.go#L307-L318
136,899
netrack/openflow
ofp/port.go
ReadFrom
func (p *Ports) ReadFrom(r io.Reader) (n int64, err error) { var nn int64 for err == nil { var port Port nn, err = port.ReadFrom(r) n += nn if err == io.EOF { err = nil return } *p = append(*p, port) } return }
go
func (p *Ports) ReadFrom(r io.Reader) (n int64, err error) { var nn int64 for err == nil { var port Port nn, err = port.ReadFrom(r) n += nn if err == io.EOF { err = nil return } *p = append(*p, port) } return }
[ "func", "(", "p", "*", "Ports", ")", "ReadFrom", "(", "r", "io", ".", "Reader", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "var", "nn", "int64", "\n\n", "for", "err", "==", "nil", "{", "var", "port", "Port", "\n", "nn", ",", "err", ...
// ReadFrom implements io.ReaderFrom interface. It deserializes the // list of ports from the wire format.
[ "ReadFrom", "implements", "io", ".", "ReaderFrom", "interface", ".", "It", "deserializes", "the", "list", "of", "ports", "from", "the", "wire", "format", "." ]
9304e84a549fd9332c278eac544f5efff47c9ab8
https://github.com/netrack/openflow/blob/9304e84a549fd9332c278eac544f5efff47c9ab8/ofp/port.go#L325-L342