Change in osmo-mgw[master]: move MGW endpoint FSM from osmo-bsc to here
Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13590 ) Change subject: move MGW endpoint FSM from osmo-bsc to here .. move MGW endpoint FSM from osmo-bsc to here Move mgw_endpoint_fsm from osmo-bsc here as osmo_mgcpc_ep_fsm. Apply various renames for consistency. Use osmo_tdef from libosmocore instead of osmo-bsc's (so far) local T_defs API. Change T23042 to T2427001, which is a slightly less arbitrary number and slightly more extendable in the future (2427 corresponds to the default MGCP port at osmo-mgw, 001 is the first MGCP timer and so far the only one). Change-Id: I9a3effd38e72841529df6c135c077116981dea36 --- M include/Makefile.am A include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h M include/osmocom/mgcp_client/mgcp_client_fsm.h M src/libosmo-mgcp-client/Makefile.am A src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c M src/libosmo-mgcp-client/mgcp_client_fsm.c 6 files changed, 866 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/include/Makefile.am b/include/Makefile.am index c34553a..2daaf20 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,6 +4,7 @@ nobase_include_HEADERS = \ osmocom/mgcp_client/mgcp_client.h \ + osmocom/mgcp_client/mgcp_client_endpoint_fsm.h \ osmocom/mgcp_client/mgcp_client_fsm.h \ osmocom/mgcp_client/mgcp_common.h \ osmocom/mgcp/mgcp.h \ diff --git a/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h b/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h new file mode 100644 index 000..73de292 --- /dev/null +++ b/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h @@ -0,0 +1,47 @@ +/* FSM to manage multiple connections of an MGW endpoint */ +#pragma once + +#include + +#define LOG_MGCPC_EP(ep, level, fmt, args...) do { \ + LOGPFSML(ep->fi, level, "%s " fmt, \ +osmo_mgcpc_ep_name(ep), ## args); \ + } while(0) + +struct osmo_mgcpc_ep; +struct osmo_mgcpc_ep_ci; +struct osmo_tdef; + +struct osmo_mgcpc_ep *osmo_mgcpc_ep_alloc(struct osmo_fsm_inst *parent, uint32_t parent_term_event, + struct mgcp_client *mgcp_client, + const struct osmo_tdef *T_defs, + const char *fsm_id, + const char *endpoint_str_fmt, ...); + +struct osmo_mgcpc_ep_ci *osmo_mgcpc_ep_ci_add(struct osmo_mgcpc_ep *ep, const char *label_fmt, ...); +const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_rtp_info(const struct osmo_mgcpc_ep_ci *ci); +bool osmo_mgcpc_ep_ci_get_crcx_info_to_sockaddr(const struct osmo_mgcpc_ep_ci *ci, struct sockaddr_storage *dest); + +void osmo_mgcpc_ep_ci_request(struct osmo_mgcpc_ep_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); + +/*! Dispatch a DLCX for the given connection. + * \param ci Connection identifier as obtained from osmo_mgcpc_ep_ci_add(). + */ +static inline void osmo_mgcpc_ep_ci_dlcx(struct osmo_mgcpc_ep_ci *ci) +{ + osmo_mgcpc_ep_ci_request(ci, MGCP_VERB_DLCX, NULL, NULL, 0, 0, NULL); +} + +void osmo_mgcpc_ep_clear(struct osmo_mgcpc_ep *ep); + +const char *osmo_mgcpc_ep_name(const struct osmo_mgcpc_ep *ep); +const char *osmo_mgcpc_ep_ci_name(const struct osmo_mgcpc_ep_ci *ci); +const char *osmo_mgcpc_ep_ci_id(const struct osmo_mgcpc_ep_ci *ci); + +extern const struct value_string osmo_mgcp_verb_names[]; +static inline const char *osmo_mgcp_verb_name(enum mgcp_verb val) +{ return get_value_string(osmo_mgcp_verb_names, val); } diff --git a/include/osmocom/mgcp_client/mgcp_client_fsm.h b/include/osmocom/mgcp_client/mgcp_client_fsm.h index dabfcca..e170a25 100644 --- a/include/osmocom/mgcp_client/mgcp_client_fsm.h +++ b/include/osmocom/mgcp_client/mgcp_client_fsm.h @@ -64,3 +64,5 @@ void mgcp_conn_delete(struct osmo_fsm_inst *fi); const char *mgcp_conn_get_ci(struct osmo_fsm_inst *fi); + +const char *osmo_mgcpc_conn_peer_name(const struct mgcp_conn_peer *info); diff --git a/src/libosmo-mgcp-client/Makefile.am b/src/libosmo-mgcp-client/Makefile.am index e59da2f..1529853 100644 --- a/src/libosmo-mgcp-client/Makefile.am +++ b/src/libosmo-mgcp-client/Makefile.am @@ -30,6 +30,7 @@ mgcp_client.c \ mgcp_client_vty.c \ mgcp_client_fsm.c \ + mgcp_client_endpoint_fsm.c \ $(NULL) libosmo_mgcp_client_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(MGCP_CLIENT_LIBVERSION) diff --git a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c new file mode 100644 index 000..76552fb --- /dev/null +++ b/src/libo
Change in osmo-mgw[master]: move MGW endpoint FSM from osmo-bsc to here
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13590 ) Change subject: move MGW endpoint FSM from osmo-bsc to here .. Patch Set 5: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13590 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I9a3effd38e72841529df6c135c077116981dea36 Gerrit-Change-Number: 13590 Gerrit-PatchSet: 5 Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Comment-Date: Tue, 30 Apr 2019 06:50:38 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-mgw[master]: move MGW endpoint FSM from osmo-bsc to here
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13590 to look at the new patch set (#5). Change subject: move MGW endpoint FSM from osmo-bsc to here .. move MGW endpoint FSM from osmo-bsc to here Move mgw_endpoint_fsm from osmo-bsc here as osmo_mgcpc_ep_fsm. Apply various renames for consistency. Use osmo_tdef from libosmocore instead of osmo-bsc's (so far) local T_defs API. Change T23042 to T2427001, which is a slightly less arbitrary number and slightly more extendable in the future (2427 corresponds to the default MGCP port at osmo-mgw, 001 is the first MGCP timer and so far the only one). Change-Id: I9a3effd38e72841529df6c135c077116981dea36 --- M include/Makefile.am A include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h M include/osmocom/mgcp_client/mgcp_client_fsm.h M src/libosmo-mgcp-client/Makefile.am A src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c M src/libosmo-mgcp-client/mgcp_client_fsm.c 6 files changed, 866 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/90/13590/5 -- To view, visit https://gerrit.osmocom.org/13590 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9a3effd38e72841529df6c135c077116981dea36 Gerrit-Change-Number: 13590 Gerrit-PatchSet: 5 Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-mgw[master]: move MGW endpoint FSM from osmo-bsc to here
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13590 ) Change subject: move MGW endpoint FSM from osmo-bsc to here .. Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/13590 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I9a3effd38e72841529df6c135c077116981dea36 Gerrit-Change-Number: 13590 Gerrit-PatchSet: 4 Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Comment-Date: Sat, 27 Apr 2019 12:49:11 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-mgw[master]: move MGW endpoint FSM from osmo-bsc to here
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13590 to look at the new patch set (#4). Change subject: move MGW endpoint FSM from osmo-bsc to here .. move MGW endpoint FSM from osmo-bsc to here Move mgw_endpoint_fsm from osmo-bsc here as osmo_mgcpc_ep_fsm. Apply various renames for consistency. Use osmo_tdef from libosmocore instead of osmo-bsc's (so far) local T_defs API. Change T23042 to T2427001, which is a slightly less arbitrary number and slightly more extendable in the future (2427 corresponds to the default MGCP port at osmo-mgw, 001 is the first MGCP timer and so far the only one). Change-Id: I9a3effd38e72841529df6c135c077116981dea36 --- M include/Makefile.am A include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h M include/osmocom/mgcp_client/mgcp_client_fsm.h M src/libosmo-mgcp-client/Makefile.am A src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c M src/libosmo-mgcp-client/mgcp_client_fsm.c 6 files changed, 869 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/90/13590/4 -- To view, visit https://gerrit.osmocom.org/13590 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9a3effd38e72841529df6c135c077116981dea36 Gerrit-Change-Number: 13590 Gerrit-PatchSet: 4 Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Harald Welte
Change in osmo-mgw[master]: move MGW endpoint FSM from osmo-bsc to here
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13590 ) Change subject: move MGW endpoint FSM from osmo-bsc to here .. Patch Set 3: I like this move (both literally and in abstract sense). However, no matter how much pressure we have in terms of getting features complete, I think it's not a good way to merge new library code without doxygen documentation. Or at least some API documentation on top of the function declearations/definitions at all. This is not some code that is internal to a given sub-system, but it's a "public" API that programs (and hence programmers) are supposed to use, and hence it deserves API docs, IMHO. -- To view, visit https://gerrit.osmocom.org/13590 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I9a3effd38e72841529df6c135c077116981dea36 Gerrit-Change-Number: 13590 Gerrit-PatchSet: 3 Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Harald Welte Gerrit-Comment-Date: Fri, 19 Apr 2019 16:05:52 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-mgw[master]: move MGW endpoint FSM from osmo-bsc to here
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/13590 to look at the new patch set (#3). Change subject: move MGW endpoint FSM from osmo-bsc to here .. move MGW endpoint FSM from osmo-bsc to here Move mgw_endpoint_fsm from osmo-bsc here as osmo_mgcpc_ep_fsm. Apply various renames for consistency. Use osmo_tdef from libosmocore instead of osmo-bsc's (so far) local T_defs API. Change T23042 to T2427001, which is a slightly less arbitrary number and slightly more extendable in the future (2427 corresponds to the default MGCP port at osmo-mgw, 001 is the first MGCP timer and so far the only one). Change-Id: I9a3effd38e72841529df6c135c077116981dea36 --- M include/Makefile.am A include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h M include/osmocom/mgcp_client/mgcp_client_fsm.h M src/libosmo-mgcp-client/Makefile.am A src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c M src/libosmo-mgcp-client/mgcp_client_fsm.c 6 files changed, 808 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/90/13590/3 -- To view, visit https://gerrit.osmocom.org/13590 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I9a3effd38e72841529df6c135c077116981dea36 Gerrit-Change-Number: 13590 Gerrit-PatchSet: 3 Gerrit-Owner: Neels Hofmeyr Gerrit-Reviewer: Jenkins Builder (102)
Change in osmo-mgw[master]: move MGW endpoint FSM from osmo-bsc to here
Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/13590 Change subject: move MGW endpoint FSM from osmo-bsc to here .. move MGW endpoint FSM from osmo-bsc to here Move mgw_endpoint_fsm from osmo-bsc here as osmo_mgcpc_ep_fsm. Apply various renames for consistency. Use osmo_tdef from libosmocore instead of osmo-bsc's (so far) local T_defs API. Change T23042 to T2427001, which is a slightly less arbitrary number and slightly more extendable in the future (2427 corresponds to the default MGCP port at osmo-mgw, 001 is the first MGCP timer and so far the only one). Change-Id: I9a3effd38e72841529df6c135c077116981dea36 --- M include/Makefile.am A include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h M include/osmocom/mgcp_client/mgcp_client_fsm.h M src/libosmo-mgcp-client/Makefile.am A src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c M src/libosmo-mgcp-client/mgcp_client_fsm.c 6 files changed, 810 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/90/13590/1 diff --git a/include/Makefile.am b/include/Makefile.am index c34553a..2daaf20 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,6 +4,7 @@ nobase_include_HEADERS = \ osmocom/mgcp_client/mgcp_client.h \ + osmocom/mgcp_client/mgcp_client_endpoint_fsm.h \ osmocom/mgcp_client/mgcp_client_fsm.h \ osmocom/mgcp_client/mgcp_common.h \ osmocom/mgcp/mgcp.h \ diff --git a/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h b/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h new file mode 100644 index 000..a2297b5 --- /dev/null +++ b/include/osmocom/mgcp_client/mgcp_client_endpoint_fsm.h @@ -0,0 +1,46 @@ +/* FSM to manage multiple connections of an MGW endpoint */ +#pragma once + +#include + +#define LOG_MGCPC_EP(ep, level, fmt, args...) do { \ + LOGPFSML(ep->fi, level, "%s " fmt, \ +osmo_mgcpc_ep_name(ep), ## args); \ + } while(0) + +struct osmo_mgcpc_ep; +struct osmo_mgcpc_ep_ci; +struct osmo_tdef; + +void osmo_mgcpc_ep_fsm_init(); + +struct osmo_mgcpc_ep *osmo_mgcpc_ep_alloc(struct osmo_fsm_inst *parent, uint32_t parent_term_event, + struct mgcp_client *mgcp_client, + const struct osmo_tdef *T_defs, + const char *fsm_id, + const char *endpoint_str_fmt, ...); + +struct osmo_mgcpc_ep_ci *osmo_mgcpc_ep_ci_add(struct osmo_mgcpc_ep *ep, const char *label_fmt, ...); +const struct mgcp_conn_peer *osmo_mgcpc_ep_ci_get_rtp_info(const struct osmo_mgcpc_ep_ci *ci); +bool osmo_mgcpc_ep_ci_get_crcx_info_to_sockaddr(const struct osmo_mgcpc_ep_ci *ci, struct sockaddr_storage *dest); + +void osmo_mgcpc_ep_ci_request(struct osmo_mgcpc_ep_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 osmo_mgcpc_ep_ci_dlcx(struct osmo_mgcpc_ep_ci *ci) +{ + osmo_mgcpc_ep_ci_request(ci, MGCP_VERB_DLCX, NULL, NULL, 0, 0, NULL); +} + +void osmo_mgcpc_ep_clear(struct osmo_mgcpc_ep *ep); + +const char *osmo_mgcpc_ep_name(const struct osmo_mgcpc_ep *ep); +const char *osmo_mgcpc_ep_ci_name(const struct osmo_mgcpc_ep_ci *ci); +const char *osmo_mgcpc_ep_ci_id(const struct osmo_mgcpc_ep_ci *ci); + +extern const struct value_string osmo_mgcp_verb_names[]; +static inline const char *osmo_mgcp_verb_name(enum mgcp_verb val) +{ return get_value_string(osmo_mgcp_verb_names, val); } diff --git a/include/osmocom/mgcp_client/mgcp_client_fsm.h b/include/osmocom/mgcp_client/mgcp_client_fsm.h index dabfcca..e170a25 100644 --- a/include/osmocom/mgcp_client/mgcp_client_fsm.h +++ b/include/osmocom/mgcp_client/mgcp_client_fsm.h @@ -64,3 +64,5 @@ void mgcp_conn_delete(struct osmo_fsm_inst *fi); const char *mgcp_conn_get_ci(struct osmo_fsm_inst *fi); + +const char *osmo_mgcpc_conn_peer_name(const struct mgcp_conn_peer *info); diff --git a/src/libosmo-mgcp-client/Makefile.am b/src/libosmo-mgcp-client/Makefile.am index e59da2f..1529853 100644 --- a/src/libosmo-mgcp-client/Makefile.am +++ b/src/libosmo-mgcp-client/Makefile.am @@ -30,6 +30,7 @@ mgcp_client.c \ mgcp_client_vty.c \ mgcp_client_fsm.c \ + mgcp_client_endpoint_fsm.c \ $(NULL) libosmo_mgcp_client_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(MGCP_CLIENT_LIBVERSION) diff --git a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c new file mode 100644 index 000..a50491f --- /dev/null +++ b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c @@ -0,0 +1,738 @@ +/* FSM to manage multiple connections of an MGW e