1#ifndef __HTTPIO_H__
2#define __HTTPIO_H__
3
4#include "platform.h"
5#include "tidy.h"
6
7#ifdef WIN32
8# include <winsock.h>
9# define ECONNREFUSED WSAECONNREFUSED
10#else
11# include <sys/socket.h>
12# include <netdb.h>
13# include <netinet/in.h>
14#ifndef __BEOS__
15# include <arpa/inet.h>
16#endif
17#endif /* WIN32 */
18
19TIDY_STRUCT
20typedef struct _HTTPInputSource
21{
22    TidyInputSource tis;    //  This declaration must be first and must not be changed!
23
24    tmbstr pHostName;
25    tmbstr pResource;
26    unsigned short nPort, nextBytePos, nextUnGotBytePos, nBufSize;
27    SOCKET s;
28    char buffer[1024];
29    char unGetBuffer[16];
30
31} HTTPInputSource;
32
33/*  get next byte from input source */
34int HTTPGetByte( HTTPInputSource *source );
35
36/*  unget byte back to input source */
37void HTTPUngetByte( HTTPInputSource *source, uint byteValue );
38
39/* check if input source at end */
40Bool HTTPIsEOF( HTTPInputSource *source );
41
42int parseURL( HTTPInputSource* source, tmbstr pUrl );
43
44int openURL( HTTPInputSource* source, tmbstr pUrl );
45
46void closeURL( HTTPInputSource *source );
47
48#endif