pwire
Precedent character defined message format input program.
The header is parsed and put into FIP header fields. The file is slotted into
the spool/2brouted queue for IPROUTE to process and route.
The parameter table can have :
;; comment line starts witha semicolon
connect: connect string for dialup default: none
discon: disconnect string for dialup default: none
soh: start of header string default: none
stx: start of text string default: none
eot: end of text string default: none
complete-soh: These are the same as soh and eot but are the COMPLETE
complete-eot: string to search for (ie ignoring any 'prestr' or
'endstr'. Use these where the start/end is NOT tagged like
the other fields.
Note that at least one of soh/stx/eot must be specified. The precedence
chr/string and the end string (if applicable) is assumed and should NOT be
specified in soh, stx or eot.
Up to 10 different soh and eots may be tracked at the same time (but NOT stx
!).
You must specify EITHER one or more 'soh' OR one or more 'complete-soh' BUT not
mix them.
Other possible keywords are :
prestr: key field start chr/string default: "{"
endstr: key field end chr/string default: none
key: key length and type in form key: (len) : (type) default: 2:p
len is the length of the string or 0 for any length
type is a-alphabetic, u-uppercase, l-lowercase
n-number, p-printable, s-space(or tab, CR, NL or FF)
b-binary (ie anything), x-alphanumeric,
c-control (ie < 040 or >= 0177),
z-anpa hdr field (ie alnum plus non-quad/format punct.
(Note the type parameter is ignored in the current release)
If length is 0 for any length, there MUST be an 'endstr'.
fiphdr: codes to translate incoming header fields to FIP hdr fields
eg : fiphdr:slug:SN
fiphdr:hj:WH
fiphdr:dq:dq
Note that ALL incoming fields MUST have a corresponding
fip hdr field associated with it or it will be ignored.
Please see the relevant chapter in the System Managers'
Administration guide for further information. default: none
extra-fiphdr: (FipSeq)
fixhdr: (FipSeq) extra FipHeader field(s) - used to add more metadata
fields or to force them to a fixed text. If more than
one field is added, use # to separate them. default: none
dup: name of a DUPLICATE wire where 2 copies of the same
file is required (SD). default: none
route: use this routing table (SR : used in iproute)
default is name as per -n
case: header is case INsensitive - yes/no default: yes
(ie {SN = {sl = {Sl = {sL
bits: no of bits - 5, 6, 7, 8 default: 7
ansbck: ansbck string to be send back on eot default: none
ansfile: send file back as answer back default: no
This will echo back the file just received. The parameter
is the number of lines to send back; if 0 the whole file
is returned. In all cases, only the data part is sent.
anseof: For ansfile, optional end of file string default: none
answait: For ansfile, Wait in seconds after file has been received
before the 'ansfile' is sent back. Only used if 'ansfile'
has been specified. default: 5 secs
binary: binary file - do NOT put a header on the files default: no
- yes/no
outfmt: Output format for IPOUT (DF) default: pwire
enq: incoming enq (single) chr to prompt enqbck msg default: none
enqmsg: message string to be send back on enq default: none
archive: archive log name if NOT that of name (-n) default: name
noarchive: Do NOT archive any incoming data def: do archive
toptxt: Information to add BEFORE the text in the file default: none
made of fixed data and FIP header fields.
Specify as toptxt: nXK - from SU)n
txtsoh: ignore duplicate soh in text default: no
hdratend: Hdr fields can also after the text/data part. default: no
Normally all the header fields Precede all the data.
Use this flag where the body or data part is in the middle
or is the first bit of text.
The first new Hdr field will end the body text.
wild: wild chr if not "*" ie wild:$ default: "*"
This must be the first parameter in the file or you could get
strange results.
seqno: add a sequence no to the filename
and increment automatically default: no
timeout: timeout in secs for end of file. default: none
ie timeout:30 PWIRE will wait for a gap of 30 seconds
with no data received before closing the file.
zapondel: Delete previous chr if a DEL or default: no
BS (backspace) arrives in data.
eol-ends-field: CR or NL ends any Header field
allownohdr: allow data to pour in even though there MAYBE no hdr. def:no
Normally we want a valid header for the file.
This will start a new file for every valid start of header
while the default is to NOT start if in a file.
strip-top-spaces: Zap any spaces and blank lines at the top of the file.
comm-error-msg: Message for when data arrives that is not correctly ended.
default is ** Truncated ** Communication line is Offline **
dump-file:
dump-data: This makes a copy in /fip/dump of all incoming raw data
timing-stats:yes/no
Show timings default: no
hash-in-fiphdr: (FipSeq)
Replace the '#' chr in a FipHdr field with this chr.
The '#' is considered an end-of-fiphdr-field chr so will be stripped
if we do not map it out of the way. The default is x9D octal 236
eg hash-is-fiphdr:35
echo-incoming-data:
Echo all incoming data. default: no
copy-folder: (FipSeq pathname)
make a copy of all incoming data in this folder default: no
ignore-file: (Fld)=(FipSeq Data)
ignore the whole file if this header field contains his data
Use this to stip/ignore ChkMsgs for example
; ignore all files which incoming field 25 -> mapped to FipHdr AB = 'M'
fiphdr:AB:25
ignore-file:AB=M
Note that all strings can be printable chrs, unix escape chrs (r, n etc)
or octal number (03).
Note that Character '#' are converted if in the FipHdr to x9D.
Example :
Incoming file is Atex CCM like -
{SL thisfile {QU rubbsh-wir {HJ Y0004.35 {PG 003 {PR 5 {CA SPT {OP
GDZILA;01/07,18:10 {BT .... text {ET
Parameter file:
; Pwire parameter file
soh:SL
stx:BT
eot:ET
prestr:{
key:2:x
fiphdr:SL:SN
fiphdr:QU:DQ
fiphdr:HJ:WH
fiphdr:PG:WP
fiphdr:CA:WC
fiphdr:OP:WO
Where there may be more than one 'soh' etc, just specify all the variants in
the parameter file.
; Start of header
; ... either
soh:c
; ... or
soh:h
stx:t
eot:e
prestr:$
key:1:a
fiphdr:h:SN
fiphdr:Q:DQ
fiphdr:j:WH
fiphdr:P:WP
fiphdr:C:WC
fiphdr:O:WO
Example 2 using complete-soh:
;
; Reuters NTM format
;
complete-soh:262601
complete-eot:04
key:2:n
prestr:34
; Story Text is 'fs 17'
stx:17
; Product Code
fiphdr:01:WU
; Topic Codes
fiphdr:02:WT
; Company Indent
fiphdr:03:WI
; Story Type
fiphdr:04:WY
; TabText Indicator
fiphdr:05:WX
; Language
fiphdr:06:WL
; USN
fiphdr:07:WU
; Priority
fiphdr:08:WP
; Headline
fiphdr:11:WH
; Named Item
fiphdr:15:WZ
; Signoff
fiphdr:16:WS
;Story Text is 17 = stx:
; No of Words
fiphdr:18:WW
; Category Codes
fiphdr:24:WC
; Message Type
fiphdr:25:WT
; Slug
fiphdr:30:WN
; TI
fiphdr:33:SN
Input Parameters :
Mandatory :
-n : name of this wire (usually the agency) default: none
either -s : Spider name or TTY device name default: none
-p : Spider port number default: none
or -P : Port on UnixBox to use for outbound default: none
This is only used where Terminal Servers canNOT run reverse telnet
correctly and need to set a Permanent Virtual Connection across
the ethernet to a fixed port number on the UnixBox
Optional :
-9 : do NOT use Speedy on a speedy system default: do
-L : For Passive (-P) type connections, reestablish the
link after disconnection default: no
-o : Output Folder if not spool/2brouted default: spool/2brouted
-x : Wakeup string for pad or modem default: none
This wakes up the pad on startup.
-y : Banner string to strip from terminal server. default: SpiderBanner
-Y : There is no banner to strip default: as above
-z : parameter file in tables/wire if different to -n name
-v : Print the version number and exit
Version Control
;013b3 16nov04 added copydata:
;b3 14jun11 speedy -9, ignore-file added ;3 allow SU to be overwritten by
extra-fiphdr
;012z 02nov99 added allownohdr, eol-ends-field, strip-top-spaces
;a 24jan00 bugette with sock being zapped.
;b 27apr00 new fiphdr date fields
;c 15aug00 minor tweaks and added com-error-msg
;d 23oct00 added completes
;e 15nov00 change '/' and '' in a filename to '_'
;f/g/h 18may01 added dump-file:
;j 22oct01 dump-file/dump-data is now in /fip/dump with date
;k 19nov01 in FipHdr, convert '#' to PC_HASH (x9D)
;l 25jun02 added do_widgets
;m-n 03jul03 always get the seqno
;o 28oct03 added timing-stats:yes/no
;p 14nov03 added HASH-IN_FIPHDR
;q-t 19mar04 added echo-incoming-data:
;u 05jul04 added -o/outque
;v 12jul04 added -I for id
;w-z 20sep04 speedy plus bugette in dump-data
--eodoc
;011a 23may99 Added up to 10 soh/eots
;a 08jul99 allow $Hfilename as well as $h filename
;010c 21mar98 Trim each incoming FipHdr field to a max of 2k.
;a 23apr98 woops - altzone for HG
;b 30jun98 only start file on SOH - was on any tagstart
;c 12mar99 keylen <> 2
;009d 24jul97 added timeout and backspace ;a bad sock ;b timeoutbug ;c
hdrbugette
;d 16oct97 added interim NT peek.
;008c 4oct96 HD/HM/HY and filename
;a 14mar97 WINNT tty/com
;b 27mar97 bugette - paxhdr NOT on after ProcessHdr
;c 16apr97 creat->open for WINNT
;007 21aug96 WINNT
;006 17jun96 strparse
;005 18jul95 bugo with -P
;004 11jan95 added -P for testing
;003a 26may93 added ansfile;a shm_name
;002 10feb92 added noarchive:
;000/1 5oct92 chris from vwire
--------------------------------------
-- todo
- for 'hidden's using ignore-file, log every x secs
-- stripped 20 sep04 cos of court case !
gapcom-header:
The sender is GapCom, so interpret the binary header. def:no
-- poss
notes/tobetested
line: Are header fields started/terminated by an eoln.default: no
linesep: lines separator in header
if not either CR or CR NL no
keepall: pass thru all including SOH STX and ETX no
todo/poss
- include standing file before text
incbefore:path and filename none
- include standing file after text
incafter:path and filename none
if param starts with '/' - absolute else in tables/wire
(copyright) 2014 and previous years FingerPost Ltd.