Blame include/fopen.h

Packit 762fc5
/* see src/fopen.c for copyright information */
Packit 762fc5
Packit 762fc5
#ifndef _FOPEN_H_INCLUDED
Packit 762fc5
#define _FOPEN_H_INCLUDED
Packit 762fc5
Packit 762fc5
#include <stdio.h>
Packit 762fc5
#include <string.h>
Packit 762fc5
#ifndef WIN32
Packit 762fc5
#  include <sys/time.h>
Packit 762fc5
#endif
Packit 762fc5
#include <stdlib.h>
Packit 762fc5
#include <errno.h>
Packit 762fc5
Packit 762fc5
#include <curl/curl.h>
Packit 762fc5
Packit 762fc5
enum fcurl_type_e {
Packit 762fc5
  CFTYPE_NONE=0,
Packit 762fc5
  CFTYPE_FILE=1,
Packit 762fc5
  CFTYPE_CURL=2
Packit 762fc5
};
Packit 762fc5
Packit 762fc5
struct fcurl_data
Packit 762fc5
{
Packit 762fc5
  enum fcurl_type_e type;     /* type of handle */
Packit 762fc5
  union {
Packit 762fc5
    CURL *curl;
Packit 762fc5
    FILE *file;
Packit 762fc5
  } handle;                   /* handle */
Packit 762fc5
Packit 762fc5
  char *buffer;               /* buffer to store cached data*/
Packit 762fc5
  size_t buffer_len;          /* currently allocated buffers length */
Packit 762fc5
  size_t buffer_pos;          /* end of data in buffer*/
Packit 762fc5
  int still_running;          /* Is background url fetch still in progress */
Packit 762fc5
};
Packit 762fc5
Packit 762fc5
typedef struct fcurl_data URL_FILE;
Packit 762fc5
Packit 762fc5
/* exported functions */
Packit 762fc5
URL_FILE *url_fopen(const char *url,const char *operation);
Packit 762fc5
int url_fclose(URL_FILE *file);
Packit 762fc5
int url_feof(URL_FILE *file);
Packit 762fc5
size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file);
Packit 762fc5
char * url_fgets(char *ptr, size_t size, URL_FILE *file);
Packit 762fc5
void url_rewind(URL_FILE *file);
Packit 762fc5
Packit 762fc5
#endif /* _FOPEN_H_INCLUDED */