This is the background server used to access data on a Fip Server.

It is normally placed in the SYSTEM file and forgot about.

Input switches are (all optional) :
    -d : top path                   default: /
    -D : display actions for Notes          default: no
    -E : maximum number of threads        default: 1
        up to a max of 200 (not Win2k)
        Note this is also a hardware limit in that small systems may not be able to
run more than 50 or so
    -I : id of this instance            default: ignored
        Where there are several copies of 'ipsvrd' running (more for Win2k)
    -l : log requests               default: no logging
    -L : log requests and connections       default: no logging
    -P : Port no to receive messages on     default: 9140
    -s : IP address or hostname to listen on    default: boot address.
        '-s +' will listen on ALL cards and address for this box.
    -u : dump incoming data             default: no
    -w : adjust the timeout in secs         default: 4
        on slow networks, try increasing it to 10 or more
    -z : Name of Parameter file         default: none

    -v : print version number and quit      default: no

Normal running is in the SYSTEM file :
    svrd    local   ipsvrd -s+ -E 20
or with some logging
    svrd    local   ipsvrd -s+ -E 20 -l

Notes upload version of ipsvrd is called ipnotwir

For testing, start the program in a terminal/command window and add the '-D'
input switch. This allows logging to the screen what is happening!

Parameter file for Notes is tables/notes/2NOTES (on WINNT 2NOTES.FIP)

    notes-server: (hostname of the notes server)
        eg notes-server:HOBBES
    notes-path: (path to a local database)
    notes-database: (path and name of database)
        eg notes-database:editorial/CET_Edit.nsf

    Where data is held locally and the database holds just a link to the files :
        notes-data-drive: (letter)
        notes-data-fiphdr: (fiphdr field)
            This just converts line ends to CR only
            It does NOT convert any oither characters.
        log-line: (extra logging)

    For each field that needs to be filled in :

    field: (Notes Field name)   file:
    field: (Notes Field name)   file:richtext
        Add the text of the file to this field
        if richtext is added, it is a richtext type field
        eg field:ArticleText    file:

    field: (Notes Field name)   data:(FipSeq)
    field: (Notes Field name)   data:(FipSeq)   type: (optional type)
        Add metadata from FipHdr or system variables into Notes fields
        The optional type can be the special notes types of
            type:list   this is a controlled list
            type:time   this is a date/time field
            type:number this is a number
        The default is a string of text

    If there are spaces in the Field name or the data specification, wrap double
quotes around them


    ; AdminDb
    fixed:ND    CN=LNCOV1/O=MG_REG
    field:AdminDb   data:\CN
    ; Headline
    combie:QH   XK|DI
    field:Headline  data:\QH

    ; no of characters in a NUMBER field
    field:Character_count   type:number data:\$c
    ; add time of insert to the Comments field
    field:Comments    data:"Sent From FIP - \$d-\$m-\$y at \$h:\$n:\$b"
    ; make sure CopyCheck is blank
    field:CopyCheck  data:""
    field:CopyCount  type:number    data:1
    field:Correspondent data:\SU
    ; TIME
    field:CreatedOn  type:time

On Windows, there may be a permissions problem accessing the database with the
LOCALSYSTEM account. So the 'Fip Comms Manager' service must be started by a
logon that can see/modify Notes!


---- Input ----
Example of Input :
<?xml version="1.0" standalone="yes"?>
Note - tags are case insensitive

---- Output ----
Example of Output :
<?xml version="1.0" standalone="yes"?>
</FIPAGENT>Data follows.......
Note there is no trailing NL

---- Notes ----
Return Codes

Ok - in the range 200-299

211 - Read complete
212 - Filter returns nothing
221 - Store complete
222 - Link complete (for LINK which succeeded)
222 - Move successful
222 - Copy successful
231 - Directory List complete
241 - Delete complete
251 - Script complete
261 - Ignore complete

errors - in the range 400-499

