blob: 95f5525d465096186b87cf9a0fc818cf853ef6e9 [file] [log] [blame]
Philipp Maier3f4a4cb2021-07-26 13:20:05 +02001#pragma once
2
3/* Struct to handle a member of a pool of MGWs. */
4struct mgcp_client_pool_member {
5 struct llist_head list;
6
7 /* Reference number assinged by VTY. This number is used to manage the pool from the VTY and to identify it in
8 * the log. */
9 unsigned int nr;
10
11 /* MGCP client configuration, this is not the running configuration, when mgcp_client_init() is executed, a
12 * copy of this config is created. */
13 struct mgcp_client_conf conf;
14
15 /* MGCP client descriptor, will be automatically allocated when mgcp_client_pool_connect() is called. (the MGCP
16 * client is connected when this pointer is populated) */
17 struct mgcp_client *client;
18
19 /* A pool member may be set as 'blocked' from the VTY, this means that the pool member may still work and serve
20 * ongoing calls, but it won't be picked from the pool anymore. */
21 bool blocked;
22
23 /* Reference counter to count how often this pool member is currently picked. */
24 unsigned int refcount;
25};
26
27/* Struct to handle a pool of MGWs. (Use _pool functions) */
28struct mgcp_client_pool {
29
30 /* A pointer to a 'single' mgcp client. This is a non-pooled MGCP client that is configured using
31 * mgcp_client_vty_init() and actively registered by the API user using mgcp_client_pool_register_single() */
32 struct mgcp_client *mgcp_client_single;
33
34 /* A list that manages the pool members (see above) */
35 struct llist_head pool;
36
37 /* String to use for indentation when writing the configuration file to the VTY. This field is populated by
38 * mgcp_client_pool_vty_init() */
39 char *vty_indent;
40
41 /* VTY node specification used with this pool. This field is populated by mgcp_client_pool_vty_init() */
42 struct cmd_node *vty_node;
43};
Philipp Maierdf9192e2021-09-03 17:50:51 +020044
45const char *mgcp_client_pool_member_name(const struct mgcp_client_pool_member *pool_member);