2

I'm trying to represent the functionning of a device. It has 2 ports, and make computations on the payload of a data packet.

I use pst-node from the PSTricks suite to realise it, b I came across some problems...

  1. I'd like to have a data packet made up of 2 parts : header and payload. But the y in Payload causes a bad alignment of the two words. Moreover, it messes up the whole dimensions of the \psframebox. The 2 packets drawn features the 2 problems.

  2. I'd like to have the Payload box "concatenated" to the Header box. I tried using the [tl] and [tr] otpions for the rput command, but it's messed up when it comes to binding boxes... Moreover, as the [cr] and [cl] doesn't exist, the data packet boxes aren't vertically aligned with the other (Process and Port 1)

My MWE hereunder summarizes all the problems I have :

\documentclass[pstricks, float]{standalone}
\usepackage{graphicx}
\usepackage[table, usenames, dvipsnames]{xcolor}
\usepackage{pstricks, pst-node, pst-circ, pst-plot, pst-3dplot, pst-solides3d, pst-sigsys, pstricks-add, pst-eucl}
\usepackage[frenchb]{babel}
\usepackage[locale=FR, per-mode=symbol, abbreviations]{siunitx}



\begin{document}
\bgroup
%\scalebox{0.8}{
\begin{pspicture}[labelangle=:U, showgrid=false](-5, 1)(13, 6)
    \rput[c](-4,4.5){\rnode{priv}{Port 1}}
    \rput[cl](12,2.5){\rnode{publ}{Port 1}}

    \rput[c](5.5,4.5){\rnode{ipsec}{\psframebox[framesep=10pt,cornersize=absolute,linearc=0.2, linecolor=red]{\textcolor{red}{Process}}}}


    \rput[tl](2,4.5){\rnode{header1}{\psframebox[framesep=4pt]{Header}}}
    \rput[tr](2,4.5){\rnode{payload1}{\psframebox[framesep=4pt]{Payload 1}}}


    \psframe[framearc=.3,linestyle=dashed, linecolor=black!40](-1.5, 1.5)(9.5,5.75)


    \rput[c](5.6,2.5){\rnode{header2}{\psframebox[framesep=4pt]{Header}}}
    \rput[c](7.25, 2.5){\rnode{payload2}{\psframebox[framesep=4pt]{Paload 2}}}

    \ncline{<->}{payload1}{ipsec}
    \ncangle[angleA=-90, angleB=180, armB=0, linearc=.5]{<->}{header1}{header2}
    \ncangle[angleB=90, armB=0, linearc=.5]{<->}{ipsec}{payload2}
    \ncline{<->}{payload2}{publ}
    \ncline{<->}{header1}{priv}

\end{pspicture}
%}
\egroup
\end{document}

And its output : MWE Ootput

Any ideas on how to right this ?

2 Answers 2

2

Is that ok that you have a straight line from Port1 to Process??

\documentclass[pstricks, float]{standalone}
\usepackage{graphicx}
\usepackage[table, usenames, dvipsnames]{xcolor}
\usepackage{pstricks-add}
\usepackage[frenchb]{babel}
\usepackage[locale=FR, per-mode=symbol, abbreviations]{siunitx}

\begin{document}
\begin{pspicture}(-5, 1)(13, 6)
\rput[c](-4,4.5){\rnode{priv}{Port 1}}
\rput[cl](12,2.5){\rnode{publ}{Port 1}}
\rput[c](5.5,4.5){\rnode{ipsec}{\psframebox[framesep=10pt,
        cornersize=absolute,linearc=0.2, linecolor=red]{\textcolor{red}{Process}}}}
\rput[l](2,4.5){\rnode{header1}{\psframebox[framesep=4pt]{Header\vphantom{y}}}}
\rput[r](2,4.5){\rnode{payload1}{\psframebox[framesep=4pt]{Payload 1}}}
\psframe[framearc=.3,linestyle=dashed, linecolor=black!40](-1.5, 1.5)(9.5,5.75)
\rput[r](7,2.5){\rnode{header2}{\psframebox[framesep=4pt]{Header}}}
\rput[l](7,2.5){\rnode{payload2}{\psframebox[framesep=4pt]{Paload 2}}}
\ncline{<->}{payload1}{priv}
\ncangle[angleA=-90,angleB=180, armB=0,linearc=.5]{<->}{header1}{header2}
\ncangle[angleB=90, armB=0, linearc=.5]{<->}{ipsec}{payload2}
\ncline{<->}{payload2}{publ}
\ncline{<->}{header1}{ipsec} 
\end{pspicture}
\end{document}

enter image description here

2
  • The arrow from Port has to stop at Payload1...
    – 3isenHeim
    Apr 13, 2016 at 13:08
  • 1
    see edited answer
    – user2478
    Apr 13, 2016 at 16:34
1

Is it what you want? It's easier to do with psmatrix.

Note you don't have to load all PSTricks related packages, as pstricks-add already loads pstricks, pst-plot, pst-node, pst-3d, pst-math and multido. Also, the option usenames for xcolor is unnecessary, as it is the default nowadays. I loaded the x11names option, as it defines may more colours than dvipsnames.

\documentclass[pstricks, border=3pt]{standalone}

\usepackage[table, dvipsnames, x11names]{xcolor}
\usepackage{eqparbox}
\usepackage{pstricks-add,}%
\usepackage{auto-pst-pdf}

\begin{document}

\def\mylength{\dimexpr1.5cm + \pslinewidth\relax}
\def\pscolhookiii{\hspace*{-\mylength}}
\def\pscolhookv{\hspace*{-\mylength}}
\newlength\mysep
\psset{framesep=4pt, arrowinset=0.15, linejoin=1}
\begin{psmatrix}%
    [name=priv] Port 1 & [name=payload1] \psframebox{Payload 1}& [name=header1] \psframebox{Header\vphantom{y}} & [name=ipsec]\makebox[0pt]{\psframebox[framesep=10pt,cornersize=absolute,linearc=0.2, linecolor=IndianRed3]{\eqmakebox[ips]{\color{IndianRed3}Process}}}& & \\ %
    & & & [name=header2] \psframebox{Header\vphantom{y}} & [name=payload2] \psframebox{Payload 2} &
    [name=publ] Port1
    \setlength{\mysep}{\dimexpr\eqboxwidth{ips}/2+10pt +\pslinewidth\relax}
    \ncline[nodesepB=\mysep]{<->}{header1}{ipsec}
    \ncangle[angleA=-90, angleB=180, armB=0, linearc=.5]{<->}{header1}{header2}
    \ncangle[angleB=90, armB=0, linearc=.3,nodesepA=\mysep]{<->}{ipsec}{payload2}
    \pnode[-1.5,1](payload1){PL1}
    \pnode[1.5,-1](payload2){PL2}
    \psframe[framearc=.3,linestyle=dashed, linecolor=LightSteelBlue3](PL1)(PL2)
    \psset{nodesepB=3pt}
    \ncline{<->}{payload2}{publ}
    \ncline{<->}{payload1}{priv}
\end{psmatrix}

\end{document} 

enter image description here

3
  • One ) is missing at the line \setlength{\mysep}{\dimexpr(\eqboxwidth{ips}/2+10pt +\pslinewidth\relax}. Is it after the /2 ?
    – 3isenHeim
    Apr 13, 2016 at 13:31
  • I will wait until Herbert's solution to mark the question answered, as it's the closest to what I tried...
    – 3isenHeim
    Apr 13, 2016 at 13:46
  • 1
    @Eisenheim: I've added the dashed frame that I had forgotten.
    – Bernard
    Apr 13, 2016 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .