4

Graphviz supports SDL shapes, an external image library:

enter image description here

How do I use an SDL node shape? I've tried:

digraph foo {
    rankdir=LR;
    a [shape=sdl_stop, label=""];
    b;
    a -> b;
}

With:

dot -Tpng sdl.dot  -o sdl.png

Which gave the following warning:

Warning: using box for unknown shape sdl_stop

The code, including a makefile, is available on github.

How do I use an SDL shape as a graphviz node image?

hlovdal
  • 26,565
  • 10
  • 94
  • 165
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
  • I want to do the same thing? Is there a progress on this problem? – Ferda-Ozdemir-Sonmez May 10 '21 at 23:41
  • These shapes are identified as legacy PostScript functions. They do not work on any of the other output formats. the latest SDL standard revision is from 2010. As Graphviz is no longer supported from within a telecommunications entity it seems unlikely that this will be changed. – Pekka May 11 '21 at 06:57
  • Is there any other way to make/use these type of shapes. Basic shapes are not sufficient for my purposes and I do not know how to extend in python. – Ferda-Ozdemir-Sonmez May 11 '21 at 10:03

2 Answers2

0

As explained in the Graphviz Shapes documentation, these are legacy shapes and "are available as PostScript functions". You are using the .png output processor so they are not available.

You may wish to draw them yourself (or clip from the image you have) and then include them from within bitmap images using the <IMG SRC=... /> notation in the HTML-like nodes to reference these.

Pekka
  • 3,529
  • 27
  • 45
0

The sdl.ps file needs to be included using the -l flag, e.g.

dot -Tps -l sdl.ps tcp.dot -o tcp.ps
# Optionally, to convert to png.
gs -q -dBATCH -dNOPAUSE -sDEVICE=png256 -sOutputFile=tcp.png tcp.ps

Whith the following input file (based on half of this fsm)

digraph G {
    state_start         [shape=sdl_start, peripheries=0, label="Start"];
    state_closed        [shape=sdl_state, peripheries=0, label="CLOSED"];
    state_syn_sent      [shape=sdl_state, peripheries=0, label="SYN-SENT"];
    state_established   [shape=sdl_state, peripheries=0, label="ESTABLISHED"];
    state_listen        [shape=sdl_state, peripheries=0, label="LISTEN"];
    state_syn_received  [shape=sdl_state, peripheries=0, label="SYN-RECEIVED"];

    input_active_open   [shape=sdl_input_from_left, peripheries=0, label="Active open"];
    input_passive_open  [shape=sdl_input_from_left, peripheries=0, label="Passive open"];

    input_syn           [shape=sdl_input_from_left, peripheries=0, label="SYN"]
    input_syn2          [shape=sdl_input_from_left, peripheries=0, label="SYN"]
    input_syn_ack       [shape=sdl_input_from_left, peripheries=0, label="SYN-ACK"]
    input_ack           [shape=sdl_input_from_left, peripheries=0, label="ACK"]

    output_syn          [shape=sdl_output_to_right, peripheries=0, label="SYN"]
    output_syn_ack      [shape=sdl_output_to_right, peripheries=0, label="SYN-ACK"]
    output_ack          [shape=sdl_output_to_right, peripheries=0, label="ACK"]
    output_ack2         [shape=sdl_output_to_right, peripheries=0, label="ACK"]

    state_start -> state_closed;

    state_closed -> input_active_open;
    input_active_open -> output_syn;
    output_syn -> state_syn_sent;

    state_syn_sent -> input_syn_ack;
    input_syn_ack -> output_ack;
    output_ack -> state_established;

    state_closed -> input_passive_open;
    input_passive_open -> state_listen;

    state_listen -> input_syn;
    input_syn -> output_syn_ack;
    output_syn_ack -> state_syn_received;

    state_syn_received -> input_ack;
    input_ack -> state_established;

    state_syn_sent -> input_syn2;
    input_syn2 -> output_ack2;
    output_ack2 -> state_syn_received;

}

the commands above generate the following output:

png output (cropped)

hlovdal
  • 26,565
  • 10
  • 94
  • 165