FreeCalypso > hg > osmo-playpen
annotate ctrl-client/client.h @ 22:7bfe3e21eaae default tip
top Makefile: add ctrl-client
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 17 Dec 2023 08:53:35 +0000 |
parents | 80849380395d |
children |
rev | line source |
---|---|
21
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #pragma once |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 #include <stdint.h> |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 #include <stdbool.h> |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 enum match_kind { |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 MATCH_NAME, |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 MATCH_HOST, |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 MATCH_BOTH, |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 MATCH_EITHER, |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 }; |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 /* a client config */ |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 struct host_cfg { |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 /* name of this client */ |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 const char *name; |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 /* remote host/IP */ |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 char *remote_host; |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 /* remote port */ |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 uint16_t remote_port; |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 }; |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 struct host_cfg *host_cfg_alloc(void *ctx, const char *name, const char *host, uint16_t port); |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 bool match_config(const struct host_cfg *cfg, const char *match, enum match_kind k); |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 char *make_authority(void *ctx, const struct host_cfg *cfg); |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 struct osmo_stream_cli *make_tcp_client(struct host_cfg *cfg); |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 void update_name(struct host_cfg *cfg, const char *new_name); |
80849380395d
osmo-ctrl-client compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 void update_host(struct host_cfg *cfg, const char *new_host); |