-
Notifications
You must be signed in to change notification settings - Fork 107
/
server.h
72 lines (64 loc) · 2.13 KB
/
server.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Copyright 2013-2024 Fabian Groffen
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SERVER_H
#define SERVER_H 1
#include <netdb.h>
#include "relay.h"
#define SERVER_STALL_BITS 4 /* 0 up to 15 */
typedef struct _server server;
server *server_new(
const char *ip,
unsigned short port,
con_type type,
con_trnsp transport,
char *mtlspemcert,
char *mtlspemkey,
con_proto ctype,
struct addrinfo *saddr,
struct addrinfo *hint,
size_t queuesize,
size_t batchsize,
int maxstalls,
unsigned short iotimeout,
unsigned int sockbufsize);
char server_cmp(server *s, struct addrinfo *saddr, const char *ip);
char server_start(server *s);
void server_closecon(server *s);
void server_add_secondaries(server *d, server **sec, size_t cnt);
void server_set_failover(server *d);
void server_set_instance(server *d, char *inst);
char server_send(server *s, const char *d, char force);
void server_shutdown(server *s);
void server_free(server *s);
void server_swap_queue(server *l, server *r);
const char *server_ip(server *s);
unsigned short server_port(server *s);
char *server_instance(server *s);
con_proto server_ctype(server *s);
con_type server_type(server *s);
con_trnsp server_transport(server *s);
char server_failed(server *s);
size_t server_get_ticks(server *s);
size_t server_get_metrics(server *s);
size_t server_get_stalls(server *s);
size_t server_get_dropped(server *s);
size_t server_get_ticks_sub(server *s);
size_t server_get_metrics_sub(server *s);
size_t server_get_stalls_sub(server *s);
size_t server_get_dropped_sub(server *s);
size_t server_get_queue_len(server *s);
size_t server_get_queue_size(server *s);
#endif