home *** CD-ROM | disk | FTP | other *** search
- TABLE OF CONTENTS
-
- pronet-driver/--Overview--
- pronet-driver/Exit
- pronet-driver/Init
- pronet-driver/Read
- pronet-driver/ReadFlush
- pronet-driver/ReadQuery
- pronet-driver/Write
- pronet-driver/--Overview-- pronet-driver/--Overview--
-
- This file covers information on how to write custom ProNET drivers.
- As is usual with my distributions ;-(, the API has changed again, but if
- there was really a single custom driver out, it can be changed really easy.
-
- A ProNET driver is an ordinary executable residing in the DEVS:ProNET/
- directory. This executable will be loaded for every ProNET Unit requiring
- it; it doesn't have to be reentrant. The code is entered at the very
- first position, which must contain the Init routine.
-
- >> CHANGES FROM V2 DRIVERS <<
-
- New in V3: Exit-Routine, Init-Flags = 1
- New in v37: ReadFlush-Routine, Init-Flags (now called Version) = 2,
- Write only one chunk, Write timeout support (three return codes now).
-
- pronet-driver/Exit pronet-driver/Exit
-
- NAME
- Exit -- Terminate a ProNET driver.
-
- SYNOPSIS
- Exit();
-
- void Exit(void);
-
- FUNCTION
- This function is called whenever pronet.device launches a new Unit
- process. You must free all resources you allocated previously and
- return after that.
-
- pronet-driver/Init pronet-driver/Init
-
- NAME
- Init -- Initialize a ProNET driver.
-
- SYNOPSIS
- error = Init(drvdata, confstr, ID, version);
- D0 A0 A1 D0 D1
-
- STRPTR Init(struct PNDrvData*, STRPTR, ULONG, ULONG);
-
- FUNCTION
- This function is called whenever pronet.device launches a new Unit
- process.
-
- INPUTS
- drvdata - pointer to struct PNDrvData which must be filled out by
- this routine.
- confstr - pointer to the configuration string following the driver
- ID.
- ID - D0 contains the bytes "RST!" (not a pointer!). Check this to
- prevent unwanted effects when your driver is started by
- accident.
- version - This number identifies the version of pronet.device that is
- calling this driver. 0=V2, 1=V3, 2=v37; 0 and 1
- should be rejected with error code NULL!.
-
- RESULT
- error - NULL if everything went ok, or a pointer to an error string,
- of which ProNET will make a copy and hand it to the calling
- application. You could also return one of the magic cookies
- as defined in devices/pronet.h for standard errors.
-
- SEE ALSO
- devices/pronet.h
-
- pronet-driver/Read pronet-driver/Read
-
- NAME
- Read -- read the incoming packet data to a specified memory location.
-
- SYNOPSIS
- Read(memptr);
- A0
-
- void Read(APTR);
-
- FUNCTION
- This function will only be called if a previous ReadQuery succeeded.
- Here we will copy the packet's data to the specified memory location.
-
- INPUTS
- memptr - memory location to which we shall copy
-
- pronet-driver/ReadFlush pronet-driver/ReadFlush
-
- NAME
- ReadFlush -- Forget the incoming packet.
-
- SYNOPSIS
- ReadFlush();
-
- void ReadFlush(void);
-
- FUNCTION
- This function will only be called if a previous ReadQuery succeeded.
- ProNET wants us to forget the complete packet.
-
- pronet-driver/ReadQuery pronet-driver/ReadQuery
-
- NAME
- ReadQuery -- find out about an incoming packet.
-
- SYNOPSIS
- length, destport, srcport = ReadQuery();
- D0 D1 D2
-
- UWORD, UWORD, UWORD = ReadQuery(void);
-
- FUNCTION
- This function is called whenever the Unit's task was woken up by
- the signal bit you provided in drvdata->ReadSignalBit in the Init
- routine. The signal bit can either be the signal bit of an
- IORequest reply port or one triggered from an interrupt or
- process set up by you.
-
- This function call is used to find out some basic info
- about the incoming packet before reading the actual data.
-
- RESULT
- length - number of bytes of the actual packet data (see NOTES)
- destport - destination ProNET Port on this machine
- srcport - source Port on the remote machine
-
- NOTES
- If you find out that the ReadSignalBit was triggered by mistake,
- you can return 0 in the length word, in which case ProNET will go
- to sleep again. Otherwise it is *guaranteed* that either ReadFlush
- or Read will be called lateron, no other driver routines will be
- called in between.
-
- pronet-driver/Write pronet-driver/Write
-
- NAME
- Write -- Send a data packet to the remote machine.
-
- SYNOPSIS
- error = Write(dataptr, length, destport, srcport);
- D0 A0 D0 D1 D2
-
- ULONG Write(APTR, ULONG, UWORD, UWORD);
-
- FUNCTION
- I guess this will always be the most complex function of a driver.
- Try to get a connection to the remote machine and send the packet
- as requested. A kind of flow control, like a timeout feature,
- should be implemented.
-
- INPUTS
- dataptr - pointer to the data to be transmitted
- length - length of data to be transmitted. The length is limited
- to 16384 bytes and it is even.
- destport - destination Port on the remote machine
- srcport - source Port on this machine
-
- RESULT
- error - 0 if packet could be sent without trouble.
- -1 if the line is currently busy -- pronet.device will then
- try again later.
- 1 if the remote machine does not respond. The application
- will be notified in this case, CMD_WRITE returns with
- an error (PNDERR_DESTINATION_GONE).
-
- NOTES
- Your driver is responsible for correct transmission of the data,
- by using checksums or similar mechanisms.
-
-