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
50
Issues
50
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
0b4996ec
Commit
0b4996ec
authored
Jan 21, 2012
by
Aurelio Colosimo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diagnostic macros defined and used to substitute old DBG/DBGV
The 'FIXME: diag' issues still needs to be uncommented
parent
93aa0cfa
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
42 deletions
+42
-42
main-loop.c
arch-gnu-linux/main-loop.c
+2
-0
posix-startup.c
arch-gnu-linux/posix-startup.c
+2
-0
diag.h
include/pptp/diag.h
+1
-18
pptp.h
include/pptp/pptp.h
+11
-0
bmc.c
proto-standard/bmc.c
+5
-8
common-fun.c
proto-standard/common-fun.c
+12
-11
open-close.c
proto-standard/open-close.c
+3
-0
servo.c
proto-standard/servo.c
+2
-1
state-slave.c
proto-standard/state-slave.c
+4
-4
No files found.
arch-gnu-linux/main-loop.c
View file @
0b4996ec
...
...
@@ -18,6 +18,8 @@ void posix_main_loop(struct pp_instance *ppi)
{
int
delay_ms
;
pp_diag_verbosity
=
1
;
set_TimeInternal
(
&
ppi
->
last_rcv_time
,
0
,
0
);
/*
...
...
arch-gnu-linux/posix-startup.c
View file @
0b4996ec
...
...
@@ -14,6 +14,8 @@
#include <pptp/diag.h>
#include "posix.h"
int
pp_diag_verbosity
=
0
;
int
main
(
int
argc
,
char
**
argv
)
{
struct
pp_instance
*
ppi
;
...
...
include/pptp/diag.h
View file @
0b4996ec
...
...
@@ -4,6 +4,7 @@
#ifndef __PTP_DIAG_H__
#define __PTP_DIAG_H__
#include <pptp/pptp.h>
/*
* The diagnostic functions (diag-yes.c and diag-no.c).
*
...
...
@@ -28,22 +29,4 @@ extern int pp_vprintf(const char *fmt, va_list args)
extern
int
pp_vsprintf
(
char
*
buf
,
const
char
*
,
va_list
)
__attribute__
((
format
(
printf
,
2
,
0
)));
/*
* Temporarily, define DBGV. I should get __attribute__((deprecated))
* at some point, and then disappear over time.
*/
static
inline
void
DBGV
(
const
char
*
msg
)
/* most DBGV are constant strings */
{
pp_printf
(
"%s"
,
msg
);
}
static
inline
void
DBGV_ARGS
(
const
char
*
fmt
,
...)
{
va_list
args
;
va_start
(
args
,
fmt
);
pp_vprintf
(
fmt
,
args
);
va_end
(
args
);
}
#endif
/* __PTP_DIAG_H__ */
include/pptp/pptp.h
View file @
0b4996ec
...
...
@@ -12,6 +12,17 @@
#include <pptp/ieee1588_types.h>
#include <pptp/constants.h>
/* Macros for diagnostic prints. Set pp_diag_verbosity as 0 or 1 (PP_V macros
* disabled/enabled) */
extern
int
pp_diag_verbosity
;
#define PP_FSM(ppi,seq,len) pp_diag_fsm(ppi,seq,len)
#define PP_VFSM(ppi,seq,len) if (pp_diag_verbosity) pp_diag_fsm(ppi,seq,len)
#define PP_VTR(ppi,f,l) if (pp_diag_verbosity) pp_diag_trace(ppi,f,l)
#define PP_ERR(ppi,err) if pp_diag_error(ppi,err)
#define PP_ERR2(ppi,s1,s2) if pp_diag_error_str2(ppi,s1,s2)
#define PP_FATAL(ppi,s1,s2) if pp_diag_fatal(ppi,s1,s2)
#define PP_PRINTF(...) pp_printf(__VA_ARGS__)
#define PP_VPRINTF(...) if (pp_diag_verbosity) pp_printf(__VA_ARGS__)
/*
* Runtime options. Default values can be overridden by command line.
...
...
proto-standard/bmc.c
View file @
0b4996ec
...
...
@@ -117,7 +117,7 @@ Integer8 bmc_dataset_cmp(struct pp_instance *ppi,
short
comp
=
0
;
Octet
*
ppci
;
DBGV
(
"Data set comparison
\n
"
);
PP_VPRINTF
(
"BMC: in bmc_dataset_cmp
\n
"
);
/* Identity comparison */
if
(
!
pp_memcmp
(
ann_a
->
grandmasterIdentity
,
...
...
@@ -266,29 +266,26 @@ UInteger8 bmc_state_decision( struct pp_instance *ppi,
hdr
,
ann
);
if
(
DSDEF
(
ppi
)
->
clockQuality
.
clockClass
<
128
)
{
if
(
cmpres
<
0
)
{
m1
(
ppi
);
return
PPS_MASTER
;
}
else
if
(
cmpres
>
0
)
{
s1
(
ppi
,
hdr
,
ann
);
return
PPS_PASSIVE
;
}
else
{
/* FIXME DBG("Error in bmcDataSetComparison..\n"); */
}
}
else
{
if
(
cmpres
<
0
)
{
m1
(
ppi
);
return
PPS_MASTER
;
}
else
if
(
cmpres
>
0
)
{
s1
(
ppi
,
hdr
,
ann
);
return
PPS_SLAVE
;
}
else
{
/* FIXME DBG("Error in bmcDataSetComparison..\n"); */
}
}
if
(
cmpres
==
0
)
{
PP_PRINTF
(
"Error in bmcDataSetComparison.
\n
"
);
}
/* MB: Is this the return code below correct? */
...
...
@@ -317,7 +314,7 @@ UInteger8 bmc(struct pp_instance *ppi, struct pp_frgn_master *frgn_master,
&
frgn_master
[
best
].
ann
)
<
0
)
best
=
i
;
DBGV_ARGS
(
"B
est record : %d
\n
"
,
best
);
PP_VPRINTF
(
"bmc, b
est record : %d
\n
"
,
best
);
ppi
->
foreign_record_best
=
best
;
return
bmc_state_decision
(
ppi
,
&
frgn_master
[
best
].
hdr
,
...
...
proto-standard/common-fun.c
View file @
0b4996ec
...
...
@@ -10,7 +10,7 @@
int
st_com_execute_slave
(
struct
pp_instance
*
ppi
)
{
if
(
pp_timer_expired
(
ppi
->
timers
[
PP_TIMER_ANN_RECEIPT
]))
{
DBGV
(
"event ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
\n
"
);
PP_VPRINTF
(
"event ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
\n
"
);
ppi
->
number_foreign_records
=
0
;
ppi
->
foreign_record_i
=
0
;
if
(
!
DSDEF
(
ppi
)
->
slaveOnly
&&
...
...
@@ -25,13 +25,13 @@ int st_com_execute_slave(struct pp_instance *ppi)
if
(
ppi
->
rt_opts
->
e2e_mode
)
{
if
(
pp_timer_expired
(
ppi
->
timers
[
PP_TIMER_DELAYREQ
]))
{
DBGV
(
"TODO:
event DELAYREQ_INTERVAL_TIMEOUT_EXPIRES
\n
"
);
PP_VPRINTF
(
"
event DELAYREQ_INTERVAL_TIMEOUT_EXPIRES
\n
"
);
return
msg_issue_delay_req
(
ppi
);
}
}
else
{
if
(
pp_timer_expired
(
ppi
->
timers
[
PP_TIMER_PDELAYREQ
]))
{
DBGV
(
"TODO:
event PDELAYREQ_INTERVAL_TOUT_EXPIRES
\n
"
);
PP_VPRINTF
(
"
event PDELAYREQ_INTERVAL_TOUT_EXPIRES
\n
"
);
return
msg_issue_pdelay_req
(
ppi
);
}
}
...
...
@@ -52,7 +52,7 @@ void st_com_restart_annrec_timer(struct pp_instance *ppi)
int
st_com_check_record_update
(
struct
pp_instance
*
ppi
)
{
if
(
ppi
->
record_update
)
{
DBGV
(
"event STATE_DECISION_EVENT
\n
"
);
PP_VPRINTF
(
"event STATE_DECISION_EVENT
\n
"
);
ppi
->
record_update
=
FALSE
;
ppi
->
next_state
=
bmc
(
ppi
,
ppi
->
frgn_master
,
ppi
->
rt_opts
);
...
...
@@ -83,7 +83,8 @@ void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
*/
ppi
->
frgn_master
[
j
].
ann_messages
++
;
found
=
1
;
DBGV
(
"addForeign : AnnounceMessage incremented
\n
"
);
PP_VPRINTF
(
"st_com_add_foreign: ann_messages: %d
\n
"
,
ppi
->
frgn_master
[
j
].
ann_messages
);
msg_copy_header
(
&
ppi
->
frgn_master
[
j
].
hdr
,
hdr
);
msg_unpack_announce
(
buf
,
&
ppi
->
frgn_master
[
j
].
ann
);
...
...
@@ -121,7 +122,7 @@ void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
msg_unpack_announce
(
buf
,
&
ppi
->
frgn_master
[
j
].
ann
);
DBGV
(
"New foreign Master added
\n
"
);
PP_VPRINTF
(
"New foreign Master added
\n
"
);
ppi
->
foreign_record_i
=
(
ppi
->
foreign_record_i
+
1
)
%
ppi
->
max_foreign_records
;
...
...
@@ -230,17 +231,17 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
return
-
1
;
if
(
!
ppi
->
is_from_cur_par
)
{
DBGV
(
"SequenceID doesn't match last Sync message
\n
"
);
PP_VPRINTF
(
"SequenceID doesn't match last Sync message
\n
"
);
return
0
;
}
if
(
!
ppi
->
waiting_for_follow
)
{
DBGV
(
"Slave was not waiting a follow up message
\n
"
);
PP_VPRINTF
(
"Slave was not waiting a follow up message
\n
"
);
return
0
;
}
if
(
ppi
->
recv_sync_sequence_id
!=
hdr
->
sequenceId
)
{
DBGV
(
"Follow up message is not from current parent
\n
"
);
PP_VPRINTF
(
"Follow up message is not from current parent
\n
"
);
return
0
;
}
...
...
@@ -305,11 +306,11 @@ int st_com_master_handle_announce(struct pp_instance *ppi, unsigned char *buf,
return
-
1
;
if
(
ppi
->
is_from_self
)
{
DBGV
(
"HandleAnnounce : Ignore message
from self
\n
"
);
PP_VPRINTF
(
"master handle_announce: ignore msg
from self
\n
"
);
return
0
;
}
DBGV
(
"Announce message from another foreign master
\n
"
);
PP_VPRINTF
(
"Announce message from another foreign master
\n
"
);
st_com_add_foreign
(
ppi
,
buf
);
...
...
proto-standard/open-close.c
View file @
0b4996ec
...
...
@@ -33,7 +33,10 @@ int pp_parse_cmdline(struct pp_instance *ppi, int argc, char **argv)
/* TODO: Check how to parse cmdline. We can not rely on getopt()
* function. Which are the really useful parameters?
* Every parameter should be contained in ppi->rt_opts and set here
* Temporarly set verbosity to 1 (for test), but it should be read
* from the command line.
*/
pp_diag_verbosity
=
1
;
return
0
;
}
...
...
proto-standard/servo.c
View file @
0b4996ec
...
...
@@ -4,10 +4,11 @@
*/
#include <pptp/pptp.h>
#include <pptp/diag.h>
void
pp_init_clock
(
struct
pp_instance
*
ppi
)
{
/* FIXME diag DBG("initClock\n"); */
PP_PRINTF
(
"SERVO init clock
\n
"
);
/* clear vars */
set_TimeInternal
(
&
SRV
(
ppi
)
->
m_to_s_dly
,
0
,
0
);
...
...
proto-standard/state-slave.c
View file @
0b4996ec
...
...
@@ -117,8 +117,8 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
hdr
->
logMessageInterval
;
}
else
{
DBGV
(
"TODO: HandledelayResp
: "
"
delayResp doesn't match delayReq.
\n
"
);
PP_VPRINTF
(
"pp_slave
: "
"
Delay Resp doesn't match Delay Req
\n
"
);
}
break
;
...
...
@@ -190,8 +190,8 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
pp_update_peer_delay
(
ppi
,
&
correction_field
,
0
);
}
}
else
{
DBGV
(
"TODO: HandlePdelayResp : Pdelayr
esp doesn't "
"match P
delay
Req.
\n
"
);
PP_VPRINTF
(
"pp_slave : PDelay R
esp doesn't "
"match P
Delay
Req.
\n
"
);
}
break
;
...
...
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