aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/bsc/mgw_endpoint_fsm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/osmocom/bsc/mgw_endpoint_fsm.h')
-rw-r--r--include/osmocom/bsc/mgw_endpoint_fsm.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/include/osmocom/bsc/mgw_endpoint_fsm.h b/include/osmocom/bsc/mgw_endpoint_fsm.h
new file mode 100644
index 0000000..54ffe07
--- /dev/null
+++ b/include/osmocom/bsc/mgw_endpoint_fsm.h
@@ -0,0 +1,57 @@
+/* osmo-bsc API to manage all sides of an MGW endpoint */
+#pragma once
+
+#include <osmocom/mgcp_client/mgcp_client_fsm.h>
+
+#include <osmocom/bsc/debug.h>
+
+/* This macro automatically includes a final \n, if omitted. */
+#define LOG_MGWEP(mgwep, level, fmt, args...) do { \
+ LOGPFSML(mgwep->fi, level, "(%s) " fmt "%s", \
+ mgw_endpoint_name(mgwep), \
+ ## args, LOG_ADD_NEWLINE(fmt)); \
+ } while(0)
+
+enum mgwep_fsm_state {
+ MGWEP_ST_UNUSED,
+ MGWEP_ST_WAIT_MGW_RESPONSE,
+ MGWEP_ST_IN_USE,
+};
+
+enum mgwep_fsm_event {
+ _MGWEP_EV_LAST,
+ /* and MGW response events are allocated dynamically */
+};
+
+struct mgw_endpoint;
+struct mgwep_ci;
+struct T_def;
+
+void mgw_endpoint_fsm_init(struct T_def *T_defs);
+
+struct mgw_endpoint *mgw_endpoint_alloc(struct osmo_fsm_inst *parent, uint32_t parent_term_event,
+ struct mgcp_client *mgcp_client,
+ const char *fsm_id,
+ const char *endpoint_str_fmt, ...);
+
+struct mgwep_ci *mgw_endpoint_ci_add(struct mgw_endpoint *mgwep,
+ const char *label_fmt, ...);
+const struct mgcp_conn_peer *mgwep_ci_get_rtp_info(const struct mgwep_ci *ci);
+bool mgwep_ci_get_crcx_info_to_sockaddr(const struct mgwep_ci *ci, struct sockaddr_storage *dest);
+
+void mgw_endpoint_ci_request(struct mgwep_ci *ci,
+ enum mgcp_verb verb, const struct mgcp_conn_peer *verb_info,
+ struct osmo_fsm_inst *notify,
+ uint32_t event_success, uint32_t event_failure,
+ void *notify_data);
+
+static inline void mgw_endpoint_ci_dlcx(struct mgwep_ci *ci)
+{
+ mgw_endpoint_ci_request(ci, MGCP_VERB_DLCX, NULL, NULL, 0, 0, NULL);
+}
+
+void mgw_endpoint_clear(struct mgw_endpoint *mgwep);
+
+const char *mgw_endpoint_name(const struct mgw_endpoint *mgwep);
+const char *mgwep_ci_name(const struct mgwep_ci *ci);
+const char *mgcp_conn_peer_name(const struct mgcp_conn_peer *info);