Max | 5d42b8e | 2019-02-07 17:28:01 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <stdint.h> |
| 4 | #include <stdbool.h> |
| 5 | |
| 6 | enum match_kind { |
| 7 | MATCH_NAME, |
| 8 | MATCH_HOST, |
| 9 | MATCH_BOTH, |
| 10 | MATCH_EITHER, |
| 11 | }; |
| 12 | |
| 13 | /* a client config */ |
| 14 | struct host_cfg { |
| 15 | /* name of this client */ |
| 16 | const char *name; |
| 17 | /* remote host/IP */ |
Max | 6cbdcaf | 2019-02-21 10:06:19 +0100 | [diff] [blame] | 18 | char *remote_host; |
Max | 5d42b8e | 2019-02-07 17:28:01 +0100 | [diff] [blame] | 19 | /* remote port */ |
| 20 | uint16_t remote_port; |
| 21 | }; |
| 22 | |
| 23 | struct host_cfg *host_cfg_alloc(void *ctx, const char *name, const char *host, uint16_t port); |
| 24 | bool match_config(const struct host_cfg *cfg, const char *match, enum match_kind k); |
| 25 | char *make_authority(void *ctx, const struct host_cfg *cfg); |
Max | 9a852f2 | 2019-01-31 15:58:57 +0100 | [diff] [blame] | 26 | |
| 27 | struct osmo_stream_cli *make_tcp_client(struct host_cfg *cfg); |
| 28 | |
| 29 | void update_name(struct host_cfg *cfg, const char *new_name); |
| 30 | void update_host(struct host_cfg *cfg, const char *new_host); |