HTML Tidy  0.1
httpio.h
00001 #ifndef __HTTPIO_H__
00002 #define __HTTPIO_H__
00003 
00004 #include "platform.h"
00005 #include "tidy.h"
00006 
00007 #ifdef WIN32
00008 # include <winsock.h>
00009 # define ECONNREFUSED WSAECONNREFUSED
00010 #else
00011 # include <sys/socket.h>
00012 # include <netdb.h>
00013 # include <netinet/in.h>
00014 #ifndef __BEOS__
00015 # include <arpa/inet.h>
00016 #endif
00017 #endif /* WIN32 */
00018 
00019 TIDY_STRUCT
00020 typedef struct _HTTPInputSource
00021 {
00022     TidyInputSource tis;    //  This declaration must be first and must not be changed!
00023 
00024     tmbstr pHostName;
00025     tmbstr pResource;
00026     unsigned short nPort, nextBytePos, nextUnGotBytePos, nBufSize;
00027     SOCKET s;
00028     char buffer[1024];
00029     char unGetBuffer[16];
00030 
00031 } HTTPInputSource;
00032 
00033 /*  get next byte from input source */
00034 int HTTPGetByte( HTTPInputSource *source );
00035 
00036 /*  unget byte back to input source */
00037 void HTTPUngetByte( HTTPInputSource *source, uint byteValue );
00038 
00039 /* check if input source at end */
00040 Bool HTTPIsEOF( HTTPInputSource *source );
00041 
00042 int parseURL( HTTPInputSource* source, tmbstr pUrl );
00043 
00044 int openURL( HTTPInputSource* source, tmbstr pUrl );
00045 
00046 void closeURL( HTTPInputSource *source );
00047 
00048 #endif