source: branches/PublicaMundi_David-devel/zoo-project/zoo-kernel/ulinet.h @ 544

Last change on this file since 544 was 492, checked in by djay, 10 years ago

Inputs passed by reference downloaded in parallel. Conform behavior for DescribeProcess? when the Identifier was not found.

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr
File size: 4.4 KB
Line 
1/**
2 * Author : Gérald FENOY
3 *
4 *  Copyright 2008-2009 GeoLabs SARL. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25#ifndef _ULINET_H
26#define _ULINET_H
27
28#include "fcgi_stdio.h"
29#include "service.h"
30#include <stdlib.h>
31#include <fcntl.h>
32#include <curl/curl.h>
33#ifndef WIN32
34#include <unistd.h>
35#endif
36#include <string.h>
37#include "time.h"
38#ifdef USE_JS
39#ifdef WIN32
40#define XP_WIN 1
41#else
42#define XP_UNIX 0
43#endif
44#include "jsapi.h"
45#endif
46
47#define MAX_REQ 100
48
49#ifdef _ULINET
50static char CCookie[MAX_REQ][1024];
51#else
52extern char HEADER[MAX_REQ][3072];
53extern char CCookie[MAX_REQ][1024];
54#endif
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60  //static pthread_mutex_t hMutexConnect = PTHREAD_MUTEX_INITIALIZER;
61
62static char* waitingRequests[MAX_REQ];
63
64struct MemoryStruct {
65  char *memory;
66  size_t size;
67};
68
69typedef struct {
70  CURL *handle;
71  struct curl_slist *header;
72  char* filename;
73  FILE* file;
74  size_t size;
75  unsigned char *pabyData;
76  unsigned char *mimeType;
77  int hasCacheFile;
78  int nDataLen;
79  int nDataAlloc;
80  int id;
81} _HINTERNET;
82
83typedef struct {
84  CURLM *handle;
85  _HINTERNET ihandle[MAX_REQ];
86  char *waitingRequests[MAX_REQ];
87  char *agent;
88  int nb;
89} HINTERNET;
90
91size_t write_data_into(void *buffer, size_t size, size_t nmemb, void *data);
92
93size_t content_write_data(void *buffer, size_t size, size_t nmemb, void *data);
94
95size_t header_write_data(void *buffer, size_t size, size_t nmemb, void *data);
96
97
98void setProxy(CURL* handle,char* host,long port);
99
100
101#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
102
103#include <CoreServices/CoreServices.h>
104#include <SystemConfiguration/SystemConfiguration.h>
105char* CFStringToCString(CFStringRef dest,char * buffer);
106OSStatus setProxiesForProtcol(CURL* handle,const char *proto);
107
108#else
109
110//#include <gconf/gconf-client.h>
111int setProxiesForProtcol(CURL* handle,const char *proto);
112
113#endif
114
115
116#define INTERNET_OPEN_TYPE_DIRECT                      0
117#define INTERNET_OPEN_TYPE_PRECONFIG                   1
118#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 2
119#define INTERNET_OPEN_TYPE_PROXY                       3
120#ifndef WIN32
121typedef char* LPCTSTR;
122#endif
123HINTERNET InternetOpen(char* lpszAgent,int dwAccessType,char* lpszProxyName,char* lpszProxyBypass,int dwFlags);
124
125void InternetCloseHandle(HINTERNET* handle);
126
127#define INTERNET_FLAG_EXISTING_CONNECT         0
128#define INTERNET_FLAG_HYPERLINK                1
129#define INTERNET_FLAG_IGNORE_CERT_CN_INVALID   2
130#define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID 3
131#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP  4
132#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS 5
133#define INTERNET_FLAG_KEEP_CONNECTION          6
134#define INTERNET_FLAG_NEED_FILE                7
135#define INTERNET_FLAG_NO_AUTH                  8
136#define INTERNET_FLAG_NO_AUTO_REDIRECT         9
137#define INTERNET_FLAG_NO_CACHE_WRITE          10
138//typedef char* LPVOID;
139#ifndef WIN32
140typedef void* LPVOID;
141typedef void* LPTSTR;
142typedef size_t* LPDWORD;
143#endif
144#ifndef bool
145#define bool int
146#endif
147
148#  define CHECK_INET_HANDLE(h) (h.handle != 0)
149
150HINTERNET InternetOpenUrl(HINTERNET* hInternet,LPCTSTR lpszUrl,LPCTSTR lpszHeaders,size_t dwHeadersLength,size_t dwFlags,size_t dwContext);
151
152int processDownloads(HINTERNET* hInternet);
153
154int freeCookieList(HINTERNET hInternet);
155
156int InternetReadFile(_HINTERNET hInternet,LPVOID lpBuffer,int dwNumberOfBytesToRead,size_t *lpdwNumberOfBytesRead);
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif
163
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png