root/main.c

Revision 50d394694572395c2e60cc6061abb8a6a3fc9686, 0.9 kB (checked in by D.J. Capelis <mail@…>, 3 years ago)

This is the version of fived I used at defcon, it is highly experimental
and should not be used yet.

  • Property mode set to 100644
Line 
1#include"main.h"
2
3int listen_queue = 16;
4int port_number = 1;
5struct service * servicelist;
6
7struct sigaction ignore;    // Ignore signal handler
8
9int main()
10{
11    ignore.sa_handler = SIG_IGN;
12    sigaction(SIGPIPE, &ignore, NULL);
13
14    printf("Layer 5 daemon starting up\n");
15
16    /* Initialization */
17    if(init_config())
18    {
19        printf("Configuration parsing failed\n");
20        return 1;
21    }
22    if(init_services())
23    {
24        printf("Failed during service initialization\n");
25        return 1;
26    }
27    if(init_net())
28    {
29        printf("Failed to initialize\n");
30        return 1;
31    }
32    printf("Layer 5 daemon online\n");
33
34    int sock;
35    pthread_t tid;
36    while(1)
37    {
38        sock = accept(mainsock,NULL,NULL);
39        error(sock); //TODO: Debugging only
40
41        pthread_create(&tid, NULL, &handle, (void*) sock);
42        pthread_detach(tid);
43    }
44    //never return
45
46    return 0;
47}
Note: See TracBrowser for help on using the browser.