MCPcopy
hub / github.com/OpenNHP/opennhp / Header

Method Header

nhp/core/packet.go:159–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157}
158
159func (pkt *Packet) Header() Header {
160 if pkt.Flag()&common.NHP_FLAG_EXTENDEDLENGTH == 0 {
161 //nolint:gosec // G103: Intentional unsafe pointer for zero-copy packet header access
162 return (*curve.HeaderCurve)(unsafe.Pointer(&pkt.Content[0]))
163 } else {
164 switch pkt.Flag() & (0xF << 12) {
165 case common.NHP_FLAG_SCHEME_GMSM:
166 fallthrough
167 default:
168 //nolint:gosec // G103: Intentional unsafe pointer for zero-copy packet header access
169 return (*gmsm.HeaderGmsm)(unsafe.Pointer(&pkt.Content[0]))
170 }
171 }
172}
173
174func (pkt *Packet) HeaderWithCipherScheme(cipherScheme int) Header {
175 switch cipherScheme {

Callers 13

RecvPrecheckMethod · 0.80
initStorageRouterMethod · 0.80
corsMiddlewareFunction · 0.80
handleClustersMethod · 0.80
corsMiddlewareFunction · 0.80
handleRelayMethod · 0.80
tcpTempAccessHandlerMethod · 0.80
udpTempAccessHandlerMethod · 0.80
corsMiddlewareFunction · 0.80
corsMiddlewareFunction · 0.80

Calls 1

FlagMethod · 0.95

Tested by 1