aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc/mncc_sock.c
diff options
context:
space:
mode:
authorJonathan Santos <jrsantos@jonathanrsantos.com>2011-08-17 15:33:57 -0400
committerJonathan Santos <jrsantos@jonathanrsantos.com>2011-08-17 15:33:57 -0400
commit5a45b156d4165fed159a290c46676d1383ffcc80 (patch)
tree3689fb40b5b432140fd48822973b760af93080a6 /src/libmsc/mncc_sock.c
parent03fd8d014f9871896a86534432c8757d65a576fe (diff)
New upstream version 0.9.14upstream/0.9.14
Diffstat (limited to 'src/libmsc/mncc_sock.c')
-rw-r--r--src/libmsc/mncc_sock.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/libmsc/mncc_sock.c b/src/libmsc/mncc_sock.c
index 2eef7c86..5ef9922d 100644
--- a/src/libmsc/mncc_sock.c
+++ b/src/libmsc/mncc_sock.c
@@ -26,13 +26,12 @@
#include <string.h>
#include <errno.h>
#include <assert.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <osmocore/talloc.h>
-#include <osmocore/select.h>
-#include <osmocore/protocol/gsm_04_08.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/select.h>
+#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <openbsc/debug.h>
#include <openbsc/mncc.h>
@@ -40,8 +39,8 @@
struct mncc_sock_state {
struct gsm_network *net;
- struct bsc_fd listen_bfd; /* fd for listen socket */
- struct bsc_fd conn_bfd; /* fd for connection to lcr */
+ struct osmo_fd listen_bfd; /* fd for listen socket */
+ struct osmo_fd conn_bfd; /* fd for connection to lcr */
};
/* FIXME: avoid this */
@@ -86,17 +85,17 @@ void mncc_sock_write_pending(void)
}
/* FIXME: move this to libosmocore */
-int osmo_unixsock_listen(struct bsc_fd *bfd, int type, const char *path);
+int osmo_unixsock_listen(struct osmo_fd *bfd, int type, const char *path);
static void mncc_sock_close(struct mncc_sock_state *state)
{
- struct bsc_fd *bfd = &state->conn_bfd;
+ struct osmo_fd *bfd = &state->conn_bfd;
LOGP(DMNCC, LOGL_NOTICE, "MNCC Socket has LOST connection\n");
close(bfd->fd);
bfd->fd = -1;
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
/* re-enable the generation of ACCEPT for new connections */
state->listen_bfd.when |= BSC_FD_READ;
@@ -113,7 +112,7 @@ static void mncc_sock_close(struct mncc_sock_state *state)
}
}
-static int mncc_sock_read(struct bsc_fd *bfd)
+static int mncc_sock_read(struct osmo_fd *bfd)
{
struct mncc_sock_state *state = (struct mncc_sock_state *)bfd->data;
struct gsm_mncc *mncc_prim;
@@ -150,7 +149,7 @@ close:
return -1;
}
-static int mncc_sock_write(struct bsc_fd *bfd)
+static int mncc_sock_write(struct osmo_fd *bfd)
{
struct mncc_sock_state *state = bfd->data;
struct gsm_network *net = state->net;
@@ -190,7 +189,7 @@ close:
return -1;
}
-static int mncc_sock_cb(struct bsc_fd *bfd, unsigned int flags)
+static int mncc_sock_cb(struct osmo_fd *bfd, unsigned int flags)
{
int rc = 0;
@@ -206,10 +205,10 @@ static int mncc_sock_cb(struct bsc_fd *bfd, unsigned int flags)
}
/* accept a new connection */
-static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags)
+static int mncc_sock_accept(struct osmo_fd *bfd, unsigned int flags)
{
struct mncc_sock_state *state = (struct mncc_sock_state *)bfd->data;
- struct bsc_fd *conn_bfd = &state->conn_bfd;
+ struct osmo_fd *conn_bfd = &state->conn_bfd;
struct sockaddr_un un_addr;
socklen_t len;
int rc;
@@ -235,11 +234,10 @@ static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags)
conn_bfd->cb = mncc_sock_cb;
conn_bfd->data = state;
- if (bsc_register_fd(conn_bfd) != 0) {
+ if (osmo_fd_register(conn_bfd) != 0) {
LOGP(DMNCC, LOGL_ERROR, "Failed to register new connection fd\n");
close(conn_bfd->fd);
conn_bfd->fd = -1;
- state->listen_bfd.when |= ~BSC_FD_READ;
return -1;
}
@@ -253,7 +251,7 @@ static int mncc_sock_accept(struct bsc_fd *bfd, unsigned int flags)
int mncc_sock_init(struct gsm_network *net)
{
struct mncc_sock_state *state;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
int rc;
state = talloc_zero(tall_bsc_ctx, struct mncc_sock_state);
@@ -277,7 +275,7 @@ int mncc_sock_init(struct gsm_network *net)
bfd->cb = mncc_sock_accept;
bfd->data = state;
- rc = bsc_register_fd(bfd);
+ rc = osmo_fd_register(bfd);
if (rc < 0) {
LOGP(DMNCC, LOGL_ERROR, "Could not register listen fd: %d\n", rc);
close(bfd->fd);
@@ -291,7 +289,7 @@ int mncc_sock_init(struct gsm_network *net)
}
/* FIXME: move this to libosmocore */
-int osmo_unixsock_listen(struct bsc_fd *bfd, int type, const char *path)
+int osmo_unixsock_listen(struct osmo_fd *bfd, int type, const char *path)
{
struct sockaddr_un local;
unsigned int namelen;