00001 00005 /* 00006 Copyright (C) 1997-2001 Id Software, Inc. 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 as published by the Free Software Foundation; either version 2 00011 of the License, or (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 See the GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00023 */ 00024 00025 #ifndef HTTP_H 00026 #define HTTP_H 00027 00028 #include "common.h" 00029 #define CURL_STATICLIB 00030 #include <curl/curl.h> 00031 00032 typedef enum { 00033 DLQ_STATE_NOT_STARTED, 00034 DLQ_STATE_RUNNING, 00035 DLQ_STATE_DONE 00036 } dlq_state; 00037 00038 typedef struct dlqueue_s { 00039 struct dlqueue_s *next; 00040 char ufoPath[MAX_QPATH]; 00041 dlq_state state; 00042 } dlqueue_t; 00043 00044 typedef struct dlhandle_s { 00045 CURL *curl; 00046 char filePath[MAX_OSPATH]; 00047 FILE *file; 00048 dlqueue_t *queueEntry; 00049 size_t fileSize; 00050 size_t position; 00051 double speed; 00052 char URL[576]; 00053 char *tempBuffer; 00054 } dlhandle_t; 00055 00056 char* HTTP_GetURL(const char *url); 00057 size_t HTTP_Recv(void *ptr, size_t size, size_t nmemb, void *stream); 00058 size_t HTTP_Header(void *ptr, size_t size, size_t nmemb, void *stream); 00059 void HTTP_Cleanup(void); 00060 00061 #endif /* HTTP_H */