// Code generated by bpf2go; DO NOT EDIT.
//go:build mips || mips64 || ppc64 || s390x

package bpf

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

	"github.com/cilium/ebpf"
)

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

	return spec, err
}

// LoadProbesObjects loads Probes and converts it into a struct.
//
// The following types are suitable as obj argument:
//
//	*ProbesObjects
//	*ProbesPrograms
//	*ProbesMaps
//
// See ebpf.CollectionSpec.LoadAndAssign documentation for details.
func LoadProbesObjects(obj interface{}, opts *ebpf.CollectionOptions) error {
	spec, err := LoadProbes()
	if err != nil {
		return err
	}

	return spec.LoadAndAssign(obj, opts)
}

// ProbesSpecs contains maps and programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ProbesSpecs struct {
	ProbesProgramSpecs
	ProbesMapSpecs
	ProbesVariableSpecs
}

// ProbesProgramSpecs contains programs before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ProbesProgramSpecs struct {
	ProbeFibLookupSkipNeigh *ebpf.ProgramSpec `ebpf:"probe_fib_lookup_skip_neigh"`
}

// ProbesMapSpecs contains maps before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ProbesMapSpecs struct {
}

// ProbesVariableSpecs contains global variables before they are loaded into the kernel.
//
// It can be passed ebpf.CollectionSpec.Assign.
type ProbesVariableSpecs struct {
}

// ProbesObjects contains all objects after they have been loaded into the kernel.
//
// It can be passed to LoadProbesObjects or ebpf.CollectionSpec.LoadAndAssign.
type ProbesObjects struct {
	ProbesPrograms
	ProbesMaps
	ProbesVariables
}

func (o *ProbesObjects) Close() error {
	return _ProbesClose(
		&o.ProbesPrograms,
		&o.ProbesMaps,
	)
}

// ProbesMaps contains all maps after they have been loaded into the kernel.
//
// It can be passed to LoadProbesObjects or ebpf.CollectionSpec.LoadAndAssign.
type ProbesMaps struct {
}

func (m *ProbesMaps) Close() error {
	return _ProbesClose()
}

// ProbesVariables contains all global variables after they have been loaded into the kernel.
//
// It can be passed to LoadProbesObjects or ebpf.CollectionSpec.LoadAndAssign.
type ProbesVariables struct {
}

// ProbesPrograms contains all programs after they have been loaded into the kernel.
//
// It can be passed to LoadProbesObjects or ebpf.CollectionSpec.LoadAndAssign.
type ProbesPrograms struct {
	ProbeFibLookupSkipNeigh *ebpf.Program `ebpf:"probe_fib_lookup_skip_neigh"`
}

func (p *ProbesPrograms) Close() error {
	return _ProbesClose(
		p.ProbeFibLookupSkipNeigh,
	)
}

func _ProbesClose(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 probes_bpfeb.o
var _ProbesBytes []byte
