/*****************************************************************************/
/*
                                 Proxy.h

08-AUG-1998  MGD  initial
*/
/*****************************************************************************/

#ifndef PROXY_H_LOADED
#define PROXY_H_LOADED 1

#include "proxystruct.h"
#include "proxytunnel.h"

/* some defaults */
#define PROXY_CACHE_NEGATIVE_SECONDS   300
#define PROXY_CONNECT_PERSIST_MAX      100
#define PROXY_CONNECT_PERSIST_SECONDS   30
#define PROXY_LOCATION_REBUILD_BUFFER 1024
#define PROXY_HEADER_REBUILD_LARGESSE 1024

/* proxy scheme */
#define PROXY_SCHEME_CONNECT   1
#define PROXY_SCHEME_HTTP      2
#define PROXY_SCHEME_HTTPSSL   3
#define PROXY_SCHEME_FTP       4

/* controlling the HTTP->SSL proxy gateway */
#define PROXY_HTTPSSL_NONE        0
#define PROXY_HTTPSSL_443       443
#define PROXY_HTTPSSL_ALL        -1

/*#   define PROXY_ERROR_HOST_UNKNOWN       0x000182b2*/
    /* this is an SS$_ENDOFFILE */
#define PROXY_ERROR_HOST_UNKNOWN       0x00000870
#define PROXY_ERROR_CONNECT_REFUSED    0x00000294
#define PROXY_ERROR_HOST_UNREACHABLE   0x00002094
#define PROXY_ERROR_HOST_DISCONNECTED  0x0000207c
#define PROXY_ERROR_HOST_TIMEOUT       0x0000022c

/* any FTP proxy specific behaviour that needs to be specially accomodated */
#define PROXY_FTP_SPECIFIC_NONE     0x0
#define PROXY_FTP_SPECIFIC_MADGOAT  0x1

#define PROXY_FORWARDED_DISABLED      0
#define PROXY_FORWARDED_BY            1
#define PROXY_FORWARDED_FOR           2
#define PROXY_FORWARDED_ADDRESS       3
#define PROXY_FORWARDED_NONE          4  /* used by mapping rules */

#define PROXY_XFORWARDEDFOR_DISABLED  0
#define PROXY_XFORWARDEDFOR_ENABLED   1
#define PROXY_XFORWARDEDFOR_ADDRESS   2
#define PROXY_XFORWARDEDFOR_UNKNOWN   3
#define PROXY_XFORWARDEDFOR_NONE      4  /* used by mapping rules */

/* prefix to cookie name */
#define PROXY_AFFINITY_COOKIE_PREFIX "WASDproxyAffinity_"

/***********************/
/* function prototypes */
/***********************/

ProxyEnd (PROXY_TASK*);
ProxyEndClientShutdownAst (REQUEST_STRUCT*);
ProxyEndProxyShutdownAst (PROXY_TASK*);
ProxyReadResponseAst (PROXY_TASK*);
ProxyReadResponseCacheWrite (PROXY_TASK*);
ProxyReadResponseCacheWriteAst (PROXY_TASK*);
int ProxyResponseChunked (PROXY_TASK*);
int ProxyResponseHeader (PROXY_TASK*);
ProxyResponseNetWrite (PROXY_TASK*);
ProxyResponseNetWriteAst (REQUEST_STRUCT*);
ProxyReadCacheFailed (PROXY_TASK*);
char* ProxyRebuildLocation (PROXY_TASK*, char*);
int ProxyRequestBegin (REQUEST_STRUCT*);
int ProxyRequestParse (REQUEST_STRUCT*);
ProxyRequestRebuild (PROXY_TASK*);
ProxyResponseRebuild (PROXY_TASK*, char*, int);
ProxyResponseNetWriteAst (REQUEST_STRUCT*);
int ProxyServiceCount ();
ProxyWriteRequest (PROXY_TASK*);
ProxyWriteRequestAst (PROXY_TASK*);
ProxyWriteRequestBody (REQUEST_STRUCT*);
ProxyWriteRequestBodyAst (PROXY_TASK*);

#endif /* PROXY_H_LOADED */

/*****************************************************************************/

