/* 
 * Filename: webport.h 
 *
 * Per-port TCP/IP, sockets, system info includes.
 */

#ifndef _WEBPORT_H_
#define _WEBPORT_H_ 1

#ifndef HTML_COMP
#include "libport.h"   /* NetPort embedded system includes */
#include "tcpapp.h"

#ifdef SMTP_ALERTS
#include "smtpport.h"
#include "smtpalrt.h"
#endif   /* SMTP_ALERTS */

/* forward declarations to stifle compiler warnings */
struct httpd;
struct httpform;
struct vfs_file;
struct map_item;

#else   /* the html compiler's case */

struct httpd;
struct vfs_file;
#include "nptypes.h"
#endif

/* Define HT_CONST to the "const" keyword used by the compiler.
   Data generated by HTML compiler uses HT_CONST. If "const" declaration
   is not desired, then HT_CONST can be changed to reflect that. */
#define HT_CONST    const

#define HTTPMAXSEND 4096    /* MAX we should send to sock in one loop */
#define HTTPTMO   (12*TPS)    /* ticks to time out idle connection */
#define HTTICKS   (cticks)    /* LONG - ticks since start */

/* Define this if there is a local disk system to default to when the 
named files are not found in the virtual file system */

#ifdef   OMIT_VFS
#define  HT_NOVFS    1     /* TRUE if there's no virtual files */
#endif

#define NP_ESCAPE_CHAR	     0xff

#define __ARGS(x) x  /* for RSA md5.h security include */

/* HTTP_ENTRY macro applied to all http code entry points: */
#define  _HTTP_ENTRY _loadds

extern long httpsock;   /* socket listening for http connections */
extern struct sockaddr_in httpsin;

int   http_init(void);   /* start up the web server */
void  http_check(void);   /* demo http server task loop */

/* define these away to nothing for now... */
#define  ht_putfile(hp)
#define  ht_putmore(hp)

#define  ht_setfiletype(hp)   (FTYPE_NULL)   /* default file type */

#define SYS_EWOULDBLOCK EWOULDBLOCK

#ifdef HT_MD5AUTH
extern char * make_nonce(struct httpd * hp, struct vfs_file * vfp);
#endif

#define HTTPVER_1_1      1   /* http version number 1.1 */
#define HTTP_PORT        80  /* non-secure http port number */
#define SSL_PORT         443 /* secure http port number */
#endif /* _WEBPORT_H_ */
