About
Docs
Files
Support
Index

Essentials
AutoDocs
Library functions
Cooperate
Process mastering
Debug
Own debugging kit
FGE
Smart modeid pick
Loader
Shared lib. loader
Macros
Helper macros
Structs
All the structures
Logs
Library changelogs
Tools
Progs baked inside

Tools
amiscreen0.3
ansifilter0.1
auto2guide0.1
ccfilter0.1
chipset0.1
cputype0.1
device640.1
dupfilter0.1
expandlogs0.1
findsm0.2
fmpp0.1
fsmount0.1
genanim0.3
gensymtab0.1
hashlab0.4
ktm0.6
linkpoint0.1
logo2ilbm0.1
lpradio0.1
lzwpack0.1
minism0.2
mkheader0.1
modeidctrl0.1
mss0.6
multisum0.3
newterm0.2
numconv0.1
palhack1.1
patmat0.1
pfr0.2
playamitape0.1
qdbflags0.1
qfill0.1
resmodinit0.2
sadctrl0.2
saveassign0.1
setanim0.2
systime0.1
tokendump0.1
uassign0.1
viewlogo0.1
waitback0.4
wrapmount0.1



L
I
N
K
P
O
I
N
T

linkpoint-0.1
--------------

---

The concept of  'linkpoint' appeared when i was porting 'ushare'(UPnP media
server) to Miggy. What i wanted to do was to listen to live network streams
with my [Un]Creative  ZEN X-Fi portable media player which is WLAN enabled,
but  unfortunately  it does not  allow to specify  where to connect(one and
only  radio  stream  available, guess which...). Yeah,  this really  sounds
insane, got Internet access but cannot make use of it? Heh...

At first i thought that i will  hog firmware developers  to death for that,
but it turned out  these are  innocent  gorillas  who try  to make a dollah
or two so they can feed their children with bannanas. I then make sure that
no gorillas are around and sat  down comfortably on my couch looking at the
blue sky. Hmmm..., how come gorillas can code? I thought. Teh brain started
to work again ;-) . Then i realised that once  port of 'ushare' is complete
i can convince this prog that what it sees is a file even though it is not.
A week later i finished with 'libupnp' and 'ushare' and started to think on
something that would make it possible to turn streams into files.

Finally  when i researched the field of almighty FileInfoBlock and FileLock
i was able  to write the prototype and see what to expect. Amazingly it all
worked and i was happy that i can listen to Nectarine  in  my backyard with
no wires. Now it was just a matter of making  it  nice, clean, multiprocess
and as universal as possible so it can be of use  for other purposes. After
mastering  the  code  several  times  and  removing  direct network support
i  faced  a  product of  pure human  being. I did  it, i did it! Thanks  to 
'linkpoint'  i can make any stream oriented handler to look like a file and
thus listen to ShoutCast radio with UPnP devices!

---

NOTES:

[*]
Requires  68020(no FPU)+, OS2.04(theoretically)+, 32+ kilos of free memory,
TCP: device if [R]HTTP: is to be provided.

[*]
Use 'CTRL + F'  signal or 'DiskChange' command to manually refresh contents
of  your Link Point  when using mapping  files or when src. filesystem does
not support notification.

[*]
Please  note that 'linkpoint'  does not reflect whole directory structures,
only files will be taken into account! Also there  is no  way to manipulate
files  through  'linkpoint's  handler. You  can  only  do  that  on a  real
filesystem.

[*]
Even  though there is a special  switch that allows  to completly  turn off
disk  requesters  some operations such as  directory contents  examining do
toggle them independently of this switch!

[*]
Yip, 'linkpoint' multitasks, so it  should be safe to use  it  with  single
tasking handlers such as  'TCP:'(consider mounting it with  'wrapmount'  so
usage comfort increases greatly).

[*]
Yip, 'linkpoint' features implicit 'HTTP:' or 'RHTTP:'(raw response) device
emulation which can also be OS wide if needed. Please note that when set to
act  as a '[R]HTTP:'  device it cannot be a filesystem at the same time! On
the  other hand  this limitation is  just a matter  of inability of listing
device contents, so you can still use it the-old-way but without feedback.

[*]
Important!  As the virtual  files store  real file locations in the comment
field they cannot be longer than 80 bytes!

[*]
File mapping arguments must all be contained in one line in mapping file or
per  file when using directory on a real filesystem. A  text line can be 1k
long max.

