diff --git a/.gitignore b/.gitignore index 602eb40..078cbd0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ bin/ out/ net test +*.o *.swp a.out diff --git a/Makefile b/Makefile index c238eaf..1f98786 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,18 @@ CFLAGS=-g -Wall -Wextra -std=gnu99 +TARGET=bin/netsl +OBJECTS=main.o msg.o net.o +all: $(TARGET) -all: bin/netsl - -#bin/net: net.c -# mkdir -pv bin -# gcc -o bin/net net.c - -#bin/test: test.c -# mkdir -pv bin -# gcc -o bin/test test.c - -bin/netsl: misc.h main.c net.c msg.c msg.h +$(TARGET): $(OBJECTS) mkdir -pv bin - gcc $(CFLAGS) -o bin/netsl main.c + gcc $^ -o $(TARGET) + +%.o: %.c %.h + $(CC) $(CFLAGS) -c $< clean: - rm -rf bin + -$(RM) -rf *.o bin + diff --git a/main.c b/main.c index 0f82528..9e20df9 100644 --- a/main.c +++ b/main.c @@ -1,10 +1,10 @@ #include #include +#include #include #include "misc.h" -#include "net.c" - +#include "net.h" #define MODE_SERVER 0 #define MODE_CLIENT 1 diff --git a/msg.h b/msg.h index fdfe0ff..ca885cb 100644 --- a/msg.h +++ b/msg.h @@ -1,15 +1,16 @@ /* This file was automatically generated. Do not edit! */ -typedef struct message message; typedef struct Buffer Buffer; -void serialize_message(struct message *msg,Buffer *b); -void serialize_string(char *str,Buffer *b); -void serialize_int(int x,Buffer *b); void append_space(Buffer *b,int n); struct Buffer *new_buffer(); +typedef struct message message; +void deserialize(struct message *msg,const char *buf); +void serialize(char *buf,struct message *msg); +int getBufferSize(struct message *msg); struct message { - long timestamp; - int width; // varies - int height; // normally 80 + uint32_t timestamp; + uint32_t width; // varies + uint32_t height; // normally 80 + //char **image; // dimension is width x height char *image; // dimension is width x height }; struct Buffer {