-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
70 lines (67 loc) · 1.54 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include "src/config.h"
#include "src/fonction_thread.h"
#include "src/divers.h"
#include "src/liste_chaine.h"
#include "src/reseau.h"
#include "src/chiffrement.h"
#include "src/camellia.h"
llist liste_client = NULL, liste_serveur = NULL, liste_ip = NULL;
Historique liste_historique;
char* chemin_maj = NULL, *chemin_executable = NULL;
char maj_en_cour = 0;
//getifaddrs
/*
Pour le moment,
*/
int main(int argc, char** argv)
{
printf("[i] Demarrage version: %d\n", VERSION);
chemin_maj = "narval.txt";
printf("[i] Chemin de maj: %s\n", chemin_maj);
chemin_executable = argv[0];
printf("[i] Chemin de l'executable: %s\n", chemin_executable);
if(argc == 3)
{
Paquet paquet;
paquet.action = atoi(argv[2]);
paquet.port_usage = PORT_UDP;
paquet.specification = 0;
paquet.suite = 0;
paquet.version = VERSION;
int sock = socket(AF_INET, SOCK_DGRAM, 0);
envoyer_udp(sock, htonl(inet_addr(argv[1])), PORT_UDP, (char*)&paquet, sizeof(paquet));
}
else
{
signal(SIGALRM, &handle_sigalrm);
recuperer_ip();
alarm(MAX_BEFORE_ERASE_CONTACTE);
thread_reception_data(NULL);
}
/*
if(argc == 2)
{
int taille;
char* paq = NULL;
recevoir_maj_tcp(htonl(inet_addr("192.168.2.2")), PORT_TCP, &paq , &taille);
if(paq != NULL)
{
printf("Recu\n");
}
else
{
printf("Tjr nul\n");
}
}
else
{
thread_envoie_maj(NULL);
}
*/
printf("[i] Fin version: %d\n", VERSION);
return 0;
}