[*]
Please  note, due to  security  and filesystem consistency reasons mappings
who  were removed  during  runtime  do not trigger memory freeing(nodes are
reused) so  file chain contains same addresses. This is good in general but
may cause low memory situation under some circumstances. In such case term.
'linkpoint' with  'CTRL + C' signal and relaunch it to get back excess mem.
Dont forget though that the process will only die if no locks are acquired!

[*]
If  you need many instances then  make the binary 'resident' so memory will
be largely saved.

[*]
Link Point really tries to filter circular files so it should be safe to be
careless. Error code of  ERROR_OBJECT_IN_USE  will be generated when such a
file is to be requested.

[*]
Keep  in mind that  file modes(MODE_OLDFILE, MODE_NEWFILE, ...) are also to
be forwarded! In  case of streams this probably has no matter, but  in case
of real files you must be careful!

[*]
Word  on  packet  interface.   Following   actions  are  all   implemented:

(LOCK)                     (FILE)                     (DISK)
ACTION_LOCATE_OBJECT       ACTION_FINDINPUT           ACTION_IS_FILESYSTEM
ACTION_COPY_DIR            ACTION_FINDOUTPUT          ACTION_INFO
ACTION_PARENT              ACTION_FINDUPDATE          ACTION_DISK_INFO
ACTION_SAME_LOCK           ACTION_FH_FROM_LOCK        ACTION_CURRENT_VOLUME
ACTION_EXAMINE_OBJECT      ACTION_COPY_DIR_FH         ACTION_INHIBIT
ACTION_EXAMINE_NEXT        ACTION_EXAMINE_FH          ACTION_WRITE_PROTECT
ACTION_FREE_LOCK           ACTION_PARENT_FH           ACTION_DIE
                           ACTION_SET_PROTECT
                           ACTION_SET_COMMENT
                           ACTION_SET_DATE
                           ACTION_READ
                           ACTION_WRITE
                           ACTION_SEEK
                           ACTION_END

While '(LOCK)'  and   '(DISK)'  interfaces are totally independent from the
mapped  object, '(FILE)'  is a bit different as some of the actions will be
forwarded to the former handler, but some will be silently dropped!

[*]
Important! In case of ZEN X-Fi and mixed mappings(network, local) there may
be  need to set 'LPW=LINKPOINTWAIT'  to something like 300(5 minutes) since
this little smartass attempts to buffer few tracks ahead!

[*]
At  least  'HippoPlayer'  is  able  to play  live  network streams(MP3) off
'linkpoint' with minor problems. Unfortunately  i was  unable  to  get  the
'SongPlayer' to work in GUI mode...

[*]
You can even map single  LinkPoint across Amigas with Timo Rossi's 'netfs'.
Using  'lpradio'  you can then generate single connection  mappings so that
all your Amigas will stream the same data using just one TCP/IP connection.

[*]
When using  'lpradio'  generated mappings and some system monitor an effect
of orphan subprocesses  can be observed. This  is because first time object
access  causes CLI process  to be synchronised with mapping's subprocess so
that when two  callers request same object one of them is used to take care
of the CLI. Thus, if the first client disconnects and its stuff gets sorted
out  its subprocess must wait for the  CLI to finish, cus the second client
also relies on that CLI! Orphan  subprocess will die if all callers of this
object are gone.

---

HELP:

   > linkpoint ?

     HE=HANDLERNAME/A,DY=DIRECTORY/A,KR=KILLALLREQS/S



   HE=HANDLERNAME/A  -  Name  of the handler a process  will be  associated
                        with. Typically  this is to be  'LP0:' , but can be
                        pretty much anything.

   DY=DIRECTORY/A    -  Formally a path where real files and  mappings sit,
                        but  can also be a file or just  command line input
                        with mappings. The advantage of supplying real path
                        is  that contents of the  directory can be modified
                        at any time and the  process will track all changes
                        as long as source filesystem supports notification.
                        ;
                        Warning! The process will start regardless of  what
                        was entered(no aggressive checks)!

   KR=KILLALLREQS/S  -  Kill all  disk requester  windows  this process can
                        generate. Quite  useful  when working  on temporary
                        or deferred paths/files.
---

