From 973e8f07725eb7d9ef620aa5ac6cd0b84cc79991 Mon Sep 17 00:00:00 2001 From: Vytor Calixto <vytorcalixto@gmail.com> Date: Tue, 24 Nov 2015 16:29:24 -0200 Subject: [PATCH] Added definitions and included socket connection --- ConexaoRawSocket.c | 2 ++ Makefile | 1 - client.cpp | 3 +++ definitions.h | 13 +++++++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ConexaoRawSocket.c b/ConexaoRawSocket.c index 0b9967c..cc70d3a 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 15d2058..b76d981 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 7b9d490..febcc73 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 6bfad53..35c3de5 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, -- GitLab