The R Project SVN R

Rev

Rev 80371 | 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
80322 ripley 3
 *  Copyright (C) 2004-2021 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,
77803 kalibera 31
                                        int serverfd, const char * const mode,
80131 urbaneks 32
                                        int timeout, int options);
77803 kalibera 33
typedef Rconnection (*R_NewServSockRoutine)(int port);
29960 ripley 34
 
35
typedef void   (*R_SockOpenRoutine)(int *port);
36
typedef void   (*R_SockListenRoutine)(int *sockp, char **buf, int *len);
37
typedef void   (*R_SockConnectRoutine)(int *port, char **host);
38
typedef void   (*R_SockCloseRoutine)(int *sockp);
39
 
40
typedef void   (*R_SockReadRoutine)(int *sockp, char **buf, int *maxlen);
41
typedef void   (*R_SockWriteRoutine)(int *sockp, char **buf, int *start, int *end, int *len);
42
typedef int    (*R_SockSelectRoutine)(int nsock, int *insockfd, int *ready, int *write, double timeout);
43
 
48990 urbaneks 44
typedef int    (*R_HTTPDCreateRoutine)(const char *ip, int port);
82754 ripley 45
typedef void   (*R_HTTPDStopRoutine)(void);
29960 ripley 46
 
67486 ripley 47
typedef SEXP (*R_CurlRoutine)(SEXP call, SEXP op, SEXP args, SEXP rho);
48
 
29960 ripley 49
typedef struct {
50
    R_DownloadRoutine download;
80371 ripley 51
    R_NewUrlRoutine   newurl; // as from R 4.2.0, only used on Windows
29960 ripley 52
    R_NewSockRoutine  newsock;
77803 kalibera 53
    R_NewServSockRoutine newservsock;
29960 ripley 54
 
55
    R_SockOpenRoutine     sockopen;
56
    R_SockListenRoutine   socklisten;
57
    R_SockConnectRoutine  sockconnect;
58
    R_SockCloseRoutine    sockclose;
59
 
60
    R_SockReadRoutine     sockread;
61
    R_SockWriteRoutine    sockwrite;
62
    R_SockSelectRoutine   sockselect;
63
 
48990 urbaneks 64
    R_HTTPDCreateRoutine  HTTPDCreate;
49434 ripley 65
    R_HTTPDStopRoutine    HTTPDStop;
67486 ripley 66
 
67
    R_CurlRoutine curlVersion;
68
    R_CurlRoutine curlGetHeaders;
69
    R_CurlRoutine curlDownload;
67505 ripley 70
    R_NewUrlRoutine   newcurlurl;
29960 ripley 71
} R_InternetRoutines;
72
 
73
R_InternetRoutines *R_setInternetRoutines(R_InternetRoutines *routines);
74
 
75
#endif /* ifndef R_INTERNET_MODULE_H */