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
39
Issues
39
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
ec332e3f
Commit
ec332e3f
authored
Dec 28, 2011
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handling of is_from_self flag
parent
26ea047c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
7 deletions
+21
-7
pproto.h
include/pproto/pproto.h
+2
-1
msg.c
proto-standard/msg.c
+13
-1
state-listening.c
proto-standard/state-listening.c
+4
-3
state-passive.c
proto-standard/state-passive.c
+1
-1
state-machine.c
state-machine.c
+1
-1
No files found.
include/pproto/pproto.h
View file @
ec332e3f
...
...
@@ -148,6 +148,7 @@ struct pp_instance {
*/
MsgHeader
msg_tmp_header
;
MsgHeader
pdelay_req_hdr
;
int
is_from_self
;
};
...
...
@@ -191,7 +192,7 @@ extern UInteger8 bmc(struct pp_frgn_master *frgn_master,
/* msg.c */
extern
void
msg_pack_header
(
void
*
buf
,
struct
pp_instance
*
ppi
);
extern
void
msg_unpack_header
(
void
*
buf
,
MsgHeader
*
hdr
);
extern
void
msg_unpack_header
(
void
*
buf
,
struct
pp_instance
*
ppi
);
extern
void
msg_pack_sync
(
void
*
buf
,
Timestamp
*
orig_tstamp
,
struct
pp_instance
*
ppi
);
extern
void
msg_unpack_sync
(
void
*
buf
,
MsgSync
*
sync
);
...
...
proto-standard/msg.c
View file @
ec332e3f
...
...
@@ -7,8 +7,10 @@
/* Unpack header from in buffer to msg_tmp_header field */
void
msg_unpack_header
(
void
*
buf
,
MsgHeader
*
hdr
)
void
msg_unpack_header
(
void
*
buf
,
struct
pp_instance
*
ppi
)
{
MsgHeader
*
hdr
=
&
ppi
->
msg_tmp_header
;
hdr
->
transportSpecific
=
(
*
(
Nibble
*
)
(
buf
+
0
))
>>
4
;
hdr
->
messageType
=
(
*
(
Enumeration4
*
)
(
buf
+
0
))
&
0x0F
;
hdr
->
versionPTP
=
(
*
(
UInteger4
*
)
(
buf
+
1
))
&
0x0F
;
...
...
@@ -31,6 +33,16 @@ void msg_unpack_header(void *buf, MsgHeader *hdr)
hdr
->
controlField
=
(
*
(
UInteger8
*
)
(
buf
+
32
));
hdr
->
logMessageInterval
=
(
*
(
Integer8
*
)
(
buf
+
33
));
if
(
DSPOR
(
ppi
)
->
portIdentity
.
portNumber
==
ppi
->
msg_tmp_header
.
sourcePortIdentity
.
portNumber
&&
!
pp_memcmp
(
ppi
->
msg_tmp_header
.
sourcePortIdentity
.
clockIdentity
,
DSPOR
(
ppi
)
->
portIdentity
.
clockIdentity
,
PP_CLOCK_IDENTITY_LENGTH
))
ppi
->
is_from_self
=
1
;
else
ppi
->
is_from_self
=
0
;
/* FIXME: diag
#ifdef PTPD_DBG
msgHeader_display(header);
...
...
proto-standard/state-listening.c
View file @
ec332e3f
...
...
@@ -16,12 +16,13 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
goto
state_updated
;
if
(
ppi
->
msg_tmp_header
.
messageType
==
PPM_ANNOUNCE
)
{
/* TODO check isFromSelf?
if (isFromSelf) {
if
(
ppi
->
is_from_self
)
{
/* FIXME diag
DBGV("HandleAnnounce : Ignore message from self \n");
*/
return
;
}
*/
/* FIXME diag
* DBGV("Announce message from another foreign master");
...
...
proto-standard/state-passive.c
View file @
ec332e3f
...
...
@@ -19,7 +19,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
if
(
ppi
->
msg_tmp_header
.
messageType
==
PPM_PDELAY_REQ
)
{
#ifdef _FROM_PTPD_2_1_0_
/* TODO "translate" it into ptp-wr structs*/
if
(
isFromS
elf
)
{
if
(
ppi
->
is_from_s
elf
)
{
/*
* Get sending timestamp from IP stack
* with So_TIMESTAMP
...
...
state-machine.c
View file @
ec332e3f
...
...
@@ -19,7 +19,7 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
int
state
,
err
;
if
(
packet
)
{
msg_unpack_header
(
packet
,
&
ppi
->
msg_tmp_header
);
msg_unpack_header
(
packet
,
ppi
);
}
state
=
ppi
->
state
;
...
...
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