gtpc1m7bTransmission Control Protocol/Internet Protocol

claw_openadapter -- Initialize an Adapter

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

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