fetch.h revision 55557
12926Sphk/*- 22926Sphk * Copyright (c) 1998 Dag-Erling Co�dan Sm�rgrav 32926Sphk * All rights reserved. 42926Sphk * 52926Sphk * Redistribution and use in source and binary forms, with or without 62926Sphk * modification, are permitted provided that the following conditions 72926Sphk * are met: 82926Sphk * 1. Redistributions of source code must retain the above copyright 92926Sphk * notice, this list of conditions and the following disclaimer 102926Sphk * in this position and unchanged. 112926Sphk * 2. Redistributions in binary form must reproduce the above copyright 122926Sphk * notice, this list of conditions and the following disclaimer in the 132886Sphk * documentation and/or other materials provided with the distribution. 142886Sphk * 3. The name of the author may not be used to endorse or promote products 152886Sphk * derived from this software without specific prior written permission 162886Sphk * 172886Sphk * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 182886Sphk * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 192886Sphk * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 202886Sphk * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 212886Sphk * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 222886Sphk * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232886Sphk * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242886Sphk * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252886Sphk * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 262886Sphk * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272886Sphk * 282886Sphk * $FreeBSD: head/lib/libfetch/fetch.h 55557 2000-01-07 12:58:40Z des $ 292886Sphk */ 302886Sphk 312886Sphk#ifndef _FETCH_H_INCLUDED 322886Sphk#define _FETCH_H_INCLUDED 332886Sphk 342886Sphk#include <fetch_err.h> 352886Sphk 362886Sphk#define _LIBFETCH_VER "libfetch/1.0" 372886Sphk 382886Sphk#define URL_SCHEMELEN 16 392886Sphk#define URL_USERLEN 256 402886Sphk#define URL_PWDLEN 256 412886Sphk 422886Sphkstruct url { 432886Sphk char scheme[URL_SCHEMELEN+1]; 442886Sphk char user[URL_USERLEN+1]; 452886Sphk char pwd[URL_PWDLEN+1]; 462886Sphk char host[MAXHOSTNAMELEN+1]; 472886Sphk int port; 482886Sphk char doc[2]; 492886Sphk}; 502886Sphk 512886Sphkstruct url_stat { 522886Sphk off_t size; 532886Sphk time_t atime; 542886Sphk time_t mtime; 552886Sphk}; 562886Sphk 572886Sphkstruct url_ent { 582886Sphk char name[MAXPATHLEN]; 592886Sphk struct url_stat stat; 602948Sphk}; 612948Sphk 622948Sphk/* FILE-specific functions */ 632948SphkFILE *fetchGetFile(struct url *, char *); 642886SphkFILE *fetchPutFile(struct url *, char *); 652886Sphkint fetchStatFile(struct url *, struct url_stat *, char *); 662886Sphkstruct url_ent *fetchListFile(struct url *, char *); 672948Sphk 682948Sphk/* HTTP-specific functions */ 692886Sphkchar *fetchContentType(FILE *); 702886SphkFILE *fetchGetHTTP(struct url *, char *); 712886SphkFILE *fetchPutHTTP(struct url *, char *); 722886Sphkint fetchStatHTTP(struct url *, struct url_stat *, char *); 732886Sphkstruct url_ent *fetchListHTTP(struct url *, char *); 742886Sphk 752886Sphk/* FTP-specific functions */ 762948SphkFILE *fetchGetFTP(struct url *, char *); 772886SphkFILE *fetchPutFTP(struct url *, char *); 782886Sphkint fetchStatFTP(struct url *, struct url_stat *, char *); 792886Sphkstruct url_ent *fetchListFTP(struct url *, char *); 802948Sphk 812886Sphk/* Generic functions */ 822886Sphkstruct url *fetchParseURL(char *); 832886SphkFILE *fetchGetURL(char *, char *); 842886SphkFILE *fetchPutURL(char *, char *); 852948Sphkint fetchStatURL(char *, struct url_stat *, char *); 862948Sphkstruct url_ent *fetchListURL(char *, char *); 872948SphkFILE *fetchGet(struct url *, char *); 882886SphkFILE *fetchPut(struct url *, char *); 892886Sphkint fetchStat(struct url *, struct url_stat *, char *); 902886Sphkstruct url_ent *fetchList(struct url *, char *); 912886Sphk 922886Sphk/* Last error code */ 932886Sphkextern int fetchLastErrCode; 942886Sphkextern int fetchTimeout; 952886Sphk 962886Sphk#endif 972886Sphk