Skip to content
Snippets Groups Projects
Commit 54f36bd7 authored by Martin Teichmann's avatar Martin Teichmann
Browse files

use arraymap in examples

the use of hashmaps is just hopelessly outdated.
parent d2e06fd0
No related merge requests found
Pipeline #157250 failed
from asyncio import get_event_loop, sleep from asyncio import get_event_loop, sleep
from ebpfcat.hashmap import HashMap from ebpfcat.arraymap import ArrayMap
from ebpfcat.xdp import XDP, XDPExitCode, XDPFlags from ebpfcat.xdp import XDP, XDPExitCode, XDPFlags
class Count(XDP): class Count(XDP):
license = "GPL" license = "GPL"
userspace = HashMap() userspace = ArrayMap()
count = userspace.globalVar() count = userspace.globalVar()
def program(self): def program(self):
......
"""example program to count IPv4 and IPv6 packets""" """example program to count IPv4 and IPv6 packets"""
from asyncio import get_event_loop, sleep from asyncio import get_event_loop, sleep
from ebpfcat.hashmap import HashMap from ebpfcat.arraymap import ArrayMap
from ebpfcat.xdp import PacketVar, XDP, XDPExitCode, XDPFlags from ebpfcat.xdp import PacketVar, XDP, XDPExitCode, XDPFlags
class IPCount(XDP): class IPCount(XDP):
...@@ -9,7 +9,7 @@ class IPCount(XDP): ...@@ -9,7 +9,7 @@ class IPCount(XDP):
minimumPacketSize = 14 minimumPacketSize = 14
userspace = HashMap() userspace = ArrayMap()
ipv4count = userspace.globalVar() ipv4count = userspace.globalVar()
ipv6count = userspace.globalVar() ipv6count = userspace.globalVar()
ethertype = PacketVar(12, "!H") ethertype = PacketVar(12, "!H")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment