1 | /* |
2 | * service.h |
3 | * |
4 | * Copyright (C) 2018 Aerospike, Inc. |
5 | * |
6 | * Portions may be licensed to Aerospike, Inc. under one or more contributor |
7 | * license agreements. |
8 | * |
9 | * This program is free software: you can redistribute it and/or modify it under |
10 | * the terms of the GNU Affero General Public License as published by the Free |
11 | * Software Foundation, either version 3 of the License, or (at your option) any |
12 | * later version. |
13 | * |
14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
16 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
17 | * details. |
18 | * |
19 | * You should have received a copy of the GNU Affero General Public License |
20 | * along with this program. If not, see http://www.gnu.org/licenses/ |
21 | */ |
22 | |
23 | #pragma once |
24 | |
25 | //========================================================== |
26 | // Includes. |
27 | // |
28 | |
29 | #include <stdint.h> |
30 | |
31 | #include "socket.h" |
32 | #include "tls.h" |
33 | |
34 | |
35 | //========================================================== |
36 | // Forward declarations. |
37 | // |
38 | |
39 | struct as_file_handle_s; |
40 | struct as_transaction_s; |
41 | |
42 | |
43 | //========================================================== |
44 | // Typedefs & constants. |
45 | // |
46 | |
47 | typedef struct as_service_endpoint_s { |
48 | cf_addr_list addrs; |
49 | cf_ip_port port; |
50 | } as_service_endpoint; |
51 | |
52 | typedef struct as_service_access_s { |
53 | as_service_endpoint service; |
54 | as_service_endpoint alt_service; |
55 | as_service_endpoint tls_service; |
56 | as_service_endpoint alt_tls_service; |
57 | } as_service_access; |
58 | |
59 | #define MAX_SERVICE_THREADS 4096 |
60 | #define MIN_PROTO_FD_MAX 1024 |
61 | |
62 | |
63 | //========================================================== |
64 | // Globals. |
65 | // |
66 | |
67 | extern as_service_access g_access; |
68 | extern cf_serv_cfg g_service_bind; |
69 | extern cf_tls_info* g_service_tls; |
70 | |
71 | |
72 | //========================================================== |
73 | // Public API. |
74 | // |
75 | |
76 | void as_service_init(void); |
77 | void as_service_start(void); |
78 | void as_service_set_threads(uint32_t n_threads); |
79 | void as_service_rearm(struct as_file_handle_s* fd_h); |
80 | void as_service_enqueue_internal(struct as_transaction_s* tr); |
81 | |