本文整理汇总了Golang中github.com/kandoo/beehive-netctrl/openflow/of.Header.Type方法的典型用法代码示例。如果您正苦于以下问题:Golang Header.Type方法的具体用法?Golang Header.Type怎么用?Golang Header.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/kandoo/beehive-netctrl/openflow/of.Header
的用法示例。
在下文中一共展示了Header.Type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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())
}
}
示例2: 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
}
}