113498266Sopenharmony_ci#ifndef HEADER_CURL_FTPLISTPARSER_H
213498266Sopenharmony_ci#define HEADER_CURL_FTPLISTPARSER_H
313498266Sopenharmony_ci/***************************************************************************
413498266Sopenharmony_ci *                                  _   _ ____  _
513498266Sopenharmony_ci *  Project                     ___| | | |  _ \| |
613498266Sopenharmony_ci *                             / __| | | | |_) | |
713498266Sopenharmony_ci *                            | (__| |_| |  _ <| |___
813498266Sopenharmony_ci *                             \___|\___/|_| \_\_____|
913498266Sopenharmony_ci *
1013498266Sopenharmony_ci * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
1113498266Sopenharmony_ci *
1213498266Sopenharmony_ci * This software is licensed as described in the file COPYING, which
1313498266Sopenharmony_ci * you should have received as part of this distribution. The terms
1413498266Sopenharmony_ci * are also available at https://curl.se/docs/copyright.html.
1513498266Sopenharmony_ci *
1613498266Sopenharmony_ci * You may opt to use, copy, modify, merge, publish, distribute and/or sell
1713498266Sopenharmony_ci * copies of the Software, and permit persons to whom the Software is
1813498266Sopenharmony_ci * furnished to do so, under the terms of the COPYING file.
1913498266Sopenharmony_ci *
2013498266Sopenharmony_ci * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2113498266Sopenharmony_ci * KIND, either express or implied.
2213498266Sopenharmony_ci *
2313498266Sopenharmony_ci * SPDX-License-Identifier: curl
2413498266Sopenharmony_ci *
2513498266Sopenharmony_ci ***************************************************************************/
2613498266Sopenharmony_ci#include "curl_setup.h"
2713498266Sopenharmony_ci
2813498266Sopenharmony_ci#ifndef CURL_DISABLE_FTP
2913498266Sopenharmony_ci
3013498266Sopenharmony_ci/* WRITEFUNCTION callback for parsing LIST responses */
3113498266Sopenharmony_cisize_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
3213498266Sopenharmony_ci                          void *connptr);
3313498266Sopenharmony_ci
3413498266Sopenharmony_cistruct ftp_parselist_data; /* defined inside ftplibparser.c */
3513498266Sopenharmony_ci
3613498266Sopenharmony_ciCURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data);
3713498266Sopenharmony_ci
3813498266Sopenharmony_cistruct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void);
3913498266Sopenharmony_ci
4013498266Sopenharmony_civoid Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data);
4113498266Sopenharmony_ci
4213498266Sopenharmony_ci/* list of wildcard process states */
4313498266Sopenharmony_citypedef enum {
4413498266Sopenharmony_ci  CURLWC_CLEAR = 0,
4513498266Sopenharmony_ci  CURLWC_INIT = 1,
4613498266Sopenharmony_ci  CURLWC_MATCHING, /* library is trying to get list of addresses for
4713498266Sopenharmony_ci                      downloading */
4813498266Sopenharmony_ci  CURLWC_DOWNLOADING,
4913498266Sopenharmony_ci  CURLWC_CLEAN, /* deallocate resources and reset settings */
5013498266Sopenharmony_ci  CURLWC_SKIP,  /* skip over concrete file */
5113498266Sopenharmony_ci  CURLWC_ERROR, /* error cases */
5213498266Sopenharmony_ci  CURLWC_DONE   /* if is wildcard->state == CURLWC_DONE wildcard loop
5313498266Sopenharmony_ci                   will end */
5413498266Sopenharmony_ci} wildcard_states;
5513498266Sopenharmony_ci
5613498266Sopenharmony_citypedef void (*wildcard_dtor)(void *ptr);
5713498266Sopenharmony_ci
5813498266Sopenharmony_ci/* struct keeping information about wildcard download process */
5913498266Sopenharmony_cistruct WildcardData {
6013498266Sopenharmony_ci  char *path; /* path to the directory, where we trying wildcard-match */
6113498266Sopenharmony_ci  char *pattern; /* wildcard pattern */
6213498266Sopenharmony_ci  struct Curl_llist filelist; /* llist with struct Curl_fileinfo */
6313498266Sopenharmony_ci  struct ftp_wc *ftpwc; /* pointer to FTP wildcard data */
6413498266Sopenharmony_ci  wildcard_dtor dtor;
6513498266Sopenharmony_ci  unsigned char state; /* wildcard_states */
6613498266Sopenharmony_ci};
6713498266Sopenharmony_ci
6813498266Sopenharmony_ciCURLcode Curl_wildcard_init(struct WildcardData *wc);
6913498266Sopenharmony_civoid Curl_wildcard_dtor(struct WildcardData **wcp);
7013498266Sopenharmony_ci
7113498266Sopenharmony_cistruct Curl_easy;
7213498266Sopenharmony_ci
7313498266Sopenharmony_ci#else
7413498266Sopenharmony_ci/* FTP is disabled */
7513498266Sopenharmony_ci#define Curl_wildcard_dtor(x)
7613498266Sopenharmony_ci#endif /* CURL_DISABLE_FTP */
7713498266Sopenharmony_ci#endif /* HEADER_CURL_FTPLISTPARSER_H */
78