source: branches/branch-1.2/zoo-kernel/ulinet.h

Last change on this file was 301, checked in by djay, 13 years ago

Merge branch-1.2 r268:r296.

File size: 4.1 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 <stdlib.h>
29#include <fcntl.h>
30#include <curl/curl.h>
31#ifndef WIN32
32#include <unistd.h>
33#endif
34#include <string.h>
35#include "time.h"
36#ifdef USE_JS
37#define XP_UNIX 0
38#include "jsapi.h"
39#endif
40
41
42#ifdef _ULINET
43static char CCookie[1024];
44#else
45extern char HEADER[3072];
46extern char CCookie[1024];
47#endif
48
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53  //static pthread_mutex_t hMutexConnect = PTHREAD_MUTEX_INITIALIZER;
54
55struct MemoryStruct {
56  char *memory;
57  size_t size;
58};
59
60typedef struct {
61  CURL *handle;
62  struct curl_slist *header;
63  char* filename;
64  FILE* file;
65  size_t size;
66  int hasCacheFile;
67  int nDataLen;
68  int nDataAlloc;
69  unsigned char *pabyData;
70} HINTERNET;
71
72size_t write_data_into(void *buffer, size_t size, size_t nmemb, void *data);
73
74size_t content_write_data(void *buffer, size_t size, size_t nmemb, void *data);
75
76size_t header_write_data(void *buffer, size_t size, size_t nmemb, void *data);
77
78
79void setProxy(CURL* handle,char* host,long port);
80
81
82#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
83
84#include <CoreServices/CoreServices.h>
85#include <SystemConfiguration/SystemConfiguration.h>
86char* CFStringToCString(CFStringRef dest,char * buffer);
87OSStatus setProxiesForProtcol(CURL* handle,const char *proto);
88
89#else
90
91//#include <gconf/gconf-client.h>
92int setProxiesForProtcol(CURL* handle,const char *proto);
93
94#endif
95
96
97#define INTERNET_OPEN_TYPE_DIRECT                      0
98#define INTERNET_OPEN_TYPE_PRECONFIG                   1
99#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 2
100#define INTERNET_OPEN_TYPE_PROXY                       3
101#ifndef WIN32
102typedef char* LPCTSTR;
103#endif
104HINTERNET InternetOpen(char* lpszAgent,int dwAccessType,char* lpszProxyName,char* lpszProxyBypass,int dwFlags);
105
106void InternetCloseHandle(HINTERNET handle);
107
108#define INTERNET_FLAG_EXISTING_CONNECT         0
109#define INTERNET_FLAG_HYPERLINK                1
110#define INTERNET_FLAG_IGNORE_CERT_CN_INVALID   2
111#define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID 3
112#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP  4
113#define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS 5
114#define INTERNET_FLAG_KEEP_CONNECTION          6
115#define INTERNET_FLAG_NEED_FILE                7
116#define INTERNET_FLAG_NO_AUTH                  8
117#define INTERNET_FLAG_NO_AUTO_REDIRECT         9
118#define INTERNET_FLAG_NO_CACHE_WRITE          10
119//typedef char* LPVOID;
120#ifndef WIN32
121typedef void* LPVOID;
122typedef void* LPTSTR;
123typedef size_t* LPDWORD;
124#endif
125#ifndef bool
126#define bool int
127#endif
128
129#  define CHECK_INET_HANDLE(h) (h.handle != 0)
130
131HINTERNET InternetOpenUrl(HINTERNET hInternet,LPCTSTR lpszUrl,LPCTSTR lpszHeaders,size_t dwHeadersLength,size_t dwFlags,size_t dwContext);
132
133int freeCookieList(HINTERNET hInternet);
134
135int InternetReadFile(HINTERNET hInternet,LPVOID lpBuffer,int dwNumberOfBytesToRead,size_t *lpdwNumberOfBytesRead);
136
137bool InternetGetCookie(LPCTSTR lpszUrl,LPCTSTR lpszCookieName,LPTSTR lpszCookieData,LPDWORD lpdwSize);
138
139#ifdef USE_JS
140JSBool JSRequest(JSContext*, uintN, jsval*);
141#endif
142
143#ifdef __cplusplus
144}
145#endif
146
147#endif
148
Note: See TracBrowser for help on using the repository browser.

Search

Context Navigation

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