TIP: Click on subject to list as thread! ANSI
echo: linux
to: MARK LEWIS
from: MAURICE KINAL
date: 2016-11-20 14:15:00
subject: two steps back

-={ 2016-11-20 09:15:50.055384221-05:00 }=-

Hey mark!

 ml> how do you convert it to binary?

perl oneliners.  Calls to the builtin pack() function to be more specific.  For
example for the type 2 pkt it looks like;

---------- ye olde gpm cut n' paste starts
perl -e 'while(){@myarray = split(/,/, $_);};\
         print pack("S12C2a8S2a20", @myarray);' > $OUTPKT
---------- ye olde gpm cut n' paste ends

Types 2+ and 2.2 are the same except the template string differs as follows;

Type 2+:   "S12C2a8S4C2S5I"
Type 2.2:  "S4a8S4C2a8S2a8a8I"

 ml> FTN domains are of similar nature to NETBIOS and NOVELL domains

That explains their inherent lameness.  ;-)

 ml> restricted to printable ASCII characters

See the two a8's in the type 2.2 template string.  The 'a' format specifier
represents ascii and the '8' part restricts the string to 8 characters.

While I am at it the 'split' call splits the data vector into fields that are
then packed according to the corresponding specifier.

 ml> i want to look at it with a couple of packet inspection tools...

Sure.

---------- ye olde gpm cut n' paste starts
# generate Type 2 pktHeader
PKT_DATE=( $(date +"%Y %-m %-d %-H %-M %-S" | \
  awk 'BEGIN { OFS = "," } {print $1, $2-1, $3, $4, $5, $6}') )
echo
"$origNode,$destNode,${PKT_DATE[@]},0,2,$origNet,$destNet,0,0,,$origZone,$destZ
one," | \
  perl -e 'while(){@myarray = split(/,/, $_);};\
           print pack("S12C2a8S2a20", @myarray);' > $OUTPKT
---------- ye olde gpm cut n' paste ends

Hopefully you'll recieve the above intact.  I've noticed someone along the path
back to here is doing some unwanted reformatting of long lines.  Let me know if
there is more you require and I'll do my best to make it so.

Life is good,
Maurice

... Ne mæg werig mod wyrde wiðstondan, ne se hreo hyge helpe gefremman.
    A weary mind cannot withstand fate, nor a sad heart offer help.
--- GNU bash, version 4.4.0(1)-release (x86_64-atom-linux-gnu)
* Origin: Little Mikey's Brain - Ladysmith BC, Canada (1:153/7001)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.