/* * Send IAC GA. */ static void telnet_send_ga(telnet_t *tp) { nqueue_t *nq; nq = tp->t_outq; nq_putc(nq, IAC); nq_putc(nq, GA); telnet_enabw(tp); }
/* * Send IAC DONT <option>. */ static void telnet_send_dont(telnet_t *tp, u_char opt) { nqueue_t *nq; nq = tp->t_outq; nq_putc(nq, IAC); nq_putc(nq, DONT); nq_putc(nq, opt); telnet_enabw(tp); }
/* * Send IAC WILL <option>. */ static void telnet_send_will(telnet_t *tp, u_char opt) { nqueue_t *nq; nq = tp->t_outq; nq_putc(nq, IAC); nq_putc(nq, WILL); nq_putc(nq, opt); telnet_enabw(tp); }
/* * Send the contents of the canonical queue to the interactive object. */ static void telnet_eol(telnet_t *tp) { char *cp; if (tp->t_flags & TF_SYNCH) return; if (nq_full(tp->t_canq)) { tp->t_flags &= ~TF_OVFLCANQ; cp = ""; } else { nq_putc(tp->t_canq, '\0'); cp = (char *)nq_rptr(tp->t_canq); } if (tp->t_flags & TF_ATTACH) interactive_input(tp->t_ip, cp); nq_init(tp->t_canq); tp->t_flags &= ~TF_GA; }
/* * Append a character to the option queue. */ static void telnet_optq_putc(telnet_t *tp, u_char c) { if (tp->t_flags & TF_OVFLOPTQ) return; if (!nq_full(tp->t_optq)) nq_putc(tp->t_optq, c); else tp->t_flags |= TF_OVFLOPTQ; }
/* * Append a character to the canonical queue. */ static void telnet_canq_putc(telnet_t *tp, u_char c) { if (tp->t_flags & (TF_OVFLCANQ | TF_SYNCH)) return; if (!nq_full(tp->t_canq)) { nq_putc(tp->t_canq, c); } else { tp->t_flags |= TF_OVFLCANQ; if (nq_avail(tp->t_outq) > 0) { nq_putc(tp->t_outq, BEL); telnet_enabw(tp); } } }
/* * Send the contents of the canonical queue to the interactive object. */ static void telnet_eol(telnet_t *tp) { if (tp->t_flags & TF_SYNCH) return; if (nq_full(tp->t_canq)) { tp->t_flags &= ~TF_OVFLCANQ; } else { nq_putc(tp->t_canq, '\0'); } tp->t_flags |= TF_INPUT; }