1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
/*
* Tcp4u v3.31 creation date: 29/05/1997 modif: 16/10/1997
*
*===========================================================================
*
* Project: Tcp4u, Library for tcp protocol
* File: http4u.h
* Purpose: Header for the Library Http4u (direct http protocol)
*
*===========================================================================
*
*
* This software is Copyright (c) 1996-1998 by Philippe Jounin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*
* If you make modifications to this software that you feel
* increases it usefulness for the rest of the community, please
* email the changes, enhancements, bug fixes as well as any and
* all ideas to me. This software is going to be maintained and
* enhanced as deemed necessary by the community.
*
*
* Philippe Jounin (ph.jounin@computer.org)
*/
#ifndef HTTP4UX_API
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
typedef BOOL (CALLBACK far *HTTP4U_CALLBACK)(
#ifdef NEED_PROTO
long , long , long , LPCSTR, unsigned int
#endif
);
/**************************
* definition error code
**************************/
enum HTTP4_RETURN_CODE {
HTTP4U_BAD_URL =-100, /* */
HTTP4U_TCP_FAILED , /* */
HTTP4U_HOST_UNKNOWN , /* */
HTTP4U_TCP_CONNECT , /* */
HTTP4U_FILE_ERROR , /* */
HTTP4U_INSMEMORY , /* */
HTTP4U_BAD_PARAM , /* */
HTTP4U_OVERFLOW , /* */
HTTP4U_CANCELLED , /* */
HTTP4U_NO_CONTENT , /* */
HTTP4U_MOVED , /* */
HTTP4U_BAD_REQUEST , /* */
HTTP4U_FORBIDDEN , /* */
HTTP4U_NOT_FOUND , /* */
HTTP4U_PROTOCOL_ERROR , /* */
HTTP4U_UNDEFINED , /* */
HTTP4U_TIMEOUT , /* */
HTTP4U_SUCCESS =1 /* */
};
/**************************
* Http4u default value
**************************/
#ifndef KBYTES
#define KBYTES 1024
#endif
#define DFLT_TIMEOUT 60
#define DFLT_BUFFERSIZE (4 * KBYTES)
/*=====================================================================
*=====================================================================
* FUNCTION PROTOTYPES
*=====================================================================
*===================================================================*/
BOOL API4U HttpIsValidURL (LPCSTR szURL, unsigned short far *lpPort,
LPSTR szService, int uServiceSize,
LPSTR szHost, int uHostSize,
LPSTR szFile, int uFileSize );
/*######################################################################
*## PURPOSE: Return body associate with the URL's parameter
*####################################################################*/
int API4U HttpGetFile (LPCSTR szURL, /* destination URL */
LPCSTR szProxyURl, /* proxy to be used (URL form) */
LPCSTR szLocalFile /* user filename for save */
);
/*######################################################################
*## PURPOSE: Return headers and body of a http request
*####################################################################*/
int API4U HttpGetFileEx (LPCSTR szURL, /* destination URL */
LPCSTR szProxyURl, /* proxy to be used (URL form) */
LPCSTR szLocalFile, /* user filename for body save */
LPCSTR szHeaderFile, /* user filename for headers save */
HTTP4U_CALLBACK CbkTransmit, /* user callback function */
long luserValue, /* user value */
LPSTR szResponse, /* user buffer for headers storage */
int nResponseSize, /* user buffer size */
LPSTR szHeaders, /* user buffer for headers storage */
int nHeadersSize /* user buffer size */
);
/*
long lBytesTransferred,
long lTotalBytes,
long lUserValue,
LPCSTR sBufRead,
unsigned int nb_bytes
*/
/*######################################################################
*## PURPOSE: Sets user preference of the buffer size
*####################################################################*/
void API4U Http4uSetBufferSize( unsigned int uBufferSize /* buffer size in bytes */
);
/*######################################################################
*## PURPOSE: Sets user preference of the timeout value
*####################################################################*/
void API4U Http4uSetTimeout( unsigned int uTimeout /* timeout value in sec */
);
/*######################################################################
*## PURPOSE: Writes a message explaining a function error
*####################################################################*/
LPCSTR API4U Http4uErrorString( int msg_code /* le code d'erreur de Http4U */
);
#ifdef __cplusplus
} /* End of extern "C" */
#endif /* ifdef __cplusplus */
#define HTTP4UX_API loaded
#endif /* ifndef HTTP4UX_API */
|