Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

server.c File Reference

initialize and start server core. More...

#include "common.h"
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include <grp.h>
#include "server.h"
#include "conftable.h"
#include "conn_handler.h"
#include "connhandlerlist.h"
#include "logger.h"
#include "signal_handler.h"
#include "xmalloc.h"

Include dependency graph for server.c:

Include dependency graph

Go to the source code of this file.

Functions

int changeUserGroupID ()
 used to degrade the user and group. More...

int newServerSocket (unsigned short int port_num)
 create a new server socket. More...

int svCloseConnection (ConnHandler ch)
 closes a client connection and terminates the corresponding ConnHandler the ConnHandler stored in the list's current active node is. More...

int svMain (const int port)
 initialize socket and start server.


Variables

fd_set sock_recv_set
 set of sockets currently active. More...

fd_set sock_send_set
 set of sockets with data in send queue.

fd_set sock_recv_ready_set
 sockets with data waiting to be read / sockets ready to send.

fd_set sock_send_ready_set
 sockets with data waiting to be read / sockets ready to send.

ConnHandlerList ch_list
 list of active connection handlers.


Detailed Description

initialize and start server core.

Definition in file server.c.


Function Documentation

int changeUserGroupID  
 

used to degrade the user and group.

this is used for security reasons

Returns:
0 on success, -1 otherwise

Definition at line 308 of file server.c.

Referenced by svMain().

int newServerSocket unsigned short int    port_num
 

create a new server socket.

Creates and binds a new socket which is then initalized for accepting connections (listen).
This function will move to a separate module until the next release.

Parameters:
port_num  number of port to bind
Returns:
returns -1 on failure and the new socket's descriptor on success

Definition at line 77 of file server.c.

Referenced by svMain().

int svCloseConnection ConnHandler    ch
 

closes a client connection and terminates the corresponding ConnHandler the ConnHandler stored in the list's current active node is.

Terminates the given connection handler and removes the corresponding socket from the set of active sockets.

Definition at line 100 of file server.c.


Variable Documentation

fd_set sock_recv_set
 

set of sockets currently active.

Todo:
: put these into a structure (create a server state structure, opaque Server data type)

Definition at line 57 of file server.c.


Generated on Fri Jan 25 22:41:00 2002 for PDepp Webserver by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001