Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
47
Issues
47
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
fab90564
Commit
fab90564
authored
Mar 12, 2013
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/dump-funcs.c: trivial: mark static what actually is static
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
194270e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
27 deletions
+13
-27
dump-funcs.c
tools/dump-funcs.c
+13
-14
ptpdump.h
tools/ptpdump.h
+0
-13
No files found.
tools/dump-funcs.c
View file @
fab90564
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include "decent_types.h"
#include "decent_types.h"
#include "ptpdump.h"
#include "ptpdump.h"
int
dumpstruct
(
char
*
prefix
,
char
*
name
,
void
*
ptr
,
int
size
)
static
int
dumpstruct
(
char
*
prefix
,
char
*
name
,
void
*
ptr
,
int
size
)
{
{
int
ret
,
i
;
int
ret
,
i
;
unsigned
char
*
p
=
ptr
;
unsigned
char
*
p
=
ptr
;
...
@@ -28,8 +28,7 @@ int dumpstruct(char *prefix, char *name, void *ptr, int size)
...
@@ -28,8 +28,7 @@ int dumpstruct(char *prefix, char *name, void *ptr, int size)
return
ret
;
return
ret
;
}
}
static
void
dump_eth
(
struct
ethhdr
*
eth
)
void
dump_eth
(
struct
ethhdr
*
eth
)
{
{
struct
timeval
tv
;
struct
timeval
tv
;
static
struct
timeval
prev
;
static
struct
timeval
prev
;
...
@@ -60,7 +59,7 @@ void dump_eth(struct ethhdr *eth)
...
@@ -60,7 +59,7 @@ void dump_eth(struct ethhdr *eth)
d
[
0
],
d
[
1
],
d
[
2
],
d
[
3
],
d
[
4
],
d
[
5
]);
d
[
0
],
d
[
1
],
d
[
2
],
d
[
3
],
d
[
4
],
d
[
5
]);
}
}
void
dump_ip
(
struct
iphdr
*
ip
)
static
void
dump_ip
(
struct
iphdr
*
ip
)
{
{
uint32_t
s
=
ntohl
(
ip
->
saddr
);
uint32_t
s
=
ntohl
(
ip
->
saddr
);
uint32_t
d
=
ntohl
(
ip
->
daddr
);
uint32_t
d
=
ntohl
(
ip
->
daddr
);
...
@@ -71,14 +70,14 @@ void dump_ip(struct iphdr *ip)
...
@@ -71,14 +70,14 @@ void dump_ip(struct iphdr *ip)
ntohs
(
ip
->
tot_len
));
ntohs
(
ip
->
tot_len
));
}
}
void
dump_udp
(
struct
udphdr
*
udp
)
static
void
dump_udp
(
struct
udphdr
*
udp
)
{
{
printf
(
"UDP: (%i -> %i) len %i
\n
"
,
printf
(
"UDP: (%i -> %i) len %i
\n
"
,
ntohs
(
udp
->
source
),
ntohs
(
udp
->
dest
),
ntohs
(
udp
->
len
));
ntohs
(
udp
->
source
),
ntohs
(
udp
->
dest
),
ntohs
(
udp
->
len
));
}
}
/* Helpers for fucking data structures */
/* Helpers for fucking data structures */
void
dump_1stamp
(
char
*
s
,
struct
stamp
*
t
)
static
void
dump_1stamp
(
char
*
s
,
struct
stamp
*
t
)
{
{
uint64_t
sec
=
(
uint64_t
)(
ntohs
(
t
->
sec
.
msb
))
<<
32
;
uint64_t
sec
=
(
uint64_t
)(
ntohs
(
t
->
sec
.
msb
))
<<
32
;
...
@@ -86,20 +85,20 @@ void dump_1stamp(char *s, struct stamp *t)
...
@@ -86,20 +85,20 @@ void dump_1stamp(char *s, struct stamp *t)
printf
(
"%s%lli.%09i
\n
"
,
s
,
sec
,
ntohl
(
t
->
nsec
));
printf
(
"%s%lli.%09i
\n
"
,
s
,
sec
,
ntohl
(
t
->
nsec
));
}
}
void
dump_1quality
(
char
*
s
,
ClockQuality
*
q
)
static
void
dump_1quality
(
char
*
s
,
ClockQuality
*
q
)
{
{
printf
(
"%s%02x-%02x-%04x
\n
"
,
s
,
q
->
clockClass
,
q
->
clockAccuracy
,
printf
(
"%s%02x-%02x-%04x
\n
"
,
s
,
q
->
clockClass
,
q
->
clockAccuracy
,
q
->
offsetScaledLogVariance
);
q
->
offsetScaledLogVariance
);
}
}
void
dump_1clockid
(
char
*
s
,
ClockIdentity
i
)
static
void
dump_1clockid
(
char
*
s
,
ClockIdentity
i
)
{
{
printf
(
"%s%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x
\n
"
,
s
,
printf
(
"%s%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x
\n
"
,
s
,
i
.
id
[
0
],
i
.
id
[
1
],
i
.
id
[
2
],
i
.
id
[
3
],
i
.
id
[
0
],
i
.
id
[
1
],
i
.
id
[
2
],
i
.
id
[
3
],
i
.
id
[
4
],
i
.
id
[
5
],
i
.
id
[
6
],
i
.
id
[
7
]);
i
.
id
[
4
],
i
.
id
[
5
],
i
.
id
[
6
],
i
.
id
[
7
]);
}
}
void
dump_1port
(
char
*
s
,
unsigned
char
*
p
)
static
void
dump_1port
(
char
*
s
,
unsigned
char
*
p
)
{
{
printf
(
"%s%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x
\n
"
,
s
,
printf
(
"%s%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x
\n
"
,
s
,
p
[
0
],
p
[
1
],
p
[
2
],
p
[
3
],
p
[
4
],
p
[
5
],
p
[
6
],
p
[
7
],
p
[
8
],
p
[
9
]);
p
[
0
],
p
[
1
],
p
[
2
],
p
[
3
],
p
[
4
],
p
[
5
],
p
[
6
],
p
[
7
],
p
[
8
],
p
[
9
]);
...
@@ -107,7 +106,7 @@ void dump_1port(char *s, unsigned char *p)
...
@@ -107,7 +106,7 @@ void dump_1port(char *s, unsigned char *p)
/* Helpers for each message types */
/* Helpers for each message types */
void
dump_msg_announce
(
struct
ptp_announce
*
p
)
static
void
dump_msg_announce
(
struct
ptp_announce
*
p
)
{
{
dump_1stamp
(
"MSG-ANNOUNCE: stamp "
,
&
p
->
originTimestamp
);
dump_1stamp
(
"MSG-ANNOUNCE: stamp "
,
&
p
->
originTimestamp
);
dump_1quality
(
"MSG-ANNOUNCE: grandmaster-quality "
,
dump_1quality
(
"MSG-ANNOUNCE: grandmaster-quality "
,
...
@@ -118,19 +117,19 @@ void dump_msg_announce(struct ptp_announce *p)
...
@@ -118,19 +117,19 @@ void dump_msg_announce(struct ptp_announce *p)
p
->
grandmasterIdentity
);
p
->
grandmasterIdentity
);
}
}
void
dump_msg_sync_etc
(
char
*
s
,
struct
ptp_sync_etc
*
p
)
static
void
dump_msg_sync_etc
(
char
*
s
,
struct
ptp_sync_etc
*
p
)
{
{
dump_1stamp
(
s
,
&
p
->
stamp
);
dump_1stamp
(
s
,
&
p
->
stamp
);
}
}
void
dump_msg_resp_etc
(
char
*
s
,
struct
ptp_sync_etc
*
p
)
static
void
dump_msg_resp_etc
(
char
*
s
,
struct
ptp_sync_etc
*
p
)
{
{
dump_1stamp
(
s
,
&
p
->
stamp
);
dump_1stamp
(
s
,
&
p
->
stamp
);
dump_1port
(
s
,
p
->
port
);
dump_1port
(
s
,
p
->
port
);
}
}
/* TLV dumper, not yet white-rabbit aware */
/* TLV dumper, not yet white-rabbit aware */
int
dump_tlv
(
struct
ptp_tlv
*
tlv
,
int
totallen
)
static
int
dump_tlv
(
struct
ptp_tlv
*
tlv
,
int
totallen
)
{
{
/* the field includes 6 bytes of the header, ecludes 4 of them. Bah! */
/* the field includes 6 bytes of the header, ecludes 4 of them. Bah! */
int
explen
=
ntohs
(
tlv
->
len
)
+
4
;
int
explen
=
ntohs
(
tlv
->
len
)
+
4
;
...
@@ -153,7 +152,7 @@ int dump_tlv(struct ptp_tlv *tlv, int totallen)
...
@@ -153,7 +152,7 @@ int dump_tlv(struct ptp_tlv *tlv, int totallen)
}
}
/* A big function to dump the ptp information */
/* A big function to dump the ptp information */
void
dump_payload
(
void
*
pl
,
int
len
)
static
void
dump_payload
(
void
*
pl
,
int
len
)
{
{
struct
ptp_header
*
h
=
pl
;
struct
ptp_header
*
h
=
pl
;
void
*
msg_specific
=
(
void
*
)(
h
+
1
);
void
*
msg_specific
=
(
void
*
)(
h
+
1
);
...
...
tools/ptpdump.h
View file @
fab90564
int
dumpstruct
(
char
*
prefix
,
char
*
name
,
void
*
ptr
,
int
size
);
void
dump_eth
(
struct
ethhdr
*
eth
);
void
dump_ip
(
struct
iphdr
*
ip
);
void
dump_udp
(
struct
udphdr
*
udp
);
void
dump_1stamp
(
char
*
s
,
struct
stamp
*
t
);
void
dump_1quality
(
char
*
s
,
ClockQuality
*
q
);
void
dump_1clockid
(
char
*
s
,
ClockIdentity
i
);
void
dump_1port
(
char
*
s
,
unsigned
char
*
p
);
void
dump_msg_announce
(
struct
ptp_announce
*
p
);
void
dump_msg_sync_etc
(
char
*
s
,
struct
ptp_sync_etc
*
p
);
void
dump_msg_resp_etc
(
char
*
s
,
struct
ptp_sync_etc
*
p
);
int
dump_tlv
(
struct
ptp_tlv
*
tlv
,
int
totallen
);
void
dump_payload
(
void
*
pl
,
int
len
);
int
dump_udppkt
(
void
*
buf
,
int
len
);
int
dump_udppkt
(
void
*
buf
,
int
len
);
int
dump_1588pkt
(
void
*
buf
,
int
len
);
int
dump_1588pkt
(
void
*
buf
,
int
len
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment