58 lines
1.4 KiB
C
58 lines
1.4 KiB
C
/* global */
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <pthread.h>
|
|
|
|
/* sys */
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
|
|
/* socket */
|
|
#include <netinet/in.h>
|
|
#include <netdb.h> // getaddrinfo, getnameinfo
|
|
#include <arpa/inet.h>
|
|
|
|
|
|
/* debug */
|
|
#define SOCKETS 0x01 // debug RESEAU
|
|
#define COMMANDS 0x02 // debug COMMANDES
|
|
#define DATA 0x04 // debug DONNEES
|
|
#define REVEALS 0x08 // debug EXPLICITATION des strings
|
|
#define BUFFERS 0x10 // debug des BUFFERS
|
|
#define HEADERS 0x20 // debug des HEADERS de fonctions
|
|
#define THREADS 0x40 // debug des THREADS
|
|
|
|
#define SCK 0x01 // FILTRE pour SOCKET
|
|
#define CMD 0x02 // FILTRE pour COMMAND
|
|
#define DAT 0x04 // FILTRE pour DATA
|
|
#define RVL 0x08 // FILTRE pour REVEALS
|
|
#define BUF 0x10 // FILTRE pour BUFFERS
|
|
#define HDR 0x20 // FILTRE pour HEADERS
|
|
#define THR 0x40 // FILTRE pour THREADS
|
|
|
|
// possibilité de cumuler les DEBUGMODES
|
|
#define DEBUGMOD SOCKETS + THREADS // REVEALS + HEADER + THREADS
|
|
|
|
|
|
/* vars */
|
|
#define remoteHost "localhost"
|
|
#define remotePort "80"
|
|
#define maxBuffLen 4096
|
|
#define maxListLen 10
|
|
#define maxHostLen 64
|
|
#define maxPortLen 6
|
|
|
|
/* local dependencies */
|
|
#include "dep/utility.c"
|
|
#include "dep/server.c"
|
|
|
|
|
|
/* headers */
|
|
void* manageConnection(void* THREADABLE_SOCKET);
|
|
|
|
// VARIABLES
|
|
static pthread_t managers[maxListLen]; // contiendra les THREADS
|
|
static int activeManagers[maxListLen] = {0}; // contiendra les THREADS actifs
|