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