extremely private squids looking is deathing
This commit is contained in:
parent
3c4ea66b8b
commit
b1b96ba3e9
7 changed files with 72 additions and 8 deletions
30
protocol
Normal file
30
protocol
Normal file
|
@ -0,0 +1,30 @@
|
|||
PROTOCOL
|
||||
|
||||
this is almost a carbon copy of every other tcp/ip protocol i write
|
||||
don't care enough to make it fancy
|
||||
|
||||
packed values are msb
|
||||
|
||||
byte n is b.sub n
|
||||
|
||||
---
|
||||
|
||||
byte the zero: packet id
|
||||
byte the one: region count
|
||||
for 0 <= n < b.sub 1
|
||||
byte the byte after the last byte byte:
|
||||
region length < 128: one byte
|
||||
region length >= 128: two bytes, highest bit on msb always 1
|
||||
|
||||
byte the bytes after the header octet bytes:
|
||||
raw body data shoved next to each other with no separation
|
||||
|
||||
---
|
||||
|
||||
server -> client
|
||||
|
||||
|
||||
---
|
||||
|
||||
client -> server
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SCREEN_H
|
||||
#define SCREEN_H
|
||||
#ifndef CLIENT_SCREEN_H
|
||||
#define CLIENT_SCREEN_H
|
||||
|
||||
#include <ncurses.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -4,7 +4,7 @@ struct {
|
|||
WINDOW *main_win;
|
||||
WINDOW *chat_win;
|
||||
WINDOW *info_win;
|
||||
} ui_ctx;
|
||||
} ctx;
|
||||
|
||||
static void ui_draw_borders();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef UI_H
|
||||
#define UI_H
|
||||
#ifndef CLIENT_UI_H
|
||||
#define CLIENT_UI_H
|
||||
|
||||
#include <ncurses.h>
|
||||
#include <stdlib.h>
|
||||
|
|
25
src/server/context.c
Normal file
25
src/server/context.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "context.h"
|
||||
|
||||
struct {
|
||||
BOOL running;
|
||||
pthread_t *thread;
|
||||
} ctx;
|
||||
|
||||
void server_context() {
|
||||
while(ctx.running == TRUE) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void server_context_start() {
|
||||
if(ctx.running == TRUE)
|
||||
return;
|
||||
|
||||
pthread_create(ctx.thread, NULL, server_context, NULL);
|
||||
ctx.running = TRUE;
|
||||
}
|
||||
|
||||
void server_context_stop() {
|
||||
ctx.running = FALSE;
|
||||
|
||||
}
|
11
src/server/context.h
Normal file
11
src/server/context.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef SERVER_CONTEXT_H
|
||||
#define SERVER_CONTEXT_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <pthread.h>
|
||||
#include "common.h"
|
||||
|
||||
void server_context_start();
|
||||
void server_context_stop();
|
||||
|
||||
#endif
|
|
@ -21,5 +21,3 @@ void server() {
|
|||
sock_stop(sock);
|
||||
sock_free(sock);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue