[template]
cargo_generate_version = ">=0.10.0"
ignore = [".github", "test.sh"]

[placeholders.program_type]
type = "string"
prompt = "Which type of eBPF program?"
choices = [
  "cgroup_skb",
  "cgroup_sockopt",
  "cgroup_sysctl",
  "classifier",
  "fentry",
  "fexit",
  "kprobe",
  "kretprobe",
  "lsm",
  "perf_event",
  "raw_tracepoint",
  "sk_msg",
  "sock_ops",
  "socket_filter",
  "tp_btf",
  "tracepoint",
  "uprobe",
  "uretprobe",
  "xdp",
]
default = "xdp"

[conditional.'program_type == "kprobe" || program_type == "kretprobe"'.placeholders.kprobe]
type = "string"
prompt = "Where to attach the (k|kret)probe? (e.g try_to_wake_up)"

[conditional.'program_type == "fentry" || program_type == "fexit"'.placeholders.fn_name]
type = "string"
prompt = "Where to attach the f(entry|exit)? (e.g try_to_wake_up)"

[conditional.'program_type == "uprobe" || program_type == "uretprobe"'.placeholders.uprobe_target]
type = "string"
prompt = "Target to attach the (u|uret)probe? (e.g libc)"

[conditional.'program_type == "uprobe" || program_type == "uretprobe"'.placeholders.uprobe_fn_name]
type = "string"
prompt = "Function name to attach the (u|uret)probe? (e.g getaddrinfo)"

[conditional.'program_type == "cgroup_skb" || program_type == "classifier"'.placeholders.direction]
type = "string"
prompt = "Attach direction?"
choices = ["Egress", "Ingress"]

[conditional.'program_type == "cgroup_sockopt"'.placeholders.sockopt_target]
type = "string"
prompt = "Which socket option?"
choices = ["getsockopt", "setsockopt"]

[conditional.'program_type == "sk_msg"'.placeholders.sock_map]
type = "string"
prompt = "Map Name (UPPER_CASE)?"
regex = "^[A-Z_]+$"

[conditional.'program_type == "tracepoint"'.placeholders.tracepoint_category]
type = "string"
prompt = "Which tracepoint category? (e.g sched, net etc...)"
regex = "^[a-z_]+$"

[conditional.'program_type == "tracepoint" || program_type == "tp_btf" || program_type == "raw_tracepoint"'.placeholders.tracepoint_name]
type = "string"
prompt = "Which tracepoint name? (e.g sched_switch, net_dev_queue)"
regex = "^[a-z_]+$"

[conditional.'program_type == "lsm"'.placeholders.lsm_hook]
type = "string"
prompt = "Which lsm hook? (e.g file_open, task_alloc) You can find a list of hooks in include/linux/lsm_hook_defs.h in the kernel source tree."
regex = "^[a-z_]+$"

[hooks]
pre = ["pre-script.rhai"]