/[axel]/tags/2.2/axel.h
ViewVC logotype

Contents of /tags/2.2/axel.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 54 - (hide annotations) (download)
Mon Oct 13 21:06:39 2008 UTC (4 years, 8 months ago) by phihag-guest
Original Path: branches/2.x/axel.h
File MIME type: text/plain
File size: 2907 byte(s)
Fix buffer overflow in http.c (Closes: #311178)
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 appaji-guest 7 #define MAX_STRING 1024
68 appaji-guest 27 #define MAX_ADD_HEADERS 10
69 appaji-guest 2 #define MAX_REDIR 5
70 phihag-guest 54 #define AXEL_VERSION_STRING "2.2"
71 appaji-guest 2 #define USER_AGENT "Axel " AXEL_VERSION_STRING " (" ARCH ")"
72    
73     typedef struct
74     {
75     void *next;
76     char text[MAX_STRING];
77     } message_t;
78    
79     typedef message_t url_t;
80     typedef message_t if_t;
81    
82     #include "conf.h"
83     #include "tcp.h"
84     #include "ftp.h"
85     #include "http.h"
86     #include "conn.h"
87     #include "search.h"
88    
89     #define min( a, b ) ( (a) < (b) ? (a) : (b) )
90     #define max( a, b ) ( (a) > (b) ? (a) : (b) )
91    
92     typedef struct
93     {
94     conn_t *conn;
95     conf_t conf[1];
96     char filename[MAX_STRING];
97     double start_time;
98     int next_state, finish_time;
99 appaji-guest 25 long long bytes_done, start_byte, size;
100 appaji-guest 2 int bytes_per_second;
101     int delay_time;
102     int outfd;
103     int ready;
104     message_t *message;
105     url_t *url;
106     } axel_t;
107    
108     axel_t *axel_new( conf_t *conf, int count, void *url );
109     int axel_open( axel_t *axel );
110     void axel_start( axel_t *axel );
111     void axel_do( axel_t *axel );
112     void axel_close( axel_t *axel );
113    
114     double gettime();

  ViewVC Help
Powered by ViewVC 1.1.5