2016-02-15 20:01:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
2016-02-16 02:28:05 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
2016-02-15 20:01:48 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PARSER_STATE_LEN 256
|
|
|
|
|
struct backend;
|
2016-02-17 08:05:18 +00:00
|
|
|
struct addrinfo;
|
2016-02-15 20:01:48 +00:00
|
|
|
typedef bool (*parser)(struct backend *, struct packet *);
|
|
|
|
|
struct backend {
|
2016-02-17 08:05:18 +00:00
|
|
|
struct peer peer;
|
2016-02-15 21:22:23 +00:00
|
|
|
char id[UUID_LEN];
|
2016-02-17 08:05:18 +00:00
|
|
|
char *node;
|
|
|
|
|
char *service;
|
|
|
|
|
struct addrinfo *addrs;
|
|
|
|
|
struct addrinfo *addr;
|
2016-02-15 20:01:48 +00:00
|
|
|
struct buf buf;
|
|
|
|
|
char parser_state[PARSER_STATE_LEN];
|
|
|
|
|
parser parser;
|
|
|
|
|
};
|
|
|
|
|
|
2016-02-17 13:41:33 -08:00
|
|
|
void backend_new(char *, char *, int);
|
2016-02-17 13:56:13 -08:00
|
|
|
void backend_new_fd(int, int, void *);
|