ramswire (Sat Oct 25 2014 01:31:01)

rdfwire/ramswire

RDFWIRE connects as a client to a Reuters RDF - Remote Data Feed server.
RAMSWIRE connects as a client to a Reuters Selectfeed Plus or Advanced Market
Service server.

It is normally used for Broadcast messages (NFCP_UBMS or N2_UBMS/N2_STORY) but
topic codes can be added to a watch list and any items mathcing that code can
be snapped.

Each item is parsed and the contents of FIDs are put in the FIP header fields
according to that described in the parameter file.

Normally the data is sent to ipramstxt which will put the jigsaw of packets
back together again.

Optionally the data file can be left in the queue named in the parameter file
and a stub file containing just the FIP Header is slotted into the
spool/2brouted queue for IPROUTE to process and route.

The parameter file in tables/wire is normally the name of the service. It
contains one or more of the following :

	; comment lines preceeded by a semicolon
	logon: The logon string for this Server
		eg	logon:000456
			For Ramswire, normally no logon needs to be specified as we are only looking
for broadcast messages..
	database-1: The database to connect to.
		eg	database-1:ATP 01
		There can be up to 9 databases specified - only if
		you are logged on.
	dump-data: This makes a copy in /fip/dump of all incoming raw data

	text-host: (tcp)
	alt-text-host1: (udp)
	alt-text-host2: (udp)
	alt-text-host3: (udp)
		Host name for forwarding to ipramstxt
	text-port:
	alt-text-port1:
	alt-text-port2:
	alt-text-port3: Port Number for forwarding to ipramstxt
	There can be there separate ramstxt feeding off a ramswire. (blank and 1 are
the same)

	The first port is TCP while the othes are UDP (ipramstxt -U).
	escape-controls:yes/no	default: no
		if yes, ESC becomes 4 chr visible string x1b

	hash-in-hdr:35
	NL-in-hdr:34
	CR-in-hdr:36
	FF-in-hdr:37

	watch:(Ric)
		Add this Ric to the watchlist
	snapfilter:(Topic)
	snaptopic:(Topic)
	snapproduct:(Product)
		Retreve data on the backchannel for Headlines/pnacs with this TOPIC or
PRODUCT
		This is not required in broadcast mode.

 The rest of the parameter file is alist of fiphdr fields and Fids :

	fiphdr:(2 letter FipHdr Code)	fid:(fid number)
	fiphdr:(2 letter FipHdr Code)	fid:(fid number)	binary:(size,format,swapped)
	fiphdr:(2 letter FipHdr Code)	fid:(fid number)	bits:(size)
	fiphdr:(2 letter FipHdr Code)	fid:(fid number)	type: (a|n|u|l|p|t)
	fiphdr:(2 letter FipHdr Code)	fixed:(fixed data)

There are a couple of variations on the fiphdr parameter. Normally just a fid
will do.
	eg Put contents of fid 254 (UNIQUE SN or PNAC) in JH
		fiphdr:JH	fid:254

Note there MUST be no spaces between the keyword 'fid' and the number.

If the data is in binary format, it can be made visible using the 'binary'
subparameter which takes parameters a size - 1,2,4 bytes, an output format -
o,d,h for octal, decimal (default) or hex and, if from an Intel or Dec box, 's'
to flag the bytes are swapped.
		fiphdr:JK	fid:333	binary:4,d,s

If the field is a bit sequence, this can be converted to visable '0' and '1'
using bits:. An optional size is the number of bytes to convert - default is
the size of the incoming data.

TYPE will force the contents of the field :
	q - cleanup spaces - multiple NLs, CRs, tabs and spaces to a single space
	a - alphabetic only
	u - force all alphabetic uppercase
	l - force all alphabetic lowercase
	n - numbers only
	p - printable only
	s - space chrs only (TAB, VT, SPC, CR or NL)
	t - punctuation only
	b - allow all chrs
	x - alphanumeric only
	c - control chrs only
	z - anpa (alphanumeric and dash)  only
FIXED allows extra Fip Hdr fields to be added with no corresponding fid.

In order to use the extra code for finding locations and email in first and
last packets respecitively, the following fiphdrs should be used :
	T1 - Next Link
	T2 - Last or Previous Link
	T4 - PNAC
	B1 - Ric
	TX - Text/Headline


Input Parameters :
	Mandatory :
	-n : name of this wire (usually the agency)		default: none
either	-s : 'px25', 'sx25', Spider name or TTY device name	default: none
	-p : Terminal Server port number (Not for TTY)		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 :
	-A : name of the archive file if not the -n name field	default: 'name'
	-d : the name of a DUPLICATE wire where 2 copies of the same
		file is required (SD header field).		default: none
	-D : do NOT dump the data - this is a resend	default: use dump-data
	-f : Extra FIP header information 			default: none
		For fixed header info in FIP. eg -f #QA:AA#QB:BASIC
		As this flag is normally the last specified, its contents
		can be used to overwrite any unique fields such as DU, DP, SN etc.
	-I : wireId						default: 0
	-K : Ignore and do not expect the AMS Keep alive records	default: do
		Use this when replaying data using 'sffport' or 'ipprint'
	-L : For Passive (-P) type connections, do NOT reestablish the
		link after disconnection			default: do
	-o : Name of output format (DF field)			default: RAMSWIRE or RDFWIRE
	-O : Output folder if not default			default: spool/2brouted
	-r : the name of a DIFFERENT routing table to 'name'
		(SR field : used by iproute)			default: name
	-t : interval vetween stats messgaes in the item log.	default: 300
	-x : Wakeup string for Pad/modem etc			default: none
	-y : Banner string to strip from terminal server.default: SpiderBanner
	-Y : There is no banner to strip		default: as above
	-z : name of the parameter file in tables/wire		default: same as -n
	-Z : do NOT archive any incoming files			default: archive
	-v : Print the version number and exit

If resending from the dump file, first rename the dump file or  (Note you will
need ipramstxt running beforehand) :

ramswire -s+ -P9089 -K -D -Z -n ams.fip
sffport -slocalhost -p9089 /fip/dump/20030712_amsfip


Version Control
;001t7	27dec02 use UDP to send to ramstext or TCP
	;i-l 21jul03 added -D disableDumps
	;m-r9 30oct03 escapes better
	;s12 28apr08 rdfwire version ;4-5 added snapproduct ;7+ rfa not sfc
	;t1-7  3jun09 Linux version ;2 added -I wireId ;3-7 NFCP_UBMS and cfg/fip
parameter files
;000l	23apr98	orriginal version
	;k/l 27may02 added mangle_email and -O added

(copyright) 2014 and previous years FingerPost Ltd.