1 /* Copyright (C) 2000-2015 Lavtech.com corp. All rights reserved.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; either version 2 of the License, or
6    (at your option) any later version.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 
13    You should have received a copy of the GNU General Public License
14    along with this program; if not, write to the Free Software
15    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16 */
17 
18 #ifndef _UDM_HTTP_H
19 #define _UDM_HTTP_H
20 
21 udm_content_type_t UdmContentTypeByName(const char *str);
22 
23 size_t UdmHTTPFindContent(const char *src, size_t srclen);
24 void UdmParseHTTPResponse(UDM_AGENT * Indexer,UDM_DOCUMENT * Doc);
25 void UdmHTTPBufParseHeadersForCachedCopy(UDM_VARLIST *Vars, const char *src, size_t len);
26 udm_rc_t UdmStartHTTPD(UDM_AGENT *A, udm_rc_t (*routine)(int sock, UDM_AGENT *A));
27 
28 const char *UdmHTTPBufPtr(const UDM_HTTPBUF *Buf);
29 const char *UdmHTTPBufContent(const UDM_HTTPBUF *Buf);
30 udm_bool_t UdmHTTPBufContentToConstStr(const UDM_HTTPBUF *Buf, UDM_CONST_STR *str);
31 size_t UdmHTTPBufContentSize(const UDM_HTTPBUF *Buf);
32 size_t UdmHTTPBufHeaderSize(const UDM_HTTPBUF *Buf);
33 size_t UdmHTTPBufSize(const UDM_HTTPBUF *Buf);
34 size_t UdmHTTPBufAllocedSize(const UDM_HTTPBUF *Buf);
35 size_t UdmHTTPBufAvailableSize(const UDM_HTTPBUF *Buf);
36 udmcrc32_t UdmHTTPBufCRC32(const UDM_HTTPBUF *Buf);
37 void UdmHTTPBufContentExport(const UDM_HTTPBUF *Buf, char *str);
38 
39 void UdmHTTPBufInit(UDM_HTTPBUF *Buf);
40 void UdmHTTPBufReset(UDM_HTTPBUF *Buf);
41 void UdmHTTPBufPutContent(UDM_HTTPBUF *Buf, const char *src, size_t len);
42 void UdmHTTPBufResetContent(UDM_HTTPBUF *Buf);
43 udm_rc_t UdmHTTPBufAlloc(UDM_HTTPBUF *Buf, size_t size);
44 udm_rc_t UdmHTTPBufRealloc(UDM_HTTPBUF *Buf, size_t size);
45 udm_rc_t UdmHTTPBufShrink(UDM_HTTPBUF *Buf);
46 void UdmHTTPBufFree(UDM_HTTPBUF *Buf);
47 void UdmHTTPBufTruncateContent(UDM_HTTPBUF *Buf);
48 udm_rc_t UdmHTTPBufAppend(UDM_HTTPBUF *Buf, const char *src, size_t len);
49 udm_rc_t UdmHTTPBufAppendHTTPTime(UDM_HTTPBUF *Buf, time_t tm);
50 udm_rc_t UdmHTTPBufAppendf(UDM_HTTPBUF *Buf, const char *fmt, ...);
51 udm_rc_t UdmHTTPBufAppendFromFile(UDM_HTTPBUF *Buf, int fd);
52 int  UdmHTTPBufAppendRecv(UDM_HTTPBUF *Buf, int fd, size_t len, int flags);
53 udm_rc_t UdmHTTPBufPrintf(UDM_HTTPBUF *Buf, const char *fmt, ...);
54 void UdmHTTPBufShiftLeft(UDM_HTTPBUF *Buf, size_t offs);
55 size_t UdmHTTPBufFindContent(UDM_HTTPBUF *Buf);
56 udm_rc_t UdmHTTPBufInflate(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
57 udm_rc_t UdmHTTPBufInflateAppend(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
58 udm_rc_t UdmHTTPBufDeflateAppend(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
59 udm_rc_t UdmHTTPBufUnGzipAppend(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
60 udm_rc_t UdmHTTPBufUncompressAppend(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
61 udm_rc_t UdmHTTPBufAppendBase64Decode(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
62 udm_rc_t UdmHTTPBufQuotedPrintableDecode(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
63 udm_rc_t UdmHTTPBufAppendQuotedPrintableDecode(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
64 udm_rc_t UdmHTTPBufBase64Decode(UDM_HTTPBUF *Buf, const char *src, size_t srclen);
65 udm_rc_t UdmHTTPBufAppendEncodingDecode(UDM_HTTPBUF *Buf, const char *src, size_t len, udm_content_encoding_t encoding);
66 #endif
67