2

I was looking for a good state machine compiler so as to test some custom networking protocols. I looked at a few tools already such as Yakindu, Ragel(compiler), SCXML(language) but I was not sure if any of them could be used for networking protocols.

SCXML(language) looks good but I could not find any compilers specifically for C (scxmlcc is for C++). Does anyone know a compiler for C based on SCXML? Yakindu tool looks promising, but I am not sure if network protocols like BGP/OSPF could be tested. Can anyone please give any pointers on this? Ragel also looks good, but again I am not sure if complex network protocol clients can be generated using this compiler.

The reason I mentioned network protocols specifically is that I also want to be able to perform custom routines such as packet_create/packet_send (with custom packet sizes) etc as part of 'actions' after an 'event' occurs.

Do I need to always generate code from the state graph or Is there a way to directly interact with the states? I am very new to FSMs, any help/advice/suggestion/links will be greatly appreciated.

Shravan B
  • 37
  • 4

3 Answers3

5

The default Yakindu SCT C code generator generates plain C code that is agnostic of the concrete execution environment. This means you get a piece of standard C code that you can integrate into you own application manually. This manual integration means mapping events, operations, and variables between your application and the state machine. Additionally you have to trigger the state machine execution properly.

You can find some information on that in the user guide. You could also customize the code generators in order to match your needs but that makes only sense if the integration into the application always look the same and you want to integrate more than one or two state machines.

So if you provide some more information about the application side API that i could provide some hints how to integrate with the state machine.

Axel T.
  • 166
  • 5
2

LOKI is a new application designed to provide an easy way for programmers and system admistrators to interact with BGP networks. Use it to test your OSPF/BGP connections as well

user2328360
  • 351
  • 2
  • 3
2

We just finished our SCXML -> ANSI C transformation. Currently, it does everything but invocations. Here is a sample of generated ANSI C code, with user-supplied callbacks and the general scaffolding here. Performance measurements for a single microstep on a late 2015 MacBook Pro@3.1GHz are here.

Note that the scaffolding is in C++98 as we had to connect to a data-model implementation to pass the SCXML IRP tests. Generated source is ANSI C though. If you want to transform a SCXML state-chart you can use uscxml-transform as:

$ uscxml-transform -tc -i FILE_OR_URL -o GENERATED_HERE

For example, to print the generated C code for test144 from the SCXML IRP suite on STDOUT:

$ uscxml-transform -tc -i https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/w3c/ecma/test144.scxml

Generated ANSI-C code passes all SCXML IRP tests but those for invocations and custom I/O processors.

sradomski
  • 436
  • 5
  • 8
  • We are still not sure with regard to the API for embedding, i.e. to hook into your actual application code. If you have any suggestions, feel free to [post an issue](https://github.com/tklab-tud/uscxml/issues) on github. – sradomski Jan 29 '16 at 10:01