TIP: Click on subject to list as thread! ANSI
echo: net_dev
to: Paul Edwards
from: mark lewis
date: 1996-05-19 14:51:34
subject: fts-0501.003 (proposed)

PE>  16   10    2       integer     baud (useless)

PP> This is not always useless. When it has a value of 2 (an impossible baud 
PP> rate), it means that this is a Type-2.2 packet (FSC-0045)... Just for 
PP> completeness...

PE> Thanks for the info.  I don't want to spec Type 2.2 at this stage.
PE> Do you think it would be better to say "baud (optional)" or just
PE> "baud"? I'm not sure that it is actually optional!

i don't know that it is optional either... witness the following pascal
structures and note the ABSOLUTE overlaying of variables... i don't know
how other authors determine which PKT type they are working with but i
like this method ;-)

===== snip =====
program readpkt;

uses crt;

{
  purpose: to read the header information in FIDO .PKT files. this is to
           determine what type of PKT format they are.
}

const
    prodfile = 'FTSCPROD.048';

type
    bulkheader = array[1..58] of byte;
    pkthead1 = record                     {Type 2.0 FTS-0001}
                 orgnode   : integer;
                 dstnode   : integer;
                 year      : integer;
                 month     : integer;
                 day       : integer;
                 hours     : integer;
                 minutes   : integer;
                 seconds   : integer;
                 baud      : integer;
                 pktver    : integer;
                 orgnet    : word;
                 dstnet    : word;
                 prdcode   : byte;
                 pvmajor   : byte;
                 password  : array[0..7] of char;
                 qorgzone  : integer;
                 qdstzone  : integer;
                 filler    : array[0..19] of char;
              end;
    pkthead2 = record                     {Type 2.2 FSC-0045}
                 orignode  : integer;
                 destnode  : integer;
                 origpoint : integer;
                 destpoint : integer;
                 reserved  : array[0..7] of char;
                 pktsubver : integer;
                 pktver    : integer;
                 orignet   : word;
                 destnet   : word;
                 prdcod    : byte;
                 prdrev    : byte;
                 password  : array[0..7] of char;
                 origzone  : integer;
                 destzone  : integer;
                 origdom   : array[0..7] of char;
                 destdom   : array[0..7] of char;
                 proddata  : array[0..3] of char;
              end;
    pkthead3 = record                     {Type 2+ FSC-0039/48}
                 orgnode   : word;
                 dstnode   : word;
                 year      : integer;
                 month     : integer;
                 day       : integer;
                 hours     : integer;
                 minutes   : integer;
                 seconds   : integer;
                 baud      : integer;
                 pktver    : integer;
                 orgnet    : word;
                 dstnet    : word;
                 prdcodl   : byte;
                 pvmajor   : byte;
                 password  : array[0..7] of char;
                 qorgzone  : integer;
                 qdstzone  : integer;
                 auxnet    : word;
                 capval    : word;
                 prdcodh   : byte;
                 pvminor   : byte;
                 capword   : word;
                 origzone  : integer;
                 destzone  : integer;
                 origpoint : integer;
                 destpoint : integer;
                 proddata  : array[0..3] of char;
              end;
var
    bheader : bulkheader;
    header1 : pkthead1 absolute bheader; { fts-0001 }
    header2 : pkthead2 absolute bheader; { fsc-0045 }
    header3 : pkthead3 absolute bheader; { fsc-0039 }
    f       : file;
    packet  : string;
    result  : word;
    pkttype : byte;

{----------------------------------------------------------------------------}

begin
  if paramcount < 1 then
    begin
      writeln;
      writeln('You didn''t tell me what .PKT file to use!');
      halt(255);
    end;
  packet := paramstr(1);
  assign(output, '');
  rewrite(output);
  fillchar(bheader,sizeof(bheader),#00);
  pkttype := 0;
  {$I-}
  assign(f, packet);
  reset(f,1);
  {$I+}
  if IOresult  0 then
    begin
      writeln('Unable to open ',packet);
      halt(254)
    end;
  blockread(F, bHeader, sizeof(bHeader), result);
  if result < sizeof(bHeader) then
    begin
      writeln('Error reading header in ',packet);
      halt(253)
    end;
  writeln;
  writeln('PKT Name  = ',packet);
  writeln;
  if (header3.day = 0) and (header3.hours = 0) and
     (header3.minutes = 0) and (header3.seconds = 0) and
     (header3.baud = 2) then
    begin
      pkttype := 2; { fsc-0045 }
    end
  else
    begin
      if header3.capword = 0 then
        begin
          pkttype := 1; { fts-0001 }
        end
      else
        begin
          if (header3.capword = 1) and (header3.baud  2) then
            begin
              pkttype := 3; { fsc-0039 }
            end;
        end;
    end;
  case pkttype of
    1  : fts_0001; { uses header1 - routine snipped, write your own - }
    2  : fsc_0045; { uses header2 - routine snipped, write your own - }
    3  : fsc_0039; { uses header3 - routine snipped, write your own - }
  else
    begin
      writeln('Unknown Packet Header Type!');
      halt(252);
    end;
  end;
  writeln;
  close(f);
  close(output);
end.

===== snip =====

yes, you'll note that all the detection of which type this PKT is is
performed with the Type 2+ FSC-0039/48 header (header3) layout... :)
additional PKT types are easy enough to add and detect  and feel
free to use this code in any manner you wish... i've never had it fail
yet -=B-)

)\/(ark

* Origin: (1:3634/12)
SEEN-BY: 10/8 13/13 37/100 50/99 102/735 104/821 105/103 330 107/411 119/88
SEEN-BY: 138/146 153/800 920 157/586 161/55 167/90 200/204 202/1919 203/512
SEEN-BY: 203/992 204/200 206/2711 209/720 218/801 239/1 245/6910 260/10
SEEN-BY: 261/1137 270/101 102 103 104 272/82 280/1 801 282/1 4073 283/657
SEEN-BY: 292/876 320/119 321/1 325/118 328/104 332/1 334/201 341/70 342/12
SEEN-BY: 344/3 345/12 346/49 348/105 353/211 353 362/37 367/1 369/110 383/22
SEEN-BY: 385/100 387/31 396/1 402/311 403/150 405/0 406/100 430/105 600/253
SEEN-BY: 600/348 620/243 626/660 632/348 640/206 217 230 305 820 821 822 823
SEEN-BY: 690/660 700/101 711/409 410 413 430 808 809 934 712/515 713/888
SEEN-BY: 721/117 724/10 800/1 2430/1423 2433/225 2490/3001 2604/104 2613/5
SEEN-BY: 2624/306 3401/308 3412/1 3611/18 3615/7 50 3619/25 3653/777 7104/2
@PATH: 3634/12 170/400 396/1 270/101 209/720 640/820 711/409 808 934

SOURCE: echomail via fidonet.ozzmosis.com

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™.