File: globus_i_ftp_control.h

package info (click to toggle)
globus-ftp-control 9.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 2,500 kB
  • sloc: ansic: 23,825; sh: 11,412; makefile: 246
file content (236 lines) | stat: -rw-r--r-- 7,281 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/*
 * Copyright 1999-2006 University of Chicago
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GLOBUS_INCLUDE_FTP_I_CONTROL_H
#define GLOBUS_INCLUDE_FTP_I_CONTROL_H 1

#define GLOBUS_I_FTP_CONTROL_BUF_SIZE 200
#define GLOBUS_I_FTP_CONTROL_BUF_INCR 100

#define GLOBUS_I_TELNET_IP "\xFF\xF4"
#define GLOBUS_I_TELNET_SYNCH "\xFF\xF2"
#define GLOBUS_I_TELNET_IAC '\xFF'

#include "globus_config.h"

extern
FILE *          globus_i_ftp_control_devnull;

typedef enum
{
    GLOBUS_I_FTP_AUTH,
    GLOBUS_I_FTP_ACCT,
    GLOBUS_I_FTP_ADAT,
    GLOBUS_I_FTP_QUIT,
    GLOBUS_I_FTP_USER,
    GLOBUS_I_FTP_PASS,
    GLOBUS_I_FTP_NOOP
}
globus_i_ftp_cmd_t;

typedef struct globus_i_ftp_passthru_cb_arg_s
{
    globus_ftp_control_response_callback_t	     user_cb;
    void *				             user_cb_arg;
    globus_i_ftp_cmd_t                               cmd;
    globus_ftp_control_handle_t *	             handle;
} globus_i_ftp_passthru_cb_arg_t;

typedef struct globus_i_ftp_server_passthru_cb_arg_s
{
    globus_ftp_control_server_callback_t	callback;
    void *					callback_arg;
    globus_ftp_control_server_t *		server_handle;
} globus_i_ftp_server_passthru_cb_arg_t;


void
globus_i_ftp_control_call_close_cb(
    globus_ftp_control_handle_t *             handle);

void 
globus_i_ftp_control_write_next(
    globus_ftp_control_handle_t *             handle);

globus_result_t
globus_i_ftp_control_radix_encode(
    unsigned char *                        inbuf,
    unsigned char *                        outbuf,
    int *                                  length);

globus_result_t
globus_i_ftp_control_radix_decode(
    unsigned char *                        inbuf,
    unsigned char *                        outbuf,
    int *                                  length);

globus_result_t
globus_i_ftp_control_decode_command(
    char *                                    cmd,
    char **                                   decoded_cmd,
    globus_ftp_control_auth_info_t *          auth_info);

globus_result_t
globus_i_ftp_control_encode_command(
    globus_ftp_cc_handle_t *               cc_handle,
    char *                                 cmd,
    char **                                encoded_cmd);


globus_result_t
globus_i_ftp_control_encode_reply(
    char *                                    reply,
    char **                                   encoded_reply,
    globus_ftp_control_auth_info_t *          auth_info);

globus_result_t
globus_i_ftp_control_data_set_netlogger(
    globus_ftp_control_handle_t *               handle,
    globus_netlogger_handle_t *                 nl_handle,
    globus_bool_t                               nl_ftp_control,
    globus_bool_t                               nl_globus_io);

globus_result_t
globus_i_ftp_control_client_set_netlogger(
    globus_ftp_control_handle_t *               handle,
    globus_netlogger_handle_t *                 nl_handle);

globus_result_t
globus_i_ftp_control_data_activate(void);

globus_result_t
globus_i_ftp_control_data_deactivate(void);


globus_result_t
globus_i_ftp_control_client_activate(void);

globus_result_t
globus_i_ftp_control_client_deactivate(void);

globus_result_t
globus_i_ftp_control_server_activate(void);

globus_result_t
globus_i_ftp_control_server_deactivate(void);

globus_result_t
globus_i_ftp_control_data_cc_destroy(
    globus_ftp_control_handle_t *                control_handle);

globus_result_t
globus_i_ftp_control_data_cc_blocking_destroy(
    globus_ftp_control_handle_t *                control_handle);

globus_result_t
globus_i_ftp_control_data_abort(
    globus_ftp_control_handle_t *                control_handle,
    globus_object_t *                            error);

globus_result_t 
globus_i_ftp_control_auth_info_init(
    globus_ftp_control_auth_info_t *        dest,
    globus_ftp_control_auth_info_t *        src);

globus_result_t 
globus_i_ftp_control_auth_info_destroy(
    globus_ftp_control_auth_info_t *        auth_info);

globus_result_t
globus_i_ftp_control_get_connection_info(
    globus_ftp_control_handle_t *               handle,
    int *                                       local_host,
    unsigned short *                            local_port,
    int *                                       remote_host,
    unsigned short *                            remote_port);

/*
 *  internal function definitions
 */
globus_result_t
globus_i_ftp_parallelism_copy(
    globus_ftp_control_parallelism_t *             dest_parallelism,
    globus_ftp_control_parallelism_t *             src_parallelism);

int
globus_i_ftp_parallelism_get_size(
    globus_ftp_control_parallelism_t *             parallelism);

int
globus_i_ftp_parallelism_get_min_size(
    globus_ftp_control_parallelism_t *             parallelism);

int
globus_i_ftp_parallelism_get_max_size(
    globus_ftp_control_parallelism_t *             parallelism);

void
globus_ftp_control_host_port_init(
    globus_ftp_control_host_port_t *              host_port,
    char *                                        host,
    unsigned short                                port);

void
globus_ftp_control_host_port_destroy(
    globus_ftp_control_host_port_t *              host_port);

void
globus_ftp_control_host_port_get_host(
    globus_ftp_control_host_port_t *              host_port,
    char *                                        host);

unsigned short
globus_ftp_control_host_port_get_port(
    globus_ftp_control_host_port_t *              host_port);

void
globus_ftp_control_host_port_copy(
    globus_ftp_control_host_port_t *              dest,
    globus_ftp_control_host_port_t *              src);

globus_result_t
globus_i_ftp_control_client_get_connection_info(
    globus_ftp_control_handle_t *         handle,
    int                                   localhost[4],
    unsigned short *                      localport,
    int                                   remotehost[4],
    unsigned short *                      remoteport);

extern const char * globus_i_ftp_server_welcome;
extern const char * globus_i_ftp_server_user_reply;
extern const char * globus_i_ftp_server_pass_reply;

extern int globus_i_ftp_control_debug_level;

#ifdef BUILD_DEBUG
#define globus_i_ftp_control_debug(Level)                   \
    (globus_i_ftp_control_debug_level >= (Level))

#define globus_i_ftp_control_debug_printf(level, message)   \
do {                                                        \
    if (globus_i_ftp_control_debug(level))                  \
    {                                                       \
	globus_libc_fprintf message;                        \
    }                                                       \
} while (0)
#else
#define globus_i_ftp_control_debug_printf(level, message)
#endif


#endif