manojampalam 491769a99f 4-13 C1
2016-04-13 19:59:06 -07:00

31 lines
595 B
C

#include <Windows.h>
#include <stdio.h>
#define BUFSIZE 5 * 1024
#define HEADER_SIZE 4
struct agent_connection {
OVERLAPPED ol;
HANDLE connection;
struct {
DWORD size;
DWORD read;
char buf[BUFSIZE];
} request;
enum {
LISTENING = 0,
READING_HEADER,
READING,
WRITING,
DONE
} state;
struct agent_connection* next;
};
void agent_connection_on_io(struct agent_connection*, DWORD, OVERLAPPED*);
void agent_connection_disconnect(struct agent_connection*);
int agent_start();
void agent_shutdown();
void agent_listen();
void agent_cleanup_connection(struct agent_connection*);