[BACK]Return to ftp.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / ftp

Annotation of src/usr.bin/ftp/ftp.h, Revision 1.1

1.1     ! kmos        1: /*
        !             2:  * Copyright (c) 2015 Sunil Nimmagadda <sunil@openbsd.org>
        !             3:  *
        !             4:  * Permission to use, copy, modify, and distribute this software for any
        !             5:  * purpose with or without fee is hereby granted, provided that the above
        !             6:  * copyright notice and this permission notice appear in all copies.
        !             7:  *
        !             8:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        !             9:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            10:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        !            11:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        !            12:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
        !            13:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
        !            14:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            15:  */
        !            16:
        !            17: #include <sys/types.h>
        !            18:
        !            19: #include <signal.h>
        !            20: #include <stdarg.h>
        !            21: #include <stdio.h>
        !            22:
        !            23: #define        S_HTTP  0
        !            24: #define S_FTP  1
        !            25: #define S_FILE 2
        !            26: #define S_HTTPS        3
        !            27:
        !            28: #define TMPBUF_LEN     131072
        !            29: #define        IMSG_OPEN       1
        !            30:
        !            31: #define P_PRE  100
        !            32: #define P_OK   200
        !            33: #define P_INTER        300
        !            34: #define N_TRANS        400
        !            35: #define        N_PERM  500
        !            36:
        !            37: #ifndef nitems
        !            38: #define nitems(_a)     (sizeof((_a)) / sizeof((_a)[0]))
        !            39: #endif
        !            40:
        !            41: struct imsg;
        !            42: struct imsgbuf;
        !            43:
        !            44: struct url {
        !            45:        int      scheme;
        !            46:        int      ipliteral;
        !            47:        char    *host;
        !            48:        char    *port;
        !            49:        char    *path;
        !            50:        char    *basic_auth;
        !            51:
        !            52:        char    *fname;
        !            53:        int      chunked;
        !            54: };
        !            55:
        !            56: /* cmd.c */
        !            57: void   cmd(const char *, const char *, const char *);
        !            58:
        !            59: /* main.c */
        !            60: extern struct imsgbuf   child_ibuf;
        !            61: extern const char      *useragent;
        !            62: extern int              activemode, family, io_debug, verbose, progressmeter;
        !            63: extern volatile sig_atomic_t interrupted;
        !            64: extern FILE            *msgout;
        !            65:
        !            66: /* file.c */
        !            67: struct url     *file_request(struct imsgbuf *, struct url *, off_t *, off_t *);
        !            68: void            file_save(struct url *, FILE *, off_t *);
        !            69:
        !            70: /* ftp.c */
        !            71: void            ftp_connect(struct url *, struct url *, int);
        !            72: struct url     *ftp_get(struct url *, struct url *, off_t *, off_t *);
        !            73: void            ftp_quit(struct url *);
        !            74: void            ftp_save(struct url *, FILE *, off_t *);
        !            75: int             ftp_auth(FILE *, const char *, const char *);
        !            76: int             ftp_command(FILE *, const char *, ...)
        !            77:                     __attribute__((__format__ (printf, 2, 3)))
        !            78:                     __attribute__((__nonnull__ (2)));
        !            79: int             ftp_eprt(FILE *);
        !            80: int             ftp_epsv(FILE *);
        !            81: int             ftp_getline(char **, size_t *, int, FILE *);
        !            82: int             ftp_size(FILE *, const char *, off_t *, char **);
        !            83:
        !            84: /* http.c */
        !            85: void            http_connect(struct url *, struct url *, int);
        !            86: struct url     *http_get(struct url *, struct url *, off_t *, off_t *);
        !            87: void            http_close(struct url *);
        !            88: void            http_save(struct url *, FILE *, off_t *);
        !            89: void            https_init(char *);
        !            90:
        !            91: /* progressmeter.c */
        !            92: void   start_progress_meter(const char *, const char *, off_t, off_t *);
        !            93: void   stop_progress_meter(void);
        !            94:
        !            95: /* url.c */
        !            96: int             scheme_lookup(const char *);
        !            97: void            url_connect(struct url *, struct url *, int);
        !            98: char           *url_encode(const char *);
        !            99: void            url_free(struct url *);
        !           100: struct url     *url_parse(const char *);
        !           101: struct url     *url_request(struct url *, struct url *, off_t *, off_t *);
        !           102: void            url_save(struct url *, FILE *, off_t *);
        !           103: void            url_close(struct url *);
        !           104: char           *url_str(struct url *);
        !           105: void            log_request(const char *, struct url *, struct url *);
        !           106:
        !           107: /* util.c */
        !           108: int    connect_wait(int);
        !           109: void   copy_file(FILE *, FILE *, off_t *);
        !           110: int    tcp_connect(const char *, const char *, int);
        !           111: int    fd_request(char *, int, off_t *);
        !           112: int    read_message(struct imsgbuf *, struct imsg *);
        !           113: void   send_message(struct imsgbuf *, int, uint32_t, void *, size_t, int);
        !           114: void   log_info(const char *, ...)
        !           115:            __attribute__((__format__ (printf, 1, 2)))
        !           116:            __attribute__((__nonnull__ (1)));