general errors
401 - Nothing !
402 - No Action Specified
403 - No Logon Specified
404 - Password Incorrect
405 - Unknown Action Specified
406 - Timeout - incomplete Token

411 - No File Specified
412 - No Such File
413 - File not Readable

421 - No File Specified
422 - Exists but is NOT a File
423 - File exists - no overwrite selected
424 - Error Writing Zero Length File
425 - No Data Sent for new file
426 - Error Appending to File
427 - Error cannot find input data File

Dir List
431 - No Queue Specified
432 - Queue does NOT exist

441 - No File Specified
442 - No Such File
443 - File Permissions do not allow Delete

451 - No Script Specified
452 - No Script File
453 - Not able to run Script file
454 - Script ran but errored

no errors

461 - No File Specified
462 - No Data Sent for new file
463 - Not able to log onto the DataBase
464 - Error uploading fields, pls check parameter file.


Tags and SubTags
If the Action is DIRLIST :
    queue       - absolute queue or folder name
    size/       - returns the size of each file
    date/       - returns last modifcation date of each file
    totals/     - returns only the number of items in the folder

If the Action is STORE :
    file        - filename with complete path
    link        - optional link - filename with complete path
    unique/     - file MUST be uniquename
    notunique/  - increment filename if exists
    overwrite/  - overwrite texisting if exists
    originals/  - save existing (if any) in /fip/originals
    makequeue/  - make the queue
    zerolength/ - allow/make a zero length file.
    permissions - unix style permissions
    script-after    - Full path and all parameters - Mandatory
                Note that FipHdr field DD holds the filename
    tmpfile     - for use with scipt-after, just use a tmp file for the data
    ignore-errors   - for script

if the Action is APPEND :
    file        - filename with complete path
    link        - optional link - filename with complete path
    originals/  - save existing (if any) in /fip/originals
    makequeue/  - make the queue

If the Action is LINK or MOVE or COPY:
    file        - filename with complete path
    source      - do NOT store the file, use this file to link to, unless the link
file does NOT exist.
    unique/     - file MUST be uniquename
    notunique/  - increment filename if exists
    overwrite/  - overwrite existing if exists
    originals/  - save existing (if any) in /fip/originals
    makequeue/  - make the queue
    zerolength/ - allow/make a zero length file.
    permissions - unix style permissions

If the Action is READ :
    file        - filename - Mandatory
    filter      - a grep of the line
    sort        - sort upside down
    maxitems    - give me only the first 100 lines  - eg log files
There are no extra tags for NOTES UPLOAD as the FipHdr is matched to Notes

If the Action is SCRIPT - run Script :
    script      - Full path and all parameters - Mandatory

If the Action is DELETE :
    file        - filename - Mandatory

Version Control
;1w14   27nov99 added Notes Upload
    ;e 05jun00 added LINK
    ;f 08aug00 more error checking
    ;g 22aug00 redid DIRLIST a bit
    ;h 26mar02 added -s for -s+
    ;i 14jul03 added action APPEND as a type of STORE files
    ;j-k 19sep04 speedy
    ;l-m 26oct05 added script-after to store
    ;n-p 25oct06 cleanup and added dump -u plus more Notes stuff
    ;q-s 20nov06 added RichText for file data
    ;t 20dec06 added META for STORE (missing dec 2005 mod)
    ;u 31may07 redid STORE/PERMISSIONS
    ;v2 20sep07 added -w (;v1 added IP address to log)
    ;w3-5 30oct08 make notes* FipSeq ;3 unlink on store -> w and added timing -T
;5 bugette in APPEND and added PREPEND
    ;w6-7 30apr14 file-trace added ;7-8 added STATTIME
    ;9-12 23aug17 added -I and -E for multiple instances - should improve thruput
on slow networks/systems
    ;13-14 5oct17 MOVE and COPY added

(copyright) 2018 and previous years FingerPost Ltd.