dexter has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/18755 )

Change subject: endp: add typeset for e1-endpoints
......................................................................

endp: add typeset for e1-endpoints

Add an endpoint typeset for E1 support, also lets add dummy callbacks
for the cleanup and rtp dispatch functionality.

Related: OS#2547
Change-Id: I68b719a906e8f7251f0ca8c74ceec73bc40376f7
---
M include/osmocom/mgcp/mgcp_endp.h
M include/osmocom/mgcp/mgcp_internal.h
M src/libosmo-mgcp/mgcp_endp.c
M src/libosmo-mgcp/mgcp_network.c
4 files changed, 41 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve



diff --git a/include/osmocom/mgcp/mgcp_endp.h b/include/osmocom/mgcp/mgcp_endp.h
index 8fb8d2c..0f9110c 100644
--- a/include/osmocom/mgcp/mgcp_endp.h
+++ b/include/osmocom/mgcp/mgcp_endp.h
@@ -60,6 +60,7 @@
 /*! MGCP endpoint typeset */
 struct mgcp_endpoint_typeset {
        struct mgcp_endpoint_type rtp;
+       struct mgcp_endpoint_type e1;
 };

 /*! static MGCP endpoint typeset (pre-initalized, read-only) */
diff --git a/include/osmocom/mgcp/mgcp_internal.h 
b/include/osmocom/mgcp/mgcp_internal.h
index f143988..e415bbc 100644
--- a/include/osmocom/mgcp/mgcp_internal.h
+++ b/include/osmocom/mgcp/mgcp_internal.h
@@ -262,6 +262,9 @@
 int mgcp_dispatch_rtp_bridge_cb(int proto, struct sockaddr_in *addr, char *buf,
                                unsigned int buf_size, struct mgcp_conn *conn);
 void mgcp_cleanup_rtp_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn 
*conn);
+int mgcp_dispatch_e1_bridge_cb(int proto, struct sockaddr_in *addr, char *buf,
+                               unsigned int buf_size, struct mgcp_conn *conn);
+void mgcp_cleanup_e1_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn 
*conn);
 int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port,
                           struct mgcp_conn_rtp *conn);
 void mgcp_free_rtp_port(struct mgcp_rtp_end *end);
diff --git a/src/libosmo-mgcp/mgcp_endp.c b/src/libosmo-mgcp/mgcp_endp.c
index db8898b..94d4083 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -28,9 +28,17 @@
 /* Endpoint typeset definition */
 const struct mgcp_endpoint_typeset ep_typeset = {
        /* Specify endpoint properties for RTP endpoint */
-       .rtp.max_conns = 2,
-       .rtp.dispatch_rtp_cb = mgcp_dispatch_rtp_bridge_cb,
-       .rtp.cleanup_cb = mgcp_cleanup_rtp_bridge_cb
+       .rtp = {
+               .max_conns = 2,
+               .dispatch_rtp_cb = mgcp_dispatch_rtp_bridge_cb,
+               .cleanup_cb = mgcp_cleanup_rtp_bridge_cb,
+       },
+       /* Specify endpoint properties for E1 endpoint */
+       .e1 = {
+               .max_conns = 1,
+               .dispatch_rtp_cb = mgcp_dispatch_e1_bridge_cb,
+               .cleanup_cb = mgcp_cleanup_e1_bridge_cb,
+       },
 };

 /* Generate virtual endpoint name from given parameters */
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 3d01918..a0714c1 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1328,6 +1328,23 @@

 }

+/*! dispatch incoming RTP packet to E1 subslot, handle RTCP packets locally.
+ *  \param[in] proto protocol (MGCP_CONN_TYPE_RTP or MGCP_CONN_TYPE_RTCP).
+ *  \param[in] addr socket address where the RTP packet has been received from.
+ *  \param[in] buf buffer that hold the RTP payload.
+ *  \param[in] buf_size size data length of buf.
+ *  \param[in] conn originating connection.
+ *  \returns 0 on success, -1 on ERROR. */
+int mgcp_dispatch_e1_bridge_cb(int proto, struct sockaddr_in *addr, char *buf,
+                               unsigned int buf_size, struct mgcp_conn *conn)
+{
+       /* FIXME: integrate E1 support from libsomoabis, also implement
+        * handling for RTCP packets, which can not converted to E1. */
+       LOGPCONN(conn, DRTP, LOGL_FATAL,
+                "cannot dispatch! E1 support is not implemented yet!\n");
+       return -1;
+}
+
 /*! cleanup an endpoint when a connection on an RTP bridge endpoint is removed.
  *  \param[in] endp Endpoint on which the connection resides.
  *  \param[in] conn Connection that is about to be removed (ignored). */
@@ -1346,6 +1363,15 @@
        }
 }

+/*! cleanup an endpoint when a connection on an E1 endpoint is removed.
+ *  \param[in] endp Endpoint on which the connection resides.
+ *  \param[in] conn Connection that is about to be removed (ignored). */
+void mgcp_cleanup_e1_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn 
*conn)
+{
+       LOGPCONN(conn, DRTP, LOGL_FATAL,
+                "cannot dispatch! E1 support is not implemented yet!\n");
+}
+
 /* Handle incoming RTP data from NET */
 static int rtp_data_net(struct osmo_fd *fd, unsigned int what)
 {

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/18755
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I68b719a906e8f7251f0ca8c74ceec73bc40376f7
Gerrit-Change-Number: 18755
Gerrit-PatchSet: 10
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to