本文整理匯總了Golang中github.com/kandoo/beehive-netctrl/openflow/of.Header類的典型用法代碼示例。如果您正苦於以下問題:Golang Header類的具體用法?Golang Header怎麽用?Golang Header使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Header類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: doHandleEchoRequest
func doHandleEchoRequest(req of.Header, res of.Header, c *ofConn) error {
glog.V(2).Infof("Received echo request from %v", c.node)
res.SetXid(req.Xid())
err := c.WriteHeaders([]of.Header{res})
if err != nil {
return err
}
c.Flush()
glog.V(2).Infof("Sent echo reply to %v", c.node)
return nil
}
示例2: handlePkt
func (d *of10Driver) handlePkt(pkt of.Header, c *ofConn) error {
pkt10, err := of10.ToHeader10(pkt)
if err != nil {
return err
}
switch {
case of10.IsEchoRequest(pkt10):
return d.handleEchoRequest(of10.NewEchoRequestWithBuf(pkt10.Buf), c)
case of10.IsFeaturesReply(pkt10):
return d.handleFeaturesReply(of10.NewFeaturesReplyWithBuf(pkt10.Buf), c)
case of10.IsPacketIn(pkt10):
return d.handlePacketIn(of10.NewPacketInWithBuf(pkt10.Buf), c)
case of10.IsErrorMsg(pkt10):
return d.handleErrorMsg(of10.NewErrorMsgWithBuf(pkt10.Buf), c)
case of10.IsStatsReply(pkt10):
return d.handleStatsReply(of10.NewStatsReplyWithBuf(pkt10.Buf), c)
default:
return fmt.Errorf("Received unsupported packet: %v", pkt.Type())
}
}
示例3: handlePkt
func (d *of12Driver) handlePkt(pkt of.Header, c *ofConn) error {
pkt12, err := of12.ToHeader12(pkt)
if err != nil {
return err
}
switch {
case of12.IsEchoRequest(pkt12):
return d.handleEchoRequest(of12.NewEchoRequestWithBuf(pkt12.Buf), c)
case of12.IsFeaturesReply(pkt12):
return d.handleFeaturesReply(of12.NewFeaturesReplyWithBuf(pkt12.Buf), c)
case of12.IsPacketIn(pkt12):
return d.handlePacketIn(of12.NewPacketInWithBuf(pkt12.Buf), c)
case of12.IsErrorMsg(pkt12):
return d.handleErrorMsg(of12.NewErrorMsgWithBuf(pkt12.Buf), c)
case of12.IsStatsReply(pkt12):
return d.handleStatsReply(of12.NewStatsReplyWithBuf(pkt12.Buf), c)
case of12.IsRoleReply(pkt12):
return d.handleRoleReply(of12.NewRoleReplyWithBuf(pkt12.Buf), c)
default:
glog.Errorf("received unsupported packet: %v", pkt.Type())
return nil
}
}