ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.2/servlink/servlink.c
Revision: 34
Committed: Sun Oct 2 21:05:51 2005 UTC (18 years, 5 months ago) by lusky
Content type: text/x-csrc
File size: 2514 byte(s)
Log Message:
create 7.2 branch, we can move/rename it as needed.


File Contents

# Content
1 /************************************************************************
2 * IRC - Internet Relay Chat, servlink/servlink.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 1, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * $Id$
19 */
20
21 #include "stdinc.h"
22
23 #ifdef HAVE_LIBCRYPTO
24 #include <openssl/evp.h>
25 #include <openssl/err.h>
26 #endif
27 #ifdef HAVE_LIBZ
28 #include <zlib.h>
29 #endif
30
31 #include "servlink.h"
32 #include "io.h"
33 #include "control.h"
34
35 static void usage(void);
36
37 struct slink_state in_state;
38 struct slink_state out_state;
39
40 struct fd_table fds[5] =
41 {
42 { 0, read_ctrl, NULL },
43 { 0, NULL, NULL },
44 { 0, NULL, NULL },
45 { 0, NULL, NULL },
46 { 0, NULL, NULL }
47 };
48
49 /* usage();
50 *
51 * Display usage message
52 */
53 static void usage(void)
54 {
55 fprintf(stderr, "ircd-hybrid server link v1.0\n");
56 fprintf(stderr, "2001-06-04\n");
57 fprintf(stderr, "\n");
58 fprintf(stderr, "This program is called by the ircd-hybrid ircd.\n");
59 fprintf(stderr, "It cannot be used on its own.\n");
60 exit(1);
61 }
62
63 int main(int argc, char *argv[])
64 {
65 int max_fd = 0;
66 int i;
67 #ifdef SERVLINK_DEBUG
68 int GDBAttached = 0;
69
70 while (!GDBAttached)
71 sleep(1);
72 #endif
73
74 #ifdef HAVE_LIBCRYPTO
75 /* load error strings */
76 ERR_load_crypto_strings();
77 #endif
78
79 /* Make sure we are running under hybrid.. */
80 if (argc != 6 || strcmp(argv[0], "-slink"))
81 usage(); /* exits */
82
83 for (i = 0; i < 5; i++ )
84 {
85 fds[i].fd = dup(atoi(argv[i+1]));
86 if (fds[i].fd < 0)
87 exit(1);
88 if (fds[i].fd > max_fd)
89 max_fd = fds[i].fd;
90 }
91
92 for (i = 0; i < 5; i++ )
93 {
94 close(atoi(argv[i+1]));
95 }
96
97 /* set file descriptors to nonblocking mode */
98 for (i = 0; i < 5; i++)
99 {
100 fcntl(fds[i].fd, F_SETFL, O_NONBLOCK);
101 }
102
103 /* enter io loop */
104 io_loop(max_fd + 1);
105
106 /* NOTREACHED */
107 return(0);
108 } /* main() */

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision