Imported Upstream version 7.48.0
[platform/upstream/curl.git] / src / tool_urlglob.h
1 #ifndef HEADER_CURL_TOOL_URLGLOB_H
2 #define HEADER_CURL_TOOL_URLGLOB_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at https://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  ***************************************************************************/
24 #include "tool_setup.h"
25
26 typedef enum {
27   UPTSet = 1,
28   UPTCharRange,
29   UPTNumRange
30 } URLPatternType;
31
32 typedef struct {
33   URLPatternType type;
34   int globindex; /* the number of this particular glob or -1 if not used
35                     within {} or [] */
36   union {
37     struct {
38       char **elements;
39       int size;
40       int ptr_s;
41     } Set;
42     struct {
43       char min_c;
44       char max_c;
45       char ptr_c;
46       int step;
47     } CharRange;
48     struct {
49       unsigned long min_n;
50       unsigned long max_n;
51       int padlength;
52       unsigned long ptr_n;
53       unsigned long step;
54     } NumRange;
55   } content;
56 } URLPattern;
57
58 /* the total number of globs supported */
59 #define GLOB_PATTERN_NUM 100
60
61 typedef struct {
62   URLPattern pattern[GLOB_PATTERN_NUM];
63   size_t size;
64   size_t urllen;
65   char *glob_buffer;
66   char beenhere;
67   const char *error; /* error message */
68   size_t pos;        /* column position of error or 0 */
69 } URLGlob;
70
71 CURLcode glob_url(URLGlob**, char*, unsigned long *, FILE *);
72 CURLcode glob_next_url(char **, URLGlob *);
73 CURLcode glob_match_url(char **, char*, URLGlob *);
74 void glob_cleanup(URLGlob* glob);
75
76 #endif /* HEADER_CURL_TOOL_URLGLOB_H */
77