1 /*
2  * Copyright (c) 1995-2009, 2014-2015, 2017-2018 Paul Mattes.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *     * Redistributions of source code must retain the above copyright
8  *       notice, this list of conditions and the following disclaimer.
9  *     * Redistributions in binary form must reproduce the above copyright
10  *       notice, this list of conditions and the following disclaimer in the
11  *       documentation and/or other materials provided with the distribution.
12  *     * Neither the names of Paul Mattes nor the names of his contributors
13  *       may be used to endorse or promote products derived from this software
14  *       without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY PAUL MATTES "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19  * EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 /*
29  *	host.h
30  *		Global declarations for host.c.
31  */
32 
33 struct host {
34     char *name;
35     char **parents;
36     char *hostname;
37     enum { PRIMARY, ALIAS, RECENT } entry_type;
38     char *loginstring;
39     time_t connect_time;
40     struct host *prev, *next;
41 };
42 extern struct host *hosts;
43 extern enum iaction connect_ia;
44 
45 /* Host connect/disconnect and state change. */
46 void hostfile_init(void);
47 bool host_connect(const char *n, enum iaction ia);
48 void host_connected(void);
49 void host_continue_connect(iosrc_t iosrc, net_connect_t nc);
50 void host_new_connection(bool pending);
51 void host_disconnect(bool disable);
52 void host_in3270(enum cstate);
53 void host_newfd(iosrc_t s);
54 bool host_reconnecting(void);
55 void host_register(void);
56 void host_set_flag(int flag);
57