1 /*
2  *  Copyright (C) 2005-2018 Team Kodi
3  *  This file is part of Kodi - https://kodi.tv
4  *
5  *  SPDX-License-Identifier: GPL-2.0-or-later
6  *  See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include <stdint.h>
12 
13 namespace XFILE
14 {
15 
16 /* indicate that caller can handle truncated reads, where function returns before entire buffer has been filled */
17   static const unsigned int READ_TRUNCATED = 0x01;
18 
19 /* indicate that that caller support read in the minimum defined chunk size, this disables internal cache then */
20   static const unsigned int READ_CHUNKED = 0x02;
21 
22 /* use cache to access this file */
23   static const unsigned int READ_CACHED = 0x04;
24 
25 /* open without caching. regardless to file type. */
26   static const unsigned int READ_NO_CACHE = 0x08;
27 
28 /* calculate bitrate for file while reading */
29   static const unsigned int READ_BITRATE = 0x10;
30 
31 /* indicate to the caller we will seek between multiple streams in the file frequently */
32   static const unsigned int READ_MULTI_STREAM = 0x20;
33 
34 /* indicate to the caller file is audio and/or video (and e.g. may grow) */
35   static const unsigned int READ_AUDIO_VIDEO = 0x40;
36 
37 /* indicate that caller will do write operations before reading  */
38   static const unsigned int READ_AFTER_WRITE = 0x80;
39 
40 /* indicate that caller want to reopen a file if its already open  */
41   static const unsigned int READ_REOPEN = 0x100;
42 
43 struct SNativeIoControl
44 {
45   unsigned long int   request;
46   void*               param;
47 };
48 
49 struct SCacheStatus
50 {
51   uint64_t forward;  /**< number of bytes cached forward of current position */
52   unsigned maxrate;  /**< maximum number of bytes per second cache is allowed to fill */
53   unsigned currate;  /**< average read rate from source file since last position change */
54   bool     lowspeed; /**< cache low speed condition detected? */
55 };
56 
57 typedef enum {
58   IOCTRL_NATIVE        = 1,  /**< SNativeIoControl structure, containing what should be passed to native ioctrl */
59   IOCTRL_SEEK_POSSIBLE = 2,  /**< return 0 if known not to work, 1 if it should work */
60   IOCTRL_CACHE_STATUS  = 3,  /**< SCacheStatus structure */
61   IOCTRL_CACHE_SETRATE = 4,  /**< unsigned int with speed limit for caching in bytes per second */
62   IOCTRL_SET_CACHE     = 8,  /**< CFileCache */
63   IOCTRL_SET_RETRY     = 16, /**< Enable/disable retry within the protocol handler (if supported) */
64 } EIoControl;
65 
66 enum CURLOPTIONTYPE
67 {
68   CURL_OPTION_OPTION,     /**< Set a general option   */
69   CURL_OPTION_PROTOCOL,   /**< Set a protocol option (see below)  */
70   CURL_OPTION_CREDENTIALS,/**< Set User and password  */
71   CURL_OPTION_HEADER      /**< Add a Header           */
72 };
73 
74 /**
75  * The following names for CURL_OPTION_PROTOCOL are possible:
76  *
77  * accept-charset: Set the "accept-charset" header
78  * acceptencoding or encoding: Set the "accept-encoding" header
79  * active-remote: Set the "active-remote" header
80  * auth: Set the authentication method. Possible values: any, anysafe, digest, ntlm
81  * connection-timeout: Set the connection timeout in seconds
82  * cookie: Set the "cookie" header
83  * customrequest: Set a custom HTTP request like DELETE
84  * noshout: Set to true if kodi detects a stream as shoutcast by mistake.
85  * postdata: Set the post body (value needs to be base64 encoded). (Implicitly sets the request to POST)
86  * referer: Set the "referer" header
87  * user-agent: Set the "user-agent" header
88  * seekable: Set the stream seekable. 1: enable, 0: disable
89  * sslcipherlist: Set list of accepted SSL ciphers.
90  */
91 
92 enum FileProperty
93 {
94   FILE_PROPERTY_RESPONSE_PROTOCOL,          /**< Get response protocol line  */
95   FILE_PROPERTY_RESPONSE_HEADER,            /**< Get response Header value  */
96   FILE_PROPERTY_CONTENT_TYPE,               /**< Get file content-type  */
97   FILE_PROPERTY_CONTENT_CHARSET,            /**< Get file content charset  */
98   FILE_PROPERTY_MIME_TYPE,                  /**< Get file mime type  */
99   FILE_PROPERTY_EFFECTIVE_URL               /**< Get effective URL for redirected streams  */
100 };
101 
102 }
103