The R Project SVN R

Rev

Rev 71662 | Rev 80131 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
71662 ripley 1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
75890 maechler 3
 *  Copyright (C) 2004-2018 The R Core Team
71662 ripley 4
 *
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, a copy is available at
17
 *  https://www.R-project.org/Licenses/
18
 */
19
 
29960 ripley 20
#ifndef R_INTERNET_MODULE_H
21
#define R_INTERNET_MODULE_H
22
 
23
 
24
#include <Rinternals.h>
25
 
26
 
60666 ripley 27
typedef SEXP (*R_DownloadRoutine)(SEXP args);
75890 maechler 28
typedef Rconnection (*R_NewUrlRoutine)(const char *description, const char * const mode,
29
				       SEXP headers, int method);
30
typedef Rconnection (*R_NewSockRoutine)(const char *host, int port, int server,
31
					const char * const mode, int timeout);
29960 ripley 32
 
75890 maechler 33
typedef void * (*R_HTTPOpenRoutine)(const char *url, const char *agent,
34
				    const char *headers, const int cacheOK);
29960 ripley 35
typedef int    (*R_HTTPReadRoutine)(void *ctx, char *dest, int len);
36
typedef void   (*R_HTTPCloseRoutine)(void *ctx);
75890 maechler 37
 
29960 ripley 38
typedef void * (*R_FTPOpenRoutine)(const char *url);
39
typedef int    (*R_FTPReadRoutine)(void *ctx, char *dest, int len);
40
typedef void   (*R_FTPCloseRoutine)(void *ctx);
41
 
42
typedef void   (*R_SockOpenRoutine)(int *port);
43
typedef void   (*R_SockListenRoutine)(int *sockp, char **buf, int *len);
44
typedef void   (*R_SockConnectRoutine)(int *port, char **host);
45
typedef void   (*R_SockCloseRoutine)(int *sockp);
46
 
47
typedef void   (*R_SockReadRoutine)(int *sockp, char **buf, int *maxlen);
48
typedef void   (*R_SockWriteRoutine)(int *sockp, char **buf, int *start, int *end, int *len);
49
typedef int    (*R_SockSelectRoutine)(int nsock, int *insockfd, int *ready, int *write, double timeout);
50
 
48990 urbaneks 51
typedef int    (*R_HTTPDCreateRoutine)(const char *ip, int port);
49434 ripley 52
typedef void   (*R_HTTPDStopRoutine)();
29960 ripley 53
 
67486 ripley 54
typedef SEXP (*R_CurlRoutine)(SEXP call, SEXP op, SEXP args, SEXP rho);
55
 
29960 ripley 56
typedef struct {
57
    R_DownloadRoutine download;
58
    R_NewUrlRoutine   newurl;
59
    R_NewSockRoutine  newsock;
60
 
61
    R_HTTPOpenRoutine  HTTPOpen;
62
    R_HTTPReadRoutine  HTTPRead;
63
    R_HTTPCloseRoutine HTTPClose;
64
 
65
    R_FTPOpenRoutine   FTPOpen;
66
    R_FTPReadRoutine   FTPRead;
67
    R_FTPCloseRoutine  FTPClose;
68
 
69
    R_SockOpenRoutine     sockopen;
70
    R_SockListenRoutine   socklisten;
71
    R_SockConnectRoutine  sockconnect;
72
    R_SockCloseRoutine    sockclose;
73
 
74
    R_SockReadRoutine     sockread;
75
    R_SockWriteRoutine    sockwrite;
76
    R_SockSelectRoutine   sockselect;
77
 
48990 urbaneks 78
    R_HTTPDCreateRoutine  HTTPDCreate;
49434 ripley 79
    R_HTTPDStopRoutine    HTTPDStop;
67486 ripley 80
 
81
    R_CurlRoutine curlVersion;
82
    R_CurlRoutine curlGetHeaders;
83
    R_CurlRoutine curlDownload;
67505 ripley 84
    R_NewUrlRoutine   newcurlurl;
29960 ripley 85
} R_InternetRoutines;
86
 
87
R_InternetRoutines *R_setInternetRoutines(R_InternetRoutines *routines);
88
 
89
#endif /* ifndef R_INTERNET_MODULE_H */