func (k *CIDRKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(k, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
GetUnsafePointer - Returns an unsafe Pointer to the data
package keyvalue
import (
	"encoding/binary"
	"fmt"
	"math/rand"
	"net"
	"unsafe"
	"github.com/pkg/errors"
	"github.com/Gui774ume/network-security-probe/pkg/model/kernel"
	"github.com/Gui774ume/network-security-probe/pkg/utils"
)
type Cookie uint32
type CookieValue struct {
	Cookie Cookie
}
func NewCookie() Cookie {
	return Cookie(rand.Uint32())
}
func CookieListContains(cookies []Cookie, cookie Cookie) int {
	for index, c := range cookies {
		if c == cookie {
			return index
		}
	}
	return -1
}
func (cv *CookieValue) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	valueB, err := utils.InterfaceToBytes(cv, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&valueB[0]), nil
}
func NewRandomMapName() string {
	allowedCharacters := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
	allowedCharactersLen := len(allowedCharacters)
	nameLength := 15
	b := make([]rune, nameLength)
	for i := range b {
		b[i] = allowedCharacters[rand.Intn(allowedCharactersLen)]
	}
	return string(b)
}
type SecurityProfileActionValue struct {
	Action kernel.SecurityProfileAction
}
type NetworkAttack uint32
const (
	EmptyNetworkAttack NetworkAttack = 0
	ArpSpoofing NetworkAttack = 1 << 0
)
func (na NetworkAttack) String() string {
	switch na {
	case EmptyNetworkAttack:
		return "EmptyNetworkAttack"
	case ArpSpoofing:
		return "ArpSpoofing"
	default:
		return "Unknown"
	}
}
type KeyValue struct {
	Key   Key
	Value interface{}
}
func (kv *KeyValue) String() string {
	return fmt.Sprintf("%v", *kv)
}
func (kv *KeyValue) GetMapSection() string {
	return kv.Key.GetMapSection()
}
func (kv *KeyValue) GetKey(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	return kv.Key.GetUnsafePointer(byteOrder)
}
func (kv *KeyValue) GetValue(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	valueB, err := utils.InterfaceToBytes(kv.Value, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&valueB[0]), nil
}
type Key interface {
	GetMapSection() string
	GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error)
	String() string
}
type NetworkAttacksKey struct {
	Cookie Cookie
}
func (nak *NetworkAttacksKey) String() string {
	return fmt.Sprintf("%v", *nak)
}
func (nak *NetworkAttacksKey) GetMapSection() string {
	return "network_attacks_rules"
}
func (nak *NetworkAttacksKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(nak, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type NetworkAttacksValue struct {
	Value NetworkAttack
}
type ActionKey struct {
	Cookie Cookie
}
func (ak *ActionKey) String() string {
	return fmt.Sprintf("%v", *ak)
}
func (ak *ActionKey) GetMapSection() string {
	return "action_rules"
}
func (ak *ActionKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(ak, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type ActionValue struct {
	Action kernel.SecurityProfileAction
}
type ProtocolKey struct {
	Cookie      Cookie
	Protocol    uint16
	TrafficType kernel.TrafficType
	Layer       uint8
}
func (pk *ProtocolKey) String() string {
	return fmt.Sprintf("%v", *pk)
}
func (pk *ProtocolKey) GetMapSection() string {
	return "protocol_rules"
}
func (pk *ProtocolKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(pk, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type ProtocolPortKey struct {
	Cookie      Cookie
	Protocol    uint16
	Port        uint16
	TrafficType kernel.TrafficType
}
func (ppk *ProtocolPortKey) String() string {
	return fmt.Sprintf("%v", *ppk)
}
func (ppk *ProtocolPortKey) GetMapSection() string {
	return "protocol_port_rules"
}
func (ppk *ProtocolPortKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(ppk, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type DNSKey struct {
	DNS         [kernel.DNSMaxLength]byte
	Cookie      Cookie
	TrafficType kernel.TrafficType
	Layer       uint8
}
func (k *DNSKey) String() string {
	return fmt.Sprintf("%v", *k)
}
func NewDNSKey(tt kernel.TrafficType, cookie Cookie, layer uint8, dns string) (*DNSKey, error) {
	encodedName, err := utils.EncodeDNS(dns)
	if err != nil {
		return nil, errors.Wrap(err, "couldn't encode DNS name")
	}
	rep := DNSKey{
		TrafficType: tt,
		Cookie:      cookie,
		Layer:       layer,
		DNS:         encodedName,
	}
	return &rep, nil
}
func (k *DNSKey) GetMapSection() string {
	return "dns_rules"
}
func (k *DNSKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(k, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type HTTPKey struct {
	TrafficType kernel.TrafficType
	Cookie      Cookie
	Method      [kernel.HTTPMaxMethodLength]byte
	URI         [kernel.HTTPMaxURILength]byte
}
func (k *HTTPKey) String() string {
	return fmt.Sprintf("%v", *k)
}
func NewHTTPKey(tt kernel.TrafficType, cookie Cookie, method string, uri string) *HTTPKey {
	rep := HTTPKey{
		TrafficType: tt,
		Cookie:      cookie,
		Method:      [kernel.HTTPMaxMethodLength]byte{},
		URI:         [kernel.HTTPMaxURILength]byte{},
	}
	copy(rep.Method[:], method)
	copy(rep.URI[:], uri)
	return &rep
}
func (k HTTPKey) GetMapSection() string {
	return "http_rules"
}
func (k *HTTPKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(k, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type PIDnsKey struct {
	NS uint64
}
func (pk *PIDnsKey) String() string {
	return fmt.Sprintf("%v", *pk)
}
func (pk PIDnsKey) GetMapSection() string {
	return "pidns_profile_id"
}
func (pk *PIDnsKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(pk, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type NETnsKey struct {
	NS uint64
}
func (nk *NETnsKey) String() string {
	return fmt.Sprintf("%v", *nk)
}
func (nk NETnsKey) GetMapSection() string {
	return "netns_profile_id"
}
func (nk *NETnsKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(nk, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type PIDKey struct {
	PID uint32
}
func (pk *PIDKey) String() string {
	return fmt.Sprintf("%v", *pk)
}
func (pk PIDKey) GetMapSection() string {
	return "pid_binary_id"
}
func (pk *PIDKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(pk, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type BinaryPathKey struct {
	Cookie Cookie
	Path   [kernel.PathMax]byte
}
func (bpk *BinaryPathKey) String() string {
	return fmt.Sprintf("%v", *bpk)
}
func (bpk BinaryPathKey) GetMapSection() string {
	return "path_binary_id"
}
func (bpk *BinaryPathKey) GetUnsafePointer(byteOrder binary.ByteOrder) (unsafe.Pointer, error) {
	keyB, err := utils.InterfaceToBytes(bpk, byteOrder)
	if err != nil {
		return nil, err
	}
	return unsafe.Pointer(&keyB[0]), nil
}
type MapOfMapsKeyValue struct {
	MapOfMapsKey      *KeyValue
	MapSectionToClone string
	Keys              []*KeyValue
}
func (momkv *MapOfMapsKeyValue) String() string {
	return fmt.Sprintf("%v", *momkv)
}
type CIDRKey struct {
	Prefix uint32
	Data   [16]uint8
}
func (k *CIDRKey) String() string {
	return fmt.Sprintf("%v", *k)
}
func (k *CIDRKey) GetMapSection() string {
	return "cidr_ranges"
}