xref: /freebsd/usr.bin/talk/talk.h (revision b8d48d6233f9e4dea8aa24fe12c059e0baaacd2f)
19b50d902SRodney W. Grimes /*
29b50d902SRodney W. Grimes  * Copyright (c) 1983, 1993
39b50d902SRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
49b50d902SRodney W. Grimes  *
59b50d902SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
69b50d902SRodney W. Grimes  * modification, are permitted provided that the following conditions
79b50d902SRodney W. Grimes  * are met:
89b50d902SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
99b50d902SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
109b50d902SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
119b50d902SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
129b50d902SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
139b50d902SRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
149b50d902SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
159b50d902SRodney W. Grimes  *    without specific prior written permission.
169b50d902SRodney W. Grimes  *
179b50d902SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
189b50d902SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199b50d902SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
209b50d902SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
219b50d902SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
229b50d902SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
239b50d902SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
249b50d902SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
259b50d902SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
269b50d902SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
279b50d902SRodney W. Grimes  * SUCH DAMAGE.
289b50d902SRodney W. Grimes  *
299b50d902SRodney W. Grimes  *	@(#)talk.h	8.1 (Berkeley) 6/6/93
30caa64801SMark Murray  * $FreeBSD$
319b50d902SRodney W. Grimes  */
329b50d902SRodney W. Grimes 
3328592604SJoerg Wunsch #include <sys/cdefs.h>
3428592604SJoerg Wunsch #include <sys/types.h>
3528592604SJoerg Wunsch #include <sys/time.h>
3628592604SJoerg Wunsch #include <sys/socket.h>
3728592604SJoerg Wunsch #include <netinet/in.h>
3828592604SJoerg Wunsch #include <arpa/inet.h>
3928592604SJoerg Wunsch #include <protocols/talkd.h>
409b50d902SRodney W. Grimes #include <curses.h>
41*b8d48d62SEd Schouten #include <signal.h>
429b50d902SRodney W. Grimes 
439b50d902SRodney W. Grimes extern	int sockt;
449b50d902SRodney W. Grimes extern	int curses_initialized;
459b50d902SRodney W. Grimes extern	int invitation_waiting;
469b50d902SRodney W. Grimes 
47caa64801SMark Murray extern	const char *current_state;
489b50d902SRodney W. Grimes extern	int current_line;
499b50d902SRodney W. Grimes 
50*b8d48d62SEd Schouten extern volatile sig_atomic_t gotwinch;
51*b8d48d62SEd Schouten 
529b50d902SRodney W. Grimes typedef struct xwin {
539b50d902SRodney W. Grimes 	WINDOW	*x_win;
549b50d902SRodney W. Grimes 	int	x_nlines;
559b50d902SRodney W. Grimes 	int	x_ncols;
569b50d902SRodney W. Grimes 	int	x_line;
579b50d902SRodney W. Grimes 	int	x_col;
589b50d902SRodney W. Grimes 	char	kill;
599b50d902SRodney W. Grimes 	char	cerase;
609b50d902SRodney W. Grimes 	char	werase;
619b50d902SRodney W. Grimes } xwin_t;
629b50d902SRodney W. Grimes 
639b50d902SRodney W. Grimes extern	xwin_t my_win;
649b50d902SRodney W. Grimes extern	xwin_t his_win;
659b50d902SRodney W. Grimes extern	WINDOW *line_win;
6628592604SJoerg Wunsch 
673f330d7dSWarner Losh extern	void	announce_invite(void);
683f330d7dSWarner Losh extern	int	check_local(void);
693f330d7dSWarner Losh extern	void	check_writeable(void);
703f330d7dSWarner Losh extern	void	ctl_transact(struct in_addr,CTL_MSG,int,CTL_RESPONSE *);
713f330d7dSWarner Losh extern	void	disp_msg(int);
723f330d7dSWarner Losh extern	void	display(xwin_t *, char *, int);
733f330d7dSWarner Losh extern	void	end_msgs(void);
74b6d9e1f3SXin LI extern	void	get_addrs(const char *, const char *);
753f330d7dSWarner Losh extern	int	get_iface(struct in_addr *, struct in_addr *);
763f330d7dSWarner Losh extern	void	get_names(int, char **);
773f330d7dSWarner Losh extern	void	init_display(void);
783f330d7dSWarner Losh extern	void	invite_remote(void);
793f330d7dSWarner Losh extern	int	look_for_invite(CTL_RESPONSE *);
803f330d7dSWarner Losh extern	int	max(int, int);
813f330d7dSWarner Losh extern	void	message(const char *);
823f330d7dSWarner Losh extern	void	open_ctl(void);
833f330d7dSWarner Losh extern	void	open_sockt(void);
843f330d7dSWarner Losh extern	void	p_error(const char *);
853f330d7dSWarner Losh extern	void	print_addr(struct sockaddr_in);
863f330d7dSWarner Losh extern	void	quit(void);
873f330d7dSWarner Losh extern	int	readwin(WINDOW *, int, int);
883f330d7dSWarner Losh extern	void	re_invite(int);
893f330d7dSWarner Losh extern	void	send_delete(void);
903f330d7dSWarner Losh extern	void	set_edit_chars(void);
913f330d7dSWarner Losh extern	void	sig_sent(int);
92ec8ffccbSOlivier Houchard extern	void	sig_winch(int);
933f330d7dSWarner Losh extern	void	start_msgs(void);
943f330d7dSWarner Losh extern	void	talk(void);
95ec8ffccbSOlivier Houchard extern	void	resize_display(void);
96