home *** CD-ROM | disk | FTP | other *** search
-
- NOTE TO DOUG:
- Streams are not implemented yet. The maximum packet size is 8K+256
- bytes. See iopar.c for example code.
-
- Note that the io requests (see parnet/devices/parnet.h) have a
- secondary io_Data2 and io_Length2 field which allows you to write
- from two buffers and read into two buffers... to prevent even more
- buffer copying. Be sure that said fields are NULL/0 when not used.
-
- AbortIO() works with CMD_READ requests for the datagram protocol.
- The protocol and port must always be specified at OpenDevice() time,
- while io_Addr (at least for datagrams) may be set on a per-io-request
- basis. I picked an arbitrary port for iopar.c ... a connection going
- the other direction can be had by using a different port.
-
- Collision Warning: DGRAMS are not reliable when collisions are
- possible. However, you will know when the write fails (io_Error will
- return non-zero) so you *can* setup some code to retry if you wish.
- This is pretty much required if you intend to allow cross-mounting
- and stick with the DGRAM protocol.
-
- Eventually we may want to move to a STREAM protocol... once it gets
- implemented. But then again, datagrams are so efficient you might
- not. I dunno. The CONNECT/LISTEN stuff applies only to the STREAM
- protocol which has not been implemented yet.
-
- -Matt
-
-
- PARNET.DEVICE DOC
-
- GENERAL OVERVIEW
-
- The parnet.device driver works with one or MORE Amigas connected together
- via a common, custom parallel port cable. Refer to doc/Cable.DOC for
- information on how to construct the cable. Taking overhead into account
- communication runs at about 23KBytes/sec (230KBaud).
-
- The limits of the network have not been determined yet, I have only been
- able to test it with two Amiga's. I am almost positive that it would
- work with three or four Amigas assuming somebody takes the time to
- construct the cableing.
-
- The network is based on machine addresses and rendezvous ports. Each
- machine on the network must have a unique address in the range 1-254.
- 0 and 255 are reserved. This network has no broadcast capability.
-
- Multiple connections may exist between any two machines. Each packet
- contains a destination port number as well as a destination address.
- Port numbers are unsigned words and may take on the value 0x0000 to
- 0x7FFF (0x8000-0xFFFF are reserved for stream connections).
-
- A number of protocols may be used:
-
- (1) Control Protocol, used for sending control commands to the
- device rather than packets over the network. Not really
- a protocol.
-
- (2) DATA-GRAM Protocol, used for sending semi-reliable data between
- machines.
-
- (3) STREAM Protocol, used for sending reliable data between machines.
-
-
- DATAGRAMS
-
- To use the datagram protocol you must specify the port number in the
- OpenDevice() command. Once you successfully open the device you may
- issue CMD_READ and CMD_WRITE's to the device. CMD_WRITE Iobs must
- have a valid destination address in io_Addr. You may modify this address
- at any time before sending off the request.
-
- When a machine receives a datagram packet it copies it to the currently
- pending CMD_READ request. If you have not queued any CMD_READ requests
- the packet is LOST. The sending machine does not know whether a packet
- it sends is thrown away or used. I REPEAT, If there is no CMD_READ
- request queued for a given port any packet sent to that port will be
- lost!!!!
-
- Normally one uses datagrams to implement one's own high level stream
- protocol. Using datagrams has very low cost and, in fact, using
- synchronous IO (DoIO()) will in many cases be able to send the packet
- without doing a task switch. Normally when one uses datagrams in this
- manner one has several CMD_READ requests queued. Never assume that
- the receiving machine can keep up with the rate the sending machine
- can send (this is normally fixed by having the sending machine wait for
- an ack of some sort).
-
- Finally, blocking is maintained. If the remote machine sends a 256 byte
- packet and your pending CMD_READ can only handle 25, then only 25 bytes
- will be copied and the rest thrown away. If you CMD_READ can handle,
- say, 300, then all 256 bytes will be copied. The maximum packet size
- is 4KBytes.
-
-
- STREAMS
-
- The Stream protocol provides the following services:
-
- - No loss of data
- - Data is reliable
- - No blocking factors
- - Rate Control
-
- Openning a stream protocol connection is a two step process. You must
- specify a valid stream port in the OpenDevice() command. OpenDevice()
- will fill in the io_Unit field for that port. The resulting Iob may
- then be used to issue PPD_CONNECT and PPD_LISTEN commands.
-
- To connect to a remote machine copy the Iob to a new Iob (so the old
- one is saved) and issue a PPD_CONNECT command using the new Iob. The
- stream protocol will arbitrate a connection with the remote machine
- and then put that connection onto a dynamically determined port (in
- the 0x8000-0xFFFF range), modifying the io_Unit field of the request
- if the PPD_CONNECT is successful. Further communication for that
- connection must occur using the modified Iob. That is, once a
- connection is established further communication occurs on a different
- port.
-
- You may still issue PPD_CONNECT and PPD_LISTEN commands on the original
- Iob for the port. Multiple tasks may open the same stream port but if
- more than one task attempts a PPD_LISTEN then the task that actually
- gets an incomming connection is indeterminant.
-
- To allow a remote machine to connect to a stream port you must issue a
- PPD_LISTEN request in the same manner as the PPD_CONNECT request.
- The PPD_LISTEN request waits for an incomming connection. If you expect
- to get several incomming connections at once you may want to issue
- several PPD_LISTEN requests. PPD_LISTEN returns when an incomming
- connection is established and the io_Unit field is modified. Further
- communication for that connection must occur using the modified Iob.
-
- You may CloseDevice() the original io_Unit without having to
- CloseDevice() connected units. You MUST CloseDevice() a connected
- unit when done with the connection. That is, once a connection is
- established it is independant of the original rendezvous port.
-
- Reading and Writing to a stream unit works somewhat like reading and
- writing the serial port except that the data is reliably transmitted.
- CMD_WRITE requests may block if the receiving machine's buffer is full.
- CMD_READ requests block until at least 1 byte of data is available
- then return immediately. NO DATA IS LOST if new data comes in before
- you can queue a CMD_READ request, and it is impossible for the sender
- to overload the receiver. You may also issue arbitrarily sized writes
- but remember that all blocking factors are removed. Issuing a 200 byte
- write does not guarentee that all 200 bytes will be sent in the same
- low level packet.
-
- IO COMMANDS
-
-
- PPD_SETADDR This command sets our network address and may be sent
- to any valid unit and always effects the entire device.
-
- Valid addresses range from 1 to 254. This command may
- be sent via any unit.
-
- PPD_SETTO This command sets our network timeout and works like
- PPD_SETADDR.. might be required when configuring with
- faster processors due to timeout loops in the low level
- packet send (the only way to make it go fast). This
- command may be sent via any unit.
-
- PPD_SHUTDOWN This command effects only connected STREAM units and
- shutsdown one or both sides of the connection without
- deallocating the unit structure. It may be used to
- send an EOF to other side, for example, or to inform
- the other side that you are no longer receiving.
-
- Set io_Flags to: 0x01 no more reads
- 0x02 no more writes (send EOF)
- 0x03 both
-
- PPD_CONNECT This command effects only unconnected STREAM units
- (returned by OpenDevice) and allocates a port and
- establishes a stream connection on it, returning the
- new port and io_Unit if the connection is successful.
-
- Several PPD_CONNECT commands may be queued to the device
- at once.
-
- On success, remember that the modified Iob is a completely
- different Unit that must be CloseDevice()d to terminate.
-
- PPD_LISTEN This command effects only unconnected STREAM units
- as PPD_CONNECT and waits for a connection to be
- established by a remote host, returning only when the
- connection is established. As in PPD_CONNECT a new
- io_Unit is allocated for the connection.
-
- Several PPD_LISTEN commands may be queued to the device
- at once and mixed with PPD_CONNECT commands (i.e. they
- are independant). Note that in some cases you want to
- queue more than one in case several remote connect
- requests occur at once.
-
- On success, remember that the modified Iob is a completely
- different Unit that must be CloseDevice()d to terminate.
-
-