Curl Scol plugin
scolplugin.cpp
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
25/*
26 CURL interface for Scol
27 First version : August 2012
28 Author : Bastien BOURINEAU - I-Maginer
29*/
30
31#include "sCurl.h"
32#include <scolMemoryHelper.hpp>
33
35#ifdef SCOL_STATIC
36extern cbmachine ww;
37extern mmachine mm;
38#else
39cbmachine ww;
40mmachine mm;
41#endif
42
43int OBJCURLSCOL;
44int CURL_DATA_CB;
45int SCOL_CURL_DATA_CB = 0;
46
68int destroyCurlObj(mmachine m, SCOL_PTR_TYPE handsys, int handscol) {
69 // Read the first element of a TAB element (table of object)
70 SCurl* curlobj = MMgetPointer<SCurl*>(m, MTOP(handscol));
71 SAFE_DELETE(curlobj);
72
73 MMsetPointer<SCurl*>(m, MTOP(handscol), 0);
74
75 // Display debug message
76 MMechostr(MSKDEBUG, "ObjCURL destroyed.\n");
77 return 0;
78}
79
80
90int _CRcurlRequest(mmachine m)
91{
92#ifdef SCOL_DEBUG
93 MMechostr(0, "_CRcurlRequest\n");
94#endif
95 // Declare local variables
96 int k = 0;
97
98 int sUrl = MMpull(m);
99
100 // Get the channel without pulling it (first element in the stack)
101 int channel = MMget(m, 0);
102
103 // Test the channel
104 if (channel == NIL || sUrl == NIL)
105 {
106 MMechostr(MSKDEBUG, "Channel NIL\n");
107 MMset(m, 0, NIL);
108 return 0;
109 }
110
111 std::string url = MMstartstr(m, MTOP(sUrl));
112 if (!SCurl::CheckUrl(url))
113 {
114 MMechostr(MSKDEBUG, "curlobj failed, bad url\n");
115 MMset(m, 0, NIL);
116 return 0;
117 }
118
119 SCurl* curlobj = new SCurl(url);
120 if (curlobj == NULL)
121 {
122 MMechostr(MSKDEBUG,"curlobj failed\n");
123 SAFE_DELETE(curlobj);
124 MMset(m, 0, NIL);
125 return 0;
126 }
127
128 //set proxy
129 std::string httpProxy = (char*)SCgetExtra("HTTPproxy");
130 if (!httpProxy.empty() && httpProxy != "no")
131 {
132 std::string proxy = "http://";
133 proxy.append(httpProxy);
134 curlobj->SetOption(CURLOPT_PROXY, proxy);
135 }
136
137 // Allocate a space in the stack for a table of joypad object
138 if ((MMpushPointer(m, curlobj) != 0))
139 {
140 SAFE_DELETE(curlobj);
141 MMset(m, 0, NIL);
142 return MERRMEM;
143 }
144
145 // Create a new scol joypad object
146 k = OBJcreate(m, OBJCURLSCOL, SCOL_PTR curlobj, 0, 0);
147
148#ifdef SCOL_DEBUG
149 MMechostr(MSKDEBUG, "ok\n");
150#endif
151
152 return k;
153}
154
162int _KILLcurlRequest(mmachine m)
163{
164#ifdef SCOL_DEBUG
165 MMechostr(MSKDEBUG, "_KILLcurlRequest\n");
166#endif
167
168 int curlTab = MMget(m, 0);
169 if (curlTab == NIL)
170 {
171 MMset(m, 0, NIL);
172 return 0;
173 }
174
175 OBJdelTM(m, OBJCURLSCOL, curlTab);
176 MMset(m, 0, ITOM(0));
177
178#ifdef SCOL_DEBUG
179 MMechostr(MSKDEBUG, "ok\n");
180#endif
181 return 0;
182}
183
193int _CALLcurlRequest(mmachine m)
194{
195#ifdef SCOL_DEBUG
196 MMechostr(MSKDEBUG, "_CALLcurlRequest\n");
197#endif
198
199 int curlTab = MMget(m, 2);
200 if (curlTab == NIL)
201 {
202 SEDROP(m, 2);
203 MMset(m, 0, NIL);
204 return 0;
205 }
206
207 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
208 if (curlObject == NULL)
209 {
210 SEDROP(m, 2);
211 MMset(m, 0, NIL);
212 return 0;
213 }
214
215 OBJaddreflex(m, OBJCURLSCOL, SCOL_CURL_DATA_CB);
216
217 curlObject->CallAsync();
218
219#ifdef SCOL_DEBUG
220 MMechostr(MSKDEBUG, "ok\n");
221#endif
222 return 0;
223}
224
234int _CALLcurlRequestSync(mmachine m)
235{
236#ifdef SCOL_DEBUG
237 MMechostr(MSKDEBUG, "_CALLcurlRequestSync\n");
238#endif
239
240 int curlTab = MMget(m, 2);
241 if (curlTab == NIL)
242 {
243 SEDROP(m, 2);
244 MMset(m, 0, NIL);
245 return 0;
246 }
247
248 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
249 if (curlObject == NULL)
250 {
251 SEDROP(m, 2);
252 MMset(m, 0, NIL);
253 return 0;
254 }
255
256 OBJaddreflex(m, OBJCURLSCOL, SCOL_CURL_DATA_CB);
257
258 curlObject->CallSync();
259
260#ifdef SCOL_DEBUG
261 MMechostr(MSKDEBUG, "ok\n");
262#endif
263 return 0;
264}
265
274{
275#ifdef SCOL_DEBUG
276 MMechostr(MSKDEBUG, "_SETcurlRequestHeader\n");
277#endif
278
279 int lhead = MMpull(m);
280 int curlTab = MMget(m, 0);
281 if (curlTab == NIL || lhead == NIL)
282 {
283 MMset(m, 0, NIL);
284 return 0;
285 }
286
287 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
288 if (curlObject == NULL)
289 {
290 MMset(m, 0, NIL);
291 return 0;
292 }
293
294 lhead = MTOP(lhead);
295 std::vector<std::string> headers;
296
297 while(lhead != NIL)
298 {
299 std::string sheader(MMstartstr(m, MTOP(MMfetch(m, lhead, 0))));
300 headers.push_back(sheader);
301 lhead = MTOP(MMfetch(m, lhead, 1));
302 }
303
304 curlObject->SetHeader(headers);
305
306#ifdef SCOL_DEBUG
307 MMechostr(MSKDEBUG, "ok\n");
308#endif
309 return 0;
310}
311
320int _SETcurlOption(mmachine m)
321{
322#ifdef SCOL_DEBUG
323 MMechostr(MSKDEBUG, "_SETcurlOption\n");
324#endif
325
326 int ivalue = MMpull(m);
327 int ioption = MMpull(m);
328 int curlTab = MMget(m, 0);
329 if (curlTab == NIL || ioption == NIL)
330 {
331 MMset(m, 0, NIL);
332 return 0;
333 }
334
335 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
336 if (curlObject == NULL)
337 {
338 MMset(m, 0, NIL);
339 return 0;
340 }
341
342 ioption = MTOI(ioption);
343 ivalue = MTOI(ivalue);
344
345 curlObject->SetOption((CURLoption)ioption, ivalue);
346
347#ifdef SCOL_DEBUG
348 MMechostr(MSKDEBUG, "ok\n");
349#endif
350 return 0;
351}
352
361int _SETcurlOptionList(mmachine m)
362{
363#ifdef SCOL_DEBUG
364 MMechostr(MSKDEBUG, "_SETcurlOptionList\n");
365#endif
366
367 int lvalue = MMpull(m);
368 int ioption = MMpull(m);
369 int curlTab = MMget(m, 0);
370 if (curlTab == NIL || ioption == NIL)
371 {
372 MMset(m, 0, NIL);
373 return 0;
374 }
375
376 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
377 if (curlObject == NULL)
378 {
379 MMset(m, 0, NIL);
380 return 0;
381 }
382
383 ioption = MTOI(ioption);
384 lvalue = MTOP(lvalue);
385 std::vector<std::string> values;
386
387 while(lvalue != NIL)
388 {
389 std::string svalue(MMstartstr(m, MTOP(MMfetch(m, lvalue, 0))));
390 values.push_back(svalue);
391 lvalue = MTOP(MMfetch(m, lvalue, 1));
392 }
393
394 curlObject->SetOption((CURLoption)ioption, values);
395
396#ifdef SCOL_DEBUG
397 MMechostr(MSKDEBUG, "ok\n");
398#endif
399 return 0;
400}
401
410int _SETcurlOptionS(mmachine m)
411{
412#ifdef SCOL_DEBUG
413 MMechostr(MSKDEBUG, "_SETcurlOptionS\n");
414#endif
415
416 int ivalue = MMpull(m);
417 int ioption = MMpull(m);
418 int curlTab = MMget(m, 0);
419 if (curlTab == NIL || ioption == NIL)
420 {
421 MMset(m, 0, NIL);
422 return 0;
423 }
424
425 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
426 if (curlObject == NULL)
427 {
428 MMset(m, 0, NIL);
429 return 0;
430 }
431
432 ioption = MTOI(ioption);
433 ivalue = MTOP(ivalue);
434
435 if (ioption == CURLOPT_UPLOAD)
436 {
437 int msize = MMsizestr(m, ivalue);
438 char* smess = (char*)MMstart(m, (ivalue)+1);
439 curlObject->SetOption((CURLoption)ioption, smess, msize);
440 }
441 else
442 {
443 std::string value = MMstartstr(m, ivalue);
444 curlObject->SetOption((CURLoption)ioption, value);
445 }
446
447#ifdef SCOL_DEBUG
448 MMechostr(MSKDEBUG, "ok\n");
449#endif
450 return 0;
451}
452
461int _SETcurlOptionFile(mmachine m)
462{
463#ifdef SCOL_DEBUG
464 MMechostr(MSKDEBUG, "_SETcurlOptionFile\n");
465#endif
466
467 int ivalue = MMpull(m);
468 int ioption = MMpull(m);
469 int curlTab = MMget(m, 0);
470 if (curlTab == NIL || ioption == NIL)
471 {
472 MMset(m, 0, NIL);
473 return 0;
474 }
475
476 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
477 if (curlObject == NULL)
478 {
479 MMset(m, 0, NIL);
480 return 0;
481 }
482
483 ioption = MTOI(ioption);
484 std::string value = MMstartstr(m, MTOP(ivalue));
485
486 curlObject->SetOption((CURLoption)ioption, value);
487
488#ifdef SCOL_DEBUG
489 MMechostr(MSKDEBUG, "ok\n");
490#endif
491 return 0;
492}
493
502int _ADDcurlFormField(mmachine m)
503{
504#ifdef SCOL_DEBUG
505 MMechostr(MSKDEBUG, "_ADDcurlFormField\n");
506#endif
507
508 int ivalue = MMpull(m);
509 int iname = MMpull(m);
510 int curlTab = MMget(m, 0);
511 if (curlTab == NIL || iname == NIL)
512 {
513 MMset(m, 0, NIL);
514 return 0;
515 }
516
517 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
518 if (curlObject == NULL)
519 {
520 MMset(m, 0, NIL);
521 return 0;
522 }
523
524 std::string name = MMstartstr(m, MTOP(iname));
525 std::string value = MMstartstr(m, MTOP(ivalue));
526
527 curlObject->AddFormField(name, value, false);
528
529#ifdef SCOL_DEBUG
530 MMechostr(MSKDEBUG, "ok\n");
531#endif
532 return 0;
533}
534
544{
545#ifdef SCOL_DEBUG
546 MMechostr(MSKDEBUG, "_ADDcurlFileFormField\n");
547#endif
548
549 int ivalue = MMpull(m);
550 int iname = MMpull(m);
551 int curlTab = MMget(m, 0);
552 if (curlTab == NIL || iname == NIL)
553 {
554 MMset(m, 0, NIL);
555 return 0;
556 }
557
558 SCurl* curlObject = MMgetPointer<SCurl*>(m, MTOP(curlTab));
559 if (curlObject == NULL)
560 {
561 MMset(m, 0, NIL);
562 return 0;
563 }
564
565 std::string name = MMstartstr(m, MTOP(iname));
566 std::string value = MMstartstr(m, MTOP(ivalue));
567
568 curlObject->AddFormField(name, value, true);
569
570#ifdef SCOL_DEBUG
571 MMechostr(MSKDEBUG, "ok\n");
572#endif
573 return 0;
574}
575
579int getCURLDataCb(mmachine m, SCOL_PTR_TYPE wParam, SCOL_PTR_TYPE lParam)
580{
581 SCurl* curlObj = (SCurl*) wParam;
582 SCbData* curlData = (SCbData*) lParam;
583
584 //call the scol callback
585 if (OBJbeginreflex(m, OBJCURLSCOL, SCOL_PTR curlObj, SCOL_CURL_DATA_CB))
586 {
587 MMechostr(MSKDEBUG, "ObjCurl callback not found\n");
588
589 if (curlData->code != -1)
590 OBJdelTH(m, OBJCURLSCOL, wParam);
591 return 0;
592 }
593
594 // push the buffer
595 int res = MMmalloc(m, STR_SIZE(curlData->size), TYPEBUF);
596 if (res == NIL)
597 {
598 MMset(m, 0, NIL);
599 return MERRMEM;
600 }
601
602 MMstore(m, res, 0, curlData->size);
603 char* BS = MMstartstr(m, res);
604 memcpy(BS, curlData->data, curlData->size);
605 BS[curlData->size] = 0;
606 MMpush(m, PTOM(res));
607
608 MMpush(m, ITOM(curlData->code));
609
610 //destroy the object
611 if (curlData->code != -1)
612 OBJdelTH(m, OBJCURLSCOL, wParam);
613
614 // Call reflex previously defined
615 int k = OBJcallreflex(m, 2 /*nb param after obj and u0*/);
616
617 // free data
618 delete(curlData);
619 return k;
620}
621
625char* mCURLname[]=
626{
627 "ObjCURL",
628
629 /*CURL options*/
630 "CURLOPT_VERBOSE", "CURLOPT_HEADER", "CURLOPT_NOPROGRESS", "CURLOPT_NOSIGNAL", "CURLOPT_WILDCARDMATCH",
631 "CURLOPT_ERRORBUFFER", "CURLOPT_FAILONERROR", "CURLOPT_URL", "CURLOPT_PROTOCOLS", "CURLOPT_REDIR_PROTOCOLS",
632 "CURLOPT_PROXY", "CURLOPT_PROXYPORT", "CURLOPT_PROXYTYPE", "CURLOPT_NOPROXY", "CURLOPT_HTTPPROXYTUNNEL",
633 "CURLOPT_SOCKS5_GSSAPI_SERVICE", "CURLOPT_SOCKS5_GSSAPI_NEC", "CURLOPT_INTERFACE", "CURLOPT_LOCALPORT",
634 "CURLOPT_LOCALPORTRANGE", "CURLOPT_DNS_CACHE_TIMEOUT", "CURLOPT_DNS_USE_GLOBAL_CACHE", "CURLOPT_BUFFERSIZE",
635 "CURLOPT_PORT", "CURLOPT_TCP_NODELAY", "CURLOPT_ADDRESS_SCOPE", "CURLOPT_TCP_KEEPALIVE", "CURLOPT_TCP_KEEPIDLE",
636 "CURLOPT_TCP_KEEPINTVL", "CURLOPT_NETRC", "CURL_NETRC_OPTIONAL", "CURL_NETRC_IGNORED", "CURL_NETRC_REQUIRED",
637 "CURLOPT_NETRC_FILE", "CURLOPT_USERPWD", "CURLOPT_PROXYUSERPWD", "CURLOPT_USERNAME", "CURLOPT_PASSWORD", "CURLOPT_PROXYUSERNAME",
638 "CURLOPT_PROXYPASSWORD", "CURLOPT_HTTPAUTH", "CURLAUTH_BASIC", "CURLAUTH_DIGEST", "CURLAUTH_DIGEST_IE", "CURLAUTH_GSSNEGOTIATE",
639 "CURLAUTH_NTLM", "CURLAUTH_NTLM_WB", "CURLAUTH_ANY", "CURLAUTH_ANYSAFE", "CURLAUTH_ONLY", "CURLOPT_TLSAUTH_TYPE",
640 "CURLOPT_TLSAUTH_USERNAME", "CURLOPT_TLSAUTH_PASSWORD", "CURLOPT_PROXYAUTH", "CURLOPT_AUTOREFERER", "CURLOPT_ACCEPT_ENCODING",
641 "CURLOPT_TRANSFER_ENCODING", "CURLOPT_FOLLOWLOCATION", "CURLOPT_UNRESTRICTED_AUTH", "CURLOPT_MAXREDIRS", "CURLOPT_POSTREDIR",
642 "CURL_REDIR_POST_301", "CURL_REDIR_POST_302", "CURL_REDIR_POST_303", "CURL_REDIR_POST_ALL", "CURLOPT_PUT", "CURLOPT_POST",
643 "CURLOPT_POSTFIELDS", "CURLOPT_POSTFIELDSIZE", "CURLOPT_POSTFIELDSIZE_LARGE", "CURLOPT_COPYPOSTFIELDS", "CURLOPT_HTTPPOST",
644 "CURLOPT_REFERER", "CURLOPT_USERAGENT", "CURLOPT_HTTPHEADER", "CURLOPT_HTTP200ALIASES", "CURLOPT_COOKIE", "CURLOPT_COOKIEFILE",
645 "CURLOPT_COOKIEJAR", "CURLOPT_COOKIESESSION", "CURLOPT_COOKIELIST", "CURLOPT_HTTPGET", "CURLOPT_HTTP_VERSION", "CURL_HTTP_VERSION_NONE",
646 "CURL_HTTP_VERSION_1_0", "CURL_HTTP_VERSION_1_1", "CURLOPT_IGNORE_CONTENT_LENGTH", "CURLOPT_HTTP_CONTENT_DECODING", "CURLOPT_HTTP_TRANSFER_DECODING",
647 "CURLOPT_MAIL_FROM", "CURLOPT_MAIL_RCPT", "CURLOPT_MAIL_AUTH", "CURLOPT_TFTP_BLKSIZE", "CURLOPT_FTPPORT", "CURLOPT_QUOTE", "CURLOPT_POSTQUOTE",
648 "CURLOPT_PREQUOTE", "CURLOPT_DIRLISTONLY", "CURLOPT_APPEND", "CURLOPT_FTP_USE_EPRT", "CURLOPT_FTP_USE_EPSV", "CURLOPT_FTP_USE_PRET", "CURLOPT_FTP_CREATE_MISSING_DIRS",
649 "CURLOPT_FTP_RESPONSE_TIMEOUT", "CURLOPT_FTP_ALTERNATIVE_TO_USER", "CURLOPT_FTP_SKIP_PASV_IP", "CURLOPT_FTPSSLAUTH", "CURLFTPAUTH_DEFAULT",
650 "CURLFTPAUTH_SSL", "CURLFTPAUTH_TLS", "CURLOPT_FTP_SSL_CCC", "CURLFTPSSL_CCC_NONE", "CURLFTPSSL_CCC_PASSIVE", "CURLFTPSSL_CCC_ACTIVE",
651 "CURLOPT_FTP_ACCOUNT", "CURLOPT_FTP_FILEMETHOD", "CURLFTPMETHOD_MULTICWD", "CURLFTPMETHOD_NOCWD", "CURLFTPMETHOD_SINGLECWD", "CURLOPT_RTSP_REQUEST",
652 "CURL_RTSPREQ_OPTIONS", "CURL_RTSPREQ_DESCRIBE", "CURL_RTSPREQ_ANNOUNCE", "CURL_RTSPREQ_SETUP", "CURL_RTSPREQ_PLAY", "CURL_RTSPREQ_PAUSE", "CURL_RTSPREQ_TEARDOWN",
653 "CURL_RTSPREQ_GET_PARAMETER", "CURL_RTSPREQ_SET_PARAMETER", "CURL_RTSPREQ_RECORD", "CURL_RTSPREQ_RECEIVE", "CURLOPT_RTSP_SESSION_ID",
654 "CURLOPT_RTSP_STREAM_URI", "CURLOPT_RTSP_TRANSPORT", "CURLOPT_RTSP_CLIENT_CSEQ", "CURLOPT_RTSP_SERVER_CSEQ",
655 "CURLOPT_TRANSFERTEXT", "CURLOPT_PROXY_TRANSFER_MODE", "CURLOPT_CRLF", "CURLOPT_RANGE", "CURLOPT_RESUME_FROM", "CURLOPT_RESUME_FROM_LARGE",
656 "CURLOPT_CUSTOMREQUEST", "CURLOPT_FILETIME", "CURLOPT_NOBODY", "CURLOPT_INFILESIZE", "CURLOPT_INFILESIZE_LARGE", "CURLOPT_UPLOAD",
657 "CURLOPT_MAXFILESIZE", "CURLOPT_MAXFILESIZE_LARGE", "CURLOPT_TIMECONDITION", "CURLOPT_TIMEVALUE", "CURLOPT_TIMEOUT", "CURLOPT_TIMEOUT_MS",
658 "CURLOPT_LOW_SPEED_LIMIT", "CURLOPT_LOW_SPEED_TIME", "CURLOPT_MAX_SEND_SPEED_LARGE", "CURLOPT_MAX_RECV_SPEED_LARGE", "CURLOPT_MAXCONNECTS",
659 "CURLOPT_CLOSEPOLICY", "CURLOPT_FRESH_CONNECT", "CURLOPT_FORBID_REUSE", "CURLOPT_CONNECTTIMEOUT", "CURLOPT_CONNECTTIMEOUT_MS",
660 "CURLOPT_IPRESOLVE", "CURL_IPRESOLVE_WHATEVER", "CURL_IPRESOLVE_V4", "CURL_IPRESOLVE_V6", "CURLOPT_CONNECT_ONLY", "CURLOPT_USE_SSL",
661 "CURLUSESSL_NONE", "CURLUSESSL_TRY", "CURLUSESSL_CONTROL", "CURLUSESSL_ALL", "CURLOPT_RESOLVE", "CURLOPT_DNS_SERVERS",
662 "CURLOPT_ACCEPTTIMEOUT_MS", "CURLOPT_SSLCERT", "CURLOPT_SSLCERTTYPE", "CURLOPT_SSLKEY", "CURLOPT_SSLKEYTYPE", "CURLOPT_KEYPASSWD",
663 "CURLOPT_SSLENGINE", "CURLOPT_SSLENGINE_DEFAULT", "CURLOPT_SSLVERSION", "CURL_SSLVERSION_DEFAULT", "CURL_SSLVERSION_TLSv1", "CURL_SSLVERSION_SSLv2",
664 "CURL_SSLVERSION_SSLv3", "CURLOPT_SSL_VERIFYPEER", "CURLOPT_CAINFO", "CURLOPT_ISSUERCERT", "CURLOPT_CAPATH", "CURLOPT_CRLFILE", "CURLOPT_SSL_VERIFYHOST",
665 "CURLOPT_CERTINFO", "CURLOPT_RANDOM_FILE", "CURLOPT_EGDSOCKET", "CURLOPT_SSL_CIPHER_LIST", "CURLOPT_SSL_SESSIONID_CACHE", "CURLOPT_SSL_OPTIONS",
666 "CURLSSLOPT_ALLOW_BEAST", "CURLOPT_KRBLEVEL", "CURLOPT_GSSAPI_DELEGATION", "CURLOPT_SSH_AUTH_TYPES", "CURLSSH_AUTH_PUBLICKEY", "CURLSSH_AUTH_PASSWORD",
667 "CURLSSH_AUTH_HOST", "CURLSSH_AUTH_KEYBOARD", "CURLSSH_AUTH_ANY", "CURLOPT_SSH_HOST_PUBLIC_KEY_MD5", "CURLOPT_SSH_PUBLIC_KEYFILE",
668 "CURLOPT_SSH_PRIVATE_KEYFILE", "CURLOPT_SSH_KNOWNHOSTS", "CURLOPT_NEW_FILE_PERMS", "CURLOPT_NEW_DIRECTORY_PERMS", "CURLOPT_TELNETOPTIONS",
669
670 "_CRcurlRequest",
671 "_KILLcurlRequest",
672 "_CALLcurlRequest",
673 "_CALLcurlRequestSync",
674 "_SETcurlRequestHeader",
675 "_SETcurlOption",
676 "_SETcurlOptionList",
677 "_SETcurlOptionS",
678 "_SETcurlOptionFile",
679 "_ADDcurlFormField",
680 "_ADDcurlFileFormField"
681};
682
686#define NCURLPKG (sizeof(mCURLname)/sizeof(char*))
687
691int (*mCURLfun[NCURLPKG])(mmachine m)=
692{
693 NULL, //ObjCURL
694
695 /*CURL options*/
696 SCOL_TYPTYPE(CURLOPT_VERBOSE), SCOL_TYPTYPE(CURLOPT_HEADER), SCOL_TYPTYPE(CURLOPT_NOPROGRESS), SCOL_TYPTYPE(CURLOPT_NOSIGNAL), SCOL_TYPTYPE(CURLOPT_WILDCARDMATCH),
697 SCOL_TYPTYPE(CURLOPT_ERRORBUFFER), SCOL_TYPTYPE(CURLOPT_FAILONERROR), SCOL_TYPTYPE(CURLOPT_URL), SCOL_TYPTYPE(CURLOPT_PROTOCOLS), SCOL_TYPTYPE(CURLOPT_REDIR_PROTOCOLS),
698 SCOL_TYPTYPE(CURLOPT_PROXY), SCOL_TYPTYPE(CURLOPT_PROXYPORT), SCOL_TYPTYPE(CURLOPT_PROXYTYPE), SCOL_TYPTYPE(CURLOPT_NOPROXY), SCOL_TYPTYPE(CURLOPT_HTTPPROXYTUNNEL),
699 SCOL_TYPTYPE(CURLOPT_SOCKS5_GSSAPI_SERVICE), SCOL_TYPTYPE(CURLOPT_SOCKS5_GSSAPI_NEC), SCOL_TYPTYPE(CURLOPT_INTERFACE), SCOL_TYPTYPE(CURLOPT_LOCALPORT),
700 SCOL_TYPTYPE(CURLOPT_LOCALPORTRANGE), SCOL_TYPTYPE(CURLOPT_DNS_CACHE_TIMEOUT), SCOL_TYPTYPE(CURLOPT_DNS_USE_GLOBAL_CACHE), SCOL_TYPTYPE(CURLOPT_BUFFERSIZE),
701 SCOL_TYPTYPE(CURLOPT_PORT), SCOL_TYPTYPE(CURLOPT_TCP_NODELAY), SCOL_TYPTYPE(CURLOPT_ADDRESS_SCOPE), SCOL_TYPTYPE(CURLOPT_TCP_KEEPALIVE), SCOL_TYPTYPE(CURLOPT_TCP_KEEPIDLE),
702 SCOL_TYPTYPE(CURLOPT_TCP_KEEPINTVL), SCOL_TYPTYPE(CURLOPT_NETRC), SCOL_TYPTYPE(CURL_NETRC_OPTIONAL), SCOL_TYPTYPE(CURL_NETRC_IGNORED), SCOL_TYPTYPE(CURL_NETRC_REQUIRED),
703 SCOL_TYPTYPE(CURLOPT_NETRC_FILE), SCOL_TYPTYPE(CURLOPT_USERPWD), SCOL_TYPTYPE(CURLOPT_PROXYUSERPWD), SCOL_TYPTYPE(CURLOPT_USERNAME), SCOL_TYPTYPE(CURLOPT_PASSWORD), SCOL_TYPTYPE(CURLOPT_PROXYUSERNAME),
704 SCOL_TYPTYPE(CURLOPT_PROXYPASSWORD), SCOL_TYPTYPE(CURLOPT_HTTPAUTH), SCOL_TYPTYPE(CURLAUTH_BASIC), SCOL_TYPTYPE(CURLAUTH_DIGEST), SCOL_TYPTYPE(CURLAUTH_DIGEST_IE), SCOL_TYPTYPE(CURLAUTH_GSSNEGOTIATE),
705 SCOL_TYPTYPE(CURLAUTH_NTLM), SCOL_TYPTYPE(CURLAUTH_NTLM_WB), SCOL_TYPTYPE(CURLAUTH_ANY), SCOL_TYPTYPE(CURLAUTH_ANYSAFE), SCOL_TYPTYPE(CURLAUTH_ONLY), SCOL_TYPTYPE(CURLOPT_TLSAUTH_TYPE),
706 SCOL_TYPTYPE(CURLOPT_TLSAUTH_USERNAME), SCOL_TYPTYPE(CURLOPT_TLSAUTH_PASSWORD), SCOL_TYPTYPE(CURLOPT_PROXYAUTH), SCOL_TYPTYPE(CURLOPT_AUTOREFERER), SCOL_TYPTYPE(CURLOPT_ACCEPT_ENCODING),
707 SCOL_TYPTYPE(CURLOPT_TRANSFER_ENCODING), SCOL_TYPTYPE(CURLOPT_FOLLOWLOCATION), SCOL_TYPTYPE(CURLOPT_UNRESTRICTED_AUTH), SCOL_TYPTYPE(CURLOPT_MAXREDIRS), SCOL_TYPTYPE(CURLOPT_POSTREDIR),
708 SCOL_TYPTYPE(CURL_REDIR_POST_301), SCOL_TYPTYPE(CURL_REDIR_POST_302), SCOL_TYPTYPE(CURL_REDIR_POST_303), SCOL_TYPTYPE(CURL_REDIR_POST_ALL), SCOL_TYPTYPE(CURLOPT_PUT), SCOL_TYPTYPE(CURLOPT_POST),
709 SCOL_TYPTYPE(CURLOPT_POSTFIELDS), SCOL_TYPTYPE(CURLOPT_POSTFIELDSIZE), SCOL_TYPTYPE(CURLOPT_POSTFIELDSIZE_LARGE), SCOL_TYPTYPE(CURLOPT_COPYPOSTFIELDS), SCOL_TYPTYPE(CURLOPT_HTTPPOST),
710 SCOL_TYPTYPE(CURLOPT_REFERER), SCOL_TYPTYPE(CURLOPT_USERAGENT), SCOL_TYPTYPE(CURLOPT_HTTPHEADER), SCOL_TYPTYPE(CURLOPT_HTTP200ALIASES), SCOL_TYPTYPE(CURLOPT_COOKIE), SCOL_TYPTYPE(CURLOPT_COOKIEFILE),
711 SCOL_TYPTYPE(CURLOPT_COOKIEJAR), SCOL_TYPTYPE(CURLOPT_COOKIESESSION), SCOL_TYPTYPE(CURLOPT_COOKIELIST), SCOL_TYPTYPE(CURLOPT_HTTPGET), SCOL_TYPTYPE(CURLOPT_HTTP_VERSION), SCOL_TYPTYPE(CURL_HTTP_VERSION_NONE),
712 SCOL_TYPTYPE(CURL_HTTP_VERSION_1_0), SCOL_TYPTYPE(CURL_HTTP_VERSION_1_1), SCOL_TYPTYPE(CURLOPT_IGNORE_CONTENT_LENGTH), SCOL_TYPTYPE(CURLOPT_HTTP_CONTENT_DECODING), SCOL_TYPTYPE(CURLOPT_HTTP_TRANSFER_DECODING),
713 SCOL_TYPTYPE(CURLOPT_MAIL_FROM), SCOL_TYPTYPE(CURLOPT_MAIL_RCPT), SCOL_TYPTYPE(CURLOPT_MAIL_AUTH), SCOL_TYPTYPE(CURLOPT_TFTP_BLKSIZE), SCOL_TYPTYPE(CURLOPT_FTPPORT), SCOL_TYPTYPE(CURLOPT_QUOTE), SCOL_TYPTYPE(CURLOPT_POSTQUOTE),
714 SCOL_TYPTYPE(CURLOPT_PREQUOTE), SCOL_TYPTYPE(CURLOPT_DIRLISTONLY), SCOL_TYPTYPE(CURLOPT_APPEND), SCOL_TYPTYPE(CURLOPT_FTP_USE_EPRT), SCOL_TYPTYPE(CURLOPT_FTP_USE_EPSV), SCOL_TYPTYPE(CURLOPT_FTP_USE_PRET), SCOL_TYPTYPE(CURLOPT_FTP_CREATE_MISSING_DIRS),
715 SCOL_TYPTYPE(CURLOPT_FTP_RESPONSE_TIMEOUT), SCOL_TYPTYPE(CURLOPT_FTP_ALTERNATIVE_TO_USER), SCOL_TYPTYPE(CURLOPT_FTP_SKIP_PASV_IP), SCOL_TYPTYPE(CURLOPT_FTPSSLAUTH), SCOL_TYPTYPE(CURLFTPAUTH_DEFAULT),
716 SCOL_TYPTYPE(CURLFTPAUTH_SSL), SCOL_TYPTYPE(CURLFTPAUTH_TLS), SCOL_TYPTYPE(CURLOPT_FTP_SSL_CCC), SCOL_TYPTYPE(CURLFTPSSL_CCC_NONE), SCOL_TYPTYPE(CURLFTPSSL_CCC_PASSIVE), SCOL_TYPTYPE(CURLFTPSSL_CCC_ACTIVE),
717 SCOL_TYPTYPE(CURLOPT_FTP_ACCOUNT), SCOL_TYPTYPE(CURLOPT_FTP_FILEMETHOD), SCOL_TYPTYPE(CURLFTPMETHOD_MULTICWD), SCOL_TYPTYPE(CURLFTPMETHOD_NOCWD), SCOL_TYPTYPE(CURLFTPMETHOD_SINGLECWD), SCOL_TYPTYPE(CURLOPT_RTSP_REQUEST),
718 SCOL_TYPTYPE(CURL_RTSPREQ_OPTIONS), SCOL_TYPTYPE(CURL_RTSPREQ_DESCRIBE), SCOL_TYPTYPE(CURL_RTSPREQ_ANNOUNCE), SCOL_TYPTYPE(CURL_RTSPREQ_SETUP), SCOL_TYPTYPE(CURL_RTSPREQ_PLAY), SCOL_TYPTYPE(CURL_RTSPREQ_PAUSE), SCOL_TYPTYPE(CURL_RTSPREQ_TEARDOWN),
719 SCOL_TYPTYPE(CURL_RTSPREQ_GET_PARAMETER), SCOL_TYPTYPE(CURL_RTSPREQ_SET_PARAMETER), SCOL_TYPTYPE(CURL_RTSPREQ_RECORD), SCOL_TYPTYPE(CURL_RTSPREQ_RECEIVE), SCOL_TYPTYPE(CURLOPT_RTSP_SESSION_ID),
720 SCOL_TYPTYPE(CURLOPT_RTSP_STREAM_URI), SCOL_TYPTYPE(CURLOPT_RTSP_TRANSPORT), SCOL_TYPTYPE(CURLOPT_RTSP_CLIENT_CSEQ), SCOL_TYPTYPE(CURLOPT_RTSP_SERVER_CSEQ),
721 SCOL_TYPTYPE(CURLOPT_TRANSFERTEXT), SCOL_TYPTYPE(CURLOPT_PROXY_TRANSFER_MODE), SCOL_TYPTYPE(CURLOPT_CRLF), SCOL_TYPTYPE(CURLOPT_RANGE), SCOL_TYPTYPE(CURLOPT_RESUME_FROM), SCOL_TYPTYPE(CURLOPT_RESUME_FROM_LARGE),
722 SCOL_TYPTYPE(CURLOPT_CUSTOMREQUEST), SCOL_TYPTYPE(CURLOPT_FILETIME), SCOL_TYPTYPE(CURLOPT_NOBODY), SCOL_TYPTYPE(CURLOPT_INFILESIZE), SCOL_TYPTYPE(CURLOPT_INFILESIZE_LARGE), SCOL_TYPTYPE(CURLOPT_UPLOAD),
723 SCOL_TYPTYPE(CURLOPT_MAXFILESIZE), SCOL_TYPTYPE(CURLOPT_MAXFILESIZE_LARGE), SCOL_TYPTYPE(CURLOPT_TIMECONDITION), SCOL_TYPTYPE(CURLOPT_TIMEVALUE), SCOL_TYPTYPE(CURLOPT_TIMEOUT), SCOL_TYPTYPE(CURLOPT_TIMEOUT_MS),
724 SCOL_TYPTYPE(CURLOPT_LOW_SPEED_LIMIT), SCOL_TYPTYPE(CURLOPT_LOW_SPEED_TIME), SCOL_TYPTYPE(CURLOPT_MAX_SEND_SPEED_LARGE), SCOL_TYPTYPE(CURLOPT_MAX_RECV_SPEED_LARGE), SCOL_TYPTYPE(CURLOPT_MAXCONNECTS),
725 SCOL_TYPTYPE(CURLOPT_CLOSEPOLICY), SCOL_TYPTYPE(CURLOPT_FRESH_CONNECT), SCOL_TYPTYPE(CURLOPT_FORBID_REUSE), SCOL_TYPTYPE(CURLOPT_CONNECTTIMEOUT), SCOL_TYPTYPE(CURLOPT_CONNECTTIMEOUT_MS),
726 SCOL_TYPTYPE(CURLOPT_IPRESOLVE), SCOL_TYPTYPE(CURL_IPRESOLVE_WHATEVER), SCOL_TYPTYPE(CURL_IPRESOLVE_V4), SCOL_TYPTYPE(CURL_IPRESOLVE_V6), SCOL_TYPTYPE(CURLOPT_CONNECT_ONLY), SCOL_TYPTYPE(CURLOPT_USE_SSL),
727 SCOL_TYPTYPE(CURLUSESSL_NONE), SCOL_TYPTYPE(CURLUSESSL_TRY), SCOL_TYPTYPE(CURLUSESSL_CONTROL), SCOL_TYPTYPE(CURLUSESSL_ALL), SCOL_TYPTYPE(CURLOPT_RESOLVE), SCOL_TYPTYPE(CURLOPT_DNS_SERVERS),
728 SCOL_TYPTYPE(CURLOPT_ACCEPTTIMEOUT_MS), SCOL_TYPTYPE(CURLOPT_SSLCERT), SCOL_TYPTYPE(CURLOPT_SSLCERTTYPE), SCOL_TYPTYPE(CURLOPT_SSLKEY), SCOL_TYPTYPE(CURLOPT_SSLKEYTYPE), SCOL_TYPTYPE(CURLOPT_KEYPASSWD),
729 SCOL_TYPTYPE(CURLOPT_SSLENGINE), SCOL_TYPTYPE(CURLOPT_SSLENGINE_DEFAULT), SCOL_TYPTYPE(CURLOPT_SSLVERSION), SCOL_TYPTYPE(CURL_SSLVERSION_DEFAULT), SCOL_TYPTYPE(CURL_SSLVERSION_TLSv1), SCOL_TYPTYPE(CURL_SSLVERSION_SSLv2),
730 SCOL_TYPTYPE(CURL_SSLVERSION_SSLv3), SCOL_TYPTYPE(CURLOPT_SSL_VERIFYPEER), SCOL_TYPTYPE(CURLOPT_CAINFO), SCOL_TYPTYPE(CURLOPT_ISSUERCERT), SCOL_TYPTYPE(CURLOPT_CAPATH), SCOL_TYPTYPE(CURLOPT_CRLFILE), SCOL_TYPTYPE(CURLOPT_SSL_VERIFYHOST),
731 SCOL_TYPTYPE(CURLOPT_CERTINFO), SCOL_TYPTYPE(CURLOPT_RANDOM_FILE), SCOL_TYPTYPE(CURLOPT_EGDSOCKET), SCOL_TYPTYPE(CURLOPT_SSL_CIPHER_LIST), SCOL_TYPTYPE(CURLOPT_SSL_SESSIONID_CACHE), SCOL_TYPTYPE(CURLOPT_SSL_OPTIONS),
732 SCOL_TYPTYPE(CURLSSLOPT_ALLOW_BEAST), SCOL_TYPTYPE(CURLOPT_KRBLEVEL), SCOL_TYPTYPE(CURLOPT_GSSAPI_DELEGATION), SCOL_TYPTYPE(CURLOPT_SSH_AUTH_TYPES), SCOL_TYPTYPE(CURLSSH_AUTH_PUBLICKEY), SCOL_TYPTYPE(CURLSSH_AUTH_PASSWORD),
733 SCOL_TYPTYPE(CURLSSH_AUTH_HOST), SCOL_TYPTYPE(CURLSSH_AUTH_KEYBOARD), SCOL_TYPTYPE(CURLSSH_AUTH_ANY), SCOL_TYPTYPE(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5), SCOL_TYPTYPE(CURLOPT_SSH_PUBLIC_KEYFILE),
734 SCOL_TYPTYPE(CURLOPT_SSH_PRIVATE_KEYFILE), SCOL_TYPTYPE(CURLOPT_SSH_KNOWNHOSTS), SCOL_TYPTYPE(CURLOPT_NEW_FILE_PERMS), SCOL_TYPTYPE(CURLOPT_NEW_DIRECTORY_PERMS), SCOL_TYPTYPE(CURLOPT_TELNETOPTIONS),
735
747};
748
752int mCURLnarg[NCURLPKG]=
753{
754 TYPTYPE, //ObjCURL
755
756 /*CURL options*/
757 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
758 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
759 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
760 TYPVAR, TYPVAR, TYPVAR, TYPVAR,
761 TYPVAR, TYPVAR, TYPVAR, TYPVAR,
762 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
763 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
764 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
765 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
766 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
767 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
768 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
769 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
770 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
771 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
772 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
773 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
774 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
775 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
776 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
777 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
778 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
779 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
780 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
781 TYPVAR, TYPVAR, TYPVAR, TYPVAR,
782 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
783 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
784 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
785 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
786 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
787 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
788 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
789 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
790 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
791 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
792 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
793 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
794 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
795 TYPVAR, TYPVAR, TYPVAR, TYPVAR, TYPVAR,
796
797 2, //_CRcurlRequest
798 1, //_KILLcurlRequest
799 3, //_CALLcurlRequest
800 3, //_CALLcurlRequestSync
801 2, //_SETcurlRequestHeader
802 3, //_SETcurlOption
803 3, //_SETcurlOptionList
804 3, //_SETcurlOptionS
805 3, //_SETcurlOptionFile
806 3, //_ADDcurlFormField
807 3 //_ADDcurlFileFormField
808};
809
813char* mCURLtype[NCURLPKG]=
814{
815 NULL, //ObjCURL
816
817 /*CURL options*/
818 "I", "I", "I", "I", "I",
819 "I", "I", "I", "I", "I",
820 "I", "I", "I", "I", "I",
821 "I", "I", "I", "I",
822 "I", "I", "I", "I",
823 "I", "I", "I", "I", "I",
824 "I", "I", "I", "I", "I",
825 "I", "I", "I", "I", "I", "I",
826 "I", "I", "I", "I", "I", "I",
827 "I", "I", "I", "I", "I", "I",
828 "I", "I", "I", "I", "I",
829 "I", "I", "I", "I", "I",
830 "I", "I", "I", "I", "I", "I",
831 "I", "I", "I", "I", "I",
832 "I", "I", "I", "I", "I", "I",
833 "I", "I", "I", "I", "I", "I",
834 "I", "I", "I", "I", "I",
835 "I", "I", "I", "I", "I", "I", "I",
836 "I", "I", "I", "I", "I", "I", "I",
837 "I", "I", "I", "I", "I",
838 "I", "I", "I", "I", "I", "I",
839 "I", "I", "I", "I", "I", "I",
840 "I", "I", "I", "I", "I", "I", "I",
841 "I", "I", "I", "I", "I",
842 "I", "I", "I", "I",
843 "I", "I", "I", "I", "I", "I",
844 "I", "I", "I", "I", "I", "I",
845 "I", "I", "I", "I", "I", "I",
846 "I", "I", "I", "I", "I",
847 "I", "I", "I", "I", "I",
848 "I", "I", "I", "I", "I", "I",
849 "I", "I", "I", "I", "I", "I",
850 "I", "I", "I", "I", "I", "I",
851 "I", "I", "I", "I", "I", "I",
852 "I", "I", "I", "I", "I", "I", "I",
853 "I", "I", "I", "I", "I", "I",
854 "I", "I", "I", "I", "I", "I",
855 "I", "I", "I", "I", "I",
856 "I", "I", "I", "I", "I",
857
858 "fun [Chn S] ObjCURL", //_CRcurlRequest
859 "fun [ObjCURL] I", //_KILLcurlRequest
860 "fun [ObjCURL fun [ObjCURL u0 S I] u1 u0] ObjCURL", //_CALLcurlRequest
861 "fun [ObjCURL fun [ObjCURL u0 S I] u1 u0] ObjCURL", //_CALLcurlRequestSync
862 "fun [ObjCURL [S r1]] ObjCURL", //_SETcurlRequestHeader
863 "fun [ObjCURL I I] ObjCURL", //_SETcurlOption
864 "fun [ObjCURL I [S r1]] ObjCURL", //_SETcurlOptionList
865 "fun [ObjCURL I S] ObjCURL", //_SETcurlOptionS
866 "fun [ObjCURL I P] ObjCURL", //_SETcurlOptionFile
867 "fun [ObjCURL S S] ObjCURL", //_ADDcurlFormField
868 "fun [ObjCURL S P] ObjCURL" //_ADDcurlFileFormField
869};
870
871
872// Everything inside _cond and _endcond is ignored by doxygen
874
879int LoadCurl(mmachine m)
880{
881 int k = 0;
882
883 // init CURL
884 curl_global_init(CURL_GLOBAL_SSL);
885
886 // initialize service threads
887 SService::GetInstance();
888
889 MMechostr(MSKDEBUG,"\n" );
890 MMechostr(MSKDEBUG," > Loading CURL Support\n");
891
892 // Declare a new type of object ("ObjCURL")
893 OBJCURLSCOL = OBJregister(1 /*nb of callback*/, 1, destroyCurlObj, "OBJCURLSCOL");
894 k = PKhardpak(m, "mCURL.pkg-1.0", NCURLPKG, mCURLname, mCURLfun, mCURLnarg, mCURLtype);
895
896 // Register data callback
897 CURL_DATA_CB = OBJgetUserEvent();
898 OBJdefEvent(CURL_DATA_CB, getCURLDataCb);
899
900 MMechostr(MSKDEBUG," > Successfully Loaded\n\n");
901 return k;
902}
903
904int CloseCurl()
905{
906 MMechostr(MSKDEBUG,"\n" );
907 MMechostr(MSKDEBUG," > Unloading CURL Support\n");
908
909 // close the threads service
910 SService::GetInstance()->Kill();
911
912 // CURL clean
913 curl_global_cleanup();
914
915 MMechostr(MSKDEBUG," > Successfully unloaded\n\n");
916 return 0;
917}
918
919
921
922#ifndef SCOL_STATIC
927extern "C" SCOL_EXPORT int ScolLoadPlugin(mmachine m, cbmachine w)
928{
929 SCOLinitplugin(w);
930 return LoadCurl(m);
931}
932
937extern "C" SCOL_EXPORT int ScolUnloadPlugin()
938{
939 return CloseCurl();
940}
941#else
946extern "C" SCOL_EXPORT int ScolScurlLoadPlugin(mmachine m, cbmachine w)
947{
948 SCOLinitplugin(w);
949 return LoadCurl(m);
950}
951
956extern "C" SCOL_EXPORT int ScolScurlUnloadPlugin()
957{
958 return CloseCurl();
959}
960#endif
Definition sCurl.h:269
int _CALLcurlRequestSync(mmachine m)
_CALLcurlRequestSync : This function execute the CURL object request and block until the request is f...
int _CALLcurlRequest(mmachine m)
_CALLcurlRequest : This function execute the CURL object request asynchronously Prototype: fun [ObjCU...
int _SETcurlRequestHeader(mmachine m)
_SETcurlRequestHeader : This function change the CURL request header content Prototype: fun [ObjCURL ...
int _SETcurlOptionList(mmachine m)
_SETcurlOptionList : This function set CURL options with a list param Prototype: fun [ObjCURL I [S r1...
int _SETcurlOptionFile(mmachine m)
_SETcurlOptionFile : This function set CURL options with a file Prototype: fun [ObjCURL I P] ObjCURL
int _SETcurlOptionS(mmachine m)
_SETcurlOptionS : This function set CURL options with a string Prototype: fun [ObjCURL I S] ObjCURL
int _SETcurlOption(mmachine m)
_SETcurlOption : This function set CURL options Prototype: fun [ObjCURL I I] ObjCURL
int _CRcurlRequest(mmachine m)
_CRcurlRequest : This function create a CURL object
int _KILLcurlRequest(mmachine m)
_KILLcurlRequest : Destroy CURL object
int _ADDcurlFileFormField(mmachine m)
_ADDcurlFileFormField : This function add a file form field for Post operation on a CURL object Proto...
int _ADDcurlFormField(mmachine m)
_ADDcurlFormField : This function add a form field for Post operation on a CURL object Prototype: fun...