LPX:

   ; File mapping options

     LPF=LINKPOINTFILE/A/K,LPS=LINKPOINTSIZE/K,LPT=LINKPOINTTASKS/K,
     LPC=LINKPOINTCLI/K,LPW=LINKPOINTWAIT/K



   LPF=LINKPOINTFILE/A/K  -  Define  real file  or stream to  be associated
                             with this mapping. Providing  argument key  is
                             important  for  this  to  work, otherwise this
                             mapping or file will be reflected as it is!

   LPS=LINKPOINTSIZE/K    -  Size of the virtual file. By def.  all streams
                             are  0xFFFFFFFF(-1)  which is pseudo infinity.
                             It is -1  also for compatibility with programs
                             who obtain size by doing  'Examine()' and  who
                             do not further check with 'Seek()'. In case of
                             real files this is not an  issue. An  argument
                             key must precede the value!
                             ;
                             Directory Opus 4.17 text  viewer  for instance
                             will crash if this  size does not match stream
                             real size, but will  peacefully cancel if this
                             is -1 or 0.

   LPT=LINKPOINTTASKS/K   -  This is to allow or deny some tasks from using
                             this mapping,  so when size cannot be negative
                             for example  you can restrict  this mapping to
                             particular task(s). Syntax is  'ktm' based, so
                             comma separated case  insensitive task/process
                             names  with  standard  patterns per  entry are
                             allowed. Error  code  of  ERROR_READ_PROTECTED
                             will  be generated when a task is not  allowed
                             to access this mapping. Dont forget about  the
                             argument key!

   LPC=LINKPOINTCLI/K     -  Run  some  CLI  command  when  target is to be
                             requested. This  command  will  be  started as
                             soon as the subprocess succeeds with real file
                             access. A '@'  character in front of a command
                             will cause so called inexclusive launch, where
                             the  command will be started only once on many
                             target  calls. A '&'  character can be used to
                             tell 'linkpoint' that this  is a pipe and that
                             it should be short-accessed to die  if command
                             failed to do so. Use this CLI launch with care
                             and only with progs that do react to  C signal
                             or die immediately.

   LPW=LINKPOINTWAIT/K     - Wait upto n seconds  for a  DOS packet on this
                             particular  mapping before  closing  real file
                             and cleaning up. Use this if you have to serve
                             mappings  over  the  network where determining
                             what  happened  to the  clients is impossible.
                             You really want to use this when combining CLI
                             command and pipes! This  way  a subprocess and
                             its  resources  will  be  sorted  out at  some
                             point thus  preventing file blockage and huge,
                             unnecessary  memory  usage. All  late  packets
                             will be replied with ERROR_OBJECT_WRONG_TYPE .

---

USAGE:

   ; Firstly start the damn thing with refs in 'RAM:'
   RAM:
   makedir streams
   run linkpoint LP0: streams

   ; Map radio stream so it will be widely available
   ; (not very practical if one wants to listen)
   echo >streams/necta.mp3 "lpf http://de.scenemusic.net/necta192.mp3"

   ; A small trick that makes it possible to use one
   ; network  connection  against  multiple  clients
   ; ('qfill' command and 'FIFO:' device required)
   lpradio >streams/multi.mp3 LP0:necta.mp3
   
   ; Play the stream with 'mpega' which is totally
   ; TCP/IP free
   mpega -f 24000 -d 2 -q 1 LP0:multi.mp3

   ; Export contents of this Link Point with 'ushare'
   ; and start listening with UPnP aware devices
   ushare -n LinkPoint -c /LP0

   ; See the contents of this Link Point, along with
   ; the references
   list LP0:

   ; Save the broadcast to  '<HARDDRIVE>:' right now,
   ; and at full speed(works with OS 'copy' only)!
   copy LP0:necta.mp3 <HARDDRIVE>:



   ; Run another instance to be plain 'HTTP:' device
   run linkpoint LP1: ".httpdevice=lpf /NIL"
   assign HTTP: LP1:
   assign RHTTP: LP1:

   ; Visit Aminet with just a 'type' command
   type http://aminet.net



   ; Run 3rd instance with mappings taken from file
   echo  >mappings "Disk.info = lpf Disk.info"
   echo >>mappings "PIPE = lpf PIPE:you_name_it"
   echo >>mappings "Google = lpf http://google.com"
   run linkpoint LP2: mappings

   ; Test if 'PIPE' file maps properly
   echo >LP2:PIPE "See me, or me goes to hell?"
   type LP2:PIPE



   ; In case when you loose network connectivity and
   ; your tasks wait endlessly try
   ; ktm "TCP,TCP (WM)" c

   ; Ask gently if all Link Points can disappear now
   ktm [linkpoint] c all

   ; Kill them permanently with 'fsmount' if they do
   ; mess around(no data memory will be freed)
   fsmount LP#? kill f

---
megacz
    


No more fear cus pure HTML is here!
Copyright (C) 2013-2014 by Burnt Chip Dominators