]> cygwin.com Git - cygwin-apps/setup.git/blob - netio.h
2004-12-25 Max Bowsher <maxb@ukf.net>
[cygwin-apps/setup.git] / netio.h
1 /*
2 * Copyright (c) 2000, Red Hat, Inc.
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 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by DJ Delorie <dj@cygnus.com>
13 *
14 */
15
16 #ifndef SETUP_NETIO_H
17 #define SETUP_NETIO_H
18
19 /* This is the parent class for all the access methods known to setup
20 (i.e. ways to download files from the internet or other sources */
21
22 class NetIO
23 {
24 protected:
25 NetIO (char const *url);
26 void set_url (char const *url);
27 BOOL ftp_auth;
28
29 public:
30 /* if nonzero, this is the estimated total file size */
31 int file_size;
32 /* broken down url FYI */
33 char *url;
34 char *proto;
35 char *host;
36 int port;
37 char *path;
38 virtual ~ NetIO ();
39
40 /* The user calls this function to create a suitable accessor for
41 the given URL. It uses the network setup state in state.h. If
42 anything fails, either the return values is NULL or the returned
43 object is !ok() */
44 static NetIO *open (char const *url);
45
46 /* If !ok() that means the transfer isn't happening. */
47 virtual int ok ();
48
49 /* Read `nbytes' bytes from the file. Returns zero when the file
50 is complete. */
51 virtual int read (char *buf, int nbytes);
52
53 /* Helper functions for http/ftp protocols. Both return nonzero for
54 "cancel", zero for "ok". They set net_proxy_user, etc, in
55 state.h */
56 int get_auth (HWND owner);
57 int get_proxy_auth (HWND owner);
58 int get_ftp_auth (HWND owner);
59 };
60
61 #endif /* SETUP_NETIO_H */
This page took 0.037488 seconds and 5 git commands to generate.