diff --git a/ConexaoRawSocket.c b/ConexaoRawSocket.c index 0b9967cf1fd8591407055e443385c6175af83db2..cc70d3ab01ffa0066f4de99efa54ece0698c8b75 100644 --- a/ConexaoRawSocket.c +++ b/ConexaoRawSocket.c @@ -7,6 +7,8 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include <netinet/in.h> +#include <arpa/inet.h> int ConexaoRawSocket(char *device) diff --git a/Makefile b/Makefile index 15d2058c259e061e11d6c399bc29865f90345fee..b76d9812bd4615d9d6eea2e56b60bb0da1ae0947 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ CC=g++ OBJ=Protocol.o - %.o: %.cpp $(CC) $(CFLAGS) $^ -c -o $@ cacoclient: client.cpp $(OBJ) diff --git a/client.cpp b/client.cpp index 7b9d4906f9d4c750d2c7f8bb101911dbfb2ba81a..febcc73f0af06f7951e6da9e6bce9af3bf26fc53 100644 --- a/client.cpp +++ b/client.cpp @@ -1,7 +1,10 @@ #include "definitions.h" #include "dirFunctions.h" +#include "ConexaoRawSocket.c" int main(){ + + int socket = ConexaoRawSocket(DEVICE); while(true){ string command, path; diff --git a/definitions.h b/definitions.h index 6bfad53abd1f2146da7d0b9b8da37c14439c0455..35c3de5e85e7b8ee350dc6e854658d7135b1094a 100644 --- a/definitions.h +++ b/definitions.h @@ -7,6 +7,19 @@ using namespace std; +#define DEVICE "lo" +#define NACK 0 +#define ACK 1 +#define CD 3 +#define LS 4 +#define PUT 5 +#define GET 6 +#define OK 8 +#define TAM 9 +#define TELA 10 +#define ERRO 14 +#define FIM 15 + typedef struct { int begin : 8, size : 6,