4
#include "_cgo_export.h"
6
/* for OPT_HEADERFUNCTION */
7
size_t header_function( char *ptr, size_t size, size_t nmemb, void *ctx) {
8
void *go_header_func = (void *)goGetCurlField((GoUintptr)ctx, "headerFunction");
9
GoInterface *userdata = (GoInterface *)goGetCurlField((GoUintptr)ctx, "headerData");
11
if (userdata == NULL) {
12
return goCallWriteFunctionCallback(go_header_func, ptr, size*nmemb, goNilInterface());
14
return goCallWriteFunctionCallback(go_header_func, ptr, size*nmemb, *userdata);
17
void *return_header_function() {
18
return (void *)&header_function;
22
/* for OPT_WRITEFUNCTION */
23
size_t write_function( char *ptr, size_t size, size_t nmemb, void *ctx) {
24
void *go_write_func = (void *)goGetCurlField((GoUintptr)ctx, "writeFunction");
25
GoInterface *userdata = (GoInterface *)goGetCurlField((GoUintptr)ctx, "writeData");
27
if (userdata == NULL) {
28
return goCallWriteFunctionCallback(go_write_func, ptr, size*nmemb, goNilInterface());
30
return goCallWriteFunctionCallback(go_write_func, ptr, size*nmemb, *userdata);
33
void *return_write_function() {
34
return (void *)&write_function;
37
/* for OPT_READFUNCTION */
38
size_t read_function( char *ptr, size_t size, size_t nmemb, void *ctx) {
39
void *go_read_func = (void *)goGetCurlField((GoUintptr)ctx, "readFunction");
40
GoInterface *userdata = (GoInterface *)goGetCurlField((GoUintptr)ctx, "readData");
42
if (userdata == NULL) {
43
return goCallReadFunctionCallback(go_read_func, ptr, size*nmemb, goNilInterface());
45
return goCallReadFunctionCallback(go_read_func, ptr, size*nmemb, *userdata);
48
void *return_read_function() {
49
return (void *)&read_function;
53
/* for OPT_PROGRESSFUNCTION */
54
int progress_function(void *ctx, double dltotal, double dlnow, double ultotal, double ulnow) {
55
void *go_progress_func = (void *)goGetCurlField((GoUintptr)ctx, "progressFunction");
56
GoInterface *clientp = (GoInterface *)goGetCurlField((GoUintptr)ctx, "progressData");
58
if (clientp == NULL) {
59
return goCallProgressCallback(go_progress_func, goNilInterface(),
60
dltotal, dlnow, ultotal, ulnow);
62
return goCallProgressCallback(go_progress_func, *clientp,
63
dltotal, dlnow, ultotal, ulnow);
66
void *return_progress_function() {
67
return (void *)progress_function;