summaryrefslogtreecommitdiff
path: root/snarf-internal.h
blob: c212b2d57dd50c37eda19710cfb3e18c8fc31eaa (plain)
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
/*
 * nvidia-installer: A tool for installing NVIDIA software packages on
 * Unix and Linux systems.
 *
 * Copyright (C) 2003 NVIDIA Corporation
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses>.
 *
 *
 * snarf-internal.h
 */

#ifndef __NVIDIA_INSTALLER_SNARF_INTERNAL_H__
#define __NVIDIA_INSTALLER_SNARF_INTERNAL_H__

#include "nvidia-installer.h"

typedef struct _UrlResource 	UrlResource;
typedef struct _Url		Url;

struct _Url {
    char *full_url;
    int service_type;
    char *username;
    char *password;
    char *host;
    int port;
    char *path;
    char *file;
};

struct _UrlResource {
    Url *url;
    Options *op;
    int out_fd;
    uint32 flags;
    char *proxy;
    char *proxy_username;
    char *proxy_password;
    off_t outfile_size;
    off_t outfile_offset;
};


/* Service types */
enum url_services {
    SERVICE_HTTP = 1,
    SERVICE_FTP
};


#define SNARF_BUFSIZE (5*2048)

/* snarf.c */

Url  *url_new    (void);
Url  *url_init   (Url *, const char *);
void  url_destroy(Url *);
char *get_proxy  (const char *);
int   dump_data  (UrlResource *, int);
int   tcp_connect(Options *, char *, int);
int transfer(UrlResource *rsrc);

/* snarf-ftp.c */

int ftp_transfer(UrlResource *);

/* snarf-http.c */

int http_transfer(UrlResource *);

#endif /* __NVIDIA_INSTALLER_SNARF_INTERNAL_H__ */