Blame src/httpget.h

Packit c32a2d
/*
Packit c32a2d
	httpget: HTTP input routines (the header)
Packit c32a2d
Packit c32a2d
	copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
Packit c32a2d
	see COPYING and AUTHORS files in distribution or http://mpg123.org
Packit c32a2d
	initially written by Thomas Orgis
Packit c32a2d
Packit c32a2d
	Note about MIME types:
Packit c32a2d
	You feed debunk_mime() a MIME string and it classifies it as it is relevant for mpg123.
Packit c32a2d
	In httpget.c are the MIME class lists, which may be appended to to support more bogus MIME types.
Packit c32a2d
*/
Packit c32a2d
Packit c32a2d
#ifndef _HTTPGET_H_
Packit c32a2d
#define _HTTPGET_H_
Packit c32a2d
#include "mpg123.h"
Packit c32a2d
Packit c32a2d
/* Pulled in by mpg123app.h! */
Packit c32a2d
Packit c32a2d
struct httpdata
Packit c32a2d
{
Packit c32a2d
	mpg123_string content_type;
Packit c32a2d
	mpg123_string icy_name;
Packit c32a2d
	mpg123_string icy_url;
Packit c32a2d
	off_t icy_interval;
Packit c32a2d
	mpg123_string proxyhost;
Packit c32a2d
	mpg123_string proxyport;
Packit c32a2d
	/* Partly dummy for now... later proxy host resolution will be cached (PROXY_ADDR). */
Packit c32a2d
	enum { PROXY_UNKNOWN=0, PROXY_NONE, PROXY_HOST, PROXY_ADDR } proxystate;
Packit c32a2d
};
Packit c32a2d
Packit c32a2d
void httpdata_init(struct httpdata *e);
Packit c32a2d
void httpdata_reset(struct httpdata *e);
Packit c32a2d
void httpdata_free(struct httpdata *e);
Packit c32a2d
Packit c32a2d
/* There is a whole lot of MIME types for the same thing.
Packit c32a2d
   the function will reduce it to a combination of these flags */
Packit c32a2d
#define IS_FILE 1
Packit c32a2d
#define IS_LIST 2
Packit c32a2d
#define IS_M3U  4
Packit c32a2d
#define IS_PLS  8
Packit c32a2d
Packit c32a2d
#define HTTP_MAX_RELOCATIONS 20
Packit c32a2d
Packit c32a2d
int debunk_mime(const char* mime);
Packit c32a2d
Packit c32a2d
/*Previously static functions, shared for win32_net_support */
Packit c32a2d
int proxy_init(struct httpdata *hd);
Packit c32a2d
int translate_url(const char *url, mpg123_string *purl);
Packit c32a2d
size_t accept_length(void);
Packit c32a2d
int fill_request(mpg123_string *request, mpg123_string *host, mpg123_string *port, mpg123_string *httpauth1, int *try_without_port);
Packit c32a2d
void get_header_string(mpg123_string *response, const char *fieldname, mpg123_string *store);
Packit c32a2d
char *get_header_val(const char *hname, mpg123_string *response);
Packit c32a2d
Packit c32a2d
/* needed for HTTP/1.1 non-pipelining mode */
Packit c32a2d
/* #define CONN_HEAD "Connection: close\r\n" */
Packit c32a2d
#define CONN_HEAD ""
Packit c32a2d
#define icy_yes "Icy-MetaData: 1\r\n"
Packit c32a2d
#define icy_no "Icy-MetaData: 0\r\n"
Packit c32a2d
Packit c32a2d
extern char *proxyurl;
Packit c32a2d
extern unsigned long proxyip;
Packit c32a2d
/* takes url and content type string address, opens resource, returns fd for data, allocates and sets content type */
Packit c32a2d
extern int http_open (char* url, struct httpdata *hd);
Packit c32a2d
extern char *httpauth;
Packit c32a2d
Packit c32a2d
#endif