1 /*
2  *  gretl -- Gnu Regression, Econometrics and Time-series Library
3  *  Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti
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 3 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, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifndef GRETL_WWW_H
21 #define GRETL_WWW_H
22 
23 typedef enum {
24     LIST_DBS = 1,
25     GRAB_IDX,
26     GRAB_DATA,
27     SHOW_IDX,
28     SHOW_DBS,
29     GRAB_NBO_DATA,
30     GRAB_FILE,
31     LIST_FUNCS,
32     GRAB_FUNC,
33     GRAB_PDF,
34     CHECK_DB,
35     UPLOAD,
36     LIST_PKGS,
37     GRAB_PKG,
38     GRAB_FOREIGN,
39     QUERY_SF,
40     GRAB_FUNC_INFO,
41     FUNC_FULLNAME,
42     LIST_CATS,
43     ALL_CATS
44 } CGIOpt;
45 
46 int gretl_www_init (const char *proxy, int use_proxy);
47 
48 void gretl_www_cleanup (void);
49 
50 void gretl_set_sf_cgi (int s);
51 
52 int curl_does_smtp (void);
53 
54 int list_remote_dbs (char **getbuf);
55 
56 int list_remote_function_packages (char **getbuf, int filter);
57 
58 int list_remote_function_categories (char **getbuf, gretlopt opt);
59 
60 int list_remote_data_packages (char **getbuf);
61 
62 int retrieve_remote_db_index (const char *dbname, char **getbuf);
63 
64 int retrieve_remote_db (const char *dbname,
65 			const char *localname,
66 			int opt);
67 
68 int check_remote_db (const char *dbname);
69 
70 int retrieve_remote_function_package (const char *pkgname,
71 				      const char *localname);
72 
73 int retrieve_remote_gfn_content (const char *zipname,
74 				 const char *localname);
75 
76 char *retrieve_remote_pkg_filename (const char *pkgname,
77 				    int *err);
78 
79 int retrieve_remote_datafiles_package (const char *pkgname,
80 				       const char *localname);
81 
82 int retrieve_remote_db_data (const char *dbname,
83 			     const char *varname,
84 			     char **getbuf,
85 			     int opt);
86 
87 int retrieve_manfile (const char *fname, const char *localname);
88 
89 int get_update_info (char **saver, int verbose);
90 
91 int upload_function_package (const char *login, const char *pass,
92 			     const char *fname, const char *buf,
93 			     size_t buflen, char **retbuf);
94 
95 int retrieve_public_file (const char *uri, char *localname);
96 
97 char *retrieve_public_file_as_buffer (const char *uri, size_t *len,
98 				      int *err);
99 
100 char *get_uri_for_addon (const char *pkgname, int *err);
101 
102 int query_sourceforge (const char *query, char **getbuf);
103 
104 int gretl_curl (const char *url, const char *header,
105 		const char *postdata, int include,
106 		char **output, char **errmsg);
107 
108 int try_http (const char *s, char *fname, int *http);
109 
110 int curl_send_mail (const char *from_addr,
111 		    const char *to_addr,
112 		    const char *server,
113 		    const char *username,
114 		    const char *password,
115 		    const char *filename);
116 
117 #endif /* GRETL_WWW_H */
118