Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ebpfCAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
karaboDevices
ebpfCAT
Commits
54f36bd7
Commit
54f36bd7
authored
2 years ago
by
Martin Teichmann
Browse files
Options
Downloads
Patches
Plain Diff
use arraymap in examples
the use of hashmaps is just hopelessly outdated.
parent
d2e06fd0
Loading
Loading
No related merge requests found
Pipeline
#157250
failed
3 months ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/count.py
+2
-2
2 additions, 2 deletions
examples/count.py
examples/ipcounter.py
+2
-2
2 additions, 2 deletions
examples/ipcounter.py
with
4 additions
and
4 deletions
examples/count.py
+
2
−
2
View file @
54f36bd7
from
asyncio
import
get_event_loop
,
sleep
from
asyncio
import
get_event_loop
,
sleep
from
ebpfcat.
hash
map
import
Hash
Map
from
ebpfcat.
array
map
import
Array
Map
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
=
Hash
Map
()
userspace
=
Array
Map
()
count
=
userspace
.
globalVar
()
count
=
userspace
.
globalVar
()
def
program
(
self
):
def
program
(
self
):
...
...
This diff is collapsed.
Click to expand it.
examples/ipcounter.py
+
2
−
2
View file @
54f36bd7
"""
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.
hash
map
import
Hash
Map
from
ebpfcat.
array
map
import
Array
Map
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
=
Hash
Map
()
userspace
=
Array
Map
()
ipv4count
=
userspace
.
globalVar
()
ipv4count
=
userspace
.
globalVar
()
ipv6count
=
userspace
.
globalVar
()
ipv6count
=
userspace
.
globalVar
()
ethertype
=
PacketVar
(
12
,
"
!H
"
)
ethertype
=
PacketVar
(
12
,
"
!H
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment