home *** CD-ROM | disk | FTP | other *** search
-
- This document discusses technical matters of the TAPs described
- in ABSTRACT.DOC. No (C) of any kind applies - implementation of
- TAP in clients or terminals is free.
-
- However sole host of truth about the TAP interface is me. If you
- have any ideas for improvement (or need other events for your TAP)
- let me know.
-
- If you plan to implement the terminal side of the TAP interface
- contact me for sample sources.
-
-
- Keep OS/2 interesting for the people, develop for OS/2!!!
-
-
-
- Markus Schmidt
-
-
-
-
-
- Introduction:
- =============
-
- Each TAP is an independent EXE file with the Name TAP_XXX.EXE
- where XXX is a file extension or the text 'ALL'. A TAP is
- designed to listen to file events occuring in an up- or
- download. Normally a TAP is designed to understand only files of
- a specific type such as GIF or ZIP.
-
- A TAP provides a special service while up- or downloading such as
-
- o online picture viewing (as the TAP_GIF.EXE delivered
- with ZOC)
-
- o online archive unpacking
-
- o virus scanner for downloaded files
-
- o nice up-/download progress indicators, speedometers,
-
- or logging facilities
-
- o an nice end of transfer bell for your soundblaster
-
- o leisure games to spend transfer time more usefully
-
-
-
- Starting your TAP application:
- ==============================
-
- As you see there are file specific and non file specific TAPs.
- Whenever a file is opened during a transfer ZOC will try to find
- all TAPs running at this time.
- If there are none and the 'Start taps' option is enabled, ZOC will
- try to start a TAP that matches the extension of the incoming file.
- If no such TAP exists ZOC will try to find a TAP called TAP_ALL.EXE.
- It is not an error if no TAPs exist at all.
-
-
-
- Method of communication:
- ========================
-
- Queues are used for communication between ZOC and the TAP. The
- queue is opened by the TAP and ZOC puts messages into that
- queue. If the TAP cannot create the queue it is very likely that
- another TAP is already running. In this case the TAP should try to
- another queue name (see 'Queue Names') or exit.
-
-
- // simple example of how to open a tap queue
- HQUEUE hq= 0;
- DosCreateQueue(&hq, QUE_FIFO, TAP_QUEUE_NAME);
- if (hq) {
- // process messages
- }
- else {
- // exit gracefully
- }
-
-
-
- Incoming messages are read like this:
-
-
-
- REQUESTDATA rqd;
- ULONG length;
- VOID *data;
- BYTE prio;
-
- DosReadQueue(hq,
- &rqd, // ulData-field for eventcode
- &length, // field for data length or offset
- &data, // field for data pointer
- 0, // get first element from queue
- 0, // wait synchronously for data
- &prio, // element priority (unused)
- 0); // no semaphore
-
- The structure rqd receives an eventcode in its ulData field.
- The following eventcodes exist (as defined in TAP.H):
-
-
-
- Download events:
- TAP_EVENT_OPENFORWRITE
- TAP_EVENT_OPENFORAPPEND
- TAP_EVENT_WRITEBLOCK
-
- Upload events:
- TAP_EVENT_OPENFORREAD
- TAP_EVENT_READBLOCK
- TAP_EVENT_READBYTE
- TAP_EVENT_SEEK
-
- Up-/Download events:
- TAP_EVENT_CLOSE
- TAP_EVENT_HOSTINFO
-
-
- The following table describes the parameters for the events:
-
-
-
- EVENT DATA-PTR LENGTH-FIELD
-
- OPENFORREAD filename '\0' size '\0' strlen(Filename)+1+7+1
-
- OPENFORWRITE filename '\0' size '\0' strlen(Filename)+1+7+1
-
- OPENFORAPPEND filename '\0' size '\0' strlen(Filename)+1+7+1
-
- READBLOCK ptr to copy of length of data
- read data
-
- WRITEBLOCK ptr to copy of length of data
- written data
-
- READBYTE (UCHAR)byte of data 1
-
- SEEK NULL new seek position
-
- CLOSE NULL 0
-
- HOSTINFO ptr to TAP_HOSTINFO sizeof(HOSTINFO)
- struct
-
-
-
- Other events might be received (most likely from a future
- version of ZOC) and should be ignored.
-
- If a data pointer exists it points to a block of giveable memory
- and has to be freed by DosFreeMem()
-
- Check TAP.C for source code of how to access the filesize.
-
-
-
-
-
-
- Queue Names:
- ============
- The name of the communication queue is defines in TAP.H as
-
- #define TAP_QUEUE_NAME "\\QUEUES\\ZOC\\TRANSFER.TAP\\A"
-
- This is the default queue name. To run more than one TAP at a
- time unique names are necessary for each TAP. To create such a
- name, the TAP may increment the last character of the name and
- try to open the queue again (but not more often than TAP_MAX
- times).
- I recommend to use this piece of code (from TAP2.C) to find a
- free name:
-
-
- // define a dynamic que name and a que handle
- char szQueName[]= TAP_QUEUE_NAME;
- HQUEUE hq= 0;
-
- // Find a free name and create a data queue to receive info
- for (i= 0; i<TAP_MAX && hq==0; i++) {
- DosCreateQueue(&hq, QUE_FIFO, szQueName);
- szQueName[strlen(szQueName)-1]++;
- }
-
-
-
-
-
-
- Example Programs:
- =================
-
- This directory contains two example programs.
-
- TAP.C is a simple dump utility to show how a queue is opened and
- how events are read from the queue.
-
- TAP2.C shows how to interface the queue more file like and read
- data sequentially byte by byte from it. This might be a good
- place to start to develop your own TAP application.
-
-