MFC 1.79 - fix lock leak in nfs_create().
[dragonfly.git] / libexec / ftp-proxy / util.h
blob6cea2f357d014b256954ef55b88a9509b86de484
1 /* $OpenBSD: util.h,v 1.3 2002/05/23 10:22:14 deraadt Exp $ */
2 /* $DragonFly: src/libexec/ftp-proxy/util.h,v 1.2 2005/02/24 15:38:09 joerg Exp $ */
4 /*
5 * Copyright (c) 1996-2001
6 * Obtuse Systems Corporation. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 4. Neither the name of the Obtuse Systems nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL OBTUSE SYSTEMS CORPORATION OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 struct proxy_channel {
34 int pc_to_fd, pc_from_fd;
35 int pc_alive;
36 int pc_nextbyte;
37 int pc_flags;
38 int pc_length;
39 int pc_size;
40 struct sockaddr_in pc_from_sa, pc_to_sa;
41 int (*pc_filter)( void ** databuf, int datalen);
42 char *pc_buffer;
45 struct csiob {
46 int fd;
47 int line_buffer_size, io_buffer_size, io_buffer_len, next_byte;
48 unsigned char *io_buffer, *line_buffer;
49 struct sockaddr_in sa, real_sa;
50 const char *who;
51 char alive, got_eof, data_available;
52 int send_oob_flags;
55 extern int telnet_getline(struct csiob *iobp,
56 struct csiob *telnet_passthrough);
58 extern int get_proxy_env(int fd, struct sockaddr_in *server_sa_ptr,
59 struct sockaddr_in *client_sa_ptr, struct sockaddr_in *proxy_sa_ptr);
61 extern int get_backchannel_socket(int type, int min_port, int max_port,
62 int start_port, int direction, struct sockaddr_in *sap);
64 extern int xfer_data(const char *what_read, int from_fd, int to_fd,
65 struct in_addr from, struct in_addr to);
67 extern char *ProgName;