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
458391e2
Commit
458391e2
authored
Mar 07, 2012
by
Alessandro Rubini
Committed by
Aurelio Colosimo
Mar 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diag-fsm: add names to states, add enum for enter/leave
parent
c0398417
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
19 deletions
+27
-19
diag-yes.c
diag/diag-yes.c
+6
-6
fsm.c
fsm.c
+2
-2
diag.h
include/pptp/diag.h
+6
-1
pptp.h
include/pptp/pptp.h
+3
-0
fsm-table.c
proto-standard/fsm-table.c
+10
-10
No files found.
diag/diag-yes.c
View file @
458391e2
...
...
@@ -8,17 +8,17 @@
* This has diagnostics. It calls pp_printf (which one, we don't know)
*/
void
pp_diag_fsm
(
struct
pp_instance
*
ppi
,
int
sequence
,
int
plen
)
void
pp_diag_fsm
(
struct
pp_instance
*
ppi
,
char
*
name
,
int
sequence
,
int
plen
)
{
if
(
!
sequence
)
{
if
(
sequence
==
STATE_ENTER
)
{
/* enter with or without a packet len */
pp_printf
(
"fsm for %p: ENTER %3i (
packet len %i)
\n
"
,
ppi
,
ppi
->
state
,
plen
);
pp_printf
(
"fsm for %p: ENTER %3i (
%s), packet len %i
\n
"
,
ppi
,
ppi
->
state
,
name
,
plen
);
return
;
}
/* leave has one \n more, so different states are separate */
pp_printf
(
"fsm for %p: LEAVE %3i (next: %3i in %i ms)
\n\n
"
,
ppi
,
ppi
->
state
,
ppi
->
next_state
,
ppi
->
next_delay
);
pp_printf
(
"fsm for %p: LEAVE %3i (
%s) (
next: %3i in %i ms)
\n\n
"
,
ppi
,
ppi
->
state
,
name
,
ppi
->
next_state
,
ppi
->
next_delay
);
}
void
pp_diag_trace
(
struct
pp_instance
*
ppi
,
const
char
*
f
,
int
line
)
...
...
fsm.c
View file @
458391e2
...
...
@@ -30,13 +30,13 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
/* found: handle this state */
ppi
->
next_state
=
state
;
ppi
->
next_delay
=
0
;
pp_diag_fsm
(
ppi
,
0
/* enter */
,
plen
);
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_ENTER
,
plen
);
err
=
ip
->
f1
(
ppi
,
packet
,
plen
);
if
(
!
err
&&
ip
->
f2
)
err
=
ip
->
f2
(
ppi
,
packet
,
plen
);
if
(
err
)
pp_diag_error
(
ppi
,
err
);
pp_diag_fsm
(
ppi
,
1
/* leave */
,
0
/* unused */
);
pp_diag_fsm
(
ppi
,
ip
->
name
,
STATE_LEAVE
,
0
/* unused */
);
ppi
->
is_new_state
=
0
;
...
...
include/pptp/diag.h
View file @
458391e2
...
...
@@ -13,7 +13,12 @@
* strerror(errno) together with the explanation. Avoid diag_printf if
* possible, for size reasons, but here it is anyways.
*/
extern
void
pp_diag_fsm
(
struct
pp_instance
*
ppi
,
int
sequence
,
int
plen
);
enum
{
STATE_ENTER
,
STATE_LEAVE
};
extern
void
pp_diag_fsm
(
struct
pp_instance
*
ppi
,
char
*
name
,
int
seq
,
int
plen
);
extern
void
pp_diag_trace
(
struct
pp_instance
*
ppi
,
const
char
*
f
,
int
line
);
extern
void
pp_diag_error
(
struct
pp_instance
*
ppi
,
int
err
);
extern
void
pp_diag_error_str2
(
struct
pp_instance
*
ppi
,
char
*
s1
,
char
*
s2
);
...
...
include/pptp/pptp.h
View file @
458391e2
...
...
@@ -16,6 +16,8 @@
#define ETH_P_1588 0x88F7
#endif
#define __weak __attribute__((weak))
/* Macros for diagnostic prints. Set pp_diag_verbosity as 0 or 1 (PP_V macros
* disabled/enabled) */
extern
int
pp_diag_verbosity
;
...
...
@@ -352,6 +354,7 @@ extern const Integer32 PP_ADJ_FREQ_MAX;
struct
pp_state_table_item
{
int
state
;
char
*
name
;
int
(
*
f1
)(
struct
pp_instance
*
ppi
,
uint8_t
*
packet
,
int
plen
);
int
(
*
f2
)(
struct
pp_instance
*
ppi
,
uint8_t
*
packet
,
int
plen
);
};
...
...
proto-standard/fsm-table.c
View file @
458391e2
...
...
@@ -10,15 +10,15 @@
* the linker can avoid pulling this data space if another table is there.
*/
struct
pp_state_table_item
pp_state_table
[]
=
{
{
PPS_INITIALIZING
,
pp_initializing
,},
{
PPS_FAULTY
,
pp_faulty
,},
{
PPS_DISABLED
,
pp_disabled
,},
{
PPS_LISTENING
,
pp_listening
,},
{
PPS_PRE_MASTER
,
pp_pre_master
,},
{
PPS_MASTER
,
pp_master
,},
{
PPS_PASSIVE
,
pp_passive
,},
{
PPS_UNCALIBRATED
,
pp_uncalibrated
,},
{
PPS_SLAVE
,
pp_slave
,},
struct
pp_state_table_item
pp_state_table
[]
__weak
=
{
{
PPS_INITIALIZING
,
"initializing"
,
pp_initializing
,},
{
PPS_FAULTY
,
"faulty"
,
pp_faulty
,},
{
PPS_DISABLED
,
"disabled"
,
pp_disabled
,},
{
PPS_LISTENING
,
"listening"
,
pp_listening
,},
{
PPS_PRE_MASTER
,
"pre-master"
,
pp_pre_master
,},
{
PPS_MASTER
,
"master"
,
pp_master
,},
{
PPS_PASSIVE
,
"passive"
,
pp_passive
,},
{
PPS_UNCALIBRATED
,
"uncalibrated"
,
pp_uncalibrated
,},
{
PPS_SLAVE
,
"slave"
,
pp_slave
,},
{
PPS_END_OF_TABLE
,}
};
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