Beispiel #1
0
void
wontoption(int option)
{
	if (do_dont_resp[option]) {
	    --do_dont_resp[option];
	    if (do_dont_resp[option] && my_state_is_dont(option))
		--do_dont_resp[option];
	}

	if ((do_dont_resp[option] == 0) && my_want_state_is_do(option)) {

	    switch (option) {

#ifdef	KLUDGELINEMODE
	    case TELOPT_SGA:
		if (!kludgelinemode)
		    break;
		/* FALL THROUGH */
#endif
	    case TELOPT_ECHO:
		settimer(modenegotiated);
		break;

	    case TELOPT_TM:
		if (flushout)
		    flushout = 0;
		set_my_want_state_dont(option);
		set_my_state_dont(option);
		return;		/* Never reply to TM will's/wont's */

#ifdef ENCRYPTION
  	    case TELOPT_ENCRYPT:
	      encrypt_not();
	      break;
#endif
	    default:
		break;
	    }
	    set_my_want_state_dont(option);
	    if (my_state_is_do(option))
		send_dont(option, 0);
	    setconnmode(0);			/* Set new tty mode */
	} else if (option == TELOPT_TM) {
	    /*
	     * Special case for TM.
	     */
	    if (flushout)
		flushout = 0;
	    set_my_want_state_dont(option);
	}
	set_my_state_dont(option);
}
Beispiel #2
0
void
send_do(int c, int init)
{
    if (init) {
	if (((do_dont_resp[c] == 0) && my_state_is_do(c)) ||
				my_want_state_is_do(c))
	    return;
	set_my_want_state_do(c);
	do_dont_resp[c]++;
    }
    NET2ADD(IAC, DO);
    NETADD(c);
    printoption("SENT", DO, c);
}
Beispiel #3
0
    int
Scheduler(int block) /* should we block in the select ? */
{
		/* One wants to be a bit careful about setting returnValue
		 * to one, since a one implies we did some useful work,
		 * and therefore probably won't be called to block next
		 * time (TN3270 mode only).
		 */
    int returnValue;
    int netin, netout, netex, ttyin, ttyout;

    /* Decide which rings should be processed */

    netout = ring_full_count(&netoring) &&
	    (flushline ||
		(my_want_state_is_wont(TELOPT_LINEMODE)
#ifdef	KLUDGELINEMODE
			&& (!kludgelinemode || my_want_state_is_do(TELOPT_SGA))
#endif
		) ||
			my_want_state_is_will(TELOPT_BINARY));
    ttyout = ring_full_count(&ttyoring);

    ttyin = ring_empty_count(&ttyiring);

    netin = !ISend && ring_empty_count(&netiring);

    netex = !SYNCHing;

    /* If we have seen a signal recently, reset things */

    if (scheduler_lockout_tty) {
        ttyin = ttyout = 0;
    }

    /* Call to system code to process rings */

    returnValue = process_rings(netin, netout, netex, ttyin, ttyout, !block);

    /* Now, look at the input rings, looking for work to do. */

    if (ring_full_count(&ttyiring)) {
	    returnValue |= telsnd();
    }

    if (ring_full_count(&netiring)) {
	returnValue |= telrcv();
    }
    return returnValue;
}
Beispiel #4
0
    void
SetIn3270(void)
{
    if (Sent3270TerminalType && my_want_state_is_will(TELOPT_BINARY)
		&& my_want_state_is_do(TELOPT_BINARY) && !donebinarytoggle) {
	if (!In3270) {
	    In3270 = 1;
	    Init3270();		/* Initialize 3270 functions */
	    /* initialize terminal key mapping */
	    InitTerminal();	/* Start terminal going */
	    setconnmode(0);
	}
    } else {
	if (In3270) {
	    StopScreen(1);
	    In3270 = 0;
	    Stop3270();		/* Tell 3270 we aren't here anymore */
	    setconnmode(0);
	}
    }
}
Beispiel #5
0
void
optionstatus (void)
{
  register int i;
  extern char will_wont_resp[], do_dont_resp[];

  for (i = 0; i < 256; i++)
    {
      if (do_dont_resp[i])
	{
	  if (TELOPT_OK (i))
	    printf ("resp DO_DONT %s: %d\n", TELOPT (i), do_dont_resp[i]);
	  else if (TELCMD_OK (i))
	    printf ("resp DO_DONT %s: %d\n", TELCMD (i), do_dont_resp[i]);
	  else
	    printf ("resp DO_DONT %d: %d\n", i, do_dont_resp[i]);
	  if (my_want_state_is_do (i))
	    {
	      if (TELOPT_OK (i))
		printf ("want DO   %s\n", TELOPT (i));
	      else if (TELCMD_OK (i))
		printf ("want DO   %s\n", TELCMD (i));
	      else
		printf ("want DO   %d\n", i);
	    }
	  else
	    {
	      if (TELOPT_OK (i))
		printf ("want DONT %s\n", TELOPT (i));
	      else if (TELCMD_OK (i))
		printf ("want DONT %s\n", TELCMD (i));
	      else
		printf ("want DONT %d\n", i);
	    }
	}
      else
	{
	  if (my_state_is_do (i))
	    {
	      if (TELOPT_OK (i))
		printf ("     DO   %s\n", TELOPT (i));
	      else if (TELCMD_OK (i))
		printf ("     DO   %s\n", TELCMD (i));
	      else
		printf ("     DO   %d\n", i);
	    }
	}
      if (will_wont_resp[i])
	{
	  if (TELOPT_OK (i))
	    printf ("resp WILL_WONT %s: %d\n", TELOPT (i), will_wont_resp[i]);
	  else if (TELCMD_OK (i))
	    printf ("resp WILL_WONT %s: %d\n", TELCMD (i), will_wont_resp[i]);
	  else
	    printf ("resp WILL_WONT %d: %d\n", i, will_wont_resp[i]);
	  if (my_want_state_is_will (i))
	    {
	      if (TELOPT_OK (i))
		printf ("want WILL %s\n", TELOPT (i));
	      else if (TELCMD_OK (i))
		printf ("want WILL %s\n", TELCMD (i));
	      else
		printf ("want WILL %d\n", i);
	    }
	  else
	    {
	      if (TELOPT_OK (i))
		printf ("want WONT %s\n", TELOPT (i));
	      else if (TELCMD_OK (i))
		printf ("want WONT %s\n", TELCMD (i));
	      else
		printf ("want WONT %d\n", i);
	    }
	}
      else
	{
	  if (my_state_is_will (i))
	    {
	      if (TELOPT_OK (i))
		printf ("     WILL %s\n", TELOPT (i));
	      else if (TELCMD_OK (i))
		printf ("     WILL %s\n", TELCMD (i));
	      else
		printf ("     WILL %d\n", i);
	    }
	}
    }

}