APIs and Structures for Status Monitoring

This chapter describes the APIs and structures used to monitor the status of Host-link.

1. API

Host-link provides APIs for monitoring its status. These APIs are available to Tmax system clients, server programs, and other general programs after Host-link is started.

The following is a list of APIs for Host-link status monitoring.

API Description

tpgethlinksvr

The number of processes of the server type of Host-link.

tpgethlinkproc

The information of processes of the server type of Host-link.

tpgethlinkluinfo

The LU information of a server that is connected to Host-link.

tpgethlinkssinfo

The session information of an LU that is connected to Host-link.

1.1. tpgethlinksvr

This function retrieves the number of Host-link processes for a specified server type. The shared memory information of Host-link is used in the following APIs: tpgethlinkproc, tpgethlinkluinfo, tpgethlinkssinfo.

  • Prototype

    int tpgethlinksvr(int shmkey, int svrtype)
  • Parameter

    Parameter Description

    shmkey

    Shared memory key of Host-link.

    svrtype

    Server types. Available server types are as follows:

    • SVRTYPE_LU0, SVRTYPE_LU62S, SVRTYPE_LU62R, SVRTYPE_CTG, SVRTYPE_CSKL, SVRTYPE_IMSLSTN, SVRTYPE_IMSOTMA

  • Return Value

    Return Value Description

    Number of Host-link Processes

    The function call succeeded.

    -1

    The function call failed.

1.2. tpgethlinkproc

This function retrieves information about Host-link processes for a specified server type.

  • Prototype

    int tpgethlinkproc(int svrtype, HLPROCINFO *info)
  • Parameter

    Parameter Description

    svrtype

    Server types. Available server types are as follows:

    • SVRTYPE_LU0, SVRTYPE_LU62S, SVRTYPE_LU62R, SVRTYPE_CTG, SVRTYPE_CSKL, SVRTYPE_IMSLSTN, SVRTYPE_IMSOTMA

    info

    Buffer of the structure table that will contain server process information. The structure buffer must be allocated for the number of structures received from tpgethlinksvr().

  • Return Value

    Return Value Description

    0

    The function call succeeded.

    -1

    The function call failed.

1.3. tpgethlinkluinfo

This function retrieves the LU information of the server connected to Host-link. Since this function allocates memory for the number of LUs, the allocated memory must be released after using this function.

  • Prototype

    HLLUINFO * tpgethlinkluinfo(char *svrname, int *lunum)
  • Parameter

    Parameter Description

    svrname

    Name of the server that is connected to Host-link.

    lunum

    The number of LUs to be returned.

  • Return Value

    Return Value Description

    Structure Table

    The function call succeeded. Returns a structure table containing the LU information of the Host-link server.

    NULL

    The function call failed.

1.4. tpgethlinkssinfo

This function retrieves the session information of the LU connected to Host-link. Since this function allocates memory for the number of sessions, the allocated memory must be released after using this function.

  • Prototype

    HLSESSINFO * tpgethlinkssinfo(char *luname, int *ssnum)
  • Parameter

    Parameter Description

    luname

    Name of the LU that is connected to Host-link.

    ssnum

    The number of sessions to be returned.

  • Return Value

    Return Value Description

    Structure Table

    The function call succeeded. Returns a structure table containing the session information of the Host-link LU.

    NULL

    The function call failed.

2. Structures

The structures used in Host-link are HLPROCINFO, HLLUINFO, and HLSESSINFO.

Structure Description

HLPROCINFO

A structure containing the process information of the Host-link server

HLLUINFO

A structure containing the LU information of the Host-link server.

HLSESSINFO

A structure containing the session information of the Host-link LU.

2.1. HLPROCINFO

HLPROCINFO is a structure containing the process information for the Host-link server.

struct HLPROCINFO
{
     int svrno;
     int msgsize;
     int function;
     int cpc;
     int buffering;
     int innum;
     int outnum;
     int line_status;
     char svrname[20];
     char linkname[8];
     char trxid[4];
     char svrlist[128];
}
Member Description

int svrno

TMAXSVRNO of the SERVER section.

int msgsize

MSGSIZE of the SERVER section.

int function

Function of the SERVER section.

  • DPL(1)

  • DTP(2)

int cpc

CPC of the of the SERVER section.

int buffering

BUFFERING of the SERVER section.

  • YES(1)

  • NO(0)

int innum

Session of the SERVER section.

int outnum

Unused member.

int line_status

Line status of the server.

  • Active(1)

  • Inactive(0)

char svrname[20]

Server name of the SERVER section.

char linkname[8]

LINKNAME of the SERVER section.

char trxid[4]

TRXID of the SERVER section.

char svrlist[128]

SVRLIST of the SERVER section.

2.2. HLLUINFO

HLLUINFO is a structure containing the LU information for the Host-link server.

struct HLLUINFO
{
     char luname[8];
     char wsname[8];
     char lutype[12];
     char svcname[16];
     char tpname[64];
     char pluname[16];
     char modename[8];
     int status;
     int send;
     int direction;
     int session;
     int available;
     int count;
}
Member Description

char luname[8]

LUNAME of the LUINFO section.

char wsname[8]

WSNAME that currently processes LU.

char lutype[12]

LUTYPE of the LUINFO section.

char svcname[16]

Service that currently processes LU.

char tpname[64]

TPNAME of the LUINFO section.

char pluname[16]

PLUNAME of the LUINFO section.

char modename[8]

MODENAME of the LUINFO section.

int status

LU status.

  • LU-LU(0x50)

  • LU-SSCP(0x51)

  • DOWN(0x52)

  • CSDN(0x53)

  • ACTLU(0x54)

  • INACTLU(0x55)

  • NSPE(0x56)

int send

Whether to send a message to an LU 0 host.

  • NONE(0)

  • SENT(1)

  • TIMEOUT(2)

int direction

DIRECTION of the LUINFO section.

  • INBOUND(1)

  • OUTBOUND(2)

int session

SESSION of the LUINFO section.

int available

The number of available sessions of LU6.2.

int count

LU processing count.

2.3. HLSESSINFO

HLSESSINFO is a structure containing the session information of a Host-link LU.

struct HLSESSINFO
{
     int status;
     char luname[8];
     char local_tp[16];
     unsigned char tp_id[8];
     char remote_tp[16];
     char pgmname[8];
     char wsname[8];
     unsigned int conv_id;
     time_t time;
}
Member Description

int status

Status of an LU6.2 session.

  • READY(1)

  • BUSY(2)

char luname[8]

LU6.2 session name.

char local_tp[16]

Local TPNAME of an LU6.2 session.

unsigned char tp_id[8]

Local TPID of an LU6.2 session.

char remote_tp[16]

Remote TPNAME of an LU6.2 session.

char pgmname[8]

PGMNAME of an LU6.2 session.

char wsname[8]

WSNAME of an LU6.2 session.

unsigned int conv_id

Conversation ID of an LU6.2 session.

time_t time

Timestamp of an LU6.2 session.

3. Error Codes

The following describes each Host-link error code.

Error Code Description

TPEOS

This error occurs while allocating the memory used in Host-link.

TPENOREADY

This error occurs when there is no available session managed in Host-link.

TPESVCERR

This error occurs when a Host-link process sends data to a host.

TPESVCFAIL

This error occurs when a Host-link process receives data from a host.

TPEBADDESC

This error occurs when sensor code is transmitted from a host that received data from a Host-link process.

TPETIME

This error occurs when the specified time exceeds after a Host-link process has sent data to a host

TPEPROTO

This error occurs when a Link session that a Host-link process manages becomes deactivated.