/[axel]/trunk/axel.h
ViewVC logotype

Contents of /trunk/axel.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations) (download)
Fri Jan 11 11:57:58 2008 UTC (5 years, 4 months ago) by appaji-guest
File MIME type: text/plain
File size: 2874 byte(s)
Import 1.0a
1 appaji-guest 2 /********************************************************************\
2     * Axel -- A lighter download accelerator for Linux and other Unices. *
3     * *
4     * Copyright 2001 Wilmer van der Gaast *
5     \********************************************************************/
6    
7     /* Main include file */
8    
9     /*
10     This program is free software; you can redistribute it and/or modify
11     it under the terms of the GNU General Public License as published by
12     the Free Software Foundation; either version 2 of the License, or
13     (at your option) any later version.
14    
15     This program is distributed in the hope that it will be useful,
16     but WITHOUT ANY WARRANTY; without even the implied warranty of
17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18     GNU General Public License for more details.
19    
20     You should have received a copy of the GNU General Public License with
21     the Debian GNU/Linux distribution in file /usr/doc/copyright/GPL;
22     if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23     Suite 330, Boston, MA 02111-1307 USA
24     */
25    
26     #include "config.h"
27    
28     #include <time.h>
29     #include <ctype.h>
30     #include <fcntl.h>
31     #include <errno.h>
32     #include <stdio.h>
33     #include <netdb.h>
34     #ifndef NOGETOPTLONG
35     #define _GNU_SOURCE
36     #include <getopt.h>
37     #endif
38     #include <limits.h>
39     #include <stdlib.h>
40     #include <unistd.h>
41     #include <signal.h>
42     #include <string.h>
43     #include <stdarg.h>
44     #include <sys/stat.h>
45     #include <sys/time.h>
46     #include <sys/types.h>
47     #include <sys/ioctl.h>
48     #include <sys/socket.h>
49     #include <netinet/in_systm.h>
50     #include <netinet/in.h>
51     #include <netinet/ip.h>
52     #include <arpa/inet.h>
53     #include <net/if.h>
54     #include <pthread.h>
55    
56     /* Internationalization */
57     #ifdef I18N
58     #define PACKAGE "axel"
59     #define _( x ) gettext( x )
60     #include <libintl.h>
61     #include <locale.h>
62     #else
63     #define _( x ) x
64     #endif
65    
66     /* Compiled-in settings */
67     #define MAX_STRING 256
68     #define MAX_REDIR 5
69     #define AXEL_VERSION_STRING "1.0a"
70     #define USER_AGENT "Axel " AXEL_VERSION_STRING " (" ARCH ")"
71    
72     typedef struct
73     {
74     void *next;
75     char text[MAX_STRING];
76     } message_t;
77    
78     typedef message_t url_t;
79     typedef message_t if_t;
80    
81     #include "conf.h"
82     #include "tcp.h"
83     #include "ftp.h"
84     #include "http.h"
85     #include "conn.h"
86     #include "search.h"
87    
88     #define min( a, b ) ( (a) < (b) ? (a) : (b) )
89     #define max( a, b ) ( (a) > (b) ? (a) : (b) )
90    
91     typedef struct
92     {
93     conn_t *conn;
94     conf_t conf[1];
95     char filename[MAX_STRING];
96     double start_time;
97     int next_state, finish_time;
98     int bytes_done, start_byte, size;
99     int bytes_per_second;
100     int delay_time;
101     int outfd;
102     int ready;
103     message_t *message;
104     url_t *url;
105     } axel_t;
106    
107     axel_t *axel_new( conf_t *conf, int count, void *url );
108     int axel_open( axel_t *axel );
109     void axel_start( axel_t *axel );
110     void axel_do( axel_t *axel );
111     void axel_close( axel_t *axel );
112    
113     double gettime();

  ViewVC Help
Powered by ViewVC 1.1.5