github.com/imran-kn/cilium-fork@v1.6.9/pkg/bpf/prog.go (about) 1 // Copyright 2017 Authors of Cilium 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package bpf 16 17 // ProgType is an enumeration for valid BPF program types 18 type ProgType int 19 20 // This enumeration must be in sync with enum bpf_prog_type in <linux/bpf.h> 21 const ( 22 ProgTypeUnspec ProgType = iota 23 ProgTypeSocketFilter 24 ProgTypeKprobe 25 ProgTypeSchedCls 26 ProgTypeSchedAct 27 ProgTypeTracepoint 28 ProgTypeXdp 29 ProgTypePerfEvent 30 ProgTypeCgroupSkb 31 ProgTypeCgroupSock 32 ProgTypeLwtIn 33 ProgTypeLwtOut 34 ProgTypeLwtXmit 35 ProgTypeSockOps 36 ProgTypeSkSkb 37 ProgTypeCgroupDevice 38 ProgTypeSkMsg 39 ProgTypeRawTracepoint 40 ProgTypeCgroupSockAddr 41 ProgTypeLwtSeg6Local 42 ProgTypeLircMode2 43 ProgTypeSkReusePort 44 ) 45 46 func (t ProgType) String() string { 47 switch t { 48 case ProgTypeSocketFilter: 49 return "Socket filter" 50 case ProgTypeKprobe: 51 return "Kprobe" 52 case ProgTypeSchedCls: 53 return "Sched CLS" 54 case ProgTypeSchedAct: 55 return "Sched ACT" 56 case ProgTypeTracepoint: 57 return "Tracepoint" 58 case ProgTypeXdp: 59 return "XDP" 60 case ProgTypePerfEvent: 61 return "Perf event" 62 case ProgTypeCgroupSkb: 63 return "Cgroup skb" 64 case ProgTypeCgroupSock: 65 return "Cgroup sock" 66 case ProgTypeLwtIn: 67 return "LWT in" 68 case ProgTypeLwtOut: 69 return "LWT out" 70 case ProgTypeLwtXmit: 71 return "LWT xmit" 72 case ProgTypeSockOps: 73 return "Sock ops" 74 case ProgTypeSkSkb: 75 return "Socket skb" 76 case ProgTypeCgroupDevice: 77 return "Cgroup device" 78 case ProgTypeSkMsg: 79 return "Socket msg" 80 case ProgTypeRawTracepoint: 81 return "Raw tracepoint" 82 case ProgTypeCgroupSockAddr: 83 return "Cgroup sockaddr" 84 case ProgTypeLwtSeg6Local: 85 return "LWT seg6local" 86 case ProgTypeLircMode2: 87 return "LIRC" 88 case ProgTypeSkReusePort: 89 return "Socket SO_REUSEPORT" 90 } 91 92 return "Unknown" 93 }