peapod  0.1.0
EAPOL Proxy Daemon
Functions | Variables
peapod.c File Reference

EAPOL Proxy Daemon. More...

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <paths.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include "args.h"
#include "daemonize.h"
#include "defaults.h"
#include "log.h"
#include "parser.h"
#include "proxy.h"
Include dependency graph for peapod.c:

Functions

static void help_exit (int status)
 Print usage information to stderr and exit. More...
 
static void signal_handler (int sig)
 Signal handler. More...
 
int main (int argc, char *argv[])
 Main function. More...
 
int peapod_close_fds (void)
 Close all open file descriptors except stdin, stdout, and stderr. More...
 
int peapod_redir_stdfds (void)
 Redirect stdin, stdout, and stderr to /dev/null. More...
 

Variables

static const char usage []
 Program usage string. More...
 
static char * clean_environ [] = { "PATH=" _PATH_STDPATH, NULL }
 An environment containing only PATH. More...
 
char ** environ
 Environment variables. More...
 
struct args_t args
 Program arguments data structure. More...
 
struct iface_tifaces
 Interface list. More...
 
Signal counters
Note
Global
volatile sig_atomic_t sig_hup = 0
 
volatile sig_atomic_t sig_int = 0
 
volatile sig_atomic_t sig_usr1 = 0
 
volatile sig_atomic_t sig_term = 0
 

Detailed Description

EAPOL Proxy Daemon.

Function Documentation

static void help_exit ( int  status)
static

Print usage information to stderr and exit.

Parameters
statusThe exit status to pass to the exit(2) system call
static void signal_handler ( int  sig)
static

Signal handler.

Increment signal counters upon receiving a signal. If more than one SIGINT or SIGTERM has been received without being acted upon, abort the program.

Parameters
sigThe signal that was received
int main ( int  argc,
char *  argv[] 
)

Main function.

Parameters
argcThe number of command-line arguments
argvAn array of command-line arguments (i.e. C strings)
Returns
0 by default
int peapod_close_fds ( void  )

Close all open file descriptors except stdin, stdout, and stderr.

Returns
0 if successful, or -1 if unsuccessful
int peapod_redir_stdfds ( void  )

Redirect stdin, stdout, and stderr to /dev/null.

Returns
0 if successful, or -1 if unsuccessful

Variable Documentation

volatile sig_atomic_t sig_hup = 0
volatile sig_atomic_t sig_int = 0
volatile sig_atomic_t sig_usr1 = 0
volatile sig_atomic_t sig_term = 0
const char usage[]
static

Program usage string.

char* clean_environ[] = { "PATH=" _PATH_STDPATH, NULL }
static

An environment containing only PATH.

char** environ

Environment variables.

Note
Global, provided by compiler
struct args_t args

Program arguments data structure.

Note
Global
struct iface_t* ifaces

Interface list.

Note
Global