gild/gild.h
simon b81ad4ac28 At this stage, GILD is selecting the write handler and calling it, and
passing the output back to the client; it isn't, however, passing the first
line of input to the client because it has eaten that.
1997-10-10 15:34:56 +00:00

69 lines
2.4 KiB
C

/**************************************************************************\
* *
* Project: Gild *
* gild.h *
* *
* Purpose: public header file for gild server. *
* *
* Author : Simon Brooke *
* Copyright: (c) Simon Brooke 1997 *
* Version : 0.1 *
* Created : 6th October 1997 *
* *
\**************************************************************************/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <regex.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/in.h>
#define CONFIG_PATH "/usr/local/etc/gild/gild.conf"
#define DEFAULT_PORT_NO 1984
#define MAX_PENDING_REQUESTS 5
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define FATAL_ERROR 1
#define NOTICE 0
#define DEBUG 1
#define ever (;;)
#define null (((void *) 0))
typedef struct handler
{
struct handler * next; /* next one down the chain */
int port; /* the port on which I listen */
char * protocol; /* a name for the protocol handled */
regex_t * pattern; /* the pattern to match to select this
handler */
char * command; /* the command to invoke this handler */
} handler;
void error( int severity);
/* log the current contents of errorBuff and then if severity is bad die */
char * get_handler_command( char * match);
/* find a handler whose pattern matches match, and return it's command */
int parse_config( char * path);
/* parse the config file and identify the handlers I handle */
void wrapper( int conversation);
/* conversation is the handle on an open socket communicating with a
client. What I want to do is quite simple, and there must be a
straightforward way of doing it: attach the conversation to both
the standard input and the standard output of a process, and then
exec the handler within that process... I can't (at present) find
an easy way of doing that, however */