FIX: calculate event from .present sync
authorVolker Birk <vb@pep-project.org>
Fri, 15 Mar 2019 15:58:00 +0100
branchsync
changeset 3338e4906a775c0c
parent 3337 3d3c340df731
child 3339 bd26d8c34462
FIX: calculate event from .present
sync/gen_statemachine.ysl2
     1.1 --- a/sync/gen_statemachine.ysl2	Fri Mar 15 13:38:18 2019 +0100
     1.2 +++ b/sync/gen_statemachine.ysl2	Fri Mar 15 15:58:00 2019 +0100
     1.3 @@ -55,7 +55,7 @@
     1.4  
     1.5          #define «yml:ucase(@name)»_TIMEOUT_EVENT new_«@name»_event(«@name»_PR_NOTHING, 0, NULL);
     1.6  
     1.7 -
     1.8 +    
     1.9          // free_«@name»_event() - free memory occupied by event
    1.10          //
    1.11          //  parameters:
    1.12 @@ -622,43 +622,54 @@
    1.13      {
    1.14          ||
    1.15          case «../@name»_PR_«yml:lcase(@name)»:
    1.16 -            event = msg->choice.«yml:lcase(@name)».payload.present;
    1.17 -            switch (event) {
    1.18 +            switch (msg->choice.«yml:lcase(@name)».payload.present) {
    1.19          ||
    1.20          if "message[@security='unencrypted']" {
    1.21 -            |         // these messages require a detached signature
    1.22 -            for "message[@security='unencrypted']"
    1.23 -                |>> case «../@name»__payload_PR_«yml:mixedCase(@name)»:
    1.24 +            |>> // these messages require a detached signature
    1.25 +            for "message[@security='unencrypted']" {
    1.26              ||
    1.27 +                    case «../@name»__payload_PR_«yml:mixedCase(@name)»:
    1.28                          if (!fpr) {
    1.29                              status = PEP_«yml:ucase(ancestor::protocol/@name)»_ILLEGAL_MESSAGE;
    1.30                              goto the_end;
    1.31                          }
    1.32 +                        event = «@name»;
    1.33                          break;
    1.34  
    1.35              ||
    1.36 +            }
    1.37          }
    1.38 -        if "message[@security='untrusted']"
    1.39 +        if "message[@security='untrusted']" {
    1.40 +            |>> // these messages must arrive encrypted
    1.41 +            for "message[@security='untrusted']" {
    1.42 +            ||
    1.43 +                    case «../@name»__payload_PR_«yml:mixedCase(@name)»:
    1.44 +                        if (fpr || rating < PEP_rating_reliable) {
    1.45 +                            status = PEP_«yml:ucase(ancestor::protocol/@name)»_ILLEGAL_MESSAGE;
    1.46 +                            goto the_end;
    1.47 +                        }
    1.48 +                        event = «@name»;
    1.49 +                        break;
    1.50 +
    1.51 +            ||
    1.52 +            }
    1.53 +        }
    1.54 +        if "message[@security='trusted']" {
    1.55 +            |>> // these messages must come through a trusted channel
    1.56 +            for "message[@security='trusted']" {
    1.57 +            ||
    1.58 +                    case «../@name»__payload_PR_«yml:mixedCase(@name)»:
    1.59 +                        if (fpr || rating < PEP_rating_trusted) {
    1.60 +                            status = PEP_«yml:ucase(ancestor::protocol/@name)»_ILLEGAL_MESSAGE;
    1.61 +                            goto the_end;
    1.62 +                        }
    1.63 +                        event = «@name»;
    1.64 +                        break;
    1.65 +
    1.66 +            ||
    1.67 +            }
    1.68 +        }
    1.69          ||
    1.70 -                // these messages must arrive encrypted
    1.71 -        `` for "message[@security='untrusted']" |>> case «../@name»__payload_PR_«yml:mixedCase(@name)»:
    1.72 -                    if (fpr || rating < PEP_rating_reliable) {
    1.73 -                        status = PEP_«yml:ucase(ancestor::protocol/@name)»_ILLEGAL_MESSAGE;
    1.74 -                        goto the_end;
    1.75 -                    }
    1.76 -                    break;
    1.77 -
    1.78 -        ||
    1.79 -        if "message[@security='trusted']"
    1.80 -        ||
    1.81 -                // these messages must come through a trusted channel
    1.82 -        `` for "message[@security='trusted']" |>> case «ancestor::fsm/@name»__payload_PR_«yml:mixedCase(@name)»:
    1.83 -                    if (fpr || rating < PEP_rating_trusted) {
    1.84 -                        status = PEP_«yml:ucase(ancestor::protocol/@name)»_ILLEGAL_MESSAGE;
    1.85 -                        goto the_end;
    1.86 -                    }
    1.87 -                    break;
    1.88 -
    1.89                  default:
    1.90                      status = PEP_«yml:ucase(ancestor::protocol/@name)»_ILLEGAL_MESSAGE;
    1.91                      goto the_end;