gtpc1m7b | Transmission Control Protocol/Internet Protocol |
ISO-C only |
---|
The claw_openadapter function is not available in the
TARGET(TPF) C library. |
The claw_openadapter function initializes an adapter for CLAW
communications.
Format
#include <claw.h>
int claw_openadapter(unsigned int *adapter_id,
const char *wsname,
unsigned int sda_dev,
const char *connect_ep,
const char *fail_ep,
unsigned int *glb_anchor)
- adapter_id
- A pointer to a 4-byte field that contains an adapter ID with a unique
32-bit integer value that is returned by CLAW when the
claw_openadapter function is requested. This adapter ID must
be used on all subsequent CLAW requests pertaining to that subchannel
pair.
- wsname
- A pointer to an 8-byte field that contains the system name by that the
workstation knows itself. This name is used in the system validation
process.
- sda_dev
- A 2-byte field that contains the symbolic device address (SDA) on that
CLAW read channel programs are processed. The SDA for the read channel
is always an even number. Zero is not a valid SDA number. The
SDA number for write_dev is equal to sda_dev plus one.
- connect_ep
- A pointer to a 4-byte field that contains the character string
CLA3. This entry point is called asynchronously if the workstation
starts a CONNECT request on this subchannel pair. This routine is
defined as a TPF real-time program.
- fail_ep
- A pointer to a 4-byte field that contains the character string
CLA1. This entry point is called asynchronously if the CLAW device
interface detects an unrecoverable error and must shut down a subchannel
pair. This call informs the caller that the adapter is no longer
active. This routine is defined as a TPF real-time program.
- glb_anchor
- A pointer to the address of an anchor word unique to this particular
subchannel pair that is filled in by the CLAW workstation when the
claw_openadapter function has completed successfully. The
caller may use that anchor word for whatever purpose it chooses for as long as
the subchannel pair stays open. This anchor word is passed as a
parameter on connect_ep (CLA3), fail_ep (CLA1),
disconn_ep (CLA2), and msg_ep (CLA4) calls.
Normal Return
Return code 0 indicates that the function was successful.
Error Return
See CLAW Return Codes for a complete list of the return codes and their
definitions.
RC_CLAW_INVALID_FUNCTION
RC_CLAW_NOT_INITED
RC_CLAW_ACQUIRE_ERROR
RC_CLAW_INIT_ERROR
RC_CLAW_OPENDEVICE_ERROR
Programming Considerations
- Under error conditions, calls to the fail_ep (CLA1) entry
points can be generated before control returns to the caller from the
claw_openadapter function. When this happens, the caller
will not have had a chance to store anything in the anchor word. To
handle this condition, the claw_openadapter function immediately
saves the value of glb_anchor in the anchor word before beginning
other processing. When the claw_openadapter function is
about to return control to the calling program, it stores the address of the
anchor word in glb_anchor. By loading the desired contents
of the anchor word into this variable before the call, the application can
save itself the additional step of saving the value after the call. The
application can also ensure that a correct anchor word will be passed to
fail_ep (CLA1) if fail_ep is called during processing of
the claw_openadapter function.
- When the program specified by connect_ep (CLA3) is activated,
it issues a claw_accept request to complete the connection.
It may also use a claw_disconnect request to reject the
connection.
- When the CLAW workstation detects an unrecoverable internal error, it
shuts itself down automatically. The program specified by
fail_ep is activated to notify the user that a particular adapter
has ended itself. This program is not activated when a adapter is shut
down as a result of a claw_closeadapter call, or if an adapter
shuts down before initialization has completed and gives an error return code
from claw_openadapter. The application program does not have
to issue a claw_closeadapter adapter call when this program is
activated. Any connected paths on the adapter are disconnected and
disconn_ep (CLA2) is activated.
Examples
The following example issues the claw_openadapter function to
initialize an adapter.
#include <claw.h>
unsigned int adapter_id;
char workstation[9] = "OS2TCP ";
unsigned int sdadev;
char connectep[5] = "CLA3";
char failep[5]; = "CLA1";
unsigned int glbl_anchor;
int claw_rc;
.
.
glb_anchor = sdadev; /* setup glb_anchor value */
claw_rc = claw_openadapter(&adapter_id,workstation,
sdadev,connectep,failep,&glbl_anchor);
/*normal processing path */
·
·
·
Related Information