aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmgcp/mgcp_network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmgcp/mgcp_network.c')
-rw-r--r--src/libmgcp/mgcp_network.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/libmgcp/mgcp_network.c b/src/libmgcp/mgcp_network.c
index 51c08d151..9ff29439e 100644
--- a/src/libmgcp/mgcp_network.c
+++ b/src/libmgcp/mgcp_network.c
@@ -29,17 +29,15 @@
#include <sys/socket.h>
#include <arpa/inet.h>
-#include <osmocore/msgb.h>
-#include <osmocore/select.h>
+#include <osmocom/core/msgb.h>
+#include <osmocom/core/select.h>
-#include <openbsc/debug.h>
#include <openbsc/mgcp.h>
#include <openbsc/mgcp_internal.h>
#warning "Make use of the rtp proxy code"
/* attempt to determine byte order */
-#include <sys/types.h>
#include <sys/param.h>
#include <limits.h>
@@ -234,8 +232,8 @@ static int send_to(struct mgcp_endpoint *endp, int dest, int is_rtp,
}
}
-static int recevice_from(struct mgcp_endpoint *endp, int fd, struct sockaddr_in *addr,
- char *buf, int bufsize)
+static int receive_from(struct mgcp_endpoint *endp, int fd, struct sockaddr_in *addr,
+ char *buf, int bufsize)
{
int rc;
socklen_t slen = sizeof(*addr);
@@ -257,7 +255,7 @@ static int recevice_from(struct mgcp_endpoint *endp, int fd, struct sockaddr_in
return rc;
}
-static int rtp_data_net(struct bsc_fd *fd, unsigned int what)
+static int rtp_data_net(struct osmo_fd *fd, unsigned int what)
{
char buf[4096];
struct sockaddr_in addr;
@@ -266,7 +264,7 @@ static int rtp_data_net(struct bsc_fd *fd, unsigned int what)
endp = (struct mgcp_endpoint *) fd->data;
- rc = recevice_from(endp, fd->fd, &addr, buf, sizeof(buf));
+ rc = receive_from(endp, fd->fd, &addr, buf, sizeof(buf));
if (rc <= 0)
return -1;
@@ -329,7 +327,7 @@ static void discover_bts(struct mgcp_endpoint *endp, int proto, struct sockaddr_
}
}
-static int rtp_data_bts(struct bsc_fd *fd, unsigned int what)
+static int rtp_data_bts(struct osmo_fd *fd, unsigned int what)
{
char buf[4096];
struct sockaddr_in addr;
@@ -340,7 +338,7 @@ static int rtp_data_bts(struct bsc_fd *fd, unsigned int what)
endp = (struct mgcp_endpoint *) fd->data;
cfg = endp->cfg;
- rc = recevice_from(endp, fd->fd, &addr, buf, sizeof(buf));
+ rc = receive_from(endp, fd->fd, &addr, buf, sizeof(buf));
if (rc <= 0)
return -1;
@@ -383,7 +381,7 @@ static int rtp_data_bts(struct bsc_fd *fd, unsigned int what)
}
static int rtp_data_transcoder(struct mgcp_rtp_end *end, struct mgcp_endpoint *_endp,
- int dest, struct bsc_fd *fd)
+ int dest, struct osmo_fd *fd)
{
char buf[4096];
struct sockaddr_in addr;
@@ -391,7 +389,7 @@ static int rtp_data_transcoder(struct mgcp_rtp_end *end, struct mgcp_endpoint *_
int rc, proto;
cfg = _endp->cfg;
- rc = recevice_from(_endp, fd->fd, &addr, buf, sizeof(buf));
+ rc = receive_from(_endp, fd->fd, &addr, buf, sizeof(buf));
if (rc <= 0)
return -1;
@@ -423,7 +421,7 @@ static int rtp_data_transcoder(struct mgcp_rtp_end *end, struct mgcp_endpoint *_
return send_to(_endp, dest, proto == PROTO_RTP, &addr, &buf[0], rc);
}
-static int rtp_data_trans_net(struct bsc_fd *fd, unsigned int what)
+static int rtp_data_trans_net(struct osmo_fd *fd, unsigned int what)
{
struct mgcp_endpoint *endp;
endp = (struct mgcp_endpoint *) fd->data;
@@ -431,7 +429,7 @@ static int rtp_data_trans_net(struct bsc_fd *fd, unsigned int what)
return rtp_data_transcoder(&endp->trans_net, endp, DEST_NETWORK, fd);
}
-static int rtp_data_trans_bts(struct bsc_fd *fd, unsigned int what)
+static int rtp_data_trans_bts(struct osmo_fd *fd, unsigned int what)
{
struct mgcp_endpoint *endp;
endp = (struct mgcp_endpoint *) fd->data;
@@ -439,7 +437,7 @@ static int rtp_data_trans_bts(struct bsc_fd *fd, unsigned int what)
return rtp_data_transcoder(&endp->trans_bts, endp, DEST_BTS, fd);
}
-static int create_bind(const char *source_addr, struct bsc_fd *fd, int port)
+static int create_bind(const char *source_addr, struct osmo_fd *fd, int port)
{
struct sockaddr_in addr;
int on = 1;
@@ -491,14 +489,14 @@ static int bind_rtp(struct mgcp_config *cfg, struct mgcp_rtp_end *rtp_end, int e
set_ip_tos(rtp_end->rtcp.fd, cfg->endp_dscp);
rtp_end->rtp.when = BSC_FD_READ;
- if (bsc_register_fd(&rtp_end->rtp) != 0) {
+ if (osmo_fd_register(&rtp_end->rtp) != 0) {
LOGP(DMGCP, LOGL_ERROR, "Failed to register RTP port %d on 0x%x\n",
rtp_end->local_port, endpno);
goto cleanup2;
}
rtp_end->rtcp.when = BSC_FD_READ;
- if (bsc_register_fd(&rtp_end->rtcp) != 0) {
+ if (osmo_fd_register(&rtp_end->rtcp) != 0) {
LOGP(DMGCP, LOGL_ERROR, "Failed to register RTCP port %d on 0x%x\n",
rtp_end->local_port + 1, endpno);
goto cleanup3;
@@ -507,7 +505,7 @@ static int bind_rtp(struct mgcp_config *cfg, struct mgcp_rtp_end *rtp_end, int e
return 0;
cleanup3:
- bsc_unregister_fd(&rtp_end->rtp);
+ osmo_fd_unregister(&rtp_end->rtp);
cleanup2:
close(rtp_end->rtcp.fd);
rtp_end->rtcp.fd = -1;
@@ -519,7 +517,7 @@ cleanup0:
}
static int int_bind(const char *port,
- struct mgcp_rtp_end *end, int (*cb)(struct bsc_fd *, unsigned),
+ struct mgcp_rtp_end *end, int (*cb)(struct osmo_fd *, unsigned),
struct mgcp_endpoint *_endp, int rtp_port)
{
if (end->rtp.fd != -1 || end->rtcp.fd != -1) {
@@ -566,13 +564,13 @@ int mgcp_free_rtp_port(struct mgcp_rtp_end *end)
if (end->rtp.fd != -1) {
close(end->rtp.fd);
end->rtp.fd = -1;
- bsc_unregister_fd(&end->rtp);
+ osmo_fd_unregister(&end->rtp);
}
if (end->rtcp.fd != -1) {
close(end->rtcp.fd);
end->rtcp.fd = -1;
- bsc_unregister_fd(&end->rtcp);
+ osmo_fd_unregister(&end->rtcp);
}
return 0;