mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
The `keepalive` feature in libosmo-mgcp-client allows scheduling periodical queries on the MGCP layer in order to make sure it is reachable and hence obtain information on the state of the MGCP link. This patch only uses it to print the status on the VTY, but it will be used too in a follow-up commit by the MGW Pool when picking an MGW from the pool: MGWs whose link is considered to be DOWN are skipped. The feature consists of: - A `keepalive request-interval` which will trigger a transmission of an MGCP AuditEndpoint command targeting endpoint with name `keepalive request-endpoint`. This interval is updated every time any message is transmitted in the MGCP link, meaning the MGCP AuditEndpoint message is only triggered if no message has been transmitted since `keepalive request-interval` seconds ago. - A `keepalive timeout` considering the MGW to be non-reachable (link DOWN) if no message is received over that amount of time. The `keepalive` parameters are to be preferrably configured so that "keepalive request-interval" * 2 < "keepalive timeout". Example VTY configuration of `keepalive` feature in libosmo-mgcp-client: ---- mgw 0 ... keepalive request-interval 20 <1> keepalive request-endpoint null <2> keepalive timeout 50 <3> ---- <1> Transmit an MGCP AuditEndpoint message to the MGW if no message has been sent to it over last 10 seconds <2> The MGCP AuditEndpoint targets the `null` endpoint. This is a special endpoint available at OsmoMGW for those purposes, but any available endpoint can be configured and used instead. <3> Consider the MGCP link to be DOWN if no message is received from the MGW over the last 50 seconds NOTE: The `keepalive` feature is disabled by default, and must be explicitly configured in order to enable it. Related: SYS#6481 Change-Id: I3dc74c78548d017f272da863d5282dc5e0020ca3
40 lines
915 B
C
40 lines
915 B
C
#pragma once
|
|
|
|
#include <osmocom/core/write_queue.h>
|
|
#include <osmocom/core/timer.h>
|
|
|
|
#define MSGB_CB_MGCP_TRANS_ID 0
|
|
|
|
/* Struct that holds one endpoint name */
|
|
struct reset_ep {
|
|
struct llist_head list;
|
|
char name[MGCP_ENDPOINT_MAXLEN];
|
|
};
|
|
|
|
struct mgcp_client {
|
|
struct mgcp_client_conf actual;
|
|
struct osmo_wqueue wq;
|
|
mgcp_trans_id_t next_trans_id;
|
|
struct llist_head responses_pending;
|
|
struct mgcp_client_pool_member *pool_member;
|
|
struct osmo_timer_list keepalive_tx_timer;
|
|
struct osmo_timer_list keepalive_rx_timer;
|
|
bool conn_up;
|
|
};
|
|
|
|
struct mgcp_response_pending {
|
|
struct llist_head entry;
|
|
|
|
mgcp_trans_id_t trans_id;
|
|
mgcp_response_cb_t response_cb;
|
|
void *priv;
|
|
};
|
|
|
|
int mgcp_client_rx(struct mgcp_client *mgcp, struct msgb *msg);
|
|
|
|
struct mgcp_response_pending * mgcp_client_pending_add(
|
|
struct mgcp_client *mgcp,
|
|
mgcp_trans_id_t trans_id,
|
|
mgcp_response_cb_t response_cb,
|
|
void *priv);
|