docs: add godoc comments to all exported functions and methods
This commit is contained in:
@@ -22,6 +22,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
// LookUpTypeByPacketInfo looks up a packet's type information by direction, state, packet id, and protocol version.
|
||||
func LookUpTypeByPacketInfo(direction proto_base.Direction, state proto_base.State, pid, version int32) (p proto_base.PacketInfo, ok bool) {
|
||||
pP, ok := pidMap[PidEtc{direction, state, pid, version}]
|
||||
if !ok {
|
||||
@@ -39,6 +40,7 @@ func LookUpTypeByPacketInfo(direction proto_base.Direction, state proto_base.Sta
|
||||
return
|
||||
}
|
||||
|
||||
// LookUpTypeByPacketInfoAndCopyType looks up a packet and returns a newly allocated instance of its type.
|
||||
func LookUpTypeByPacketInfoAndCopyType(direction proto_base.Direction, state proto_base.State, pid, version int32) (p proto_base.EncodeDecodeAble, ok bool) {
|
||||
i, ok := LookUpTypeByPacketInfo(direction, state, pid, version)
|
||||
if !ok {
|
||||
@@ -48,6 +50,7 @@ func LookUpTypeByPacketInfoAndCopyType(direction proto_base.Direction, state pro
|
||||
return
|
||||
}
|
||||
|
||||
// LookupPacketInfoByType looks up a packet's type information by matching against the type of the given packet value.
|
||||
func LookupPacketInfoByType(packet proto_base.EncodeDecodeAble) (p proto_base.PacketInfo, ok bool) {
|
||||
undecodedPacket, isUndecoable := packet.(*UnCodablePacket)
|
||||
if isUndecoable {
|
||||
@@ -64,6 +67,7 @@ func LookupPacketInfoByType(packet proto_base.EncodeDecodeAble) (p proto_base.Pa
|
||||
return
|
||||
}
|
||||
|
||||
// LookupPacketInfoByTypeAndState looks up a packet's type information by type and state.
|
||||
func LookupPacketInfoByTypeAndState(packet proto_base.EncodeDecodeAble, state proto_base.State) (p proto_base.PacketInfo, ok bool) {
|
||||
for _, p := range proto_generated.Packets {
|
||||
if state == p.State && reflect.TypeOf(p.Type) == reflect.TypeOf(packet) {
|
||||
@@ -73,6 +77,7 @@ func LookupPacketInfoByTypeAndState(packet proto_base.EncodeDecodeAble, state pr
|
||||
return
|
||||
}
|
||||
|
||||
// LookupPacketInfoByNameProtocolVersionAndState looks up a packet's type information by name, protocol version, and state.
|
||||
func LookupPacketInfoByNameProtocolVersionAndState(name string, version int32, state proto_base.State) (p proto_base.PacketInfo, ok bool) {
|
||||
for _, p := range proto_generated.Packets {
|
||||
if state == p.State && p.Name == name && p.ProtocolVersion == version {
|
||||
@@ -82,6 +87,7 @@ func LookupPacketInfoByNameProtocolVersionAndState(name string, version int32, s
|
||||
return
|
||||
}
|
||||
|
||||
// LookupPacketInfoByNameProtocolVersionStateAndDirection looks up a packet's type information by name, protocol version, state, and direction.
|
||||
func LookupPacketInfoByNameProtocolVersionStateAndDirection(name string, version int32, state proto_base.State, direction proto_base.Direction) (p proto_base.PacketInfo, ok bool) {
|
||||
for _, p := range proto_generated.Packets {
|
||||
if state == p.State && p.Name == name && p.ProtocolVersion == version && p.Direction == direction {
|
||||
|
||||
Reference in New Issue
Block a user