11590Srgrimes/*
21590Srgrimes * Copyright (c) 1983, 1993
31590Srgrimes *	The Regents of the University of California.  All rights reserved.
41590Srgrimes *
51590Srgrimes * Redistribution and use in source and binary forms, with or without
61590Srgrimes * modification, are permitted provided that the following conditions
71590Srgrimes * are met:
81590Srgrimes * 1. Redistributions of source code must retain the above copyright
91590Srgrimes *    notice, this list of conditions and the following disclaimer.
101590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111590Srgrimes *    notice, this list of conditions and the following disclaimer in the
121590Srgrimes *    documentation and/or other materials provided with the distribution.
131590Srgrimes * 4. Neither the name of the University nor the names of its contributors
141590Srgrimes *    may be used to endorse or promote products derived from this software
151590Srgrimes *    without specific prior written permission.
161590Srgrimes *
171590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201590Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271590Srgrimes * SUCH DAMAGE.
281590Srgrimes *
291590Srgrimes *	@(#)talk.h	8.1 (Berkeley) 6/6/93
3087710Smarkm * $FreeBSD$
311590Srgrimes */
321590Srgrimes
3314443Sjoerg#include <sys/cdefs.h>
3414443Sjoerg#include <sys/types.h>
3514443Sjoerg#include <sys/time.h>
3614443Sjoerg#include <sys/socket.h>
3714443Sjoerg#include <netinet/in.h>
3814443Sjoerg#include <arpa/inet.h>
3914443Sjoerg#include <protocols/talkd.h>
401590Srgrimes#include <curses.h>
41227185Sed#include <signal.h>
421590Srgrimes
431590Srgrimesextern	int sockt;
441590Srgrimesextern	int curses_initialized;
451590Srgrimesextern	int invitation_waiting;
461590Srgrimes
4787710Smarkmextern	const char *current_state;
481590Srgrimesextern	int current_line;
491590Srgrimes
50227185Sedextern volatile sig_atomic_t gotwinch;
51227185Sed
521590Srgrimestypedef struct xwin {
531590Srgrimes	WINDOW	*x_win;
541590Srgrimes	int	x_nlines;
551590Srgrimes	int	x_ncols;
561590Srgrimes	int	x_line;
571590Srgrimes	int	x_col;
581590Srgrimes	char	kill;
591590Srgrimes	char	cerase;
601590Srgrimes	char	werase;
611590Srgrimes} xwin_t;
621590Srgrimes
631590Srgrimesextern	xwin_t my_win;
641590Srgrimesextern	xwin_t his_win;
651590Srgrimesextern	WINDOW *line_win;
6614443Sjoerg
6792922Simpextern	void	announce_invite(void);
6892922Simpextern	int	check_local(void);
6992922Simpextern	void	check_writeable(void);
7092922Simpextern	void	ctl_transact(struct in_addr,CTL_MSG,int,CTL_RESPONSE *);
7192922Simpextern	void	disp_msg(int);
7292922Simpextern	void	display(xwin_t *, char *, int);
7392922Simpextern	void	end_msgs(void);
74178642Sdelphijextern	void	get_addrs(const char *, const char *);
7592922Simpextern	int	get_iface(struct in_addr *, struct in_addr *);
7692922Simpextern	void	get_names(int, char **);
7792922Simpextern	void	init_display(void);
7892922Simpextern	void	invite_remote(void);
7992922Simpextern	int	look_for_invite(CTL_RESPONSE *);
8092922Simpextern	int	max(int, int);
8192922Simpextern	void	message(const char *);
8292922Simpextern	void	open_ctl(void);
8392922Simpextern	void	open_sockt(void);
8492922Simpextern	void	p_error(const char *);
8592922Simpextern	void	print_addr(struct sockaddr_in);
8692922Simpextern	void	quit(void);
8792922Simpextern	int	readwin(WINDOW *, int, int);
8892922Simpextern	void	re_invite(int);
8992922Simpextern	void	send_delete(void);
9092922Simpextern	void	set_edit_chars(void);
9192922Simpextern	void	sig_sent(int);
92128445Scognetextern	void	sig_winch(int);
9392922Simpextern	void	start_msgs(void);
9492922Simpextern	void	talk(void);
95128445Scognetextern	void	resize_display(void);
96