Forráskód Böngészése

:construction: Debut serveur BomberStudent

Arthur Brandao 6 éve
szülő
commit
87c053faf4
3 módosított fájl, 16 hozzáadás és 3 törlés
  1. 4 2
      Serveur/arraylist.h
  2. 10 1
      Serveur/bomberstudent_server.c
  3. 2 0
      Serveur/bomberstudent_server.h

+ 4 - 2
Serveur/arraylist.h

@@ -10,12 +10,14 @@
 
 /* --- Include --- */
 #include "constante.h"
+#include "server.h"
+#include "json.h"
 
 /* --- Structure --- */
 typedef struct al_node al_node;
 struct al_node{
     char* key; //Clef d'accès
-    int(*handler)(char*); //Fonction
+    int(*handler)(Server, JsonParser*); //Fonction
     al_node* prev; //Noeud precedent
     al_node* next; //Noeud suivant
 };
@@ -40,7 +42,7 @@ void arraylist_ini(arraylist*);
  * @param int(*)(char*) Fonction
  * @return al_node* Le noeud ajouté
  */
-al_node* arraylist_add(arraylist*, char*, int(*)(char*));
+al_node* arraylist_add(arraylist*, char*, int(*)(Server, JsonParser*));
 
 /**
  * Cherche un noeud

+ 10 - 1
Serveur/bomberstudent_server.c

@@ -8,10 +8,19 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
-#include "server.h"
+#include "arraylist.h"
 #include "bomberstudent_server.h"
 
+/* --- Globale --- */
+arraylist get;
+arraylist post;
+
 /* --- Fonctions publiques --- */
+void ini_server(){
+    arraylist_ini(&get);
+    arraylist_ini(&post);
+}
+
 boolean launch_udp_server(int port){
     return false;
 }

+ 2 - 0
Serveur/bomberstudent_server.h

@@ -10,12 +10,14 @@
 
 /* --- Include --- */
 #include "constante.h"
+#include "server.h"
 
 /* --- Constantes --- */
 #define PORT_UDP 18624
 #define PORT_TCP 18642
 
 /* --- Fonctions --- */
+void ini_server();
 boolean launch_udp_server(int);
 
 #endif /* BOMBERSTUDENT_SERVER_H */