Split out peer

This commit is contained in:
Ian Gulliver
2016-02-22 16:49:43 -08:00
parent b5219d9c1a
commit b5ab0cb0a6
12 changed files with 119 additions and 99 deletions

15
adsbus/peer.h Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
#include <sys/epoll.h>
// All specific peer structs must be castable to this.
struct peer;
typedef void (*peer_event_handler)(struct peer *);
struct peer {
int fd;
peer_event_handler event_handler;
};
void peer_init();
void peer_epoll_add(struct peer *, uint32_t);
void peer_epoll_del(struct peer *);
void peer_loop();