|
|
@ -14,7 +14,7 @@ tstylesheet { |
|
|
|
include ./functions.ysl2 |
|
|
|
|
|
|
|
template "/protocol" { |
|
|
|
document "generated/{@name}_event.h", "text" |
|
|
|
if "count(fsm/state)" document "generated/{@name}_event.h", "text" |
|
|
|
|| |
|
|
|
/** |
|
|
|
* @file «@name»_event.h |
|
|
@ -93,7 +93,7 @@ tstylesheet { |
|
|
|
|
|
|
|
|| |
|
|
|
|
|
|
|
document "generated/{@name}_event.c", "text" |
|
|
|
if "count(fsm/state)" document "generated/{@name}_event.c", "text" |
|
|
|
|| |
|
|
|
|
|
|
|
/** |
|
|
@ -148,7 +148,7 @@ tstylesheet { |
|
|
|
|
|
|
|
|| |
|
|
|
|
|
|
|
document "generated/{@name}_impl.h", "text" { |
|
|
|
if "count(fsm/state)" document "generated/{@name}_impl.h", "text" { |
|
|
|
|| |
|
|
|
/** |
|
|
|
* @file «@name»_impl.h |
|
|
@ -167,7 +167,7 @@ tstylesheet { |
|
|
|
#include "../asn.1/«@name».h" |
|
|
|
|
|
|
|
#define «yml:ucase(@name)»_THRESHOLD «@threshold» |
|
|
|
`` for "fsm" | #define «yml:ucase(@name)»_THRESHOLD «@threshold» |
|
|
|
`` for "fsm[count(state)]" | #define «yml:ucase(@name)»_THRESHOLD «@threshold» |
|
|
|
|
|
|
|
#ifdef __cplusplus |
|
|
|
extern "C" { |
|
|
@ -338,7 +338,7 @@ tstylesheet { |
|
|
|
|| |
|
|
|
} |
|
|
|
|
|
|
|
document "generated/{@name}_impl.c", "text" { |
|
|
|
if "count(fsm/state)" document "generated/{@name}_impl.c", "text" { |
|
|
|
|| |
|
|
|
/** |
|
|
|
* @file «@name»_impl.c |
|
|
@ -354,9 +354,9 @@ tstylesheet { |
|
|
|
#include "«yml:lcase(@name)»_codec.h" |
|
|
|
#include "baseprotocol.h" |
|
|
|
#include "security_checks.h" |
|
|
|
`` for "fsm" | #include "«@name»_fsm.h" |
|
|
|
`` for "fsm[count(state)]" | #include "«@name»_fsm.h" |
|
|
|
|
|
|
|
`` apply "fsm", 0, mode=timeout |
|
|
|
`` apply "fsm[count(state)]", 0, mode=timeout |
|
|
|
PEP_STATUS «@name»_driver( |
|
|
|
PEP_SESSION session, |
|
|
|
«@name»_PR fsm, |
|
|
@ -371,12 +371,12 @@ tstylesheet { |
|
|
|
case None: |
|
|
|
if (!event) { |
|
|
|
// timeout occured |
|
|
|
`` for "fsm" |>>>> «../@name»_driver(session, «../@name»_PR_«yml:lcase(@name)», None); |
|
|
|
`` for "fsm[count(state)]" |>>>> «../@name»_driver(session, «../@name»_PR_«yml:lcase(@name)», None); |
|
|
|
return PEP_STATUS_OK; |
|
|
|
} |
|
|
|
return PEP_ILLEGAL_VALUE; |
|
|
|
|
|
|
|
`` apply "fsm", mode=reset_state_machine; |
|
|
|
`` apply "fsm[count(state)]", mode=reset_state_machine; |
|
|
|
default: |
|
|
|
return PEP_ILLEGAL_VALUE; |
|
|
|
} |
|
|
@ -384,7 +384,7 @@ tstylesheet { |
|
|
|
int next_state = None; |
|
|
|
do { |
|
|
|
switch (fsm) { |
|
|
|
`` apply "fsm", 3, mode=driver |
|
|
|
`` apply "fsm[count(state)]", 3, mode=driver |
|
|
|
default: |
|
|
|
return PEP_ILLEGAL_VALUE; |
|
|
|
} |
|
|
@ -480,7 +480,7 @@ tstylesheet { |
|
|
|
bool is_own_key = false; |
|
|
|
|
|
|
|
switch (fsm) { |
|
|
|
`` apply "fsm", 2, mode=signal_message |
|
|
|
`` apply "fsm[count(state)]", 2, mode=signal_message |
|
|
|
default: |
|
|
|
status = PEP_«yml:ucase(@name)»_ILLEGAL_MESSAGE; |
|
|
|
goto the_end; |
|
|
@ -540,7 +540,7 @@ tstylesheet { |
|
|
|
time_t now = time(NULL); |
|
|
|
switch (fsm) { |
|
|
|
|| |
|
|
|
apply "fsm", 2, mode=send; |
|
|
|
apply "fsm[count(state)]", 2, mode=send; |
|
|
|
|| |
|
|
|
} |
|
|
|
|
|
|
@ -586,7 +586,7 @@ tstylesheet { |
|
|
|
|
|
|
|
switch (fsm) { |
|
|
|
|| |
|
|
|
apply "fsm", 2, mode=send2; |
|
|
|
apply "fsm[count(state)]", 2, mode=send2; |
|
|
|
|| |
|
|
|
default: |
|
|
|
break; |
|
|
@ -628,8 +628,7 @@ tstylesheet { |
|
|
|
m = _m; |
|
|
|
break; |
|
|
|
|
|
|
|
`` for "fsm/message[@security='untrusted' and ../@name!='KeySync']" | #error untrusted only allowed with KeySync |
|
|
|
`` for "fsm/message[@security='untrusted' and ../@name='KeySync']" |>>> case «../@name»_PR_«yml:mixedCase(@name)»: |
|
|
|
`` for "fsm/message[@security='untrusted']" |>>> case «../@name»_PR_«yml:mixedCase(@name)»: |
|
|
|
// add fpr of key of comm partner |
|
|
|
|
|
|
|
if (!session->«yml:lcase(@name)»_state.transport.sender_fpr) { |
|
|
@ -1434,7 +1433,7 @@ tstylesheet { |
|
|
|
|| |
|
|
|
|
|
|
|
template "fsm", mode=gen { |
|
|
|
document "generated/{@name}_fsm.h", "text" { |
|
|
|
if "count(state)" document "generated/{@name}_fsm.h", "text" { |
|
|
|
|| |
|
|
|
/** |
|
|
|
* @file «@name»_fsm.h |
|
|
@ -1548,7 +1547,7 @@ tstylesheet { |
|
|
|
|| |
|
|
|
} |
|
|
|
|
|
|
|
document "generated/{@name}_fsm.c", "text" { |
|
|
|
if "count(state)" document "generated/{@name}_fsm.c", "text" { |
|
|
|
|| |
|
|
|
/** |
|
|
|
* @file «@name»_fsm.c |
|
|
|