00001 #ifndef HEADER_CURL_TOOL_URLGLOB_H 00002 #define HEADER_CURL_TOOL_URLGLOB_H 00003 /*************************************************************************** 00004 * _ _ ____ _ 00005 * Project ___| | | | _ \| | 00006 * / __| | | | |_) | | 00007 * | (__| |_| | _ <| |___ 00008 * \___|\___/|_| \_\_____| 00009 * 00010 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. 00011 * 00012 * This software is licensed as described in the file COPYING, which 00013 * you should have received as part of this distribution. The terms 00014 * are also available at https://curl.haxx.se/docs/copyright.html. 00015 * 00016 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 00017 * copies of the Software, and permit persons to whom the Software is 00018 * furnished to do so, under the terms of the COPYING file. 00019 * 00020 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 00021 * KIND, either express or implied. 00022 * 00023 ***************************************************************************/ 00024 #include "tool_setup.h" 00025 00026 typedef enum { 00027 UPTSet = 1, 00028 UPTCharRange, 00029 UPTNumRange 00030 } URLPatternType; 00031 00032 typedef struct { 00033 URLPatternType type; 00034 int globindex; /* the number of this particular glob or -1 if not used 00035 within {} or [] */ 00036 union { 00037 struct { 00038 char **elements; 00039 int size; 00040 int ptr_s; 00041 } Set; 00042 struct { 00043 char min_c; 00044 char max_c; 00045 char ptr_c; 00046 int step; 00047 } CharRange; 00048 struct { 00049 unsigned long min_n; 00050 unsigned long max_n; 00051 int padlength; 00052 unsigned long ptr_n; 00053 unsigned long step; 00054 } NumRange; 00055 } content; 00056 } URLPattern; 00057 00058 /* the total number of globs supported */ 00059 #define GLOB_PATTERN_NUM 100 00060 00061 typedef struct { 00062 URLPattern pattern[GLOB_PATTERN_NUM]; 00063 size_t size; 00064 size_t urllen; 00065 char *glob_buffer; 00066 char beenhere; 00067 const char *error; /* error message */ 00068 size_t pos; /* column position of error or 0 */ 00069 } URLGlob; 00070 00071 CURLcode glob_url(URLGlob**, char *, unsigned long *, FILE *); 00072 CURLcode glob_next_url(char **, URLGlob *); 00073 CURLcode glob_match_url(char **, char *, URLGlob *); 00074 void glob_cleanup(URLGlob* glob); 00075 00076 #endif /* HEADER_CURL_TOOL_URLGLOB_H */ 00077