home *** CD-ROM | disk | FTP | other *** search
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
- /* HIGH-LEVEL APPLICATION PROGRAMMING IPX INTERFACE FUNCTIONS */
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
- /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
-
-
- /*******************************************************************/
- /*******************************************************************/
- /*
- ------------------------
- ------------------------
- FUNCTION: IPXReceiveRT()
- ------------------------
- ------------------------
-
- Receive data into a buffer or file from a non-specified sender.
-
- NOTE:
- The sender must know the internetwork address and socket of the
- machine that is to receive its transmission(s), but the receiver
- merely has to issue a LISTEN & can then receive from any sender.
-
- ----------
- ----------
- PROTOTYPE:
- ----------
- ----------
-
- unsigned IPXReceiveRT( long *BfrLen,
- BYTE *FileOrBfr,
- char *SocketStr,
- void (*RTfunc)(void) );
-
- ---------
- ---------
- INPUT(S):
- ---------
- ---------
-
- BfrLen = 0 if receiving a file
- OR
- the maximum # of bytes that can be stored in a given buffer
-
- FileOrBfr = (string) name of file (path optional) into which to write
- the data that is received
- OR
- pointer to given byte buffer into which to store the data
- that is received
-
- SocketStr = 4 character hex-ASCII string of IPX Socket to
- use for receiving. Note that certain NOVELL sockets
- are reserved, and the caller is cautioned to use
- socket numbers "40xx", e.g., "4010", "40A1", etc.
-
- RTfunc = pointer to a function which is to be called during
- time out loops when IPX command is pending. Set
- to NULL if you don't need this "real time" capability.
-
- ----------
- ----------
- RETURN(S):
- ----------
- ----------
-
- 0x00 - GOOD_IPX_RETURN - all went well.
-
-
- 0x10 - BAD_LOCAL_TARGET - the internal IPX call to find the sender's
- local target failed. Check the global variable IPXerrno for the
- specific reason, e.g.:
-
- 0xFA - DEST_NODE_PATH_NOT_FND - the 6-byte node address
- specified in the received IPX packet parameter SrceAddr
- could not be found. Either the packet was corrupted,
- or the sending machine with that node has died.
-
-
- 0x11 - BAD_SOCKET_PARAM - the SocketStr parameter did not consist of
- a string of four hex-ascii digits.
-
-
- 0x12 - BAD_SOCKET_OPEN - the attempt to open the socket specified in
- SocketStr parameter failed. The global variable IPXerrno will contain
- return code received from IPX. It can be one of the following:
-
- 0xFE - SOCKET_TABLE_FULL - each machine gets 20 sockets, so
- this error should never occur unless other non-"well
- behaved" IPX applications are running on the machine.
-
- 0xFF - SOCKET_ALREADY_OPEN - it will be closed upon return,
- so try again. It is not ignored because at the point
- of call the socket shouldn't have been open, and all
- discrepancies will be caught and reported!
-
-
- 0x20 - BAD_TX_TRY - an attempt to send a packet failed, due to
- failure of either the network or the configuration of the receiving
- machine. Check the global IPXerrno to discern the problem.
- It should be one of the following:
-
- 0xFC - EVENT_CANCELED - send request was canceled by
- application due to timeout.
-
- 0xFD - FRAGMENT_SIZE_ERROR - malformed packet size, either
- less than 30 bytes or greater than 576 bytes, or
- the event control block's Fragment Count field was 0.
-
- 0xFE - DESTINATION_NOT_FOUND - the destination machine,
- specified in the NETADDR parameter, is not on the
- network or not powered up.
-
- 0xFF - NETWORK_FAILURE - network or hardware failure.
-
-
- 0x21 - BAD_RETRIES - the receiver, while awaiting data from the
- sending machine, has exhausted its retry number & count series.
- Check IPXerrno for:
-
- 0xFC - EVENT_CANCELED - listen request was canceled by
- application due to timeout.
-
- 0xFD - FRAGMENT_SIZE_ERROR - either the event control block's
- Fragment Count field was 0, or the receiver's buffer
- space was too small to hold the incoming data.
-
- 0xFF - ECB_SOCKET_NOT_OPEN - Socket for listening has not
- been opened by the application.
-
-
- 0x22 - BAD_RX_SEQ_NUM - the receiving machine has received a block
- of data whose sequence number is unexpected. If this has occured,
- a network failure has caused the transmission to become garbled,
- or the sending machine had aborted the current send/received sequence
- and restarted anew within the retry number & timeout series of the
- receiving machine. Both scenarios are highly unlikely.
-
-
- 0x30 - BAD_FILE_OPEN - the file to be received, specified by
- the FileOrBfr parameter, could not be opened. Check syntax of
- ASCIIZ string to make sure path and filename are correct, and
- don't forget to use double slashes in the string when specifying
- a path! For example, "D:\MYPATH\MYFILE.DAT" is not a valid C
- string. You must pass it as "D:\\MYPATH\\MYFILE.DAT".
-
-
- 0x31 - BAD_FILE_WRITE - problem writing to the file specified in the
- parameter FileOrBfr, even though the file was successfully opened.
- This should never occur, barring disk failure or some strange
- interaction between the caller's program and other programs running
- as background processes or TSR's.
-
-
- 0xBB - USER_TERMINATED - the user has chosen to abort the application
- by hitting the two SHIFT keys & an ALT key during a send/receive sequence.
-
-
- 0xDD - IPX_NOT_PRESENT - IPX API interface was not detected. Make
- sure NOVELL's IPX.COM or equivalent has been run before attempting to
- access IPX functions.
-
-
- -------------------------
- -------------------------
- APPLICATION CODE EXAMPLE:
- -------------------------
- -------------------------
-
- #include "rkipx.h"
-
- #define RXSOCKET "4050"
- #define RXBFRSIZE 8192
-
- int main( void )
- {
- unsigned rc;
- long len;
- BYTE *RxBfr;
-
- // receiving a file
- len = 0;
- rc = IPXReceiveRT( &len, "RXDATA.DAT", RXSOCKET, NULL );
- if ( rc != GOOD_IPX_RETURN )
- {
- printf( "FUNCTION ERROR: %02X IPX ERROR: %02X", rc, IPXerrno );
- // take appropriate error action here
- return( -1 );
- }
-
- // receiving a buffer
- RxBfr = calloc( 1, RXBFRSIZE );
- if ( !RxBfr )
- {
- printf( "MEMORY ALLOCATION FAILURE!" );
- return( -1 );
- }
-
- len = RXBFRSIZE;
- rc = IPXReceiveRT( &len, RxBfr, RXSOCKET, NULL );
- if ( rc != GOOD_IPX_RETURN )
- {
- printf( "FUNCTION ERROR: %02X IPX ERROR: %02X", rc, IPXerrno );
- // take appropriate error action here
- return( -1 );
- }
-
- return( 0 );
- }
-
- */
- /*******************************************************************/
- /*******************************************************************/
- /*
- ---------------------
- ---------------------
- FUNCTION: IPXSendRT()
- ---------------------
- ---------------------
-
- Send a file or buffer to specified destination machine
-
- ----------
- ----------
- PROTOTYPE:
- ----------
- ----------
-
- unsigned IPXSendRT( long *BfrLen,
- BYTE *FileOrBfr,
- char *SocketStr,
- NETADDR *Destination,
- void (*RTfunc)(void) );
-
- ---------
- ---------
- INPUT(S):
- ---------
- ---------
-
- BfrLen = 0 if sending a file
- OR
- the # of bytes to send from a given byte buffer
-
- FileOrBfr = (string) name of file (path optional) to send
- OR
- pointer to given byte buffer from which to send data
-
- SocketStr = 4 character hex-ASCII string of IPX Socket to
- use for sending. Note that certain NOVELL sockets
- are reserved, and the caller is cautioned to use
- socket numbers "40xx", e.g., "4010", "40A1", etc.
-
- Destination = structure containing Network Address, Node
- Address, and receiving socket number of the
- machine that is to receive the file/buffer data.
- See IPX.H for structure layout; if needed, use
- function xatoxb() for converting hex-ascii
- strings to hex-binary bytes.
-
- RTfunc = pointer to a function which is to be called during
- time out loops when IPX command is pending. Set
- to NULL if you don't need this "real time" capability.
-
- ----------
- ----------
- RETURN(S):
- ----------
- ----------
-
- 0x00 - GOOD_IPX_RETURN - all went well.
-
-
- 0x10 - BAD_LOCAL_TARGET - the internal IPX call to find the receiver's
- local target failed. Check the global variable IPXerrno for the
- specific reason, e.g.:
-
- 0xFA - DEST_NODE_PATH_NOT_FND - the 6-byte node address
- specified in the passed parameter Destination.INA.Node
- could not be found. Either the node is non-extant, or
- the machine with that node is not powered on.
-
-
- 0x11 - BAD_SOCKET_PARAM - the SocketStr parameter did not consist of
- a string of four hex-ascii digits.
-
-
- 0x12 - BAD_SOCKET_OPEN - the attempt to open the socket specified in
- SocketStr parameter failed. The global variable IPXerrno will contain
- return code received from IPX. It can be one of the following:
-
- 0xFE - SOCKET_TABLE_FULL - each machine gets 20 sockets, so
- this error should never occur unless other non-"well
- behaved" IPX applications are running on the machine.
-
- 0xFF - SOCKET_ALREADY_OPEN - it will be closed upon return,
- so try again. It is not ignored because at the point
- of call the socket shouldn't have been open, and all
- discrepancies will be caught and reported!
-
-
- 0x20 - BAD_TX_TRY - the attempt to send an IPX packet failed due to
- a problem of either the network or the configuration of the sending
- machine. Check the global IPXerrno to discern the problem. It should
- be one of the following:
-
- 0xFC - EVENT_CANCELED - send request was canceled by
- application due to timeout.
-
- 0xFD - FRAGMENT_SIZE_ERROR - malformed packet size, either
- less than 30 bytes or greater than 576 bytes, or
- the event control block's Fragment Count field was 0.
-
- 0xFE - DESTINATION_NOT_FOUND - the destination machine,
- specified in the NETADDR parameter, is not on the
- network or not powered up.
-
- 0xFF - NETWORK_FAILURE - network or hardware failure.
-
-
- 0x21 - BAD_RETRIES - the sender has been awaiting an acknowledgement
- from the receiver for most recently sent data, and has exhausted its
- retry number & count series. Check IPXerrno for:
-
- 0xFC - EVENT_CANCELED - listen request was canceled by
- application due to timeout.
-
- 0xFD - FRAGMENT_SIZE_ERROR - either the event control block's
- Fragment Count field was 0, or the receiver's buffer
- space was too small to hold the incoming data.
-
- 0xFF - ECB_SOCKET_NOT_OPEN - Socket for listening has not
- been opened by the application.
-
-
- 0x22 - BAD_RX_SEQ_NUM - the destination machine has transmitted an
- acknowledgement to received data, but the sequence number does not
- match the sequence number of the data that the sender transmitted.
- If this problem occurs, either a network failure has caused the
- transmission to become garbled, or the destination machine had
- aborted the current send/received sequence and restarted anew
- within the retry number & timeout series of the sender.
- Both scenarios are highly unlikely.
-
- 0x23 - BAD_RX_SRCE_ADDR - the sending machine received a transmission
- from a machine other than the expected receiver of the original trans-
- mission. This should never occur, due to the fact that the sender
- socket should be known at this point only to the receiver of the
- message that the sender transmitted. If other machines transmitting
- on the network are getting through to another sender unexpectedly, then
- some application software debugging is in order, or special TSR programs
- are running, the behavior of which should be monitored more stringently.
-
-
- 0x30 - BAD_FILE_OPEN - the file to be transmitted, specified by
- the FileOrBfr parameter, could not be opened. Check syntax of
- ASCIIZ string to make sure path and filename are correct, and
- don't forget to use double slashes in the string when specifying
- a path! For example, "D:\MYPATH\MYFILE.DAT" is not a valid C
- string. You must pass it as "D:\\MYPATH\\MYFILE.DAT".
-
-
- 0x32 - BAD_FILE_READ - problem reading the file specified in the
- parameter FileOrBfr, even though the file was successfully opened.
- This should never occur, barring disk failure or some strange
- interaction between the caller's program and other programs running
- as background processes or TSR's.
-
-
- 0xBB - USER_TERMINATED - the user has chosen to abort the application
- by hitting the two SHIFT keys & an ALT key during a send/receive sequence.
-
-
- 0xDD - IPX_NOT_PRESENT - IPX API interface was not detected. Make
- sure NOVELL's IPX.COM or equivalent has been run before attempting to
- access IPX functions.
-
-
- -------------------------
- -------------------------
- APPLICATION CODE EXAMPLE:
- -------------------------
- -------------------------
-
- #include "rkipx.h"
-
- #define TXSOCKET "4050"
- #define TXBFRSIZE 8192
-
- int main( void )
- {
- NETADDR na;
- unsigned rc;
- long len;
- BYTE *TxBfr;
-
- // hard-coded example of internetwork address of destination machine
- xatoxb( na.INA.Network, "01234567" );
- xatoxb( na.INA.Node, "0123456789AB" );
- xatoxb( na.Socket, "4010" );
-
- // sending a file
- len = 0;
- rc = IPXSendRT( &len, "TXDATA.DAT", TXSOCKET, &na, NULL );
- if ( rc != GOOD_IPX_RETURN )
- {
- // take appropriate error action here
- return( -1 );
- }
-
- // sending a buffer
- TxBfr = calloc( 1, TXBFRSIZE );
- if ( !TxBfr )
- {
- printf( "MEMORY ALLOCATION FAILURE!" );
- return( -1 );
- }
-
- len = TXBFRSIZE;
- rc = IPXSendRT( &len, TxBfr, TXSOCKET, &na, NULL );
- if ( rc != GOOD_IPX_RETURN )
- {
- printf( "FUNCTION ERROR: %02X IPX ERROR: %02X", rc, IPXerrno );
- // take appropriate error action here
- return( -1 );
- }
-
- return( 0 );
- }
-
- */
- /*******************************************************************/
- /*******************************************************************/
-