Dillo v3.1.1-46-g8a360e32
Loading...
Searching...
No Matches
main.c File Reference
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/stat.h>
#include "dpid_common.h"
#include "dpid.h"
#include "dpi.h"
#include "dpi_socket_dir.h"
#include "misc_new.h"
#include "../dlib/dlib.h"
#include "../dpip/dpip.h"
Include dependency graph for main.c:

Go to the source code of this file.

Enumerations

enum  { no_errors , dpid_srs_addrinuse }
 

Functions

static int start_filter_plugin (struct dp dpi_attr)
 Start a dpi filter plugin after accepting the pending connection \Return.
 
static void start_server_plugin (struct dp dpi_attr)
 
static char * get_request (Dsh *sh)
 
static int get_command (Dsh *sh, char *dpi_tag)
 
static int server_is_running (char *server_id)
 Check whether a dpi server is running.
 
static int get_open_max (void)
 Get MAX open FD limit (yes, it's tricky –Jcid).
 
int main (void)
 

Variables

sigset_t mask_sigchld
 
enum { ... }  dpi_errno
 
char * srs_name
 
int numdpis
 
fd_set sock_set
 
struct dpdpi_attr_list
 
Dlistservices_list
 
int numsocks
 
int srs_fd
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
no_errors 
dpid_srs_addrinuse 

Definition at line 39 of file main.c.

Function Documentation

◆ get_command()

static int get_command ( Dsh sh,
char *  dpi_tag 
)
static

Get value of cmd field in dpi_tag \Return command code on success, -1 on failure

Definition at line 152 of file main.c.

References _ERRMSG, a_Dpip_build_cmd(), a_Dpip_dsh_write_str(), a_Dpip_get_attr(), AUTH_CMD, BYE_CMD, CHECK_SERVER_CMD, dFree(), ERRMSG, MSG_ERR, REGISTER_ALL_CMD, REGISTER_SERVICE_CMD, sh, and UNKNOWN_CMD.

Referenced by main().

◆ get_open_max()

static int get_open_max ( void  )
static

Get MAX open FD limit (yes, it's tricky –Jcid).

Definition at line 210 of file main.c.

Referenced by main().

◆ get_request()

static char * get_request ( Dsh sh)
static

Read service request from sock \Return pointer to dynamically allocated request tag

Definition at line 136 of file main.c.

References a_Dpip_dsh_read_token(), mask_sigchld, and sh.

Referenced by main().

◆ main()

◆ server_is_running()

static int server_is_running ( char *  server_id)
static

Check whether a dpi server is running.

Definition at line 193 of file main.c.

References dpi_attr_list, and numdpis.

Referenced by main().

◆ start_filter_plugin()

static int start_filter_plugin ( struct dp  dpi_attr)
static

Start a dpi filter plugin after accepting the pending connection \Return.

  • Child process ID on success
  • 0 on failure

Definition at line 60 of file main.c.

References dClose(), ERRMSG, MSG_ERR, dp::path, and dp::sock_fd.

Referenced by main().

◆ start_server_plugin()

static void start_server_plugin ( struct dp  dpi_attr)
static

Definition at line 112 of file main.c.

References dClose(), ERRMSG, MSG_ERR, dp::path, and dp::sock_fd.

Referenced by main().

Variable Documentation

◆ dpi_attr_list

struct dp* dpi_attr_list

◆ []

enum { ... } dpi_errno

Referenced by main().

◆ mask_sigchld

sigset_t mask_sigchld

Definition at line 35 of file main.c.

Referenced by get_request(), and main().

◆ numdpis

◆ numsocks

int numsocks

Number of sockets being watched

Definition at line 49 of file main.c.

Referenced by handle_sigchld(), init_all_dpi_sockets(), main(), and register_all_cmd().

◆ services_list

Dlist* services_list

service served for each plugin

Definition at line 48 of file main.c.

Referenced by fill_services_list(), main(), register_all_cmd(), and send_sockport().

◆ sock_set

fd_set sock_set

Set of sockets watched for connections

Definition at line 46 of file main.c.

Referenced by handle_sigchld(), ignore_dpi_sockets(), init_dpi_socket(), init_ids_srs_socket(), main(), and register_all_cmd().

◆ srs_fd

int srs_fd

dpid's service request socket file descriptor

Definition at line 50 of file main.c.

Referenced by init_ids_srs_socket(), main(), and register_all_cmd().

◆ srs_name

char* srs_name

Definition at line 44 of file main.c.

Referenced by a_Dpi_srs().