src: use namespace prefix osmo_fd* and osmo_select*
Summary of changes:
s/struct bsc_fd/struct osmo_fd/g
s/bsc_register_fd/osmo_fd_register/g
s/bsc_unregister_fd/osmo_fd_unregister/g
s/bsc_select_main/osmo_select_main/g
diff --git a/openbsc/src/gprs/gb_proxy_main.c b/openbsc/src/gprs/gb_proxy_main.c
index 4f6944f..b0fb664 100644
--- a/openbsc/src/gprs/gb_proxy_main.c
+++ b/openbsc/src/gprs/gb_proxy_main.c
@@ -279,7 +279,7 @@
gbprox_reset_persistent_nsvcs(bssgp_nsi);
while (1) {
- rc = bsc_select_main(0);
+ rc = osmo_select_main(0);
if (rc < 0)
exit(3);
}
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index 7e66035..f193aa3 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -505,7 +505,7 @@
}
/* libgtp select loop integration */
-static int sgsn_gtp_fd_cb(struct bsc_fd *fd, unsigned int what)
+static int sgsn_gtp_fd_cb(struct osmo_fd *fd, unsigned int what)
{
struct sgsn_instance *sgi = fd->data;
int rc;
@@ -570,7 +570,7 @@
sgi->gtp_fd0.data = sgi;
sgi->gtp_fd0.when = BSC_FD_READ;
sgi->gtp_fd0.cb = sgsn_gtp_fd_cb;
- rc = bsc_register_fd(&sgi->gtp_fd0);
+ rc = osmo_fd_register(&sgi->gtp_fd0);
if (rc < 0)
return rc;
@@ -579,7 +579,7 @@
sgi->gtp_fd1c.data = sgi;
sgi->gtp_fd1c.when = BSC_FD_READ;
sgi->gtp_fd1c.cb = sgsn_gtp_fd_cb;
- bsc_register_fd(&sgi->gtp_fd1c);
+ osmo_fd_register(&sgi->gtp_fd1c);
if (rc < 0)
return rc;
@@ -588,7 +588,7 @@
sgi->gtp_fd1u.data = sgi;
sgi->gtp_fd1u.when = BSC_FD_READ;
sgi->gtp_fd1u.cb = sgsn_gtp_fd_cb;
- bsc_register_fd(&sgi->gtp_fd1u);
+ osmo_fd_register(&sgi->gtp_fd1u);
if (rc < 0)
return rc;
diff --git a/openbsc/src/gprs/sgsn_main.c b/openbsc/src/gprs/sgsn_main.c
index f6a645f..6876939 100644
--- a/openbsc/src/gprs/sgsn_main.c
+++ b/openbsc/src/gprs/sgsn_main.c
@@ -279,7 +279,7 @@
}
while (1) {
- rc = bsc_select_main(0);
+ rc = osmo_select_main(0);
if (rc < 0)
exit(3);
}
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c
index aa38d10..5cd901c 100644
--- a/openbsc/src/ipaccess/ipaccess-config.c
+++ b/openbsc/src/ipaccess/ipaccess-config.c
@@ -927,7 +927,7 @@
bts->oml_link->ts->sign.delay = 10;
bts->c0->rsl_link->ts->sign.delay = 10;
while (1) {
- rc = bsc_select_main(0);
+ rc = osmo_select_main(0);
if (rc < 0)
exit(3);
}
diff --git a/openbsc/src/ipaccess/ipaccess-find.c b/openbsc/src/ipaccess/ipaccess-find.c
index 24f602e..b0db045 100644
--- a/openbsc/src/ipaccess/ipaccess-find.c
+++ b/openbsc/src/ipaccess/ipaccess-find.c
@@ -141,7 +141,7 @@
return parse_response(buf+6, len-6);
}
-static int bfd_cb(struct bsc_fd *bfd, unsigned int flags)
+static int bfd_cb(struct osmo_fd *bfd, unsigned int flags)
{
if (flags & BSC_FD_READ)
return read_response(bfd->fd);
@@ -156,7 +156,7 @@
static void timer_cb(void *_data)
{
- struct bsc_fd *bfd = _data;
+ struct osmo_fd *bfd = _data;
bfd->when |= BSC_FD_WRITE;
@@ -165,7 +165,7 @@
int main(int argc, char **argv)
{
- struct bsc_fd bfd;
+ struct osmo_fd bfd;
char *ifname;
int rc;
@@ -187,7 +187,7 @@
exit(1);
}
- bsc_register_fd(&bfd);
+ osmo_fd_register(&bfd);
timer.cb = timer_cb;
timer.data = &bfd;
@@ -197,7 +197,7 @@
printf("Trying to find ip.access BTS by broadcast UDP...\n");
while (1) {
- rc = bsc_select_main(0);
+ rc = osmo_select_main(0);
if (rc < 0)
exit(3);
}
diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c
index f40590a..2717ba1 100644
--- a/openbsc/src/ipaccess/ipaccess-proxy.c
+++ b/openbsc/src/ipaccess/ipaccess-proxy.c
@@ -51,9 +51,9 @@
/* one instance of an ip.access protocol proxy */
struct ipa_proxy {
/* socket where we listen for incoming OML from BTS */
- struct bsc_fd oml_listen_fd;
+ struct osmo_fd oml_listen_fd;
/* socket where we listen for incoming RSL from BTS */
- struct bsc_fd rsl_listen_fd;
+ struct osmo_fd rsl_listen_fd;
/* list of BTS's (struct ipa_bts_conn */
struct llist_head bts_list;
/* the BSC reconnect timer */
@@ -67,7 +67,7 @@
static struct ipa_proxy *ipp;
struct ipa_proxy_conn {
- struct bsc_fd fd;
+ struct osmo_fd fd;
struct llist_head tx_queue;
struct ipa_bts_conn *bts_conn;
};
@@ -94,12 +94,12 @@
struct ipa_proxy_conn *bsc_rsl_conn[MAX_TRX];
/* UDP sockets for BTS and BSC injection */
- struct bsc_fd udp_bts_fd;
- struct bsc_fd udp_bsc_fd;
+ struct osmo_fd udp_bts_fd;
+ struct osmo_fd udp_bsc_fd;
/* NS data */
struct in_addr bts_addr;
- struct bsc_fd gprs_ns_fd;
+ struct osmo_fd gprs_ns_fd;
int gprs_local_port;
uint16_t gprs_orig_port;
uint32_t gprs_orig_ip;
@@ -125,7 +125,7 @@
static char *bsc_ipaddr;
static char *gprs_ns_ipaddr;
-static int gprs_ns_cb(struct bsc_fd *bfd, unsigned int what);
+static int gprs_ns_cb(struct osmo_fd *bfd, unsigned int what);
#define PROXY_ALLOC_SIZE 1200
@@ -197,7 +197,7 @@
logp2(ss, lvl, file, line, 0, "unknown ");
}
-static int handle_udp_read(struct bsc_fd *bfd)
+static int handle_udp_read(struct osmo_fd *bfd)
{
struct ipa_bts_conn *ipbc = bfd->data;
struct ipa_proxy_conn *other_conn = NULL;
@@ -217,7 +217,7 @@
}
if (ret == 0) {
DEBUGP(DINP, "UDP peer disappeared, dead socket\n");
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
msgb_free(msg);
@@ -288,7 +288,7 @@
return 0;
}
-static int handle_udp_write(struct bsc_fd *bfd)
+static int handle_udp_write(struct osmo_fd *bfd)
{
/* not implemented yet */
bfd->when &= ~BSC_FD_WRITE;
@@ -297,7 +297,7 @@
}
/* callback from select.c in case one of the fd's can be read/written */
-static int udp_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int udp_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
int rc = 0;
@@ -310,7 +310,7 @@
}
-static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct bsc_fd *bfd,
+static int ipbc_alloc_connect(struct ipa_proxy_conn *ipc, struct osmo_fd *bfd,
uint16_t site_id, uint16_t bts_id,
uint16_t trx_id, struct tlv_parsed *tlvp,
struct msgb *msg)
@@ -414,9 +414,9 @@
return 0;
err_udp_bsc:
- bsc_unregister_fd(&ipbc->udp_bts_fd);
+ osmo_fd_unregister(&ipbc->udp_bts_fd);
err_udp_bts:
- bsc_unregister_fd(&ipbc->bsc_oml_conn->fd);
+ osmo_fd_unregister(&ipbc->bsc_oml_conn->fd);
close(ipbc->bsc_oml_conn->fd.fd);
talloc_free(ipbc->bsc_oml_conn);
ipbc->bsc_oml_conn = NULL;
@@ -424,7 +424,7 @@
talloc_free(ipbc->id_resp);
talloc_free(ipbc);
#if 0
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
talloc_free(bfd);
#endif
@@ -433,7 +433,7 @@
}
static int ipaccess_rcvmsg(struct ipa_proxy_conn *ipc, struct msgb *msg,
- struct bsc_fd *bfd)
+ struct osmo_fd *bfd)
{
struct tlv_parsed tlvp;
uint8_t msg_type = *(msg->l2h);
@@ -536,7 +536,7 @@
return 0;
}
-struct msgb *ipaccess_proxy_read_msg(struct bsc_fd *bfd, int *error)
+struct msgb *ipaccess_proxy_read_msg(struct osmo_fd *bfd, int *error)
{
struct msgb *msg = msgb_alloc(PROXY_ALLOC_SIZE, "Abis/IP");
struct ipaccess_head *hh;
@@ -660,7 +660,7 @@
osmo_timer_schedule(&ipp->reconn_timer, 5, 0);
}
-static void handle_dead_socket(struct bsc_fd *bfd)
+static void handle_dead_socket(struct osmo_fd *bfd)
{
struct ipa_proxy_conn *ipc = bfd->data; /* local conn */
struct ipa_proxy_conn *bsc_conn; /* remote conn */
@@ -668,7 +668,7 @@
unsigned int trx_id = bfd->priv_nr >> 8;
struct msgb *msg, *msg2;
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
@@ -686,7 +686,7 @@
ipbc->oml_conn = NULL;
bsc_conn = ipbc->bsc_oml_conn;
/* close the connection to the BSC */
- bsc_unregister_fd(&bsc_conn->fd);
+ osmo_fd_unregister(&bsc_conn->fd);
close(bsc_conn->fd.fd);
llist_for_each_entry_safe(msg, msg2, &bsc_conn->tx_queue, list)
msgb_free(msg);
@@ -698,7 +698,7 @@
ipbc->rsl_conn[trx_id] = NULL;
bsc_conn = ipbc->bsc_rsl_conn[trx_id];
/* close the connection to the BSC */
- bsc_unregister_fd(&bsc_conn->fd);
+ osmo_fd_unregister(&bsc_conn->fd);
close(bsc_conn->fd.fd);
llist_for_each_entry_safe(msg, msg2, &bsc_conn->tx_queue, list)
msgb_free(msg);
@@ -761,7 +761,7 @@
}
}
-static int handle_tcp_read(struct bsc_fd *bfd)
+static int handle_tcp_read(struct osmo_fd *bfd)
{
struct ipa_proxy_conn *ipc = bfd->data;
struct ipa_bts_conn *ipbc = ipc->bts_conn;
@@ -795,7 +795,7 @@
if (hh->proto == IPAC_PROTO_IPACCESS) {
ret = ipaccess_rcvmsg(ipc, msg, bfd);
if (ret < 0) {
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
talloc_free(bfd);
@@ -835,7 +835,7 @@
}
/* a TCP socket is ready to be written to */
-static int handle_tcp_write(struct bsc_fd *bfd)
+static int handle_tcp_write(struct osmo_fd *bfd)
{
struct ipa_proxy_conn *ipc = bfd->data;
struct ipa_bts_conn *ipbc = ipc->bts_conn;
@@ -876,7 +876,7 @@
}
/* callback from select.c in case one of the fd's can be read/written */
-static int ipaccess_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int ipaccess_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
int rc = 0;
@@ -892,11 +892,11 @@
}
/* callback of the listening filedescriptor */
-static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what)
+static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
{
int ret;
struct ipa_proxy_conn *ipc;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
struct sockaddr_in sa;
socklen_t sa_len = sizeof(sa);
@@ -924,7 +924,7 @@
bfd->priv_nr = listen_bfd->priv_nr;
bfd->cb = ipaccess_fd_cb;
bfd->when = BSC_FD_READ;
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
LOGP(DINP, LOGL_ERROR, "could not register FD\n");
close(bfd->fd);
@@ -955,7 +955,7 @@
}
}
-static int gprs_ns_cb(struct bsc_fd *bfd, unsigned int what)
+static int gprs_ns_cb(struct osmo_fd *bfd, unsigned int what)
{
struct ipa_bts_conn *bts;
char buf[4096];
@@ -990,7 +990,7 @@
static struct ipa_proxy_conn *connect_bsc(struct sockaddr_in *sa, int priv_nr, void *data)
{
struct ipa_proxy_conn *ipc;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
int ret, on = 1;
ipc = alloc_conn();
@@ -1018,7 +1018,7 @@
}
/* pre-fill tx_queue with identity request */
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
close(bfd->fd);
talloc_free(ipc);
@@ -1200,6 +1200,6 @@
signal(SIGABRT, &signal_handler);
while (1) {
- bsc_select_main(0);
+ osmo_select_main(0);
}
}
diff --git a/openbsc/src/libabis/input/dahdi.c b/openbsc/src/libabis/input/dahdi.c
index 4fcd64f..e02e141 100644
--- a/openbsc/src/libabis/input/dahdi.c
+++ b/openbsc/src/libabis/input/dahdi.c
@@ -92,7 +92,7 @@
}
}
-static int handle_ts1_read(struct bsc_fd *bfd)
+static int handle_ts1_read(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -184,7 +184,7 @@
static void dahdi_write_msg(uint8_t *data, int len, void *cbdata)
{
- struct bsc_fd *bfd = cbdata;
+ struct osmo_fd *bfd = cbdata;
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
@@ -197,7 +197,7 @@
LOGP(DMI, LOGL_NOTICE, "%s write failed %d\n", __func__, ret);
}
-static int handle_ts1_write(struct bsc_fd *bfd)
+static int handle_ts1_write(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -259,7 +259,7 @@
#define D_BCHAN_TX_GRAN 160
/* write to a B channel TS */
-static int handle_tsX_write(struct bsc_fd *bfd)
+static int handle_tsX_write(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -293,7 +293,7 @@
#define D_TSX_ALLOC_SIZE (D_BCHAN_TX_GRAN)
/* FIXME: read from a B channel TS */
-static int handle_tsX_read(struct bsc_fd *bfd)
+static int handle_tsX_read(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -329,7 +329,7 @@
}
/* callback from select.c in case one of the fd's can be read/written */
-static int dahdi_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int dahdi_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -420,7 +420,7 @@
unsigned int idx = ts-1;
char openstr[128];
struct e1inp_ts *e1i_ts = &line->ts[idx];
- struct bsc_fd *bfd = &e1i_ts->driver.dahdi.fd;
+ struct osmo_fd *bfd = &e1i_ts->driver.dahdi.fd;
bfd->data = line;
bfd->priv_nr = ts;
@@ -463,7 +463,7 @@
return bfd->fd;
}
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
fprintf(stderr, "could not register FD: %s\n",
strerror(ret));
diff --git a/openbsc/src/libabis/input/hsl.c b/openbsc/src/libabis/input/hsl.c
index 9ff8552..af95afa 100644
--- a/openbsc/src/libabis/input/hsl.c
+++ b/openbsc/src/libabis/input/hsl.c
@@ -64,7 +64,7 @@
/* data structure for one E1 interface with A-bis */
struct hsl_e1_handle {
- struct bsc_fd listen_fd;
+ struct osmo_fd listen_fd;
struct gsm_network *gsmnet;
};
@@ -81,7 +81,7 @@
struct gsm_bts_trx *trx;
struct e1inp_ts *ts;
struct e1inp_line *line;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
if (!bts || !bts->oml_link)
return -1;
@@ -92,7 +92,7 @@
e1inp_event(ts, S_INP_TEI_DN, bts->oml_link->tei, bts->oml_link->sapi);
bfd = &ts->driver.ipaccess.fd;
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
@@ -109,7 +109,7 @@
return -1;
}
-static int hsl_drop_ts_fd(struct e1inp_ts *ts, struct bsc_fd *bfd)
+static int hsl_drop_ts_fd(struct e1inp_ts *ts, struct osmo_fd *bfd)
{
struct e1inp_sign_link *link, *link2;
int bts_nr = -1;
@@ -119,7 +119,7 @@
e1inp_sign_link_destroy(link);
}
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
@@ -195,7 +195,7 @@
return 0;
}
-static int handle_ts1_read(struct bsc_fd *bfd)
+static int handle_ts1_read(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -290,7 +290,7 @@
ts_want_write(e1i_ts);
}
-static int handle_ts1_write(struct bsc_fd *bfd)
+static int handle_ts1_write(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -346,7 +346,7 @@
}
/* callback from select.c in case one of the fd's can be read/written */
-static int hsl_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int hsl_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -377,14 +377,14 @@
};
/* callback of the OML listening filedescriptor */
-static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what)
+static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
{
int ret;
int idx = 0;
int i;
struct e1inp_line *line;
struct e1inp_ts *e1i_ts;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
struct sockaddr_in sa;
socklen_t sa_len = sizeof(sa);
@@ -421,7 +421,7 @@
bfd->priv_nr = PRIV_OML;
bfd->cb = hsl_fd_cb;
bfd->when = BSC_FD_READ;
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
LOGP(DINP, LOGL_ERROR, "could not register FD\n");
close(bfd->fd);
diff --git a/openbsc/src/libabis/input/ipaccess.c b/openbsc/src/libabis/input/ipaccess.c
index 95e84f6..13294dc 100644
--- a/openbsc/src/libabis/input/ipaccess.c
+++ b/openbsc/src/libabis/input/ipaccess.c
@@ -51,8 +51,8 @@
/* data structure for one E1 interface with A-bis */
struct ia_e1_handle {
- struct bsc_fd listen_fd;
- struct bsc_fd rsl_listen_fd;
+ struct osmo_fd listen_fd;
+ struct osmo_fd rsl_listen_fd;
struct gsm_network *gsmnet;
};
@@ -222,7 +222,7 @@
/* base handling of the ip.access protocol */
int ipaccess_rcvmsg_base(struct msgb *msg,
- struct bsc_fd *bfd)
+ struct osmo_fd *bfd)
{
uint8_t msg_type = *(msg->l2h);
int ret = 0;
@@ -243,7 +243,7 @@
}
static int ipaccess_rcvmsg(struct e1inp_line *line, struct msgb *msg,
- struct bsc_fd *bfd)
+ struct osmo_fd *bfd)
{
struct tlv_parsed tlvp;
uint8_t msg_type = *(msg->l2h);
@@ -294,14 +294,14 @@
bts->oml_tei, 0);
} else if (bfd->priv_nr == PRIV_RSL) {
struct e1inp_ts *e1i_ts;
- struct bsc_fd *newbfd;
+ struct osmo_fd *newbfd;
struct gsm_bts_trx *trx = gsm_bts_trx_num(bts, trx_id);
/* drop any old rsl connection */
ipaccess_drop_rsl(trx);
if (!bts->oml_link) {
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
talloc_free(bfd);
@@ -321,10 +321,10 @@
/* get rid of our old temporary bfd */
memcpy(newbfd, bfd, sizeof(*newbfd));
newbfd->priv_nr = PRIV_RSL + trx_id;
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
bfd->fd = -1;
talloc_free(bfd);
- bsc_register_fd(newbfd);
+ osmo_fd_register(newbfd);
}
break;
}
@@ -338,7 +338,7 @@
* read one ipa message from the socket
* return NULL in case of error
*/
-struct msgb *ipaccess_read_msg(struct bsc_fd *bfd, int *error)
+struct msgb *ipaccess_read_msg(struct osmo_fd *bfd, int *error)
{
struct msgb *msg = msgb_alloc(TS1_ALLOC_SIZE, "Abis/IP");
struct ipaccess_head *hh;
@@ -394,7 +394,7 @@
struct gsm_bts_trx *trx;
struct e1inp_ts *ts;
struct e1inp_line *line;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
if (!bts || !bts->oml_link)
return -1;
@@ -405,7 +405,7 @@
e1inp_event(ts, S_INP_TEI_DN, bts->oml_link->tei, bts->oml_link->sapi);
bfd = &ts->driver.ipaccess.fd;
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
@@ -424,7 +424,7 @@
return -1;
}
-static int ipaccess_drop(struct e1inp_ts *ts, struct bsc_fd *bfd)
+static int ipaccess_drop(struct e1inp_ts *ts, struct osmo_fd *bfd)
{
struct e1inp_sign_link *link;
int bts_nr;
@@ -436,7 +436,7 @@
* handling yet. So we can safely delete this bfd and
* wait for a reconnect.
*/
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
talloc_free(bfd);
@@ -455,7 +455,7 @@
/* error case */
LOGP(DINP, LOGL_ERROR, "Failed to find a signalling link for ts: %p\n", ts);
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
return -1;
@@ -463,7 +463,7 @@
int ipaccess_drop_rsl(struct gsm_bts_trx *trx)
{
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
struct e1inp_ts *ts;
if (!trx || !trx->rsl_link)
@@ -475,7 +475,7 @@
/* close the socket */
bfd = &ts->driver.ipaccess.fd;
- bsc_unregister_fd(bfd);
+ osmo_fd_unregister(bfd);
close(bfd->fd);
bfd->fd = -1;
@@ -486,7 +486,7 @@
return -1;
}
-static int handle_ts1_read(struct bsc_fd *bfd)
+static int handle_ts1_read(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -588,7 +588,7 @@
ts_want_write(e1i_ts);
}
-static int handle_ts1_write(struct bsc_fd *bfd)
+static int handle_ts1_write(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -639,7 +639,7 @@
}
/* callback from select.c in case one of the fd's can be read/written */
-static int ipaccess_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int ipaccess_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -670,14 +670,14 @@
};
/* callback of the OML listening filedescriptor */
-static int listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what)
+static int listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
{
int ret;
int idx = 0;
int i;
struct e1inp_line *line;
struct e1inp_ts *e1i_ts;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
struct sockaddr_in sa;
socklen_t sa_len = sizeof(sa);
@@ -714,7 +714,7 @@
bfd->priv_nr = PRIV_OML;
bfd->cb = ipaccess_fd_cb;
bfd->when = BSC_FD_READ;
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
LOGP(DINP, LOGL_ERROR, "could not register FD\n");
close(bfd->fd);
@@ -729,17 +729,17 @@
//return e1inp_line_register(line);
}
-static int rsl_listen_fd_cb(struct bsc_fd *listen_bfd, unsigned int what)
+static int rsl_listen_fd_cb(struct osmo_fd *listen_bfd, unsigned int what)
{
struct sockaddr_in sa;
socklen_t sa_len = sizeof(sa);
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
int ret;
if (!(what & BSC_FD_READ))
return 0;
- bfd = talloc_zero(tall_bsc_ctx, struct bsc_fd);
+ bfd = talloc_zero(tall_bsc_ctx, struct osmo_fd);
if (!bfd)
return -ENOMEM;
@@ -756,7 +756,7 @@
bfd->priv_nr = PRIV_RSL;
bfd->cb = ipaccess_fd_cb;
bfd->when = BSC_FD_READ;
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
LOGP(DINP, LOGL_ERROR, "could not register FD\n");
close(bfd->fd);
@@ -773,7 +773,7 @@
int ipaccess_connect(struct e1inp_line *line, struct sockaddr_in *sa)
{
struct e1inp_ts *e1i_ts = &line->ts[0];
- struct bsc_fd *bfd = &e1i_ts->driver.ipaccess.fd;
+ struct osmo_fd *bfd = &e1i_ts->driver.ipaccess.fd;
int ret, on = 1;
bfd->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
@@ -796,7 +796,7 @@
return ret;
}
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
close(bfd->fd);
return ret;
diff --git a/openbsc/src/libabis/input/misdn.c b/openbsc/src/libabis/input/misdn.c
index 3c33792..d239ee7 100644
--- a/openbsc/src/libabis/input/misdn.c
+++ b/openbsc/src/libabis/input/misdn.c
@@ -85,7 +85,7 @@
return "UNKNOWN";
}
-static int handle_ts1_read(struct bsc_fd *bfd)
+static int handle_ts1_read(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -200,7 +200,7 @@
ts_want_write(e1i_ts);
}
-static int handle_ts1_write(struct bsc_fd *bfd)
+static int handle_ts1_write(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -253,7 +253,7 @@
#define BCHAN_TX_GRAN 160
/* write to a B channel TS */
-static int handle_tsX_write(struct bsc_fd *bfd)
+static int handle_tsX_write(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -281,7 +281,7 @@
#define TSX_ALLOC_SIZE 4096
/* FIXME: read from a B channel TS */
-static int handle_tsX_read(struct bsc_fd *bfd)
+static int handle_tsX_read(struct osmo_fd *bfd)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -329,7 +329,7 @@
}
/* callback from select.c in case one of the fd's can be read/written */
-static int misdn_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int misdn_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
struct e1inp_line *line = bfd->data;
unsigned int ts_nr = bfd->priv_nr;
@@ -365,7 +365,7 @@
int ret;
unsigned int idx = ts-1;
struct e1inp_ts *e1i_ts = &line->ts[idx];
- struct bsc_fd *bfd = &e1i_ts->driver.misdn.fd;
+ struct osmo_fd *bfd = &e1i_ts->driver.misdn.fd;
fprintf(stdout, "activate bchan\n");
if (act)
@@ -400,7 +400,7 @@
for (ts = 1; ts < NUM_E1_TS; ts++) {
unsigned int idx = ts-1;
struct e1inp_ts *e1i_ts = &line->ts[idx];
- struct bsc_fd *bfd = &e1i_ts->driver.misdn.fd;
+ struct osmo_fd *bfd = &e1i_ts->driver.misdn.fd;
struct sockaddr_mISDN addr;
bfd->data = line;
@@ -470,7 +470,7 @@
if (e1i_ts->type == E1INP_TS_TYPE_TRAU)
activate_bchan(line, ts, 1);
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
fprintf(stderr, "could not register FD: %s\n",
strerror(ret));
diff --git a/openbsc/src/libbsc/bsc_msc.c b/openbsc/src/libbsc/bsc_msc.c
index f4eee9c..a46f4b9 100644
--- a/openbsc/src/libbsc/bsc_msc.c
+++ b/openbsc/src/libbsc/bsc_msc.c
@@ -36,7 +36,7 @@
static void connection_loss(struct bsc_msc_connection *con)
{
- struct bsc_fd *fd;
+ struct osmo_fd *fd;
fd = &con->write_queue.bfd;
@@ -59,7 +59,7 @@
}
/* called in the case of a non blocking connect */
-static int msc_connection_connect(struct bsc_fd *fd, unsigned int what)
+static int msc_connection_connect(struct osmo_fd *fd, unsigned int what)
{
int rc;
int val;
@@ -102,11 +102,11 @@
return 0;
error:
- bsc_unregister_fd(fd);
+ osmo_fd_unregister(fd);
connection_loss(con);
return -1;
}
-static void setnonblocking(struct bsc_fd *fd)
+static void setnonblocking(struct osmo_fd *fd)
{
int flags;
@@ -131,7 +131,7 @@
int bsc_msc_connect(struct bsc_msc_connection *con)
{
struct bsc_msc_dest *dest;
- struct bsc_fd *fd;
+ struct osmo_fd *fd;
struct sockaddr_in sin;
int on = 1, ret;
@@ -197,7 +197,7 @@
con->connected(con);
}
- ret = bsc_register_fd(fd);
+ ret = osmo_fd_register(fd);
if (ret < 0) {
perror("Registering the fd failed");
close(fd->fd);
@@ -229,7 +229,7 @@
osmo_timer_del(&con->timeout_timer);
if (con->write_queue.bfd.fd >= 0)
- bsc_unregister_fd(&con->write_queue.bfd);
+ osmo_fd_unregister(&con->write_queue.bfd);
connection_loss(con);
}
diff --git a/openbsc/src/libcommon/socket.c b/openbsc/src/libcommon/socket.c
index dd25dd7..ff846aa 100644
--- a/openbsc/src/libcommon/socket.c
+++ b/openbsc/src/libcommon/socket.c
@@ -39,9 +39,9 @@
#include <openbsc/gsm_data.h>
#include <osmocom/core/talloc.h>
-int make_sock(struct bsc_fd *bfd, int proto,
+int make_sock(struct osmo_fd *bfd, int proto,
uint32_t ip, uint16_t port, int priv_nr,
- int (*cb)(struct bsc_fd *fd, unsigned int what), void *data)
+ int (*cb)(struct osmo_fd *fd, unsigned int what), void *data)
{
struct sockaddr_in addr;
int ret, on = 1;
@@ -99,7 +99,7 @@
}
}
- ret = bsc_register_fd(bfd);
+ ret = osmo_fd_register(bfd);
if (ret < 0) {
perror("register_listen_fd");
close(bfd->fd);
diff --git a/openbsc/src/libgb/gprs_ns.c b/openbsc/src/libgb/gprs_ns.c
index 1c3c1b6..2e549f3 100644
--- a/openbsc/src/libgb/gprs_ns.c
+++ b/openbsc/src/libgb/gprs_ns.c
@@ -858,7 +858,7 @@
* We don't support Size Procedure, Configuration Procedure, ChangeWeight Procedure */
/* Read a single NS-over-IP message */
-static struct msgb *read_nsip_msg(struct bsc_fd *bfd, int *error,
+static struct msgb *read_nsip_msg(struct osmo_fd *bfd, int *error,
struct sockaddr_in *saddr)
{
struct msgb *msg = gprs_ns_msgb_alloc();
@@ -890,7 +890,7 @@
return msg;
}
-static int handle_nsip_read(struct bsc_fd *bfd)
+static int handle_nsip_read(struct osmo_fd *bfd)
{
int error;
struct sockaddr_in saddr;
@@ -907,7 +907,7 @@
return error;
}
-static int handle_nsip_write(struct bsc_fd *bfd)
+static int handle_nsip_write(struct osmo_fd *bfd)
{
/* FIXME: actually send the data here instead of nsip_sendmsg() */
return -EIO;
@@ -928,7 +928,7 @@
}
/* UDP Port 23000 carries the LLC-in-BSSGP-in-NS protocol stack */
-static int nsip_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int nsip_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
int rc = 0;
diff --git a/openbsc/src/libgb/gprs_ns_frgre.c b/openbsc/src/libgb/gprs_ns_frgre.c
index 85019e1..3662572 100644
--- a/openbsc/src/libgb/gprs_ns_frgre.c
+++ b/openbsc/src/libgb/gprs_ns_frgre.c
@@ -49,7 +49,7 @@
} __attribute__ ((packed));
/* IPv4 messages inside the GRE tunnel might be GRE keepalives */
-static int handle_rx_gre_ipv4(struct bsc_fd *bfd, struct msgb *msg,
+static int handle_rx_gre_ipv4(struct osmo_fd *bfd, struct msgb *msg,
struct iphdr *iph, struct gre_hdr *greh)
{
struct gprs_ns_inst *nsi = bfd->data;
@@ -101,7 +101,7 @@
(struct sockaddr *)&daddr, sizeof(daddr));
}
-static struct msgb *read_nsfrgre_msg(struct bsc_fd *bfd, int *error,
+static struct msgb *read_nsfrgre_msg(struct osmo_fd *bfd, int *error,
struct sockaddr_in *saddr)
{
struct msgb *msg = msgb_alloc(NS_ALLOC_SIZE, "Gb/NS/FR/GRE Rx");
@@ -203,7 +203,7 @@
int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg,
struct sockaddr_in *saddr, enum gprs_ns_ll ll);
-static int handle_nsfrgre_read(struct bsc_fd *bfd)
+static int handle_nsfrgre_read(struct osmo_fd *bfd)
{
int rc;
struct sockaddr_in saddr;
@@ -230,7 +230,7 @@
return rc;
}
-static int handle_nsfrgre_write(struct bsc_fd *bfd)
+static int handle_nsfrgre_write(struct osmo_fd *bfd)
{
/* FIXME: actually send the data here instead of nsip_sendmsg() */
return -EIO;
@@ -268,7 +268,7 @@
return rc;
}
-static int nsfrgre_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int nsfrgre_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
int rc = 0;
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 18d43a0..10f117b 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -255,7 +255,7 @@
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;
@@ -327,7 +327,7 @@
}
}
-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;
@@ -381,7 +381,7 @@
}
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;
@@ -421,7 +421,7 @@
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;
@@ -429,7 +429,7 @@
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;
@@ -437,7 +437,7 @@
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;
@@ -489,14 +489,14 @@
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;
@@ -505,7 +505,7 @@
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;
@@ -517,7 +517,7 @@
}
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) {
@@ -564,13 +564,13 @@
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;
diff --git a/openbsc/src/libmsc/mncc_sock.c b/openbsc/src/libmsc/mncc_sock.c
index f3841b0..5ef9922 100644
--- a/openbsc/src/libmsc/mncc_sock.c
+++ b/openbsc/src/libmsc/mncc_sock.c
@@ -39,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 */
@@ -85,17 +85,17 @@
}
/* 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;
@@ -112,7 +112,7 @@
}
}
-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;
@@ -149,7 +149,7 @@
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;
@@ -189,7 +189,7 @@
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;
@@ -205,10 +205,10 @@
}
/* 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;
@@ -234,7 +234,7 @@
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;
@@ -251,7 +251,7 @@
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);
@@ -275,7 +275,7 @@
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);
@@ -289,7 +289,7 @@
}
/* 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;
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index 04e224c..86d5624 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -482,7 +482,7 @@
/* callback for the select.c:bfd_* layer */
-static int rtp_bfd_cb(struct bsc_fd *bfd, unsigned int flags)
+static int rtp_bfd_cb(struct osmo_fd *bfd, unsigned int flags)
{
struct rtp_socket *rs = bfd->data;
struct rtp_sub_socket *rss;
@@ -536,7 +536,7 @@
goto out_free;
init_rss(&rs->rtp, rs, rc, RTP_PRIV_RTP);
- rc = bsc_register_fd(&rs->rtp.bfd);
+ rc = osmo_fd_register(&rs->rtp.bfd);
if (rc < 0)
goto out_rtp_socket;
@@ -545,7 +545,7 @@
goto out_rtp_bfd;
init_rss(&rs->rtcp, rs, rc, RTP_PRIV_RTCP);
- rc = bsc_register_fd(&rs->rtcp.bfd);
+ rc = osmo_fd_register(&rs->rtcp.bfd);
if (rc < 0)
goto out_rtcp_socket;
@@ -558,11 +558,11 @@
return rs;
out_rtcp_bfd:
- bsc_unregister_fd(&rs->rtcp.bfd);
+ osmo_fd_unregister(&rs->rtcp.bfd);
out_rtcp_socket:
close(rs->rtcp.bfd.fd);
out_rtp_bfd:
- bsc_unregister_fd(&rs->rtp.bfd);
+ osmo_fd_unregister(&rs->rtp.bfd);
out_rtp_socket:
close(rs->rtp.bfd.fd);
out_free:
@@ -713,11 +713,11 @@
rs->proxy.other_sock)
rs->proxy.other_sock->proxy.other_sock = NULL;
- bsc_unregister_fd(&rs->rtp.bfd);
+ osmo_fd_unregister(&rs->rtp.bfd);
close(rs->rtp.bfd.fd);
free_tx_queue(&rs->rtp);
- bsc_unregister_fd(&rs->rtcp.bfd);
+ osmo_fd_unregister(&rs->rtcp.bfd);
close(rs->rtcp.bfd.fd);
free_tx_queue(&rs->rtcp);
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_main.c b/openbsc/src/osmo-bsc/osmo_bsc_main.c
index 51e5077..6437d93 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_main.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_main.c
@@ -256,7 +256,7 @@
}
while (1) {
- bsc_select_main(0);
+ osmo_select_main(0);
}
return 0;
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
index e1a95a8..8b7c6e2 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c
@@ -44,7 +44,7 @@
/*
* MGCP forwarding code
*/
-static int mgcp_do_read(struct bsc_fd *fd)
+static int mgcp_do_read(struct osmo_fd *fd)
{
struct osmo_msc_data *data = (struct osmo_msc_data *) fd->data;
struct msgb *mgcp;
@@ -72,7 +72,7 @@
return 0;
}
-static int mgcp_do_write(struct bsc_fd *fd, struct msgb *msg)
+static int mgcp_do_write(struct osmo_fd *fd, struct msgb *msg)
{
int ret;
@@ -150,7 +150,7 @@
data->mgcp_agent.read_cb = mgcp_do_read;
data->mgcp_agent.write_cb = mgcp_do_write;
- if (bsc_register_fd(&data->mgcp_agent.bfd) != 0) {
+ if (osmo_fd_register(&data->mgcp_agent.bfd) != 0) {
LOGP(DMGCP, LOGL_FATAL, "Failed to register BFD\n");
close(data->mgcp_agent.bfd.fd);
data->mgcp_agent.bfd.fd = -1;
@@ -175,7 +175,7 @@
return 0;
}
-static int msc_alink_do_write(struct bsc_fd *fd, struct msgb *msg)
+static int msc_alink_do_write(struct osmo_fd *fd, struct msgb *msg)
{
int ret;
@@ -208,7 +208,7 @@
send_lacs(msc->network, msc->msc_con);
}
-static int ipaccess_a_fd_cb(struct bsc_fd *bfd)
+static int ipaccess_a_fd_cb(struct osmo_fd *bfd)
{
int error;
struct msgb *msg = ipaccess_read_msg(bfd, &error);
diff --git a/openbsc/src/osmo-bsc/osmo_bsc_rf.c b/openbsc/src/osmo-bsc/osmo_bsc_rf.c
index 8df0306..5ce6bf5 100644
--- a/openbsc/src/osmo-bsc/osmo_bsc_rf.c
+++ b/openbsc/src/osmo-bsc/osmo_bsc_rf.c
@@ -194,7 +194,7 @@
}
}
-static int rf_read_cmd(struct bsc_fd *fd)
+static int rf_read_cmd(struct osmo_fd *fd)
{
struct osmo_bsc_rf_conn *conn = fd->data;
char buf[1];
@@ -203,7 +203,7 @@
rc = read(fd->fd, buf, sizeof(buf));
if (rc != sizeof(buf)) {
LOGP(DINP, LOGL_ERROR, "Short read %d/%s\n", errno, strerror(errno));
- bsc_unregister_fd(fd);
+ osmo_fd_unregister(fd);
close(fd->fd);
write_queue_clear(&conn->queue);
talloc_free(conn);
@@ -230,7 +230,7 @@
return 0;
}
-static int rf_write_cmd(struct bsc_fd *fd, struct msgb *msg)
+static int rf_write_cmd(struct osmo_fd *fd, struct msgb *msg)
{
int rc;
@@ -243,7 +243,7 @@
return 0;
}
-static int rf_ctl_accept(struct bsc_fd *bfd, unsigned int what)
+static int rf_ctl_accept(struct osmo_fd *bfd, unsigned int what)
{
struct osmo_bsc_rf_conn *conn;
struct osmo_bsc_rf *rf = bfd->data;
@@ -273,7 +273,7 @@
conn->queue.write_cb = rf_write_cmd;
conn->rf = rf;
- if (bsc_register_fd(&conn->queue.bfd) != 0) {
+ if (osmo_fd_register(&conn->queue.bfd) != 0) {
close(fd);
talloc_free(conn);
return -1;
@@ -286,7 +286,7 @@
{
unsigned int namelen;
struct sockaddr_un local;
- struct bsc_fd *bfd;
+ struct osmo_fd *bfd;
struct osmo_bsc_rf *rf;
int rc;
@@ -341,7 +341,7 @@
bfd->cb = rf_ctl_accept;
bfd->data = rf;
- if (bsc_register_fd(bfd) != 0) {
+ if (osmo_fd_register(bfd) != 0) {
LOGP(DINP, LOGL_ERROR, "Failed to register bfd.\n");
close(bfd->fd);
talloc_free(rf);
diff --git a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
index 2077929..8cb90c5 100644
--- a/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
+++ b/openbsc/src/osmo-bsc_mgcp/mgcp_main.c
@@ -135,7 +135,7 @@
return 0;
}
-static int read_call_agent(struct bsc_fd *fd, unsigned int what)
+static int read_call_agent(struct osmo_fd *fd, unsigned int what)
{
struct sockaddr_in addr;
socklen_t slen = sizeof(addr);
@@ -254,7 +254,7 @@
}
- if (bsc_register_fd(&cfg->gw_fd.bfd) != 0) {
+ if (osmo_fd_register(&cfg->gw_fd.bfd) != 0) {
LOGP(DMGCP, LOGL_FATAL, "Failed to register the fd\n");
return -1;
}
@@ -275,7 +275,7 @@
/* main loop */
while (1) {
- bsc_select_main(0);
+ osmo_select_main(0);
}
diff --git a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
index 95a5388..be2666d 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_mgcp_utils.c
@@ -598,7 +598,7 @@
return output;
}
-static int mgcp_do_read(struct bsc_fd *fd)
+static int mgcp_do_read(struct osmo_fd *fd)
{
struct bsc_nat *nat;
struct msgb *msg, *resp;
@@ -637,7 +637,7 @@
return 0;
}
-static int mgcp_do_write(struct bsc_fd *bfd, struct msgb *msg)
+static int mgcp_do_write(struct osmo_fd *bfd, struct msgb *msg)
{
int rc;
@@ -704,7 +704,7 @@
cfg->gw_fd.read_cb = mgcp_do_read;
cfg->gw_fd.write_cb = mgcp_do_write;
- if (bsc_register_fd(&cfg->gw_fd.bfd) != 0) {
+ if (osmo_fd_register(&cfg->gw_fd.bfd) != 0) {
LOGP(DMGCP, LOGL_ERROR, "Failed to register MGCP fd.\n");
close(cfg->gw_fd.bfd.fd);
cfg->gw_fd.bfd.fd = -1;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index ffcd388..0fb5843 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -64,7 +64,7 @@
struct log_target *stderr_target;
static const char *config_file = "bsc-nat.cfg";
static struct in_addr local_addr;
-static struct bsc_fd bsc_listen;
+static struct osmo_fd bsc_listen;
static const char *msc_ip = NULL;
static struct osmo_timer_list sccp_close;
static int daemonize = 0;
@@ -780,7 +780,7 @@
LOGP(DMSC, LOGL_NOTICE, "Scheduled GSM0808 reset msg for the MSC.\n");
}
-static int ipaccess_msc_read_cb(struct bsc_fd *bfd)
+static int ipaccess_msc_read_cb(struct osmo_fd *bfd)
{
int error;
struct bsc_msc_connection *msc_con;
@@ -818,7 +818,7 @@
return 0;
}
-static int ipaccess_msc_write_cb(struct bsc_fd *bfd, struct msgb *msg)
+static int ipaccess_msc_write_cb(struct osmo_fd *bfd, struct msgb *msg)
{
int rc;
rc = write(bfd->fd, msg->data, msg->len);
@@ -875,7 +875,7 @@
/* close endpoints allocated by this BSC */
bsc_mgcp_clear_endpoints_for(connection);
- bsc_unregister_fd(&connection->write_queue.bfd);
+ osmo_fd_unregister(&connection->write_queue.bfd);
close(connection->write_queue.bfd.fd);
write_queue_clear(&connection->write_queue);
llist_del(&connection->list_entry);
@@ -1147,7 +1147,7 @@
return -1;
}
-static int ipaccess_bsc_read_cb(struct bsc_fd *bfd)
+static int ipaccess_bsc_read_cb(struct osmo_fd *bfd)
{
int error;
struct bsc_connection *bsc = bfd->data;
@@ -1194,7 +1194,7 @@
return 0;
}
-static int ipaccess_listen_bsc_cb(struct bsc_fd *bfd, unsigned int what)
+static int ipaccess_listen_bsc_cb(struct osmo_fd *bfd, unsigned int what)
{
struct bsc_connection *bsc;
int fd, rc, on;
@@ -1256,7 +1256,7 @@
bsc->write_queue.read_cb = ipaccess_bsc_read_cb;
bsc->write_queue.write_cb = bsc_write_cb;
bsc->write_queue.bfd.when = BSC_FD_READ;
- if (bsc_register_fd(&bsc->write_queue.bfd) < 0) {
+ if (osmo_fd_register(&bsc->write_queue.bfd) < 0) {
LOGP(DNAT, LOGL_ERROR, "Failed to register BSC fd.\n");
close(fd);
talloc_free(bsc);
@@ -1514,7 +1514,7 @@
osmo_timer_schedule(&sccp_close, SCCP_CLOSE_TIME, 0);
while (1) {
- bsc_select_main(0);
+ osmo_select_main(0);
}
return 0;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
index 9ddc948..e796b2b 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_utils.c
@@ -787,7 +787,7 @@
return con_to_ctr[conn->con_type];
}
-int bsc_write_cb(struct bsc_fd *bfd, struct msgb *msg)
+int bsc_write_cb(struct osmo_fd *bfd, struct msgb *msg)
{
int rc;
diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
index 5d599c7..910ef40 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c
@@ -58,7 +58,7 @@
}
close(con->queue.bfd.fd);
- bsc_unregister_fd(&con->queue.bfd);
+ osmo_fd_unregister(&con->queue.bfd);
osmo_timer_del(&con->auth_timeout);
write_queue_clear(&con->queue);
talloc_free(con);
@@ -95,7 +95,7 @@
return 0;
}
-static int ussd_read_cb(struct bsc_fd *bfd)
+static int ussd_read_cb(struct osmo_fd *bfd)
{
int error;
struct bsc_nat_ussd_con *conn = bfd->data;
@@ -191,7 +191,7 @@
bsc_do_write(&conn->queue, msg, IPAC_PROTO_IPACCESS);
}
-static int ussd_listen_cb(struct bsc_fd *bfd, unsigned int what)
+static int ussd_listen_cb(struct osmo_fd *bfd, unsigned int what)
{
struct bsc_nat_ussd_con *conn;
struct bsc_nat *nat;
@@ -225,7 +225,7 @@
conn->queue.read_cb = ussd_read_cb;
conn->queue.write_cb = bsc_write_cb;
- if (bsc_register_fd(&conn->queue.bfd) < 0) {
+ if (osmo_fd_register(&conn->queue.bfd) < 0) {
LOGP(DNAT, LOGL_ERROR, "Failed to register USSD fd.\n");
bsc_nat_ussd_destroy(conn);
return -1;
diff --git a/openbsc/src/osmo-nitb/bsc_hack.c b/openbsc/src/osmo-nitb/bsc_hack.c
index 8fec368..261c426 100644
--- a/openbsc/src/osmo-nitb/bsc_hack.c
+++ b/openbsc/src/osmo-nitb/bsc_hack.c
@@ -307,6 +307,6 @@
while (1) {
log_reset_context();
- bsc_select_main(0);
+ osmo_select_main(0);
}
}
diff --git a/openbsc/src/utils/bs11_config.c b/openbsc/src/utils/bs11_config.c
index 8e987de..9cb6897 100644
--- a/openbsc/src/utils/bs11_config.c
+++ b/openbsc/src/utils/bs11_config.c
@@ -903,7 +903,7 @@
status_timer.cb = status_timer_cb;
while (1) {
- bsc_select_main(0);
+ osmo_select_main(0);
}
abis_nm_bs11_factory_logon(g_bts, 0);
diff --git a/openbsc/src/utils/rs232.c b/openbsc/src/utils/rs232.c
index 43b0dc4..b322e8a 100644
--- a/openbsc/src/utils/rs232.c
+++ b/openbsc/src/utils/rs232.c
@@ -36,7 +36,7 @@
/* adaption layer from GSM 08.59 + 12.21 to RS232 */
struct serial_handle {
- struct bsc_fd fd;
+ struct osmo_fd fd;
struct llist_head tx_queue;
struct msgb *rx_msg;
@@ -51,7 +51,7 @@
#define LAPD_HDR_LEN 10
-static int handle_ser_write(struct bsc_fd *bfd);
+static int handle_ser_write(struct osmo_fd *bfd);
/* callback from abis_nm */
int _abis_nm_sendmsg(struct msgb *msg, int to_trx_oml)
@@ -88,7 +88,7 @@
}
/* select.c callback in case we can write to the RS232 */
-static int handle_ser_write(struct bsc_fd *bfd)
+static int handle_ser_write(struct osmo_fd *bfd)
{
struct serial_handle *sh = bfd->data;
struct msgb *msg;
@@ -119,7 +119,7 @@
#define SERIAL_ALLOC_SIZE 300
/* select.c callback in case we can read from the RS232 */
-static int handle_ser_read(struct bsc_fd *bfd)
+static int handle_ser_read(struct osmo_fd *bfd)
{
struct serial_handle *sh = bfd->data;
struct msgb *msg;
@@ -182,7 +182,7 @@
}
/* select.c callback */
-static int serial_fd_cb(struct bsc_fd *bfd, unsigned int what)
+static int serial_fd_cb(struct osmo_fd *bfd, unsigned int what)
{
int rc = 0;
@@ -237,7 +237,7 @@
ser_handle->fd.data = ser_handle;
ser_handle->delay_ms = delay_ms;
ser_handle->bts = bts;
- rc = bsc_register_fd(&ser_handle->fd);
+ rc = osmo_fd_register(&ser_handle->fd);
if (rc < 0) {
fprintf(stderr, "could not register FD: %s\n",
strerror(rc));