/* tables.h */

/* Copyright 1997 by Eberhard Mattes <mattes@azu.informatik.uni-stuttgart.de>
   Donated to the public domain.  No warranty.

   1997-07-19 Initial version
   1997-09-09 Hash stuff moved from squid-gw to libem */

/* This header contains definitions shared by squid-gw and
   maketable.

   The preprocessor symbols SELECT_CTYPE_HTML, SELECT_CTYPE_HTTP, and
   SELECT_CTYPE_URL select the meaning of overloaded bits.  This is
   just a safety measure to avoid using wrong bits, it's not strictly
   necessary. */

/* Some characters as defined by RFC 1945. */

#define HT      9
#define LF      10
#define CR      13
#define SP      32
#define DEL     127

/* Character types. */

#define CTYPE_DIGIT	0x01
#define CTYPE_LOALPHA	0x02
#define CTYPE_UPALPHA	0x04

/* Overloaded bits.  Names starting with "CTYPE_I_" are used for bits
   which are used only in conjunction with other bits (see below).  We
   overload bits to avoid having to use more than 8 bits. */

#ifdef SELECT_CTYPE_URL
#define CTYPE_I_SCHEME	0x08	/* URL: scheme */
#define CTYPE_I_HEX	0x10	/* URL: hexadecimal digit */
#define CTYPE_I_HPATH	0x20	/* URL: hpath, search, fragment */
#define CTYPE_I_FPATH	0x40	/* URL: fpath */
#define CTYPE_I_USER	0x80	/* URL: user, password */
#endif

#ifdef SELECT_CTYPE_HTML
#define CTYPE_WHITE	0x08
#define CTYPE_I_NAME	0x10	/* HTML */
#define CTYPE_ESCAPE	0x20	/* HTML: character needs quoting */
#define CTYPE_VALUE	0x40	/* HTML: value of an attribute */
#endif

#ifdef SELECT_CTYPE_HTTP
#define CTYPE_WHITE	0x08	/* HTTP */
#define CTYPE_TOKEN	0x10	/* HTTP: token */
#endif

/* Combinations of bits */

#define CTYPE_ALPHA	(CTYPE_LOALPHA | CTYPE_UPALPHA)

#ifdef SELECT_CTYPE_HTML
#define CTYPE_NAME	(CTYPE_ALPHA | CTYPE_DIGIT | CTYPE_I_NAME)
#endif

#ifdef SELECT_CTYPE_URL
#define CTYPE_SCHEME	(CTYPE_ALPHA | CTYPE_DIGIT | CTYPE_I_SCHEME)
#define CTYPE_HPATH	(CTYPE_ALPHA | CTYPE_DIGIT | CTYPE_I_HPATH)
#define CTYPE_FPATH	(CTYPE_ALPHA | CTYPE_DIGIT | CTYPE_I_FPATH)
#define CTYPE_USER	(CTYPE_ALPHA | CTYPE_DIGIT | CTYPE_I_USER)
#define CTYPE_HEXDIGIT	(CTYPE_DIGIT | CTYPE_I_HEX)
#endif
