Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

User-defined exits

&pagelevel(4)&pagelevel

For exit handling with your own procedures, you have to add the relevant code to the EXITTEL.C module.

If you define an exit for send or receive, you are also responsible for handling all special characters. In particular, you must ensure that

  • a 0xff character is duplicated for sending,

  • two successive 0xff characters are converted to a single 0xff for sending.


Activating user-defined server exits on the TELNET server

You can activate the code created in this way on the TELNET server with the -e option:

-e [open:<selector1>!][close:<selector2>!][receive:<selector3>!][send:<selector4>]

If you specify * for <selector>, the exit mechanism is started without the more precise specification of <selector>.


Activating user-defined server exits on the TELNET client

You can activate server exits for send and receive on the TELNET client with the rexit (remote exit) command. This restricts the effect of rexit, however, to the connection of this special client to the server.

The rexit command has the following syntax:

rexit [receive:<selector1>][<send:<selector2>]

The following cases can be distinguished:

  • Server options are specified:

    If no rexit command was specified for a connection between the server and client, the setting of the -e server option applies.

    If there are entries for an exit routine both in the rexit command and in the -e server options, the specifications of the rexit command apply. Subsequent specification of * for <selector1> or <selector2> in the rexit command causes a reset to the entry in the server option. A blank entry for <selector1> or <selector2> disables the exit.

  • No server options are specified:

    The specification of * for <selector> in the rexit command activates the exit routine. More precise differentiation of the handling type as enabled by the specification of <selector>, is not provided for in this case. A blank entry for <selector1> or <selector2> disables the exit.


Activating user-defined client exits on the TELNET client

User-defined exit routines for the client can be set on the client with the exit command:

exit [receive:<selector1>][<send:<selector2>]

If * is specified for <selector1> or <selector2>, the YAPTEXIT entry is selected but without the more precise specification of selector. If no entry is made for <selector>, no exit routine will be selected. A blank entry for <selector1> or <selector2> disables the exit.


Examples

  1. Clients on the host host should not be given access to the TELNET server.
    This can be specified with the following user-defined module with the YAPTEXIT entry:

    YAPTEXIT (struct yaptx *exparam)
    {
       switch (exparam->action) {
          case telopen:
             if (strcmp(exparam->hname,"host") == 0)
                return(-1);
             break;
          default;
             break;
       }
    }
    

    This module must replace the EXITTEL module in the SYSLNK.TCP-IP-AP.nnn library and be activated with the -e open:* option. The external reference YAPTEXIT is resolved from the user-defined module at runtime.

  2. Two different user-defined open exits are defined for a TELNET server:

    • If a client logs on from host1, exit1 should be selected.

    • If a client logs on from host2, exit2 should be selected.

    YAPTEXIT (struct yaptx *exparam)
    {
       if ((exparam->action) == telopen)
          if (strcmp(exparam.hname,"host1")==0)
             exit1(exparam)
          else
             if ((strcmp(exparam.hname,"host2")==0)
                exit2(exparam);
    }
    

    The relevant option is: -e open;*

  3. Two different code conversions should be defined for the data that are sent from the client to the server. For example, x‘0102’ should be converted therefore to x‘0a’ or x‘0a0b’. In the example below, the code conversion routines are called proc1 or proc2. The recognition strings are "proc1" or "proc2".

YAPTEXIT (struct yaptx *exparam)
{
   if ((exparam->caller) == client) && (exparam->action == telsend))
      if (strcmp(exparam->selector,"proc1")==0)
         proc1(exparam);
      else
         if ((strcmp(exparam->selector,"proc2")==0)
            proc2(exparam);
}

The relevant commands for enabling this exit are:

exit send:proc1 or exit send:proc2


User-defined TELNET exits under POSIX

The POSIX TELNET is created by linking the LLMs TELPOSIX and EXITTEL. You can thus also work with the TELNET exits under POSIX.

The interNet Services package contains the dummy module EXITTEL, which only executes a return.

You write your own TELNET exits as follows: