engine.c File Reference

A http 1.0 server. More...

Go to the source code of this file.

Defines

#define HOST   1
#define WRAPPER   2
#define INETADDR   3

Functions

void start_httpd (int port, int backlog, char *bindAddr)
 Start the HTTPD server. More...

void stop_httpd ()
 Stop the HTTPD server. More...

int add_host_allow (char *name)
 Add hosts allowed to connect to this server. More...

int has_hosts_allow ()
 Are any hosts present in the host allow list? More...

void destroy_hosts_allow ()
 Free the host allow list. More...


Detailed Description

A http 1.0 server.

The server delegates handling of a HTTP request and response to the processor module.

NOTE This server does not use threads or forks; Requests are serialized and pending requests will be popped from the connection queue when the current request finish.

Since this server is written for monit, low traffic is expected. Connect from not-authenicated clients will be closed down promptly. The authentication schema or access control is based on client name/address and only requests from known clients are accepted. Hosts allowed to connect to this server should be added to the access control list by calling add_host_allow().

Author:
Jan-Henrik Haukeland, <hauk@tildeslash.com>
Version:
$Id: engine.c,v 1.12 2002/09/11 20:45:07 hauk Exp $

Definition in file engine.c.


Define Documentation

#define HOST   1
 

Definition at line 56 of file engine.c.

#define INETADDR   3
 

Definition at line 58 of file engine.c.

#define WRAPPER   2
 

Definition at line 57 of file engine.c.


Function Documentation

int add_host_allow char *    name
 

Add hosts allowed to connect to this server.

Parameters:
name  A hostname (A-Record) or IP address to be added to the hosts allow list
Returns:
FALSE if the given host does not resolve, otherwise TRUE

Definition at line 181 of file engine.c.

References END_LOCK, LOCK, host_allow::name, NEW, host_allow::next, and xstrdup().

void destroy_hosts_allow  
 

Free the host allow list.

Definition at line 254 of file engine.c.

References END_LOCK, has_hosts_allow(), and LOCK.

int has_hosts_allow  
 

Are any hosts present in the host allow list?

Returns:
TRUE if the host allow list is non-empty, otherwise FALSE

Definition at line 238 of file engine.c.

References END_LOCK, and LOCK.

Referenced by can_http(), and destroy_hosts_allow().

void start_httpd int    port,
int    backlog,
char *    bindAddr
 

Start the HTTPD server.

Parameters:
port  The Port number to start the server at
backlog  The maximum length of the incomming connection queue
bindAddr  the local address the server will bind to

Definition at line 110 of file engine.c.

References check_socket(), create_server_socket(), destroy_wrapper(), error(), http_processor(), requestwrapper::socket, requestwrapper::status, and STRERROR.

void stop_httpd  
 

Stop the HTTPD server.

Definition at line 165 of file engine.c.

References close_socket().

Referenced by monit_http().