Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
RTSD
HDL
Commits
b3d280c9
Commit
b3d280c9
authored
7 years ago
by
Daniel van der Schuur
Browse files
Options
Downloads
Patches
Plain Diff
-Added PCAP header information.
parent
a5b04bfd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/arts/commissioning/sc4/lab/20170421_iab_i_1GbE_bg/arts_unb1_sc4_pcap.py
+16
-1
16 additions, 1 deletion
...ning/sc4/lab/20170421_iab_i_1GbE_bg/arts_unb1_sc4_pcap.py
with
16 additions
and
1 deletion
applications/arts/commissioning/sc4/lab/20170421_iab_i_1GbE_bg/arts_unb1_sc4_pcap.py
+
16
−
1
View file @
b3d280c9
...
...
@@ -39,6 +39,7 @@ Extra:
import
struct
import
sys
from
common
import
*
import
datetime
def
dumpfile_to_array
(
dumpfile
,
nof_packets
):
"""
...
...
@@ -56,7 +57,7 @@ def dumpfile_to_array(dumpfile, nof_packets):
append_channels
=
False
for
packet
in
range
(
nof_packets
):
# 960 channels = 15 integration periods of 64 channels.
pcap_
pkt_
hdr_raw
=
f
.
read
(
16
)
pcap_hdr_raw
=
f
.
read
(
16
)
eth_hdr_raw
=
f
.
read
(
14
)
ip_hdr_raw
=
f
.
read
(
20
)
udp_hdr_raw
=
f
.
read
(
8
)
...
...
@@ -65,6 +66,20 @@ def dumpfile_to_array(dumpfile, nof_packets):
data_raw
=
f
.
read
(
6250
)
###########################################################################
# PCAP header: 4 little endian unsigned integers (32b)
###########################################################################
pcap_hdr_struct
=
struct
.
unpack
(
'
<4I
'
,
pcap_hdr_raw
)
pcap_hdr_words
=
CommonWords
(
0
,
4
)
for
word_index
,
word
in
enumerate
(
reversed
(
pcap_hdr_struct
)):
pcap_hdr_words
[
word_index
]
=
word
timestamp_utc_pcap
=
str
(
datetime
.
datetime
.
fromtimestamp
(
pcap_hdr_words
[
3
]))
+
'
.
'
+
str
(
"
%06d
"
%
pcap_hdr_words
[
2
])
print
'
Packet
'
,
packet
,
'
-
'
,
'
PCAP timestamp UTC
'
,
timestamp_utc_pcap
print
'
Packet
'
,
packet
,
'
-
'
,
'
PCAP pkt size: file (bytes)
'
,
pcap_hdr_words
[
1
]
print
'
Packet
'
,
packet
,
'
-
'
,
'
PCAP pkt size: wire (bytes)
'
,
pcap_hdr_words
[
0
]
###########################################################################
# Ethernet header: 7 big endian unsigned shorts (16b)
###########################################################################
...
...
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