Debian Codegraph @

src/httpget.h

raw
1 /*
2 httpget: HTTP input routines (the header)
3
4 copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
6 initially written by Thomas Orgis
7
8 Note about MIME types:
9 You feed debunk_mime() a MIME string and it classifies it as it is relevant for mpg123.
10 In httpget.c are the MIME class lists, which may be appended to to support more bogus MIME types.
11 */
12
13 #ifndef _HTTPGET_H_
14 #define _HTTPGET_H_
15 #include "mpg123.h"
16
17 #include "net123.h"
18
19 /* Pulled in by mpg123app.h! */
20
21 struct httpdata
22 {
23 mpg123_string content_type;
24 mpg123_string icy_name;
25 mpg123_string icy_url;
26 off_t icy_interval;
27 mpg123_string proxyhost;
28 mpg123_string proxyport;
29 /* Partly dummy for now... later proxy host resolution will be cached (PROXY_ADDR). */
30 enum { PROXY_UNKNOWN=0, PROXY_NONE, PROXY_HOST, PROXY_ADDR } proxystate;
31 };
32
33 void httpdata_init(struct httpdata *e);
34 void httpdata_reset(struct httpdata *e);
35 void httpdata_free(struct httpdata *e);
36
37 /* There is a whole lot of MIME types for the same thing.
38 the function will reduce it to a combination of these flags */
39 #define IS_FILE 1
40 #define IS_LIST 2
41 #define IS_M3U 4
42 #define IS_PLS 8
43
44 #define HTTP_MAX_RELOCATIONS 20
45
46 int debunk_mime(const char* mime);
47
48 /*Previously static functions, shared for win32_net_support */
49 int proxy_init(struct httpdata *hd);
50 int translate_url(const char *url, mpg123_string *purl);
51 size_t accept_length(void);
52 int fill_request(mpg123_string *request, mpg123_string *host, mpg123_string *port, mpg123_string *httpauth1, const char * const *client_head);
53 void get_header_string(mpg123_string *response, const char *fieldname, mpg123_string *store);
54 char *get_header_val(const char *hname, mpg123_string *response);
55
56 #define icy_yes "Icy-MetaData: 1"
57 #define icy_no "Icy-MetaData: 0"
58
59 // Append an accept header line to the string, without line end.
60 int append_accept(mpg123_string *s);
61
62 // Open HTTP URL with internal network code.
63 int http_open(const char* url, struct httpdata *hd, const char * const *client_head);
64
65 #endif