Neels Hofmeyr | 538d2c5 | 2019-01-28 03:51:35 +0100 | [diff] [blame] | 1 | /* FSM to manage multiple connections of an MGW endpoint */ |
| 2 | #pragma once |
| 3 | |
| 4 | #include <osmocom/mgcp_client/mgcp_client_fsm.h> |
| 5 | |
| 6 | #define LOG_MGCPC_EP(ep, level, fmt, args...) do { \ |
| 7 | LOGPFSML(ep->fi, level, "%s " fmt, \ |
| 8 | osmo_mgcpc_ep_name(ep), ## args); \ |
| 9 | } while(0) |
| 10 | |
| 11 | struct osmo_mgcpc_ep; |
| 12 | struct osmo_mgcpc_ep_ci; |
| 13 | struct osmo_tdef; |
| 14 | |
| 15 | struct osmo_mgcpc_ep *osmo_mgcpc_ep_alloc(struct osmo_fsm_inst *parent, uint32_t parent_term_event, |
| 16 | struct mgcp_client *mgcp_client, |
| 17 | const struct osmo_tdef *T_defs, |
| 18 | const char *fsm_id, |
| 19 | const char *endpoint_str_fmt, ...); |
| 20 | |
| 21 | struct osmo_mgcpc_ep_ci *osmo_mgcpc_ep_ci_add(struct osmo_mgcpc_ep *ep, const char *label_fmt, ...); |
| 22 | const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_rtp_info(const struct osmo_mgcpc_ep_ci *ci); |
| 23 | bool osmo_mgcpc_ep_ci_get_crcx_info_to_sockaddr(const struct osmo_mgcpc_ep_ci *ci, struct sockaddr_storage *dest); |
Pau Espin Pedrol | 30907dc | 2019-05-06 11:54:17 +0200 | [diff] [blame] | 24 | bool osmo_mgcpc_ep_ci_get_crcx_info_to_osmux_cid(const struct osmo_mgcpc_ep_ci *ci, uint8_t* cid); |
Neels Hofmeyr | 538d2c5 | 2019-01-28 03:51:35 +0100 | [diff] [blame] | 25 | |
| 26 | void osmo_mgcpc_ep_ci_request(struct osmo_mgcpc_ep_ci *ci, |
| 27 | enum mgcp_verb verb, const struct mgcp_conn_peer *verb_info, |
| 28 | struct osmo_fsm_inst *notify, |
| 29 | uint32_t event_success, uint32_t event_failure, |
| 30 | void *notify_data); |
| 31 | |
| 32 | /*! Dispatch a DLCX for the given connection. |
| 33 | * \param ci Connection identifier as obtained from osmo_mgcpc_ep_ci_add(). |
| 34 | */ |
| 35 | static inline void osmo_mgcpc_ep_ci_dlcx(struct osmo_mgcpc_ep_ci *ci) |
| 36 | { |
| 37 | osmo_mgcpc_ep_ci_request(ci, MGCP_VERB_DLCX, NULL, NULL, 0, 0, NULL); |
| 38 | } |
| 39 | |
| 40 | void osmo_mgcpc_ep_clear(struct osmo_mgcpc_ep *ep); |
| 41 | |
| 42 | const char *osmo_mgcpc_ep_name(const struct osmo_mgcpc_ep *ep); |
| 43 | const char *osmo_mgcpc_ep_ci_name(const struct osmo_mgcpc_ep_ci *ci); |
| 44 | const char *osmo_mgcpc_ep_ci_id(const struct osmo_mgcpc_ep_ci *ci); |
| 45 | |
| 46 | extern const struct value_string osmo_mgcp_verb_names[]; |
| 47 | static inline const char *osmo_mgcp_verb_name(enum mgcp_verb val) |
| 48 | { return get_value_string(osmo_mgcp_verb_names, val); } |