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