Rudiments
url.h
1 // Copyright (c) 1999-2018 David Muse
2 // See the COPYING file for more information
3 
4  url(const url &u);
5  url &operator=(const url &u);
6 
7  bool getCurrentProperties();
8 
9  off64_t getCurrentPosition() const;
10  off64_t setPositionRelativeToBeginning(off64_t offset) const;
11  off64_t setPositionRelativeToCurrent(off64_t offset) const;
12  off64_t setPositionRelativeToEnd(off64_t offset) const;
13 
14  char *getContents();
15  ssize_t getContents(unsigned char *buffer,size_t buffersize);
16 
17  static char *getContents(const char *name);
18  static ssize_t getContents(const char *name,
19  unsigned char *buffer,
20  size_t buffersize);
21 
22  void enableOpenTimings();
23  void disableOpenTimings();
24  void getOpenTimings(uint64_t *build,
25  uint64_t *connect,
26  uint64_t *send,
27  uint64_t *wait,
28  uint64_t *recv);
29 
30  protected:
31  bool lowLevelOpen(const char *name, int32_t flags,
32  mode_t perms, bool useperms);
33  int32_t lowLevelClose();
34 
35  ssize_t lowLevelRead(void *buffer, ssize_t size);
36  private:
37  void init();
38 
39  bool httpOpen(const char *urlname, char *userpwd);
40  bool curlOpen(const char *urlname, char *userpwd);
41  bool getChunkSize(bool bof);
42 
43  bool curlPerform();
44  static size_t curlReadData(void *buffer, size_t size,
45  size_t nmemb, void *userp);
46 
47  static bool initUrl();
48  static void shutDownUrl();
49 
50  uint64_t interval();
51 
52  urlprivate *pvt;
Definition: url.h:35