mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
remove the _t postfix from type names because POSIX reserves types ending in _t
This commit is contained in:
@@ -27,19 +27,19 @@
|
||||
#include "folder.h"
|
||||
#include "mfconn.h"
|
||||
|
||||
int mfconn_api_file_get_info(mfconn_t *mfconn, file_t *file, char *quickkey);
|
||||
int mfconn_api_file_get_info(mfconn *conn, mffile *file, char *quickkey);
|
||||
|
||||
int mfconn_api_file_get_links(mfconn_t *mfconn, file_t *file, char *quickkey);
|
||||
int mfconn_api_file_get_links(mfconn *conn, mffile *file, char *quickkey);
|
||||
|
||||
int mfconn_api_folder_create(mfconn_t *mfconn, char *parent, char *name);
|
||||
int mfconn_api_folder_create(mfconn *conn, char *parent, char *name);
|
||||
|
||||
long mfconn_api_folder_get_content(mfconn_t *mfconn, int mode, folder_t *folder_curr);
|
||||
long mfconn_api_folder_get_content(mfconn *conn, int mode, mffolder *folder_curr);
|
||||
|
||||
int mfconn_api_folder_get_info(mfconn_t *mfconn, folder_t *folder, char *folderkey);
|
||||
int mfconn_api_folder_get_info(mfconn *conn, mffolder *folder, char *folderkey);
|
||||
|
||||
int mfconn_api_user_get_info(mfconn_t *mfconn);
|
||||
int mfconn_api_user_get_info(mfconn *conn);
|
||||
|
||||
int mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
int mfconn_api_user_get_session_token(mfconn *conn, char *server,
|
||||
char *username, char *password, int app_id, char *app_key,
|
||||
uint32_t *secret_key, char **secret_time, char **session_token);
|
||||
|
||||
|
||||
@@ -32,16 +32,16 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_file_get_info(http_t *conn, void *data);
|
||||
_decode_file_get_info(mfhttp *conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_file_get_info(mfconn_t *mfconn,file_t *file,char *quickkey)
|
||||
mfconn_api_file_get_info(mfconn *conn,mffile *file,char *quickkey)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
int len;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(file == NULL) return -1;
|
||||
if(quickkey == NULL) return -1;
|
||||
@@ -51,18 +51,18 @@ mfconn_api_file_get_info(mfconn_t *mfconn,file_t *file,char *quickkey)
|
||||
// key must either be 11 or 15 chars
|
||||
if(len != 11 && len != 15) return -1;
|
||||
|
||||
api_call = mfconn_create_signed_get(mfconn, 1, "file/get_info.php",
|
||||
api_call = mfconn_create_signed_get(conn, 1, "file/get_info.php",
|
||||
"?quick_key=%s&response_format=json", quickkey);
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, _decode_file_get_info, file);
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_file_get_info, file);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_file_get_info(http_t *conn, void *data)
|
||||
_decode_file_get_info(mfhttp *conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -71,11 +71,11 @@ _decode_file_get_info(http_t *conn, void *data)
|
||||
json_t *file_hash;
|
||||
json_t *file_name;
|
||||
int retval = 0;
|
||||
file_t *file;
|
||||
mffile *file;
|
||||
|
||||
if(data == NULL) return -1;
|
||||
|
||||
file = (file_t *)data;
|
||||
file = (mffile *)data;
|
||||
|
||||
root = http_parse_buf_json(conn, 0, &error);
|
||||
|
||||
|
||||
@@ -32,16 +32,16 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_file_get_links(http_t *conn, void *data);
|
||||
_decode_file_get_links(mfhttp *conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_file_get_links(mfconn_t *mfconn,file_t *file,char *quickkey)
|
||||
mfconn_api_file_get_links(mfconn *conn,mffile *file,char *quickkey)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
int len;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(file == NULL) return -1;
|
||||
if(quickkey == NULL) return -1;
|
||||
@@ -51,18 +51,18 @@ mfconn_api_file_get_links(mfconn_t *mfconn,file_t *file,char *quickkey)
|
||||
// key must either be 11 or 15 chars
|
||||
if(len != 11 && len != 15) return -1;
|
||||
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"file/get_links.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"file/get_links.php",
|
||||
"?quick_key=%s&response_format=json", quickkey);
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, _decode_file_get_links, file);
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_file_get_links, file);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_file_get_links(http_t *conn, void *data)
|
||||
_decode_file_get_links(mfhttp *conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -73,11 +73,11 @@ _decode_file_get_links(http_t *conn, void *data)
|
||||
json_t *onetime_link;
|
||||
json_t *links_array;
|
||||
int retval = 0;
|
||||
file_t *file;
|
||||
mffile *file;
|
||||
|
||||
if(data == NULL) return -1;
|
||||
|
||||
file = (file_t *)data;
|
||||
file = (mffile *)data;
|
||||
|
||||
root = http_parse_buf_json(conn, 0, &error);
|
||||
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
#include "../../utils/strings.h"
|
||||
|
||||
int
|
||||
mfconn_api_folder_create(mfconn_t *mfconn,char *parent,char *name)
|
||||
mfconn_api_folder_create(mfconn *conn,char *parent,char *name)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(name == NULL) return -1;
|
||||
if(strlen(name) < 1) return -1;
|
||||
@@ -52,7 +52,7 @@ mfconn_api_folder_create(mfconn_t *mfconn,char *parent,char *name)
|
||||
|
||||
if(parent != NULL)
|
||||
{
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"folder/create.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"folder/create.php",
|
||||
"?parent_key=%s"
|
||||
"&foldername=%s"
|
||||
"&response_format=json",
|
||||
@@ -60,13 +60,13 @@ mfconn_api_folder_create(mfconn_t *mfconn,char *parent,char *name)
|
||||
}
|
||||
else
|
||||
{
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"folder/create.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"folder/create.php",
|
||||
"?foldername=%s&response_format=json", name);
|
||||
}
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, NULL, NULL);
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_get_buf(http, api_call, NULL, NULL);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_folder_get_content_folders(http_t *conn, void *data);
|
||||
_decode_folder_get_content_folders(mfhttp *conn, void *data);
|
||||
|
||||
static int
|
||||
_decode_folder_get_content_files(http_t *conn, void *data);
|
||||
_decode_folder_get_content_files(mfhttp *conn, void *data);
|
||||
|
||||
long
|
||||
mfconn_api_folder_get_content(mfconn_t *mfconn, int mode, folder_t *folder_curr)
|
||||
mfconn_api_folder_get_content(mfconn *conn, int mode, mffolder *folder_curr)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
char *content_type;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(mode == 0)
|
||||
content_type = "folders";
|
||||
@@ -61,26 +61,26 @@ mfconn_api_folder_get_content(mfconn_t *mfconn, int mode, folder_t *folder_curr)
|
||||
fprintf(stderr, "folder_get_key '\\0'\n");
|
||||
return 0;
|
||||
}*/
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"folder/get_content.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"folder/get_content.php",
|
||||
"?folder_key=%s"
|
||||
"&content_type=%s"
|
||||
"&response_format=json",
|
||||
folderkey,
|
||||
content_type);
|
||||
|
||||
http_t* conn = http_create();
|
||||
mfhttp* http = http_create();
|
||||
|
||||
if(mode == 0)
|
||||
retval = http_get_buf(conn, api_call, _decode_folder_get_content_folders, NULL);
|
||||
retval = http_get_buf(http, api_call, _decode_folder_get_content_folders, NULL);
|
||||
else
|
||||
retval = http_get_buf(conn, api_call, _decode_folder_get_content_files, NULL);
|
||||
http_destroy(conn);
|
||||
retval = http_get_buf(http, api_call, _decode_folder_get_content_files, NULL);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_folder_get_content_folders(http_t *conn, void *user_ptr)
|
||||
_decode_folder_get_content_folders(mfhttp *conn, void *user_ptr)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -143,7 +143,7 @@ _decode_folder_get_content_folders(http_t *conn, void *user_ptr)
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_folder_get_content_files(http_t *conn, void *user_ptr)
|
||||
_decode_folder_get_content_files(mfhttp *conn, void *user_ptr)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_folder_get_info(http_t *conn, void *data);
|
||||
_decode_folder_get_info(mfhttp *conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_folder_get_info(mfconn_t *mfconn,folder_t *folder,char *folderkey)
|
||||
mfconn_api_folder_get_info(mfconn *conn,mffolder *folder,char *folderkey)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(folder == NULL) return -1;
|
||||
if(folderkey == NULL) return -1;
|
||||
@@ -52,18 +52,18 @@ mfconn_api_folder_get_info(mfconn_t *mfconn,folder_t *folder,char *folderkey)
|
||||
if(strcmp(folderkey,"myfiles") == 0) return -1;
|
||||
}
|
||||
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"folder/get_info.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"folder/get_info.php",
|
||||
"?folder_key=%s&response_format=json", folderkey);
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, _decode_folder_get_info, folder);
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_folder_get_info, folder);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_folder_get_info(http_t *conn, void *data)
|
||||
_decode_folder_get_info(mfhttp *conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -72,11 +72,11 @@ _decode_folder_get_info(http_t *conn, void *data)
|
||||
json_t *folder_name;
|
||||
json_t *parent_folder;
|
||||
int retval = 0;
|
||||
folder_t *folder;
|
||||
mffolder *folder;
|
||||
|
||||
if(data == NULL) return -1;
|
||||
|
||||
folder = (folder_t *)data;
|
||||
folder = (mffolder *)data;
|
||||
|
||||
root = http_parse_buf_json(conn, 0, &error);
|
||||
|
||||
@@ -110,7 +110,7 @@ _decode_folder_get_info(http_t *conn, void *data)
|
||||
// sample user callback
|
||||
/*
|
||||
static void
|
||||
_mycallback(char *data,size_t sz,cfile_t *cfile)
|
||||
_mycallback(char *data,size_t sz,cmffile *cfile)
|
||||
{
|
||||
double bytes_read;
|
||||
double bytes_total;
|
||||
|
||||
@@ -32,29 +32,29 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_user_get_info(http_t *conn, void *data);
|
||||
_decode_user_get_info(mfhttp *conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_user_get_info(mfconn_t *mfconn)
|
||||
mfconn_api_user_get_info(mfconn *conn)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
// char *rx_buffer;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"user/get_info.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"user/get_info.php",
|
||||
"&response_format=json");
|
||||
|
||||
http_t* conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, _decode_user_get_info, NULL);
|
||||
http_destroy(conn);
|
||||
mfhttp* http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_user_get_info, NULL);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_user_get_info(http_t *conn, void *data)
|
||||
_decode_user_get_info(mfhttp *conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -92,7 +92,7 @@ _decode_user_get_info(http_t *conn, void *data)
|
||||
// sample user callback
|
||||
/*
|
||||
static void
|
||||
_mycallback(char *data,size_t sz,cfile_t *cfile)
|
||||
_mycallback(char *data,size_t sz,cmffile *cfile)
|
||||
{
|
||||
double bytes_read;
|
||||
double bytes_total;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "../../utils/json.h"
|
||||
|
||||
static int
|
||||
_decode_get_session_token(http_t *conn, void *data);
|
||||
_decode_get_session_token(mfhttp *conn, void *data);
|
||||
|
||||
struct user_get_session_token_response
|
||||
{
|
||||
@@ -42,7 +42,7 @@ struct user_get_session_token_response
|
||||
};
|
||||
|
||||
int
|
||||
mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
mfconn_api_user_get_session_token(mfconn *conn, char *server,
|
||||
char *username, char *password, int app_id, char *app_key,
|
||||
uint32_t *secret_key, char **secret_time, char **session_token)
|
||||
{
|
||||
@@ -52,14 +52,14 @@ mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
int retval;
|
||||
struct user_get_session_token_response response;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
// configure url for operation
|
||||
login_url = strdup_printf("https://%s/api/user/get_session_token.php",
|
||||
server);
|
||||
|
||||
// create user signature
|
||||
user_signature = mfconn_create_user_signature(mfconn, username, password, app_id, app_key);
|
||||
user_signature = mfconn_create_user_signature(conn, username, password, app_id, app_key);
|
||||
|
||||
post_args = strdup_printf(
|
||||
"email=%s"
|
||||
@@ -70,9 +70,9 @@ mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
"&response_format=json",
|
||||
username, password, user_signature);
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_post_buf(conn, login_url, post_args, _decode_get_session_token, (void *)(&response));
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_post_buf(http, login_url, post_args, _decode_get_session_token, (void *)(&response));
|
||||
http_destroy(http);
|
||||
|
||||
free(login_url);
|
||||
free(post_args);
|
||||
@@ -85,7 +85,7 @@ mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_get_session_token(http_t *conn, void *user_ptr)
|
||||
_decode_get_session_token(mfhttp *conn, void *user_ptr)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root = NULL;
|
||||
@@ -133,7 +133,7 @@ _decode_get_session_token(http_t *conn, void *user_ptr)
|
||||
// sample user callback
|
||||
/*
|
||||
static void
|
||||
_mycallback(char *data,size_t sz,cfile_t *cfile)
|
||||
_mycallback(char *data,size_t sz,cmffile *cfile)
|
||||
{
|
||||
double bytes_read;
|
||||
double bytes_total;
|
||||
|
||||
36
mfapi/file.c
36
mfapi/file.c
@@ -37,18 +37,18 @@ struct _file_s
|
||||
char *onetime_link;
|
||||
};
|
||||
|
||||
file_t*
|
||||
mffile*
|
||||
file_alloc(void)
|
||||
{
|
||||
file_t *file;
|
||||
mffile *file;
|
||||
|
||||
file = (file_t*)calloc(1,sizeof(file_t));
|
||||
file = (mffile*)calloc(1,sizeof(mffile));
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
void
|
||||
file_free(file_t *file)
|
||||
file_free(mffile *file)
|
||||
{
|
||||
if(file == NULL) return;
|
||||
|
||||
@@ -62,7 +62,7 @@ file_free(file_t *file)
|
||||
}
|
||||
|
||||
int
|
||||
file_set_key(file_t *file,const char *key)
|
||||
file_set_key(mffile *file,const char *key)
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -79,7 +79,7 @@ file_set_key(file_t *file,const char *key)
|
||||
}
|
||||
|
||||
const char*
|
||||
file_get_key(file_t *file)
|
||||
file_get_key(mffile *file)
|
||||
{
|
||||
if(file == NULL) return NULL;
|
||||
|
||||
@@ -87,7 +87,7 @@ file_get_key(file_t *file)
|
||||
}
|
||||
|
||||
int
|
||||
file_set_hash(file_t *file,const char *hash)
|
||||
file_set_hash(mffile *file,const char *hash)
|
||||
{
|
||||
if(file == NULL) return -1;
|
||||
if(hash == NULL) return -1;
|
||||
@@ -102,7 +102,7 @@ file_set_hash(file_t *file,const char *hash)
|
||||
}
|
||||
|
||||
const char*
|
||||
file_get_hash(file_t *file)
|
||||
file_get_hash(mffile *file)
|
||||
{
|
||||
if(file == NULL) return NULL;
|
||||
|
||||
@@ -110,7 +110,7 @@ file_get_hash(file_t *file)
|
||||
}
|
||||
|
||||
int
|
||||
file_set_name(file_t *file,const char *name)
|
||||
file_set_name(mffile *file,const char *name)
|
||||
{
|
||||
if(file == NULL) return -1;
|
||||
if(name == NULL) return -1;
|
||||
@@ -124,7 +124,7 @@ file_set_name(file_t *file,const char *name)
|
||||
}
|
||||
|
||||
const char*
|
||||
file_get_name(file_t *file)
|
||||
file_get_name(mffile *file)
|
||||
{
|
||||
if(file == NULL) return NULL;
|
||||
|
||||
@@ -132,7 +132,7 @@ file_get_name(file_t *file)
|
||||
}
|
||||
|
||||
int
|
||||
file_set_share_link(file_t *file,const char *share_link)
|
||||
file_set_share_link(mffile *file,const char *share_link)
|
||||
{
|
||||
if(file == NULL) return -1;
|
||||
if(share_link == NULL) return -1;
|
||||
@@ -149,7 +149,7 @@ file_set_share_link(file_t *file,const char *share_link)
|
||||
}
|
||||
|
||||
const char*
|
||||
file_get_share_link(file_t *file)
|
||||
file_get_share_link(mffile *file)
|
||||
{
|
||||
if(file == NULL) return NULL;
|
||||
|
||||
@@ -157,7 +157,7 @@ file_get_share_link(file_t *file)
|
||||
}
|
||||
|
||||
int
|
||||
file_set_direct_link(file_t *file,const char *direct_link)
|
||||
file_set_direct_link(mffile *file,const char *direct_link)
|
||||
{
|
||||
if(file == NULL) return -1;
|
||||
if(direct_link == NULL) return -1;
|
||||
@@ -174,7 +174,7 @@ file_set_direct_link(file_t *file,const char *direct_link)
|
||||
}
|
||||
|
||||
const char*
|
||||
file_get_direct_link(file_t *file)
|
||||
file_get_direct_link(mffile *file)
|
||||
{
|
||||
if(file == NULL) return NULL;
|
||||
|
||||
@@ -182,7 +182,7 @@ file_get_direct_link(file_t *file)
|
||||
}
|
||||
|
||||
int
|
||||
file_set_onetime_link(file_t *file,const char *onetime_link)
|
||||
file_set_onetime_link(mffile *file,const char *onetime_link)
|
||||
{
|
||||
if(file == NULL) return -1;
|
||||
if(onetime_link == NULL) return -1;
|
||||
@@ -199,7 +199,7 @@ file_set_onetime_link(file_t *file,const char *onetime_link)
|
||||
}
|
||||
|
||||
const char*
|
||||
file_get_onetime_link(file_t *file)
|
||||
file_get_onetime_link(mffile *file)
|
||||
{
|
||||
if(file == NULL) return NULL;
|
||||
|
||||
@@ -222,7 +222,7 @@ file_get_onetime_link(file_t *file)
|
||||
#include "../utils/strings.h"
|
||||
|
||||
ssize_t
|
||||
file_download_direct(file_t *file, char *local_dir)
|
||||
file_download_direct(mffile *file, char *local_dir)
|
||||
{
|
||||
const char *url;
|
||||
const char *file_name;
|
||||
@@ -246,7 +246,7 @@ file_download_direct(file_t *file, char *local_dir)
|
||||
else
|
||||
file_path = strdup_printf("%s/%s",local_dir,file_name);
|
||||
|
||||
http_t *conn = http_create();
|
||||
mfhttp *conn = http_create();
|
||||
retval = http_get_file(conn, url, file_path);
|
||||
http_destroy(conn);
|
||||
|
||||
|
||||
32
mfapi/file.h
32
mfapi/file.h
@@ -20,38 +20,38 @@
|
||||
#ifndef __MFAPI_FILE_H__
|
||||
#define __MFAPI_FILE_H__
|
||||
|
||||
typedef struct _file_s file_t;
|
||||
typedef struct _file_s mffile;
|
||||
|
||||
struct _file_s;
|
||||
|
||||
file_t* file_alloc(void);
|
||||
mffile* file_alloc(void);
|
||||
|
||||
void file_free(file_t *file);
|
||||
void file_free(mffile *file);
|
||||
|
||||
int file_set_key(file_t *file,const char *quickkey);
|
||||
int file_set_key(mffile *file,const char *quickkey);
|
||||
|
||||
const char* file_get_key(file_t *file);
|
||||
const char* file_get_key(mffile *file);
|
||||
|
||||
int file_set_hash(file_t *file,const char *hash);
|
||||
int file_set_hash(mffile *file,const char *hash);
|
||||
|
||||
const char* file_get_hash(file_t *file);
|
||||
const char* file_get_hash(mffile *file);
|
||||
|
||||
int file_set_name(file_t *file,const char *name);
|
||||
int file_set_name(mffile *file,const char *name);
|
||||
|
||||
const char* file_get_name(file_t *file);
|
||||
const char* file_get_name(mffile *file);
|
||||
|
||||
int file_set_share_link(file_t *file,const char *share_link);
|
||||
int file_set_share_link(mffile *file,const char *share_link);
|
||||
|
||||
const char* file_get_share_link(file_t *file);
|
||||
const char* file_get_share_link(mffile *file);
|
||||
|
||||
int file_set_direct_link(file_t *file,const char *direct_link);
|
||||
int file_set_direct_link(mffile *file,const char *direct_link);
|
||||
|
||||
const char* file_get_direct_link(file_t *file);
|
||||
const char* file_get_direct_link(mffile *file);
|
||||
|
||||
int file_set_onetime_link(file_t *file,const char *onetime_link);
|
||||
int file_set_onetime_link(mffile *file,const char *onetime_link);
|
||||
|
||||
const char* file_get_onetime_link(file_t *file);
|
||||
const char* file_get_onetime_link(mffile *file);
|
||||
|
||||
ssize_t file_download_direct(file_t *file, char *local_dir);
|
||||
ssize_t file_download_direct(mffile *file, char *local_dir);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,18 +34,18 @@ struct _folder_s
|
||||
uint32_t file_count;
|
||||
};
|
||||
|
||||
folder_t*
|
||||
mffolder*
|
||||
folder_alloc(void)
|
||||
{
|
||||
folder_t *folder;
|
||||
mffolder *folder;
|
||||
|
||||
folder = (folder_t*)calloc(1,sizeof(folder_t));
|
||||
folder = (mffolder*)calloc(1,sizeof(mffolder));
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
void
|
||||
folder_free(folder_t *folder)
|
||||
folder_free(mffolder *folder)
|
||||
{
|
||||
if(folder == NULL) return;
|
||||
|
||||
@@ -55,7 +55,7 @@ folder_free(folder_t *folder)
|
||||
}
|
||||
|
||||
int
|
||||
folder_set_key(folder_t *folder,const char *key)
|
||||
folder_set_key(mffolder *folder,const char *key)
|
||||
{
|
||||
if(folder == NULL) return -1;
|
||||
if(key == NULL) return -1;
|
||||
@@ -69,7 +69,7 @@ folder_set_key(folder_t *folder,const char *key)
|
||||
}
|
||||
|
||||
const char*
|
||||
folder_get_key(folder_t *folder)
|
||||
folder_get_key(mffolder *folder)
|
||||
{
|
||||
if(folder == NULL) return NULL;
|
||||
|
||||
@@ -77,7 +77,7 @@ folder_get_key(folder_t *folder)
|
||||
}
|
||||
|
||||
int
|
||||
folder_set_parent(folder_t *folder,const char *parent_key)
|
||||
folder_set_parent(mffolder *folder,const char *parent_key)
|
||||
{
|
||||
if(folder == NULL) return -1;
|
||||
if(parent_key == NULL) return -1;
|
||||
@@ -94,7 +94,7 @@ folder_set_parent(folder_t *folder,const char *parent_key)
|
||||
}
|
||||
|
||||
const char*
|
||||
folder_get_parent(folder_t *folder)
|
||||
folder_get_parent(mffolder *folder)
|
||||
{
|
||||
if(folder == NULL) return NULL;
|
||||
|
||||
@@ -102,7 +102,7 @@ folder_get_parent(folder_t *folder)
|
||||
}
|
||||
|
||||
int
|
||||
folder_set_name(folder_t *folder,const char *name)
|
||||
folder_set_name(mffolder *folder,const char *name)
|
||||
{
|
||||
if(folder == NULL) return -1;
|
||||
if(name == NULL) return -1;
|
||||
@@ -116,7 +116,7 @@ folder_set_name(folder_t *folder,const char *name)
|
||||
}
|
||||
|
||||
const char*
|
||||
folder_get_name(folder_t *folder)
|
||||
folder_get_name(mffolder *folder)
|
||||
{
|
||||
if(folder == NULL) return NULL;
|
||||
|
||||
|
||||
@@ -20,24 +20,24 @@
|
||||
#ifndef __MFAPI_FOLDER_H__
|
||||
#define __MFAPI_FOLDER_H__
|
||||
|
||||
typedef struct _folder_s folder_t;
|
||||
typedef struct _folder_s mffolder;
|
||||
|
||||
struct _folder_s;
|
||||
|
||||
folder_t* folder_alloc(void);
|
||||
mffolder* folder_alloc(void);
|
||||
|
||||
void folder_free(folder_t *folder);
|
||||
void folder_free(mffolder *folder);
|
||||
|
||||
int folder_set_key(folder_t *folder,const char *folderkey);
|
||||
int folder_set_key(mffolder *folder,const char *folderkey);
|
||||
|
||||
const char* folder_get_key(folder_t *folder);
|
||||
const char* folder_get_key(mffolder *folder);
|
||||
|
||||
int folder_set_parent(folder_t *folder,const char *folderkey);
|
||||
int folder_set_parent(mffolder *folder,const char *folderkey);
|
||||
|
||||
const char* folder_get_parent(folder_t *folder);
|
||||
const char* folder_get_parent(mffolder *folder);
|
||||
|
||||
int folder_set_name(folder_t *folder,const char *name);
|
||||
int folder_set_name(mffolder *folder,const char *name);
|
||||
|
||||
const char* folder_get_name(folder_t *folder);
|
||||
const char* folder_get_name(mffolder *folder);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "mfconn.h"
|
||||
#include "apicalls.h"
|
||||
|
||||
struct mfconn_t
|
||||
struct mfconn
|
||||
{
|
||||
char *server;
|
||||
uint32_t secret_key;
|
||||
@@ -36,51 +36,51 @@ struct mfconn_t
|
||||
char *session_token;
|
||||
};
|
||||
|
||||
mfconn_t*
|
||||
mfconn*
|
||||
mfconn_create(char *server, char *username, char *password, int app_id, char *app_key)
|
||||
{
|
||||
mfconn_t *mfconn;
|
||||
mfconn *conn;
|
||||
int retval;
|
||||
|
||||
mfconn = (mfconn_t *)calloc(1,sizeof(mfconn_t));
|
||||
conn = (mfconn *)calloc(1,sizeof(mfconn));
|
||||
|
||||
mfconn->server = strdup(server);
|
||||
retval = mfconn_api_user_get_session_token(mfconn, mfconn->server,
|
||||
username, password, app_id, app_key, &(mfconn->secret_key),
|
||||
&(mfconn->secret_time), &(mfconn->session_token));
|
||||
conn->server = strdup(server);
|
||||
retval = mfconn_api_user_get_session_token(conn, conn->server,
|
||||
username, password, app_id, app_key, &(conn->secret_key),
|
||||
&(conn->secret_time), &(conn->session_token));
|
||||
|
||||
if (retval == 0)
|
||||
return mfconn;
|
||||
return conn;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
mfconn_destroy(mfconn_t *mfconn)
|
||||
mfconn_destroy(mfconn *conn)
|
||||
{
|
||||
free(mfconn->server);
|
||||
free(mfconn->secret_time);
|
||||
free(mfconn->session_token);
|
||||
free(mfconn);
|
||||
free(conn->server);
|
||||
free(conn->secret_time);
|
||||
free(conn->session_token);
|
||||
free(conn);
|
||||
}
|
||||
|
||||
void
|
||||
mfconn_update_secret_key(mfconn_t *mfconn)
|
||||
mfconn_update_secret_key(mfconn *conn)
|
||||
{
|
||||
uint64_t new_val;
|
||||
|
||||
if(mfconn == NULL) return;
|
||||
if(conn == NULL) return;
|
||||
|
||||
new_val = ((uint64_t)mfconn->secret_key) * 16807;
|
||||
new_val = ((uint64_t)conn->secret_key) * 16807;
|
||||
new_val %= 0x7FFFFFFF;
|
||||
|
||||
mfconn->secret_key = new_val;
|
||||
conn->secret_key = new_val;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
char*
|
||||
mfconn_create_user_signature(mfconn_t *mfconn, char *username, char *password,
|
||||
mfconn_create_user_signature(mfconn *conn, char *username, char *password,
|
||||
int app_id, char *app_key)
|
||||
{
|
||||
char *signature_raw;
|
||||
@@ -88,7 +88,7 @@ mfconn_create_user_signature(mfconn_t *mfconn, char *username, char *password,
|
||||
char signature_hex[41];
|
||||
int i;
|
||||
|
||||
if(mfconn == NULL) return NULL;
|
||||
if(conn == NULL) return NULL;
|
||||
|
||||
signature_raw = strdup_printf("%s%s%d%s",
|
||||
username, password, app_id, app_key);
|
||||
@@ -108,7 +108,7 @@ mfconn_create_user_signature(mfconn_t *mfconn, char *username, char *password,
|
||||
}
|
||||
|
||||
char*
|
||||
mfconn_create_call_signature(mfconn_t *mfconn,char *url,char *args)
|
||||
mfconn_create_call_signature(mfconn *conn,char *url,char *args)
|
||||
{
|
||||
char *signature_raw;
|
||||
unsigned char signature_enc[16]; // md5 is 128 bits
|
||||
@@ -116,7 +116,7 @@ mfconn_create_call_signature(mfconn_t *mfconn,char *url,char *args)
|
||||
char *api;
|
||||
int i;
|
||||
|
||||
if(mfconn == NULL) return NULL;
|
||||
if(conn == NULL) return NULL;
|
||||
if(url == NULL) return NULL;
|
||||
if(args == NULL) return NULL;
|
||||
|
||||
@@ -127,8 +127,8 @@ mfconn_create_call_signature(mfconn_t *mfconn,char *url,char *args)
|
||||
if(api == NULL) return NULL;
|
||||
|
||||
signature_raw = strdup_printf("%d%s%s%s",
|
||||
(mfconn->secret_key % 256),
|
||||
mfconn->secret_time,
|
||||
(conn->secret_key % 256),
|
||||
conn->secret_time,
|
||||
api,args);
|
||||
|
||||
MD5((const unsigned char *)signature_raw,
|
||||
@@ -146,7 +146,7 @@ mfconn_create_call_signature(mfconn_t *mfconn,char *url,char *args)
|
||||
}
|
||||
|
||||
char*
|
||||
mfconn_create_signed_get(mfconn_t *mfconn,int ssl,char *api,char *fmt,...)
|
||||
mfconn_create_signed_get(mfconn *conn,int ssl,char *api,char *fmt,...)
|
||||
{
|
||||
char *api_request = NULL;
|
||||
char *api_args = NULL;
|
||||
@@ -158,10 +158,10 @@ mfconn_create_signed_get(mfconn_t *mfconn,int ssl,char *api,char *fmt,...)
|
||||
int api_len;
|
||||
va_list ap;
|
||||
|
||||
if(mfconn == NULL) return NULL;
|
||||
if(mfconn->server == NULL) return NULL;
|
||||
if(mfconn->secret_time == NULL) return NULL;
|
||||
if(mfconn->session_token == NULL) return NULL;
|
||||
if(conn == NULL) return NULL;
|
||||
if(conn->server == NULL) return NULL;
|
||||
if(conn->secret_time == NULL) return NULL;
|
||||
if(conn->session_token == NULL) return NULL;
|
||||
|
||||
// make sure the api (ex: user/get_info.php) is sane
|
||||
if(api == NULL) return NULL;
|
||||
@@ -173,7 +173,7 @@ mfconn_create_signed_get(mfconn_t *mfconn,int ssl,char *api,char *fmt,...)
|
||||
api_args_len = (vsnprintf(NULL, 0, fmt, ap) + 1); // + 1 for NULL
|
||||
va_end(ap);
|
||||
|
||||
session_token = strdup_printf("&session_token=%s", mfconn->session_token);
|
||||
session_token = strdup_printf("&session_token=%s", conn->session_token);
|
||||
|
||||
api_args_len += strlen(session_token);
|
||||
|
||||
@@ -193,9 +193,9 @@ mfconn_create_signed_get(mfconn_t *mfconn,int ssl,char *api,char *fmt,...)
|
||||
if(api[api_len - 1] == '/') api[api_len - 1] = '\0';
|
||||
|
||||
api_request = strdup_printf("%s//%s/api/%s",
|
||||
(ssl ? "https:" : "http:"), mfconn->server,api);
|
||||
(ssl ? "https:" : "http:"), conn->server,api);
|
||||
|
||||
call_hash = mfconn_create_call_signature(mfconn,api_request,api_args);
|
||||
call_hash = mfconn_create_call_signature(conn,api_request,api_args);
|
||||
signature = strdup_printf("&signature=%s",call_hash);
|
||||
free(call_hash);
|
||||
|
||||
@@ -217,19 +217,19 @@ mfconn_create_signed_get(mfconn_t *mfconn,int ssl,char *api,char *fmt,...)
|
||||
}
|
||||
|
||||
const char*
|
||||
mfconn_get_session_token(mfconn_t *mfconn)
|
||||
mfconn_get_session_token(mfconn *conn)
|
||||
{
|
||||
return mfconn->session_token;
|
||||
return conn->session_token;
|
||||
}
|
||||
|
||||
const char*
|
||||
mfconn_get_secret_time(mfconn_t *mfconn)
|
||||
mfconn_get_secret_time(mfconn *conn)
|
||||
{
|
||||
return mfconn->secret_time;
|
||||
return conn->secret_time;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
mfconn_get_secret_key(mfconn_t *mfconn)
|
||||
mfconn_get_secret_key(mfconn *conn)
|
||||
{
|
||||
return mfconn->secret_key;
|
||||
return conn->secret_key;
|
||||
}
|
||||
|
||||
@@ -23,24 +23,24 @@
|
||||
|
||||
#include "file.h"
|
||||
|
||||
typedef struct mfconn_t mfconn_t;
|
||||
typedef struct mfconn mfconn;
|
||||
|
||||
mfconn_t* mfconn_create(char *server, char *username, char *password, int app_id, char *app_key);
|
||||
mfconn* mfconn_create(char *server, char *username, char *password, int app_id, char *app_key);
|
||||
|
||||
void mfconn_destroy(mfconn_t *mfconn);
|
||||
void mfconn_destroy(mfconn *conn);
|
||||
|
||||
ssize_t mfconn_download_direct(file_t *file,char *local_dir);
|
||||
ssize_t mfconn_download_direct(mffile *file,char *local_dir);
|
||||
|
||||
char* mfconn_create_signed_get(mfconn_t *mfconn,int ssl,char *api,char *fmt,...);
|
||||
char* mfconn_create_signed_get(mfconn *conn,int ssl,char *api,char *fmt,...);
|
||||
|
||||
char* mfconn_create_user_signature(mfconn_t *mfconn, char *username,
|
||||
char* mfconn_create_user_signature(mfconn *conn, char *username,
|
||||
char *password, int app_id, char *app_key);
|
||||
|
||||
void mfconn_update_secret_key(mfconn_t *mfconn);
|
||||
void mfconn_update_secret_key(mfconn *conn);
|
||||
|
||||
const char* mfconn_get_session_token(mfconn_t *mfconn);
|
||||
const char* mfconn_get_session_token(mfconn *conn);
|
||||
|
||||
const char* mfconn_get_secret_time(mfconn_t *mfconn);
|
||||
const char* mfconn_get_secret_time(mfconn *conn);
|
||||
|
||||
uint32_t mfconn_get_secret_key(mfconn_t *mfconn);
|
||||
uint32_t mfconn_get_secret_key(mfconn *conn);
|
||||
#endif
|
||||
|
||||
@@ -23,34 +23,34 @@
|
||||
|
||||
#include "mfshell.h"
|
||||
|
||||
int mfshell_cmd_help(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_help(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_debug(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_debug(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_host(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_host(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_auth(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_auth(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_whomai(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_whomai(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_list(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_list(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_chdir(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_chdir(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_pwd(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_pwd(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_lpwd(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_lpwd(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_lcd(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_lcd(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_file(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_file(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_links(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_links(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_mkdir(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_mkdir(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_get(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_get(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_cmd_whoami(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_cmd_whoami(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@ static char*
|
||||
_get_passwd_from_user(void);
|
||||
|
||||
int
|
||||
mfshell_cmd_auth(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_auth(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
char *username;
|
||||
char *password;
|
||||
@@ -62,15 +62,15 @@ mfshell_cmd_auth(mfshell_t *mfshell, int argc, char **argv)
|
||||
|
||||
if(username == NULL || password == NULL) return -1;
|
||||
|
||||
mfshell->mfconn = mfconn_create(mfshell->server, username, password,
|
||||
mfshell->conn = mfconn_create(mfshell->server, username, password,
|
||||
mfshell->app_id, mfshell->app_key);
|
||||
|
||||
if (mfshell->mfconn != NULL)
|
||||
if (mfshell->conn != NULL)
|
||||
printf("\n\rAuthentication SUCCESS\n\r");
|
||||
else
|
||||
printf("\n\rAuthentication FAILURE\n\r");
|
||||
|
||||
return (mfshell->mfconn != NULL);
|
||||
return (mfshell->conn != NULL);
|
||||
}
|
||||
|
||||
char*
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#include "../../mfapi/apicalls.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_chdir(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_chdir(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
folder_t *folder_new;
|
||||
mffolder *folder_new;
|
||||
const char *folder_curr;
|
||||
const char *folder_parent;
|
||||
const char *folderkey;
|
||||
@@ -83,9 +83,9 @@ mfshell_cmd_chdir(mfshell_t *mfshell, int argc, char **argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = mfconn_api_folder_get_info(mfshell->mfconn,
|
||||
retval = mfconn_api_folder_get_info(mfshell->conn,
|
||||
folder_new,(char*)folderkey);
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
}
|
||||
|
||||
if(retval == 0)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "../commands.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_debug(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_debug(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
(void)argv;
|
||||
if (argc != 1) {
|
||||
@@ -40,9 +40,9 @@ mfshell_cmd_debug(mfshell_t *mfshell, int argc, char **argv)
|
||||
"server:",
|
||||
mfshell->server);
|
||||
|
||||
const char *session_token = mfconn_get_session_token(mfshell->mfconn);
|
||||
const char *secret_time = mfconn_get_secret_time(mfshell->mfconn);
|
||||
uint32_t secret_key = mfconn_get_secret_key(mfshell->mfconn);
|
||||
const char *session_token = mfconn_get_session_token(mfshell->conn);
|
||||
const char *secret_time = mfconn_get_secret_time(mfshell->conn);
|
||||
uint32_t secret_key = mfconn_get_secret_key(mfshell->conn);
|
||||
if(session_token != NULL && secret_time != NULL)
|
||||
{
|
||||
printf(" %-15.15s %"PRIu32"\n\r",
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#include "../../mfapi/apicalls.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_file(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_file(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
file_t *file;
|
||||
mffile *file;
|
||||
int len;
|
||||
int retval;
|
||||
const char *quickkey;
|
||||
@@ -51,11 +51,11 @@ mfshell_cmd_file(mfshell_t *mfshell, int argc, char **argv)
|
||||
|
||||
file = file_alloc();
|
||||
|
||||
retval = mfconn_api_file_get_info(mfshell->mfconn,file,(char*)quickkey);
|
||||
retval = mfconn_api_file_get_info(mfshell->conn,file,(char*)quickkey);
|
||||
if (retval != 0) {
|
||||
fprintf(stderr, "api call unsuccessful\n");
|
||||
}
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
quickkey = file_get_key(file);
|
||||
name = file_get_name(file);
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
#include "../../mfapi/apicalls.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_get(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_get(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
file_t *file;
|
||||
mffile *file;
|
||||
int len;
|
||||
int retval;
|
||||
ssize_t bytes_read;
|
||||
@@ -54,8 +54,8 @@ mfshell_cmd_get(mfshell_t *mfshell, int argc, char **argv)
|
||||
file = file_alloc();
|
||||
|
||||
// get file name
|
||||
retval = mfconn_api_file_get_info(mfshell->mfconn,file,(char*)quickkey);
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
retval = mfconn_api_file_get_info(mfshell->conn,file,(char*)quickkey);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
if(retval == -1)
|
||||
{
|
||||
@@ -64,8 +64,8 @@ mfshell_cmd_get(mfshell_t *mfshell, int argc, char **argv)
|
||||
}
|
||||
|
||||
// request a direct download (streaming) link
|
||||
retval = mfconn_api_file_get_links(mfshell->mfconn,file,(char*)quickkey);
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
retval = mfconn_api_file_get_links(mfshell->conn,file,(char*)quickkey);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
if(retval == -1)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "../commands.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_help(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_help(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
(void)argv;
|
||||
if (argc != 1) {
|
||||
@@ -44,7 +44,7 @@ mfshell_cmd_help(mfshell_t *mfshell, int argc, char **argv)
|
||||
unsigned int column1_width = 0;
|
||||
unsigned int column2_width = 0;
|
||||
|
||||
cmd_t* curr_cmd;
|
||||
mfcmd* curr_cmd;
|
||||
for (curr_cmd = mfshell->commands; curr_cmd->name != NULL; curr_cmd++) {
|
||||
if (strlen(curr_cmd->name) > column1_width)
|
||||
column1_width = strlen(curr_cmd->name);
|
||||
|
||||
@@ -29,7 +29,7 @@ static char*
|
||||
_get_host_from_user(void);
|
||||
|
||||
int
|
||||
mfshell_cmd_host(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_host(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
char *alt_host = NULL;
|
||||
char *host;
|
||||
@@ -65,7 +65,7 @@ mfshell_cmd_host(mfshell_t *mfshell, int argc, char **argv)
|
||||
|
||||
mfshell->server = strdup(host);
|
||||
|
||||
mfconn_destroy(mfshell->mfconn);
|
||||
mfconn_destroy(mfshell->conn);
|
||||
|
||||
if(alt_host != NULL) free(alt_host);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "../commands.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_lcd(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_lcd(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
int retval;
|
||||
const char *dir;
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#include "../../mfapi/apicalls.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_links(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_links(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
file_t *file;
|
||||
mffile *file;
|
||||
int len;
|
||||
int retval;
|
||||
const char *quickkey;
|
||||
@@ -52,11 +52,11 @@ mfshell_cmd_links(mfshell_t *mfshell, int argc, char **argv)
|
||||
|
||||
file = file_alloc();
|
||||
|
||||
retval = mfconn_api_file_get_links(mfshell->mfconn,file,(char*)quickkey);
|
||||
retval = mfconn_api_file_get_links(mfshell->conn,file,(char*)quickkey);
|
||||
if (retval != 0) {
|
||||
fprintf(stderr, "api call unsuccessful\n");
|
||||
}
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
share_link = file_get_share_link(file);
|
||||
direct_link = file_get_direct_link(file);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "../../mfapi/apicalls.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_list(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_list(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
(void)argv;
|
||||
int retval;
|
||||
@@ -51,12 +51,12 @@ mfshell_cmd_list(mfshell_t *mfshell, int argc, char **argv)
|
||||
folder_set_key(mfshell->folder_curr,"myfiles");
|
||||
|
||||
// first folders
|
||||
retval = mfconn_api_folder_get_content(mfshell->mfconn, 0, mfshell->folder_curr);
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
retval = mfconn_api_folder_get_content(mfshell->conn, 0, mfshell->folder_curr);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
// then files
|
||||
retval = mfconn_api_folder_get_content(mfshell->mfconn, 1, mfshell->folder_curr);
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
retval = mfconn_api_folder_get_content(mfshell->conn, 1, mfshell->folder_curr);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "../commands.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_lpwd(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_lpwd(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
(void)argv;
|
||||
if(mfshell == NULL) return -1;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "../../mfapi/apicalls.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_mkdir(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_mkdir(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
int retval;
|
||||
const char *folder_curr;
|
||||
@@ -55,8 +55,8 @@ mfshell_cmd_mkdir(mfshell_t *mfshell, int argc, char **argv)
|
||||
|
||||
folder_curr = folder_get_key(mfshell->folder_curr);
|
||||
|
||||
retval = mfconn_api_folder_create(mfshell->mfconn,(char*)folder_curr,(char*)name);
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
retval = mfconn_api_folder_create(mfshell->conn,(char*)folder_curr,(char*)name);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "../../utils/strings.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_pwd(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_pwd(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
(void)argv;
|
||||
const char *folder_name;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "../../mfapi/apicalls.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_whoami(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_cmd_whoami(mfshell *mfshell, int argc, char **argv)
|
||||
{
|
||||
(void)argv;
|
||||
int retval;
|
||||
@@ -37,8 +37,8 @@ mfshell_cmd_whoami(mfshell_t *mfshell, int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
retval = mfconn_api_user_get_info(mfshell->mfconn);
|
||||
mfconn_update_secret_key(mfshell->mfconn);
|
||||
retval = mfconn_api_user_get_info(mfshell->conn);
|
||||
mfconn_update_secret_key(mfshell->conn);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
#include "../utils/strings.h"
|
||||
|
||||
static void
|
||||
mfshell_run(mfshell_t *mfshell);
|
||||
mfshell_run(mfshell *mfshell);
|
||||
|
||||
static void
|
||||
mfshell_parse_commands(mfshell_t *mfshell, char *command);
|
||||
mfshell_parse_commands(mfshell *mfshell, char *command);
|
||||
|
||||
void print_help(char *cmd)
|
||||
{
|
||||
@@ -120,7 +120,7 @@ void parse_argv(int argc, char **argv, char **username,
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
mfshell_t *mfshell;
|
||||
mfshell *mfshell;
|
||||
char *server = "www.mediafire.com";
|
||||
char *username = NULL;
|
||||
char *password = NULL;
|
||||
@@ -145,7 +145,7 @@ int main(int argc,char **argv)
|
||||
}
|
||||
|
||||
static void
|
||||
mfshell_parse_commands(mfshell_t *mfshell, char *command)
|
||||
mfshell_parse_commands(mfshell *mfshell, char *command)
|
||||
{
|
||||
char *next;
|
||||
int ret;
|
||||
@@ -173,7 +173,7 @@ mfshell_parse_commands(mfshell_t *mfshell, char *command)
|
||||
}
|
||||
|
||||
static void
|
||||
mfshell_run(mfshell_t *mfshell)
|
||||
mfshell_run(mfshell *mfshell)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
size_t len;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "mfshell.h"
|
||||
#include "commands.h"
|
||||
|
||||
struct cmd_t commands[] = {
|
||||
struct mfcmd commands[] = {
|
||||
{"help", "", "show this help", mfshell_cmd_help},
|
||||
{"debug", "", "show debug information", mfshell_cmd_debug},
|
||||
{"host", "<server>", "change target server", mfshell_cmd_host},
|
||||
@@ -60,10 +60,10 @@ struct cmd_t commands[] = {
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
mfshell_t*
|
||||
mfshell*
|
||||
mfshell_create(int app_id,char *app_key,char *server)
|
||||
{
|
||||
mfshell_t *mfshell;
|
||||
mfshell *shell;
|
||||
|
||||
if(app_id <= 0) return NULL;
|
||||
if(app_key == NULL) return NULL;
|
||||
@@ -76,41 +76,41 @@ mfshell_create(int app_id,char *app_key,char *server)
|
||||
*/
|
||||
if(strchr(server,'/') != NULL) return NULL;
|
||||
|
||||
mfshell = (mfshell_t*)calloc(1,sizeof(mfshell_t));
|
||||
shell = (mfshell*)calloc(1,sizeof(mfshell));
|
||||
|
||||
mfshell->app_id = app_id;
|
||||
mfshell->app_key = strdup(app_key);
|
||||
mfshell->server = strdup(server);
|
||||
shell->app_id = app_id;
|
||||
shell->app_key = strdup(app_key);
|
||||
shell->server = strdup(server);
|
||||
|
||||
// object to track folder location
|
||||
mfshell->folder_curr = folder_alloc();
|
||||
folder_set_key(mfshell->folder_curr,"myfiles");
|
||||
shell->folder_curr = folder_alloc();
|
||||
folder_set_key(shell->folder_curr,"myfiles");
|
||||
|
||||
// shell commands
|
||||
mfshell->commands = commands;
|
||||
shell->commands = commands;
|
||||
|
||||
return mfshell;
|
||||
return shell;
|
||||
}
|
||||
|
||||
int
|
||||
mfshell_exec(mfshell_t *mfshell, int argc, char **argv)
|
||||
mfshell_exec(mfshell *shell, int argc, char **argv)
|
||||
{
|
||||
cmd_t* curr_cmd;
|
||||
for (curr_cmd = mfshell->commands; curr_cmd->name != NULL; curr_cmd++) {
|
||||
mfcmd* curr_cmd;
|
||||
for (curr_cmd = shell->commands; curr_cmd->name != NULL; curr_cmd++) {
|
||||
if (strcmp(argv[0], curr_cmd->name) == 0) {
|
||||
return curr_cmd->handler(mfshell, argc, argv);
|
||||
return curr_cmd->handler(shell, argc, argv);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
mfshell_exec_shell_command(mfshell_t *mfshell,char *command)
|
||||
mfshell_exec_shell_command(mfshell *shell,char *command)
|
||||
{
|
||||
wordexp_t p;
|
||||
int retval;
|
||||
|
||||
if(mfshell == NULL) return -1;
|
||||
if(shell == NULL) return -1;
|
||||
if(command == NULL) return -1;
|
||||
|
||||
// FIXME: handle non-zero return value of wordexp
|
||||
@@ -132,7 +132,7 @@ mfshell_exec_shell_command(mfshell_t *mfshell,char *command)
|
||||
return 0;
|
||||
|
||||
// TODO: handle retval
|
||||
retval = mfshell_exec(mfshell, p.we_wordc, p.we_wordv);
|
||||
retval = mfshell_exec(shell, p.we_wordc, p.we_wordv);
|
||||
|
||||
wordfree(&p);
|
||||
|
||||
|
||||
@@ -24,42 +24,42 @@
|
||||
#include "../mfapi/folder.h"
|
||||
#include "../mfapi/mfconn.h"
|
||||
|
||||
typedef struct cmd_t cmd_t;
|
||||
typedef struct mfshell_t mfshell_t;
|
||||
typedef struct mfcmd mfcmd;
|
||||
typedef struct mfshell mfshell;
|
||||
|
||||
struct cmd_t
|
||||
struct mfcmd
|
||||
{
|
||||
char *name;
|
||||
char *argstring;
|
||||
char *help;
|
||||
int (*handler) (mfshell_t *mfshell, int argc, char **argv);
|
||||
int (*handler) (mfshell *mfshell, int argc, char **argv);
|
||||
};
|
||||
|
||||
struct mfshell_t
|
||||
struct mfshell
|
||||
{
|
||||
int app_id;
|
||||
char *app_key;
|
||||
char *server;
|
||||
|
||||
/* REST API tracking */
|
||||
folder_t *folder_curr;
|
||||
mffolder *folder_curr;
|
||||
|
||||
/* Local tracking */
|
||||
char *local_working_dir;
|
||||
|
||||
/* shell commands */
|
||||
cmd_t *commands;
|
||||
mfcmd *commands;
|
||||
|
||||
mfconn_t *mfconn;
|
||||
mfconn *conn;
|
||||
};
|
||||
|
||||
mfshell_t* mfshell_create(int app_id,char *app_key,char *server);
|
||||
mfshell* mfshell_create(int app_id,char *app_key,char *server);
|
||||
|
||||
int mfshell_authenticate_user(mfshell_t *mfshell);
|
||||
int mfshell_authenticate_user(mfshell *mfshell);
|
||||
|
||||
int mfshell_exec(mfshell_t *mfshell, int argc, char **argv);
|
||||
int mfshell_exec(mfshell *mfshell, int argc, char **argv);
|
||||
|
||||
int mfshell_exec_shell_command(mfshell_t *mfshell,char *command);
|
||||
int mfshell_exec_shell_command(mfshell *mfshell,char *command);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
34
utils/http.c
34
utils/http.c
@@ -29,7 +29,7 @@ static size_t http_read_buf_cb(char *data, size_t size, size_t nmemb, void *user
|
||||
static size_t http_write_buf_cb(char *data, size_t size, size_t nmemb, void *user_ptr);
|
||||
static size_t http_write_file_cb(char *data, size_t size, size_t nmemb, void *user_ptr);
|
||||
|
||||
struct http_t
|
||||
struct mfhttp
|
||||
{
|
||||
CURL *curl_handle;
|
||||
char *write_buf;
|
||||
@@ -44,22 +44,22 @@ struct http_t
|
||||
};
|
||||
|
||||
/*
|
||||
* This set of functions is made such that the http_t struct and the curl
|
||||
* This set of functions is made such that the mfhttp struct and the curl
|
||||
* handle it stores can be reused for multiple operations
|
||||
*
|
||||
* We do not use a single global instance because mediafire does not support
|
||||
* keep-alive anyways.
|
||||
*/
|
||||
|
||||
http_t*
|
||||
mfhttp*
|
||||
http_create(void)
|
||||
{
|
||||
http_t *conn;
|
||||
mfhttp *conn;
|
||||
CURL *curl_handle;
|
||||
curl_handle = curl_easy_init();
|
||||
if(curl_handle == NULL) return NULL;
|
||||
|
||||
conn = (http_t*)calloc(1,sizeof(http_t));
|
||||
conn = (mfhttp*)calloc(1,sizeof(mfhttp));
|
||||
conn->curl_handle = curl_handle;
|
||||
|
||||
conn->show_progress = false;
|
||||
@@ -78,13 +78,13 @@ http_create(void)
|
||||
}
|
||||
|
||||
json_t *
|
||||
http_parse_buf_json(http_t* conn, size_t flags, json_error_t *error)
|
||||
http_parse_buf_json(mfhttp* conn, size_t flags, json_error_t *error)
|
||||
{
|
||||
return json_loadb(conn->write_buf, conn->write_buf_len, flags, error);
|
||||
}
|
||||
|
||||
void
|
||||
http_destroy(http_t* conn)
|
||||
http_destroy(mfhttp* conn)
|
||||
{
|
||||
curl_easy_cleanup(conn->curl_handle);
|
||||
free(conn->write_buf);
|
||||
@@ -94,11 +94,11 @@ http_destroy(http_t* conn)
|
||||
static int http_progress_cb(void *user_ptr, double dltotal, double dlnow,
|
||||
double ultotal, double ulnow)
|
||||
{
|
||||
http_t *conn;
|
||||
mfhttp *conn;
|
||||
|
||||
if (user_ptr == NULL) return 0;
|
||||
|
||||
conn = (http_t *)user_ptr;
|
||||
conn = (mfhttp *)user_ptr;
|
||||
|
||||
conn->ul_len = ultotal;
|
||||
conn->ul_now = ulnow;
|
||||
@@ -110,7 +110,7 @@ static int http_progress_cb(void *user_ptr, double dltotal, double dlnow,
|
||||
}
|
||||
|
||||
int
|
||||
http_get_buf(http_t *conn, const char *url, int (*data_handler)(http_t *conn, void *data), void *data)
|
||||
http_get_buf(mfhttp *conn, const char *url, int (*data_handler)(mfhttp *conn, void *data), void *data)
|
||||
{
|
||||
int retval;
|
||||
curl_easy_reset(conn->curl_handle);
|
||||
@@ -152,12 +152,12 @@ http_read_buf_cb(char *data, size_t size, size_t nmemb, void *user_ptr)
|
||||
static size_t
|
||||
http_write_buf_cb(char *data, size_t size, size_t nmemb, void *user_ptr)
|
||||
{
|
||||
http_t *conn;
|
||||
mfhttp *conn;
|
||||
size_t data_len;
|
||||
|
||||
if (user_ptr == NULL) return 0;
|
||||
|
||||
conn = (http_t*)user_ptr;
|
||||
conn = (mfhttp*)user_ptr;
|
||||
data_len = size*nmemb;
|
||||
|
||||
if (data_len > 0) {
|
||||
@@ -172,7 +172,7 @@ http_write_buf_cb(char *data, size_t size, size_t nmemb, void *user_ptr)
|
||||
}
|
||||
|
||||
int
|
||||
http_post_buf(http_t *conn, const char *url, const char *post_args, int (*data_handler)(http_t *conn, void *data), void *data)
|
||||
http_post_buf(mfhttp *conn, const char *url, const char *post_args, int (*data_handler)(mfhttp *conn, void *data), void *data)
|
||||
{
|
||||
int retval;
|
||||
curl_easy_reset(conn->curl_handle);
|
||||
@@ -194,7 +194,7 @@ http_post_buf(http_t *conn, const char *url, const char *post_args, int (*data_h
|
||||
}
|
||||
|
||||
int
|
||||
http_get_file(http_t *conn, const char *url, const char *path)
|
||||
http_get_file(mfhttp *conn, const char *url, const char *path)
|
||||
{
|
||||
int retval;
|
||||
curl_easy_reset(conn->curl_handle);
|
||||
@@ -217,10 +217,10 @@ http_get_file(http_t *conn, const char *url, const char *path)
|
||||
static size_t
|
||||
http_write_file_cb(char *data, size_t size, size_t nmemb, void *user_ptr)
|
||||
{
|
||||
http_t *conn;
|
||||
mfhttp *conn;
|
||||
|
||||
if (user_ptr == NULL) return 0;
|
||||
conn = (http_t*)user_ptr;
|
||||
conn = (mfhttp*)user_ptr;
|
||||
|
||||
fwrite(data, size, nmemb, conn->stream);
|
||||
|
||||
@@ -230,6 +230,6 @@ http_write_file_cb(char *data, size_t size, size_t nmemb, void *user_ptr)
|
||||
}
|
||||
|
||||
/*int
|
||||
http_post_file(http_t *conn, const char *url, const char *post_args, FILE *fd)
|
||||
http_post_file(mfhttp *conn, const char *url, const char *post_args, FILE *fd)
|
||||
{
|
||||
}*/
|
||||
|
||||
16
utils/http.h
16
utils/http.h
@@ -21,15 +21,15 @@
|
||||
|
||||
#include <jansson.h>
|
||||
|
||||
typedef struct http_t http_t;
|
||||
typedef struct mfhttp mfhttp;
|
||||
|
||||
http_t* http_create(void);
|
||||
void http_destroy(http_t* conn);
|
||||
int http_get_buf(http_t *conn, const char *url, int (*data_handler)(http_t *conn, void *data), void *data);
|
||||
int http_post_buf(http_t *conn, const char *url, const char *post_args, int (*data_handler)(http_t *conn, void *data), void *data);
|
||||
int http_get_file(http_t *conn, const char *url, const char *path);
|
||||
int http_post_file(http_t *conn, const char *url, const char *post_args, FILE *fd);
|
||||
json_t *http_parse_buf_json(http_t* conn, size_t flags, json_error_t *error);
|
||||
mfhttp* http_create(void);
|
||||
void http_destroy(mfhttp* conn);
|
||||
int http_get_buf(mfhttp *conn, const char *url, int (*data_handler)(mfhttp *conn, void *data), void *data);
|
||||
int http_post_buf(mfhttp *conn, const char *url, const char *post_args, int (*data_handler)(mfhttp *conn, void *data), void *data);
|
||||
int http_get_file(mfhttp *conn, const char *url, const char *path);
|
||||
int http_post_file(mfhttp *conn, const char *url, const char *post_args, FILE *fd);
|
||||
json_t *http_parse_buf_json(mfhttp* conn, size_t flags, json_error_t *error);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user